summaryrefslogtreecommitdiff
path: root/newapkbuild.in
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2017-10-19 10:32:59 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2017-10-19 10:40:28 +0200
commitf91242fe3910d4968611d58f4826ec349e012782 (patch)
tree9e2a87e9f0f1e7d34a26d8998661eb88a2261ad6 /newapkbuild.in
parent0f9d333305a7be2db4ec35808ebafec36ff037a4 (diff)
downloadabuild-f91242fe3910d4968611d58f4826ec349e012782.tar.gz
abuild-f91242fe3910d4968611d58f4826ec349e012782.tar.bz2
abuild-f91242fe3910d4968611d58f4826ec349e012782.tar.xz
abuild-f91242fe3910d4968611d58f4826ec349e012782.zip
newapkbuild: add support for meson
Diffstat (limited to 'newapkbuild.in')
-rw-r--r--newapkbuild.in39
1 files changed, 36 insertions, 3 deletions
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;;