Commit f91242fe authored by Sören Tempel's avatar Sören Tempel

newapkbuild: add support for meson

parent 0f9d3333
......@@ -74,6 +74,25 @@ build_cmake() {
__EOF__
}
build_meson() {
# References:
# http://mesonbuild.com/Reference-manual.html
# http://mesonbuild.com/Cross-compilation.html
# TODO For cross compilation a cross_file needs to be created.
sed -i -e 's/^\(makedepends="\)/\1meson /' APKBUILD
cat >>APKBUILD<<__EOF__
meson \\
--prefix=/usr \\
--sysconfdir=/etc \\
--mandir=/usr/share/man \\
--localstatedir=/var \\
--buildtype=release \\
. output
ninja -C output
__EOF__
}
build_perl() {
cat >>APKBUILD<<__EOF__
PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
......@@ -98,6 +117,12 @@ package_autotools() {
package_make
}
package_meson() {
cat >>APKBUILD<<__EOF__
DESTDIR="$pkgdir" ninja -C output install
__EOF__
}
package_perl() {
cat >>APKBUILD<<__EOF__
make DESTDIR="\$pkgdir" install
......@@ -208,7 +233,7 @@ __EOF__
| head -n 1 | grep -q ".*" \
|| sed -i -e '/^depends_dev=.*/d' -e 's/\$depends_dev\s*//' APKBUILD
# Check if its autotools
# Try to autodetect the buildtype
if [ -z "$buildtype" ]; then
if [ -x "$sdir"/configure ]; then
buildtype="autotools"
......@@ -216,6 +241,8 @@ __EOF__
buildtype="perl"
elif [ -r "$sdir"/waf ]; then
buildtype="waf"
elif [ -r "$sdir"/meson.build ]; then
buildtype="meson"
elif [ -d "$sdir"/cmake ] || [ -r "$sdir/CMakeLists.txt" ]; then
buildtype="cmake"
elif [ -r "$sdir"/Makefile ]; then
......@@ -236,6 +263,8 @@ __EOF__
build_make;;
cmake)
build_cmake;;
meson)
build_meson;;
autotools)
build_autotools;;
perl)
......@@ -260,6 +289,8 @@ __EOF__
package_make;;
autotools)
package_autotools;;
meson)
package_meson;;
perl)
package_perl;;
python)
......@@ -293,8 +324,9 @@ usage() {
-d Set package description (pkgdesc) to DESC
-l Set package license to LICENSE
-u Set package URL
-a Create autotools (use ./configure ...)
-a Create autotools package (use ./configure ...)
-C Create CMake pakckage (Assume cmake/ is there)
-m Create meson package (Assume meson.build is there)
-p Create perl package (Assume Makefile.PL is there)
-y Create python package (Assume setup.py is there)
-s Use sourceforge source URL
......@@ -305,11 +337,12 @@ usage() {
__EOF__
}
while getopts "acd:fhl:n:pyu:s" opt; do
while getopts "acmd:fhl:n:pyu:s" opt; do
case $opt in
'a') buildtype="autotools";;
'c') cpinitd=1;;
'C') buildtype="cmake";;
'm') buildtype="meson";;
'd') pkgdesc="$OPTARG";;
'f') force=1;;
'h') usage; exit;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment