From e25a880883c43e8ffd52e56fe723a16af942d2c9 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 30 Apr 2017 10:45:23 +0200
Subject: Add packaging scripts for Meson
It probably doesn't belong here but I don't feel like creating another
repository for this either yet.
---
meson/packaging/make-deb.sh | 28 ++++++++++++++++++++++++++++
meson/packaging/make-pacman.sh | 22 ++++++++++++++++++++++
meson/packaging/meson.build | 11 +++++++++++
meson/packaging/meta.in | 8 ++++++++
4 files changed, 69 insertions(+)
create mode 100755 meson/packaging/make-deb.sh
create mode 100755 meson/packaging/make-pacman.sh
create mode 100644 meson/packaging/meson.build
create mode 100644 meson/packaging/meta.in
(limited to 'meson/packaging')
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" <