summaryrefslogtreecommitdiff
path: root/Mk/Uses/meson.mk
diff options
context:
space:
mode:
authorKoop Mast <kwm@FreeBSD.org>2017-04-17 18:55:56 +0000
committerKoop Mast <kwm@FreeBSD.org>2017-04-17 18:55:56 +0000
commite8ad1e183f043bb01e049d1d17c4ed839ed49908 (patch)
tree18de4239cee77d4951a8beca465045a70edfa7d9 /Mk/Uses/meson.mk
parentMark DEPRECATED and set EXPIRATION_DATE to 2017-04-30 (diff)
Introduce new "meson" USES.
This uses will handling building software that uses the meson build system. Expand the option framework to handle MESON options. Approved by: portmgr (swills@) Differential Revision: https://reviews.freebsd.org/D104091
Notes
Notes: svn path=/head/; revision=438747
Diffstat (limited to 'Mk/Uses/meson.mk')
-rw-r--r--Mk/Uses/meson.mk68
1 files changed, 68 insertions, 0 deletions
diff --git a/Mk/Uses/meson.mk b/Mk/Uses/meson.mk
new file mode 100644
index 000000000000..b3d4e0aca837
--- /dev/null
+++ b/Mk/Uses/meson.mk
@@ -0,0 +1,68 @@
+# $FreeBSD$
+#
+# Provide support for Meson based projects
+#
+# Feature: meson
+# Usage: USES=meson
+#
+# The following files are bundled in source tar files.
+# meson.build - Instructions for meson like autoconf configure,
+# there is no changeable parts in the file.
+# meson_options.txt - All the options meson understands
+#
+# Variables for ports:
+# MESON_ARGS - Arguments passed to meson
+# format: -Denable_foo=true
+# MESON_BUILD_DIR - Path to the build directory
+# Default: ${WRKSRC}/_build
+#
+# MAINTAINER: gnome@FreeBSD.org
+
+.if !defined(_INCLUDE_USES_MESON_MK)
+_INCLUDE_USES_MESON_MK= yes
+
+# Sanity check
+.if !empty(meson_ARGS)
+IGNORE= Incorrect 'USES+= meson:${meson_ARGS}'. meson takes no arguments
+.endif
+
+BUILD_DEPENDS+= meson:devel/meson
+
+# meson uses ninja
+.include "${USESDIR}/ninja.mk"
+
+# meson might have issues with non-unicode locales
+USE_LOCALE?= en_US.UTF-8
+
+CONFIGURE_ARGS+= --prefix ${PREFIX} \
+ --mandir man
+
+# meson has it own strip mechanic
+INSTALL_TARGET= install
+
+# should we have strip separate from WITH_DEBUG?
+.if defined(WITH_DEBUG)
+CONFIGURE_ARGS+= --buildtype debug
+.else
+CONFIGURE_ARGS+= --buildtype release \
+ --strip
+.endif
+
+HAS_CONFIGURE= yes
+CONFIGURE_CMD= meson
+# Pull in manual set settings and from options
+CONFIGURE_ARGS+= ${MESON_ARGS}
+
+BUILD_WRKSRC= ${WRKSRC}/${MESON_BUILD_DIR}
+
+INSTALL_WRKSRC= ${WRKSRC}/${MESON_BUILD_DIR}
+
+TEST_WRKSRC= ${WRKSRC}/${MESON_BUILD_DIR}
+TEST_TARGET= test
+
+MESON_BUILD_DIR?= _build
+
+# Add meson build dir at the end.
+CONFIGURE_ARGS+= ${MESON_BUILD_DIR}
+
+.endif #!defined(_INCLUDE_USES_MESON_MK)