diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2017-04-30 10:45:23 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2017-04-30 10:45:23 +0200 |
commit | e25a880883c43e8ffd52e56fe723a16af942d2c9 (patch) | |
tree | 6509d46e1adf31f1be65b0730ccc228ca82ff032 | |
parent | 9afcb337ada91f87aa1a566ec3feba1a12bc9287 (diff) | |
download | liberty-e25a880883c43e8ffd52e56fe723a16af942d2c9.tar.gz liberty-e25a880883c43e8ffd52e56fe723a16af942d2c9.tar.xz liberty-e25a880883c43e8ffd52e56fe723a16af942d2c9.zip |
Add packaging scripts for Meson
It probably doesn't belong here but I don't feel like creating another
repository for this either yet.
-rwxr-xr-x | meson/packaging/make-deb.sh | 28 | ||||
-rwxr-xr-x | meson/packaging/make-pacman.sh | 22 | ||||
-rw-r--r-- | meson/packaging/meson.build | 11 | ||||
-rw-r--r-- | meson/packaging/meta.in | 8 |
4 files changed, 69 insertions, 0 deletions
diff --git a/meson/packaging/make-deb.sh b/meson/packaging/make-deb.sh new file mode 100755 index 0000000..3d2a292 --- /dev/null +++ b/meson/packaging/make-deb.sh @@ -0,0 +1,28 @@ +#!/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 diff --git a/meson/packaging/make-pacman.sh b/meson/packaging/make-pacman.sh new file mode 100755 index 0000000..375cff8 --- /dev/null +++ b/meson/packaging/make-pacman.sh @@ -0,0 +1,22 @@ +#!/bin/sh -e +cd "$MESON_BUILD_ROOT" +. "$MESON_SUBDIR/meta" +wd="`pwd`/`mktemp -d pacman.XXXXXX`" +trap "rm -rf '$wd'" INT QUIT TERM EXIT + +target="$name-$version-$arch.tar.xz" +fakeroot sh -e <<-EOF + DESTDIR="$wd" ninja install + cat > "$wd/.PKGINFO" <<END + pkgname = $name + pkgver = $version-1 + pkgdesc = $summary + url = $url + builddate = \`date -u +%s\` + packager = $author + size = \`du -sb --apparent-size | cut -f1\` + arch = $arch + END + cd "$wd" && tar cJf "../$target" .PKGINFO * + echo Written $target +EOF diff --git a/meson/packaging/meson.build b/meson/packaging/meson.build new file mode 100644 index 0000000..d0b9cb2 --- /dev/null +++ b/meson/packaging/meson.build @@ -0,0 +1,11 @@ +# You need to prepare a configuration object with the required metadata +packaging.set ('arch', target_machine.cpu_family ()) +packaging.set ('system', target_machine.system ()) +configure_file (input: 'meta.in', output: 'meta', configuration: packaging) + +# RPM is awful and I've given up on both manual generation (we'd have to either +# include rpmrc data or generate fake noarch packages) and rpmbuild (just no) +run_target ('deb', + command: [join_paths (meson.current_source_dir (), 'make-deb.sh')]) +run_target ('pacman', + command: [join_paths (meson.current_source_dir (), 'make-pacman.sh')]) diff --git a/meson/packaging/meta.in b/meson/packaging/meta.in new file mode 100644 index 0000000..a3f5d65 --- /dev/null +++ b/meson/packaging/meta.in @@ -0,0 +1,8 @@ +define() { [ -z "$2" ] && { echo $1 is undefined; exit 1; } || eval "$1='$2'"; } + +define name "@name@" +define version "@version@" +define summary "@summary@" +define author "@author@" +define arch "@arch@" +define system "@system@" |