newapkbuild: supporrt for forcing autotools or perl with -a -p
This commit is contained in:
parent
f20d7983ae
commit
b581f87e85
@ -32,6 +32,28 @@ is_url() {
|
|||||||
return 1
|
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
|
# create new aport from templates
|
||||||
newaport() {
|
newaport() {
|
||||||
@ -105,6 +127,22 @@ __EOF__
|
|||||||
done
|
done
|
||||||
echo "_builddir=$_builddir" >> APKBUILD
|
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
|
# create the prepare() template
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
prepare() {
|
prepare() {
|
||||||
@ -124,16 +162,14 @@ __EOF__
|
|||||||
build() {
|
build() {
|
||||||
cd "\$_builddir"
|
cd "\$_builddir"
|
||||||
__EOF__
|
__EOF__
|
||||||
if [ -x "$sdir"/configure ]; then
|
|
||||||
cat >>APKBUILD<<__EOF__
|
case "$buildtype" in
|
||||||
./configure --prefix=/usr \\
|
autotools)
|
||||||
--sysconfdir=/etc \\
|
config_autotools;;
|
||||||
--mandir=/usr/share/man \\
|
perl)
|
||||||
--infodir=/usr/share/info \\
|
config_perl;;
|
||||||
--localstatedir=/var \\
|
esac
|
||||||
|| return 1
|
|
||||||
__EOF__
|
|
||||||
fi
|
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
make || return 1
|
make || return 1
|
||||||
}
|
}
|
||||||
@ -155,6 +191,11 @@ __EOF__
|
|||||||
"\$pkgdir"/etc/conf.d/\$pkgname || return 1
|
"\$pkgdir"/etc/conf.d/\$pkgname || return 1
|
||||||
__EOF__
|
__EOF__
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$buildtype" in
|
||||||
|
perl) cleanup_perl;;
|
||||||
|
esac
|
||||||
|
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,24 +206,28 @@ usage() {
|
|||||||
echo "$prog $version"
|
echo "$prog $version"
|
||||||
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-u URL] PKGNAME[-PKGVER]"
|
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-u URL] PKGNAME[-PKGVER]"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
|
echo " -a Create autotools (use ./configure ...)"
|
||||||
echo " -c Copy a sample init.d, conf.d and install script to new directory"
|
echo " -c Copy a sample init.d, conf.d and install script to new directory"
|
||||||
echo " -d Set package description (pkgdesc) to DESC"
|
echo " -d Set package description (pkgdesc) to DESC"
|
||||||
echo " -f Force even if directory already exist"
|
echo " -f Force even if directory already exist"
|
||||||
echo " -h Show this help"
|
echo " -h Show this help"
|
||||||
echo " -l Set package license to LICENSE"
|
echo " -l Set package license to LICENSE"
|
||||||
|
echo " -p Create perl package (Assume Makefile.PL is there)"
|
||||||
echo " -u Set package URL"
|
echo " -u Set package URL"
|
||||||
echo " -s Use sourceforge source url"
|
echo " -s Use sourceforge source url"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "cd:fhl:u:s" opt; do
|
while getopts "acd:fhl:pu:s" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
'a') buildtype="autotools";;
|
||||||
'c') cpinitd=1;;
|
'c') cpinitd=1;;
|
||||||
'd') pkgdesc="$OPTARG";;
|
'd') pkgdesc="$OPTARG";;
|
||||||
'f') force=1;;
|
'f') force=1;;
|
||||||
'h') usage;;
|
'h') usage;;
|
||||||
'l') license="$OPTARG";;
|
'l') license="$OPTARG";;
|
||||||
|
'p') buildtype="perl";;
|
||||||
'u') url="$OPTARG";;
|
'u') url="$OPTARG";;
|
||||||
's') sourceforge=1;;
|
's') sourceforge=1;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user