mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-03-11 06:37:31 +00:00
newapkbuild: supporrt for forcing autotools or perl with -a -p
This commit is contained in:
parent
f20d7983ae
commit
b581f87e85
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user