liberty/meson/packaging/make-deb.sh
Přemysl Janouch e25a880883
Add packaging scripts for Meson
It probably doesn't belong here but I don't feel like creating another
repository for this either yet.
2017-04-30 10:45:23 +02:00

29 lines
687 B
Bash
Executable File

#!/bin/sh -e
cd "$MESON_BUILD_ROOT"
. "$MESON_SUBDIR/meta"
wd="`pwd`/`mktemp -d deb.XXXXXX`"
trap "rm -rf '$wd'" INT QUIT TERM EXIT
[ "$arch" = x86 ] && arch=i386
[ "$arch" = x86_64 ] && arch=amd64
target="$name-$version-$system-$arch.deb"
echo 2.0 > "$wd/debian-binary"
cat > "$wd/control" <<-EOF
Package: $name
Version: $version
Section: misc
Priority: optional
Architecture: $arch
Maintainer: $author
Description: $summary
EOF
fakeroot sh -e <<-EOF
DESTDIR="$wd/pkg" ninja install
cd "$wd/pkg" && tar cJf ../data.tar.xz .
EOF
(cd "$wd" && tar czf control.tar.gz ./control)
ar rc "$target" "$wd/debian-binary" "$wd/control.tar.gz" "$wd/data.tar.xz"
echo Written $target