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
This commit is contained in:
Koop Mast 2017-04-17 18:55:56 +00:00
parent 7aa9822bd9
commit e8ad1e183f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=438747
3 changed files with 99 additions and 2 deletions

View File

@ -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

68
Mk/Uses/meson.mk Normal file
View File

@ -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)

View File

@ -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