From f91242fe3910d4968611d58f4826ec349e012782 Mon Sep 17 00:00:00 2001 From: Sören Tempel Date: Thu, 19 Oct 2017 10:32:59 +0200 Subject: newapkbuild: add support for meson --- newapkbuild.in | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'newapkbuild.in') diff --git a/newapkbuild.in b/newapkbuild.in index 0e86b39..b1a3d50 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -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;; -- cgit v1.2.3-70-g09d2