Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jun 2022 19:14:18 GMT
From:      "Tobias C. Berner" <tcberner@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 882f16714d90 - main - framework: add new variable PKGCONFIG_BASE
Message-ID:  <202206301914.25UJEIAI058605@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tcberner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=882f16714d909f1413b2c4bda44436726a0ff819

commit 882f16714d909f1413b2c4bda44436726a0ff819
Author:     Tobias C. Berner <tcberner@FreeBSD.org>
AuthorDate: 2022-06-15 15:56:50 +0000
Commit:     Tobias C. Berner <tcberner@FreeBSD.org>
CommitDate: 2022-06-30 19:14:10 +0000

    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
---
 Mk/bsd.port.mk | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 89ed04917318..bcffecf2ab93 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -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 \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206301914.25UJEIAI058605>