summaryrefslogtreecommitdiffstats
path: root/bin/makepkgbuild
diff options
context:
space:
mode:
authorJustin Davis <jrcd83@gmail.com>2011-09-21 23:18:58 +0200
committerJustin Davis <jrcd83@gmail.com>2011-09-21 23:18:58 +0200
commitd4ad6bae77cfd68d4ac79471ee6f977621fb9b31 (patch)
treefaa5ccc3d3c01efc94a93691df7fc2a3517c29c9 /bin/makepkgbuild
parentc3f405c8f1af4a06661584e12f8449e86389a772 (diff)
downloadgenpkg-d4ad6bae77cfd68d4ac79471ee6f977621fb9b31.tar.gz
genpkg-d4ad6bae77cfd68d4ac79471ee6f977621fb9b31.tar.xz
Refinish PKGBUILD generation.
Adds makepkgbuild script. The call to pbfields is moved from perl-pkg to makepkgbuild. pbfields prints the PKGBUILD header now, too. makepkgbuild is called from the Makefile with the proper env var set. Pretty close to 100% working again.
Diffstat (limited to 'bin/makepkgbuild')
-rwxr-xr-xbin/makepkgbuild35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/makepkgbuild b/bin/makepkgbuild
new file mode 100755
index 0000000..9ecfb80
--- /dev/null
+++ b/bin/makepkgbuild
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+prog=makepkgbuild
+
+if ! [ -f PKGMETA ]
+then
+ echo "$prog: PKGMETA could not be read." 1>&2
+ exit 1
+fi
+
+case "$TDIR" in
+'') echo "$prog: TDIR env variable is not set." 1>&2
+ exit 1
+esac
+
+tcmd=$(awk '
+ BEGIN { FS = "\n"; RS = "" }
+ $1 == "template" { for (i = 2; i <= NF; i++) print $i }' PKGMETA | \
+ while read line
+ do
+ set -- $line
+ cmd="$TDIR/$1"
+ if ! [ -x $cmd ]
+ then
+ echo "$prog: Unknown template command: $cmd" \
+ 1>&2
+ exit 2
+ fi
+ echo "$TDIR/$*"
+ done | tr '\n' '|' | sed 's/\|$//')
+
+echo "\$tcmd = $tcmd" 1>&2
+"$TDIR/pbfields" <PKGMETA >PKGBUILD
+$tcmd <PKGMETA >>PKGBUILD
+