2020-03-15 11:33:42 +01:00
|
|
|
# $NetBSD: pkg-build-options.mk,v 1.16 2020/03/15 10:33:42 rillig Exp $
|
2007-03-18 12:09:32 +01:00
|
|
|
#
|
|
|
|
# This procedure determines the PKG_OPTIONS that have been in effect
|
2007-04-10 05:45:36 +02:00
|
|
|
# when the package ${pkgbase} has been built. When the package is not
|
2020-03-14 11:32:30 +01:00
|
|
|
# yet installed, its current PKG_OPTIONS are queried.
|
2007-03-18 12:09:32 +01:00
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# pkgbase
|
2020-03-14 11:32:30 +01:00
|
|
|
# The package identifier, as in the package's buildlink3.mk
|
|
|
|
# file.
|
2007-03-18 12:09:32 +01:00
|
|
|
#
|
|
|
|
# Returns:
|
|
|
|
# PKG_BUILD_OPTIONS.${pkgbase}
|
|
|
|
# The build options of the package.
|
|
|
|
#
|
|
|
|
# Example:
|
2020-03-14 14:28:38 +01:00
|
|
|
# # in emulators/wine/buildlink3.mk
|
2007-03-18 12:09:32 +01:00
|
|
|
# pkgbase := wine
|
|
|
|
# .include "../../mk/pkg-build-options.mk"
|
|
|
|
#
|
2007-10-02 00:32:45 +02:00
|
|
|
# Keywords: options pkg-build-options PKG_BUILD_OPTIONS
|
|
|
|
#
|
2007-05-07 11:26:40 +02:00
|
|
|
|
2020-03-15 11:33:42 +01:00
|
|
|
.if !defined(pkgbase)
|
|
|
|
. for including in ${.INCLUDEDFROMDIR}/${.INCLUDEDFROMFILE}
|
|
|
|
PKG_FAIL_REASON+= "[pkg-build-options.mk] ${including}: pkgbase must be set"
|
|
|
|
. endfor
|
|
|
|
.endif
|
|
|
|
|
2007-10-13 13:04:15 +02:00
|
|
|
.include "bsd.fast.prefs.mk"
|
2007-03-18 12:09:32 +01:00
|
|
|
|
2009-03-20 20:23:50 +01:00
|
|
|
# For the check for inclusion from non-buildlink3.mk, it is irrelevant
|
|
|
|
# whether BUILDLINK_TREE was empty or undefined, so defining it here
|
|
|
|
# avoids dealing one case.
|
|
|
|
BUILDLINK_TREE?=
|
|
|
|
|
|
|
|
# Counting words doesn't work as expected for empty strings, they
|
|
|
|
# still have one word. Older make doesn't like the code without
|
|
|
|
# variable assignment for unknown reasons.
|
2016-07-09 11:54:27 +02:00
|
|
|
_BUILDLINK_TREE_WITH:= ${BUILDLINK_TREE:M-*:[\#]}
|
2009-03-20 20:23:50 +01:00
|
|
|
_BUILDLINK_TREE_WITHOUT:= ${BUILDLINK_TREE:N-*:[\#]}
|
|
|
|
.if (empty(BUILDLINK_TREE:M-*) && empty(BUILDLINK_TREE:N-*)) || \
|
|
|
|
(!empty(BUILDLINK_TREE:M-*) && !empty(BUILDLINK_TREE:N-*) && \
|
|
|
|
${_BUILDLINK_TREE_WITH} == ${_BUILDLINK_TREE_WITHOUT})
|
|
|
|
. for b in ${pkgbase}
|
|
|
|
PKG_BUILD_OPTIONS.${b}=
|
|
|
|
PKG_FAIL_REASON+= "[pkg-build-options.mk] This file may only be included from a buildlink3.mk file (pkgbase=${b})."
|
|
|
|
. endfor
|
|
|
|
.else
|
2007-03-18 12:09:32 +01:00
|
|
|
. for b in ${pkgbase}
|
2016-12-18 00:41:51 +01:00
|
|
|
. if !defined(PKG_BUILD_OPTIONS.${b}) && defined(PBULK_CACHE_DIRECTORY)
|
|
|
|
.sinclude "${PBULK_CACHE_DIRECTORY}/build-options.${b}"
|
|
|
|
. endif
|
2007-03-18 12:09:32 +01:00
|
|
|
. if !defined(PKG_BUILD_OPTIONS.${b})
|
2016-07-09 11:54:27 +02:00
|
|
|
PKG_BUILD_OPTIONS.${b}!= \
|
2007-08-11 18:25:16 +02:00
|
|
|
echo ""; \
|
2012-12-17 15:27:44 +01:00
|
|
|
${PKG_INFO} -Q PKG_OPTIONS ${b} 2>/dev/null \
|
2007-05-07 11:26:40 +02:00
|
|
|
|| { cd ${BUILDLINK_PKGSRCDIR.${b}} \
|
|
|
|
&& ${MAKE} ${MAKEFLAGS} show-var VARNAME=PKG_OPTIONS; }
|
2016-12-18 00:41:51 +01:00
|
|
|
. if defined(PBULK_CACHE_DIRECTORY)
|
|
|
|
_PKG_BUILD_OPTIONS.${b}!= \
|
2017-03-08 17:16:40 +01:00
|
|
|
mkdir -p ${PBULK_CACHE_DIRECTORY:Q}; \
|
2016-12-18 00:41:51 +01:00
|
|
|
echo PKG_BUILD_OPTIONS.${b:Q}=${PKG_BUILD_OPTIONS.${b:Q}} > ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$; \
|
|
|
|
mv ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$ ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}
|
|
|
|
. endif
|
2007-03-18 12:09:32 +01:00
|
|
|
MAKEFLAGS+= PKG_BUILD_OPTIONS.${b}=${PKG_BUILD_OPTIONS.${b}:Q}
|
|
|
|
. endif
|
|
|
|
|
|
|
|
MAKEVARS+= PKG_BUILD_OPTIONS.${b}
|
|
|
|
. endfor
|
|
|
|
.endif
|
2020-03-15 11:33:42 +01:00
|
|
|
|
|
|
|
.undef pkgbase # prepare for the next invocation
|