framework: add new variable PKGCONFIG_BASE

The base system started to provide certain pkgconfig files for
components it provides. This new variable allows ports to prefer base
components explicitly using for example

	PKGCONFIG_BASE=foo

This will create a symlink of /usr/libdata/pkgconfig/foo.pc to
${WKRDIR}/.pkgconfig and adding said path to pkgconfigs search path.

This allows us to switch easily between base and port implementation
of different components (say openssl) by simply defining the appropriate
variable in (say ssl.mk).

Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D35494
This commit is contained in:
Tobias C. Berner 2022-06-15 17:56:50 +02:00
parent f500b9d07c
commit 882f16714d

View File

@ -1050,7 +1050,8 @@ PORTS_FEATURES+= FLAVORS
MINIMAL_PKG_VERSION= 1.17.2
_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
${STAGEDIR}${PREFIX} ${WRKDIR}/pkg ${BINARY_LINKDIR}
${STAGEDIR}${PREFIX} ${WRKDIR}/pkg ${BINARY_LINKDIR} \
${PKGCONFIG_LINKDIR}
# Ensure .CURDIR contains an absolute path without a trailing slash. Failed
# builds can occur when PORTSDIR is a symbolic link, or with something like
@ -1681,6 +1682,13 @@ MAKE_ENV+= PATH=${PATH}
CONFIGURE_ENV+= PATH=${PATH}
. endif
PKGCONFIG_LINKDIR= ${WRKDIR}/.pkgconfig
PKGCONFIG_BASEDIR= /usr/libdata/pkgconfig
. if !${MAKE_ENV:MPKG_CONFIG_LIBDIR=*} && !${CONFIGURE_ENV:MPKG_CONFIG_LIBDIR=*}
MAKE_ENV+= PKG_CONFIG_LIBDIR=${PKGCONFIG_LINKDIR}:${LOCALBASE}/libdata/pkgconfig:${PKGCONFIG_BASEDIR}
CONFIGURE_ENV+= PKG_CONFIG_LIBDIR=${PKGCONFIG_LINKDIR}:${LOCALBASE}/libdata/pkgconfig:${PKGCONFIG_BASEDIR}
. endif
. if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) && empty(USE_GITHUB:Mnodefault)
. if defined(WRKSRC)
DEV_WARNING+= "You are using USE_GITHUB and WRKSRC is set which is wrong. Set GH_PROJECT correctly or set WRKSRC_SUBDIR and remove WRKSRC entirely."
@ -5147,6 +5155,20 @@ create-binary-alias: ${BINARY_LINKDIR}
. endif
. endif
. if !empty(PKGCONFIG_BASE)
. if !target(create-base-pkgconfig)
create-base-pkgconfig: ${PKGCONFIG_LINKDIR}
. for pcfile in ${PKGCONFIG_BASE:S/$/.pc/}
@if `test -f ${PKGCONFIG_BASEDIR}/${pcfile}`; then \
${RLN} ${PKGCONFIG_BASEDIR}/${pcfile} ${PKGCONFIG_LINKDIR}/${pcfile}; \
else \
${ECHO_MSG} "===> Missing \"${pcfile}\" to create a link at \"${PKGCONFIG_LINKDIR}/${pcfile}\" "; \
${FALSE}; \
fi
. endfor
. endif
. endif
. if !empty(BINARY_WRAPPERS)
. if !target(create-binary-wrappers)
create-binary-wrappers: ${BINARY_LINKDIR}
@ -5256,7 +5278,7 @@ _PATCH_SEQ= 050:ask-license 100:patch-message 150:patch-depends \
${_OPTIONS_patch} ${_USES_patch}
_CONFIGURE_DEP= patch
_CONFIGURE_SEQ= 150:build-depends 151:lib-depends 160:create-binary-alias \
161:create-binary-wrappers \
161:create-binary-wrappers 170:create-base-pkgconfig \
200:configure-message 210:apply-slist \
300:pre-configure 450:pre-configure-script \
490:run-autotools-fixup 500:do-configure 700:post-configure \