summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/makepkgbuild35
-rwxr-xr-xbin/templ/pbfields6
-rwxr-xr-xbin/templ/perl-pkg19
3 files changed, 41 insertions, 19 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
+
diff --git a/bin/templ/pbfields b/bin/templ/pbfields
index 4bbfdfc..980dc7a 100755
--- a/bin/templ/pbfields
+++ b/bin/templ/pbfields
@@ -19,6 +19,8 @@ BEGIN {
NF < 2 { next }
+$1 ~ "packager" { packager = $2 }
+
$1 ~ /depends$|conflicts|provides|source/ { quotevals() }
$1 == "pkgdesc" {
@@ -33,6 +35,10 @@ arrfield[$1] {
}
END {
+ if (!packager) { packager = "Anonymous" }
+ print "# Maintainer: " packager
+ print ""
+
OFS = "="; ORS = "\n";
for (i=1; i<=max; i++) {
name = fields[i]
diff --git a/bin/templ/perl-pkg b/bin/templ/perl-pkg
index b008cbd..790a798 100755
--- a/bin/templ/perl-pkg
+++ b/bin/templ/perl-pkg
@@ -16,11 +16,6 @@ my %ACTIONS_OF = ('MM',
'package' => [ q{./Build install} ]
} );
-my $PBBEG = <<'END_BEG';
-# Maintainer : %s
-# Generator : pbjam %s
-END_BEG
-
my %FUNCFMTS;
$FUNCFMTS{'build'} = <<'END_FMT';
build() {
@@ -91,20 +86,6 @@ sub printpb
my $acts = $ACTIONS_OF{$btype}
or die "$0: unknown build type ($btype)\n";
- my $pkger = $pbvars->{'packager'}[0] || 'Anonymous';
- printf $PBBEG, $pkger, $pbvars->{'pbjver'}[0];
- print "\n";
-
- # 'pbfields' will recognize and PKGBUILD fields in the data
- # and print them out in order, wordwrapping arrays.
- open my $pbfields, '|pbfields' or die "failed to pipe to pbfields: $!";
- while (my ($name, $vals) = each %$pbvars) {
- print $pbfields $name, "\n";
- print $pbfields $_, "\n" for @$vals;
- print $pbfields "\n";
- }
- close $pbfields;
-
my $distdir = $pbvars->{'distdir'}[0];
print qq{_distdir="\${srcdir}/$distdir"\n};
print "\n";