aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--Mk/Uses/meson.mk68
-rw-r--r--Mk/bsd.options.mk28
3 files changed, 99 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 9dd78710c67e..e6c076bc4a2f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,11 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
+20170417:
+AUTHOR: kwm@FreeBSD.org
+
+ New USES: meson, to handle properly the meson building system.
+
20170313:
AUTHOR: tijl@FreeBSD.org
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)
diff --git a/Mk/bsd.options.mk b/Mk/bsd.options.mk
index caba3b7e7e7a..48328dee9d8e 100644
--- a/Mk/bsd.options.mk
+++ b/Mk/bsd.options.mk
@@ -112,6 +112,18 @@
# ${opt}_QMAKE_OFF When option is disabled, it will add its content to
# the QMAKE_ARGS.
#
+# ${opt}_MESON_ON When option is enabled, it will add its
+# content to MESON_ARGS.
+# ${opt}_MESON_OFF When option is disabled, it will add its
+# content to MESON_ARGS.
+#
+# ${opt}_MESON_TRUE Will add to MESON_ARGS:
+# Option enabled --${content} true
+# Option disabled --${content} false
+# ${opt}_MESON_FALSE Will add to MESON_ARGS:
+# Option enabled --${content} false
+# Option disabled --${content} true
+#
# ${opt}_IMPLIES When opt is enabled, options named in IMPLIES will
# get enabled too.
# ${opt}_PREVENTS When opt is enabled, if any options in PREVENTS are
@@ -521,7 +533,13 @@ CMAKE_ARGS+= ${${opt}_CMAKE_BOOL:C/.*/-D&:BOOL=true/}
. if defined(${opt}_CMAKE_BOOL_OFF)
CMAKE_ARGS+= ${${opt}_CMAKE_BOOL_OFF:C/.*/-D&:BOOL=false/}
. endif
-. for configure in CONFIGURE CMAKE QMAKE
+. if defined(${opt}_MESON_TRUE)
+MESON_ARGS+= ${${opt}_MESON_TRUE:C/.*/-D&=true/}
+. endif
+. if defined(${opt}_MESON_TRUE_OFF)
+MESON_ARGS+= ${${opt}_MESON_TRUE_OFF:C/.*/-D&=false/}
+. endif
+. for configure in CONFIGURE CMAKE MESON QMAKE
. if defined(${opt}_${configure}_ON)
${configure}_ARGS+= ${${opt}_${configure}_ON}
. endif
@@ -571,7 +589,13 @@ CMAKE_ARGS+= ${${opt}_CMAKE_BOOL:C/.*/-D&:BOOL=false/}
. if defined(${opt}_CMAKE_BOOL_OFF)
CMAKE_ARGS+= ${${opt}_CMAKE_BOOL_OFF:C/.*/-D&:BOOL=true/}
. endif
-. for configure in CONFIGURE CMAKE QMAKE
+. if defined(${opt}_MESON_FALSE)
+MESON_ARGS+= ${${opt}_MESON_FALSE:C/.*/-D&=false/}
+. endif
+. if defined(${opt}_MESON_FALSE_OFF)
+MESON_ARGS+= ${${opt}_MESON_FALSE_OFF:C/.*/-D&=true/}
+. endif
+. for configure in CONFIGURE CMAKE MESON QMAKE
. if defined(${opt}_${configure}_OFF)
${configure}_ARGS+= ${${opt}_${configure}_OFF}
. endif