summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorcube <cube>2008-10-05 21:36:32 +0000
committercube <cube>2008-10-05 21:36:32 +0000
commit2c8f273533926f8b1e1655584dcb2080f2e79048 (patch)
tree7e3acb4e1cfd62c69446a0e9e96faf8cfb567d76 /mk
parent65393655c330983dfd10414dd9fbf359b7d9ebd8 (diff)
downloadpkgsrc-2c8f273533926f8b1e1655584dcb2080f2e79048.tar.gz
Merge cube-native-xorg, so that pkgsrc-current can be used with the native
X.Org found in NetBSD-current. Thanks a lot to all who helped, especially Matthias Scheler who did repeated tests on Mac OS X and older versions of NetBSD to make sure the support for those platforms wouldn't be broken (or at least, not fatally, as I would still expect a few hiccups here and there, because there is only so much one can test in such limited time). On the infrastructure side, this branch brings pkgconfig-builtin.mk, in order to write very easily new builtin.mk files. It can actually handle more than just pkgconfig files, but it will provide a version if it finds such a file. x11.builtin.mk has also been made more useful and now all existing (and future!) native-X11-related builtin.mk files should include it.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.prefs.mk4
-rw-r--r--mk/buildlink3/pkgconfig-builtin.mk57
-rw-r--r--mk/defaults/mk.conf9
-rw-r--r--mk/x11.builtin.mk23
4 files changed, 86 insertions, 7 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index e6add2cc6c9..d2983084e9c 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.287 2008/09/16 11:40:10 tron Exp $
+# $NetBSD: bsd.prefs.mk,v 1.288 2008/10/05 21:36:34 cube Exp $
#
# This file includes the mk.conf file, which contains the user settings.
#
@@ -493,6 +493,8 @@ X11BASE?= /usr/openwin
X11BASE?= /usr
. elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*)
X11BASE?= /usr/X11
+. elif exists(/usr/X11R7/lib/libX11.so)
+X11BASE?= /usr/X11R7
. else
X11BASE?= /usr/X11R6
. endif
diff --git a/mk/buildlink3/pkgconfig-builtin.mk b/mk/buildlink3/pkgconfig-builtin.mk
new file mode 100644
index 00000000000..1cd204d94f6
--- /dev/null
+++ b/mk/buildlink3/pkgconfig-builtin.mk
@@ -0,0 +1,57 @@
+# $NetBSD: pkgconfig-builtin.mk,v 1.2 2008/10/05 21:36:35 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.<BUILTIN_PKG>.
+#
+# Optionally, caller may define PKGCONFIG_BASE.<BUILTIN_PKG> 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 ${PKGCONFIG_BASE.${BUILTIN_PKG}:U${X11BASE}} == ${LOCALBASE}
+IS_BUILTIN.${BUILTIN_PKG}= no
+.elif !defined(IS_BUILTIN.${BUILTIN_PKG})
+IS_BUILTIN.${BUILTIN_PKG}= no
+. if empty(FIND_FILES_${BUILTIN_PKG}:M__nonexistent__)
+IS_BUILTIN.${BUILTIN_PKG}= yes
+. endif
+.endif
+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*.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}}
+.endif
+MAKEVARS:= ${MAKEVARS} BUILTIN_PKG.${BUILTIN_PKG}
+
+.if !defined(USE_BUILTIN.${BUILTIN_PKG})
+. if ${PREFER.${BUILTIN_PKG}} == "pkgsrc"
+USE_BUILTIN.${BUILTIN_PKG}= no
+. else
+USE_BUILTIN.${BUILTIN_PKG}:= ${IS_BUILTIN.${BUILTIN_PKG}}
+. if defined(BUILTIN_PKG.${BUILTIN_PKG}) && \
+ !empty(IS_BUILTIN.${BUILTIN_PKG}:M[Yy][Ee][Ss])
+USE_BUILTIN.${BUILTIN_PKG}= yes
+. for _dep_ in ${BUILDLINK_API_DEPENDS.${BUILTIN_PKG}}
+. if !empty(USE_BUILTIN.${BUILTIN_PKG}:M[Yy][Ee][Ss])
+USE_BUILTIN.${BUILTIN_PKG}!= \
+ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.${BUILTIN_PKG}}; then \
+ ${ECHO} yes; \
+ else \
+ ${ECHO} no; \
+ fi
+. endif
+. endfor
+. endif
+. endif
+.endif
+MAKEVARS:= ${MAKEVARS} USE_BUILTIN.${BUILTIN_PKG}
diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf
index b9d8b7d382d..570ae07efb4 100644
--- a/mk/defaults/mk.conf
+++ b/mk/defaults/mk.conf
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.176 2008/05/22 20:11:55 joerg Exp $
+# $NetBSD: mk.conf,v 1.177 2008/10/05 21:36:35 cube Exp $
#
# This file provides default values for variables that may be overridden
@@ -203,8 +203,11 @@ PKGSRC_RUN_TEST?= no
# Possible: yes, no
# Default: no
-.if empty(MACHINE_PLATFORM:MDarwin-9.*-*) || \
- (defined(X11_TYPE) && ${X11_TYPE} != "native")
+.if (!empty(MACHINE_PLATFORM:MNetBSD-*-*) && \
+ exists(/usr/X11R7/lib/libX11.so))
+PREFER_PKGSRC?=
+.elif empty(MACHINE_PLATFORM:MDarwin-9.*-*) || \
+ (defined(X11_TYPE) && ${X11_TYPE} != "native")
PREFER_PKGSRC?= MesaLib Xft2 Xrandr Xrender expat fontconfig \
freetype2 glu randrproto renderproto xcursor
.else
diff --git a/mk/x11.builtin.mk b/mk/x11.builtin.mk
index 22ae6398214..1337eb0a21c 100644
--- a/mk/x11.builtin.mk
+++ b/mk/x11.builtin.mk
@@ -1,8 +1,25 @@
-# $NetBSD: x11.builtin.mk,v 1.2 2006/10/26 17:08:08 rillig Exp $
+# $NetBSD: x11.builtin.mk,v 1.3 2008/10/05 21:36:35 cube Exp $
#
# x11.builtin.mk will include the builtin.mk file from the appropriate
# X11 distribution.
#
+# BUILTIN_PKG and USE_BUILTIN.<BUILTIN_PKG> must be defined by the caller
-.include "../../mk/x11.version.mk"
-.include "${X11_PKGSRCDIR.${X11_TYPE}}/builtin.mk"
+# XXX make(1) idiosyncrasy
+# 'CHECK_BUILTIN.${BUILTIN_PKG}?= no' will overwrite the value on older
+# version of make (in NetBSD's base system, prior to 20080331).
+.if !defined(CHECK_BUILTIN.${BUILTIN_PKG})
+CHECK_BUILTIN.${BUILTIN_PKG}= no
+.endif
+
+.if !empty(CHECK_BUILTIN.${BUILTIN_PKG}:M[Nn][Oo])
+. if !empty(USE_BUILTIN.${BUILTIN_PKG}:M[Yy][Ee][Ss])
+
+BUILDLINK_PREFIX.${BUILTIN_PKG}= ${X11BASE}
+
+. include "../../mk/x11.buildlink3.mk"
+. include "../../mk/x11.version.mk"
+. include "${X11_PKGSRCDIR.${X11_TYPE}}/builtin.mk"
+
+. endif
+.endif