summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-03-17 10:47:12 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-17 10:47:12 +0000
commitb581f87e8530f8c2a855c3473763fbb800d9e401 (patch)
treefd3bcb364aee4716bd648c6cd3099c6e8a7a141d
parentf20d7983ae120359a3fc459c74fc2b513380b504 (diff)
downloadabuild-b581f87e8530f8c2a855c3473763fbb800d9e401.tar.gz
abuild-b581f87e8530f8c2a855c3473763fbb800d9e401.tar.bz2
abuild-b581f87e8530f8c2a855c3473763fbb800d9e401.tar.xz
abuild-b581f87e8530f8c2a855c3473763fbb800d9e401.zip
newapkbuild: supporrt for forcing autotools or perl with -a -p
-rwxr-xr-xnewapkbuild.in69
1 files changed, 57 insertions, 12 deletions
diff --git a/newapkbuild.in b/newapkbuild.in
index e8b7ea5..0047ab2 100755
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -32,7 +32,29 @@ is_url() {
return 1
}
-
+config_autotools() {
+ cat >>APKBUILD<<__EOF__
+ ./configure --prefix=/usr \\
+ --sysconfdir=/etc \\
+ --mandir=/usr/share/man \\
+ --infodir=/usr/share/info \\
+ --localstatedir=/var \\
+ || return 1
+__EOF__
+}
+
+config_perl() {
+ cat >>APKBUILD<<__EOF__
+ PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
+__EOF__
+}
+
+cleanup_perl() {
+ cat >>APKBUILD<<__EOF__
+ find "\$pkgdir" \\( -name perllocal.pod -o -name .packlist \\) -delete
+__EOF__
+}
+
# create new aport from templates
newaport() {
local newname="${1##*/}"
@@ -105,6 +127,22 @@ __EOF__
done
echo "_builddir=$_builddir" >> APKBUILD
+ # check if its autotools
+ if [ -z "$buildtype" ]; then
+ if [ -x "$sdir"/configure ]; then
+ buildtype="autotools"
+ elif [ -r "$sdir"/Makefile.PL ]; then
+ buildtype="perl"
+ elif [ -r "$sdir"/waf ]; then
+ buildtype="waf"
+ elif [ -d "$sdir"/cmake ]; then
+ buildtype="cmake"
+ elif [ -r "$sdir"/Makefile ]; then
+ buildtype="make"
+ fi
+ fi
+
+
# create the prepare() template
cat >>APKBUILD<<__EOF__
prepare() {
@@ -124,16 +162,14 @@ __EOF__
build() {
cd "\$_builddir"
__EOF__
- if [ -x "$sdir"/configure ]; then
- cat >>APKBUILD<<__EOF__
- ./configure --prefix=/usr \\
- --sysconfdir=/etc \\
- --mandir=/usr/share/man \\
- --infodir=/usr/share/info \\
- --localstatedir=/var \\
- || return 1
-__EOF__
- fi
+
+ case "$buildtype" in
+ autotools)
+ config_autotools;;
+ perl)
+ config_perl;;
+ esac
+
cat >>APKBUILD<<__EOF__
make || return 1
}
@@ -155,6 +191,11 @@ __EOF__
"\$pkgdir"/etc/conf.d/\$pkgname || return 1
__EOF__
fi
+
+ case "$buildtype" in
+ perl) cleanup_perl;;
+ esac
+
cat >>APKBUILD<<__EOF__
}
@@ -165,24 +206,28 @@ usage() {
echo "$prog $version"
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-u URL] PKGNAME[-PKGVER]"
echo "Options:"
+ echo " -a Create autotools (use ./configure ...)"
echo " -c Copy a sample init.d, conf.d and install script to new directory"
echo " -d Set package description (pkgdesc) to DESC"
echo " -f Force even if directory already exist"
echo " -h Show this help"
echo " -l Set package license to LICENSE"
+ echo " -p Create perl package (Assume Makefile.PL is there)"
echo " -u Set package URL"
echo " -s Use sourceforge source url"
echo ""
exit 0
}
-while getopts "cd:fhl:u:s" opt; do
+while getopts "acd:fhl:pu:s" opt; do
case $opt in
+ 'a') buildtype="autotools";;
'c') cpinitd=1;;
'd') pkgdesc="$OPTARG";;
'f') force=1;;
'h') usage;;
'l') license="$OPTARG";;
+ 'p') buildtype="perl";;
'u') url="$OPTARG";;
's') sourceforge=1;;
esac