From a399a1b74f633f2a3416019f9856461c3ebcae6b Mon Sep 17 00:00:00 2001 From: cube Date: Thu, 18 Sep 2008 02:18:33 +0000 Subject: - Make this subroutine more generic by allowing a base in which the files are considered native different than X11BASE. However, it is the default. - Fix an evaluation bug for BUILTIN_PKG.; := is needed here. - Only construct a BUILTIN_PKG. variable if we actually found a .pc file. This allows the caller to search for more than just a .pc file, in case the native package doesn't provide one, or even not to search for .pc file, but for something different. This makes the subroutine even more generic. --- mk/buildlink3/pkgconfig-builtin.mk | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mk/buildlink3/pkgconfig-builtin.mk b/mk/buildlink3/pkgconfig-builtin.mk index e7b3dc94940..4d366db0c7e 100644 --- a/mk/buildlink3/pkgconfig-builtin.mk +++ b/mk/buildlink3/pkgconfig-builtin.mk @@ -1,16 +1,22 @@ -# $NetBSD: pkgconfig-builtin.mk,v 1.1.2.2 2008/09/16 03:24:58 cube Exp $ +# $NetBSD: pkgconfig-builtin.mk,v 1.1.2.3 2008/09/18 02:18:33 cube Exp $ # This file is used to factor out a common pattern in builtin.mk files backed # up by the existence of a pkgconfig file. # # Caller has to define BUILTIN_PKG and PKGCONFIG_FILE.. +# +# Optionally, caller may define PKGCONFIG_BASE. as the base +# location for a native implementation of the package. It conveniently +# defaults to X11BASE. BUILTIN_FIND_FILES_VAR:= FIND_FILES_${BUILTIN_PKG} BUILTIN_FIND_FILES.FIND_FILES_${BUILTIN_PKG}= ${PKGCONFIG_FILE.${BUILTIN_PKG}} .include "../../mk/buildlink3/bsd.builtin.mk" -.if ${X11BASE} == ${LOCALBASE} +PKGCONFIG_BASE.${BUILTIN_PKG}?= ${X11BASE} + +.if ${PKGCONFIG_BASE.${BUILTIN_PKG}} == ${LOCALBASE} IS_BUILTIN.${BUILTIN_PKG}= no .elif !defined(IS_BUILTIN.${BUILTIN_PKG}) IS_BUILTIN.${BUILTIN_PKG}= no @@ -22,10 +28,10 @@ MAKEVARS:= ${MAKEVARS} IS_BUILTIN.${BUILTIN_PKG} .if !defined(BUILTIN_PKG.${BUILTIN_PKG}) && \ !empty(IS_BUILTIN.${BUILTIN_PKG}:M[yY][eE][sS]) && \ - empty(FIND_FILES_${BUILTIN_PKG}:M__nonexistent__) + !empty(FIND_FILES_${BUILTIN_PKG}:M*.pc) BUILTIN_VERSION.${BUILTIN_PKG}!= \ ${SED} -n -e 's/Version: //p' ${FIND_FILES_${BUILTIN_PKG}} -BUILTIN_PKG.${BUILTIN_PKG}= ${BUILTIN_PKG}-${BUILTIN_VERSION.${BUILTIN_PKG}} +BUILTIN_PKG.${BUILTIN_PKG}:= ${BUILTIN_PKG}-${BUILTIN_VERSION.${BUILTIN_PKG}} .endif MAKEVARS:= ${MAKEVARS} BUILTIN_PKG.${BUILTIN_PKG} -- cgit v1.2.3