summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-09-02 06:59:37 +0000
committerjlam <jlam@pkgsrc.org>2003-09-02 06:59:37 +0000
commit841b57441b803acb6edd290521d4343593e7e175 (patch)
tree84e91cd88c93c01f847527b25d244510cb5b95db
parent97e17132ab11f03e7cfe511b3e6188812a6c47e4 (diff)
downloadpkgsrc-841b57441b803acb6edd290521d4343593e7e175.tar.gz
Merge pkgviews-mk branch into the HEAD by running:
cd pkgsrc/mk cvs update -Pd -A cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
-rw-r--r--mk/Darwin.pkg.dist2
-rw-r--r--mk/Darwin.x11.dist2
-rw-r--r--mk/FreeBSD.pkg.dist2
-rw-r--r--mk/IRIX.pkg.dist2
-rw-r--r--mk/IRIX.x11.dist2
-rw-r--r--mk/Linux.pkg.dist2
-rw-r--r--mk/Linux.x11.dist2
-rw-r--r--mk/NetBSD.pkg.dist2
-rw-r--r--mk/NetBSD.x11.dist2
-rw-r--r--mk/OpenBSD.pkg.dist2
-rw-r--r--mk/OpenBSD.x11.dist2
-rw-r--r--mk/SunOS.pkg.dist2
-rw-r--r--mk/SunOS.x11.dist2
-rw-r--r--mk/bsd.pkg.defaults.mk18
-rw-r--r--mk/bsd.pkg.install.mk8
-rw-r--r--mk/bsd.pkg.mk421
-rw-r--r--mk/bsd.prefs.mk56
-rw-r--r--mk/buildlink2/NOTES2
-rw-r--r--mk/buildlink2/bsd.buildlink2.mk27
-rw-r--r--mk/buildlink2/gen-transform.sh12
-rw-r--r--mk/buildlink2/libtool-fix-la2
-rw-r--r--mk/buildlink2/libtool.sh2
-rw-r--r--mk/buildlink2/wrapper.sh2
-rw-r--r--mk/buildlink3/README159
-rw-r--r--mk/buildlink3/TODO43
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk1285
-rw-r--r--mk/buildlink3/gen-transform.sh223
-rw-r--r--mk/buildlink3/ld-post-cache11
-rw-r--r--mk/buildlink3/ld-post-logic14
-rw-r--r--mk/buildlink3/libtool-do-install25
-rw-r--r--mk/buildlink3/libtool-fix-la275
-rw-r--r--mk/buildlink3/libtool-post-cache12
-rw-r--r--mk/buildlink3/libtool-post-logic57
-rw-r--r--mk/buildlink3/libtool.sh98
-rw-r--r--mk/buildlink3/logic75
-rw-r--r--mk/buildlink3/marshall13
-rw-r--r--mk/buildlink3/post-cache4
-rw-r--r--mk/buildlink3/pre-cache3
-rw-r--r--mk/buildlink3/sunpro-cc-post-cache12
-rw-r--r--mk/buildlink3/sunpro-cc-post-logic30
-rw-r--r--mk/buildlink3/wrapper.sh67
-rw-r--r--mk/bulk/bsd.bulk-pkg.mk10
-rwxr-xr-xmk/bulk/mksandbox2
-rw-r--r--mk/bulk/post-build2
-rw-r--r--mk/bulk/pre-build58
-rwxr-xr-xmk/bulk/tflat2
-rw-r--r--mk/defs.Darwin.mk2
-rw-r--r--mk/defs.FreeBSD.mk2
-rw-r--r--mk/defs.IRIX.mk2
-rw-r--r--mk/defs.Linux.mk2
-rw-r--r--mk/defs.NetBSD.mk2
-rw-r--r--mk/defs.OpenBSD.mk2
-rw-r--r--mk/defs.SunOS.mk3
-rw-r--r--mk/emacs.mk2
-rw-r--r--mk/gcc.buildlink2.mk2
-rw-r--r--mk/install/deinstall51
-rw-r--r--mk/install/header10
-rw-r--r--mk/install/install42
-rw-r--r--mk/install/install-info4
-rw-r--r--mk/java-vm.mk2
-rw-r--r--mk/pthread.buildlink2.mk2
-rwxr-xr-xmk/scripts/genindex.awk2
-rw-r--r--mk/subst.mk2
-rw-r--r--mk/texinfo.mk2
-rw-r--r--mk/tools.mk2
-rw-r--r--mk/x11.buildlink2.mk24
66 files changed, 3004 insertions, 214 deletions
diff --git a/mk/Darwin.pkg.dist b/mk/Darwin.pkg.dist
index 44b44c00f22..6a422b38967 100644
--- a/mk/Darwin.pkg.dist
+++ b/mk/Darwin.pkg.dist
@@ -1,5 +1,5 @@
# Id: BSD.local.dist,v 1.30 1997/08/01 13:16:39 phk Exp
-# $NetBSD: Darwin.pkg.dist,v 1.35 2003/08/27 10:55:50 wiz Exp $
+# $NetBSD: Darwin.pkg.dist,v 1.36 2003/09/02 06:59:37 jlam Exp $
#
/set type=dir uname=root gname=wheel mode=0755
diff --git a/mk/Darwin.x11.dist b/mk/Darwin.x11.dist
index fea3a86a898..4bc77844c10 100644
--- a/mk/Darwin.x11.dist
+++ b/mk/Darwin.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: Darwin.x11.dist,v 1.24 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: Darwin.x11.dist,v 1.25 2003/09/02 06:59:37 jlam Exp $
# FreeBSD Id: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
#
diff --git a/mk/FreeBSD.pkg.dist b/mk/FreeBSD.pkg.dist
index 56974e4f895..fb3ea3312ad 100644
--- a/mk/FreeBSD.pkg.dist
+++ b/mk/FreeBSD.pkg.dist
@@ -1,4 +1,4 @@
-# $NetBSD: FreeBSD.pkg.dist,v 1.26 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: FreeBSD.pkg.dist,v 1.27 2003/09/02 06:59:38 jlam Exp $
#
/set type=dir uname=root gname=wheel mode=0755
diff --git a/mk/IRIX.pkg.dist b/mk/IRIX.pkg.dist
index 6526bb9ff0a..b65ad182ed0 100644
--- a/mk/IRIX.pkg.dist
+++ b/mk/IRIX.pkg.dist
@@ -1,4 +1,4 @@
-# $NetBSD: IRIX.pkg.dist,v 1.25 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: IRIX.pkg.dist,v 1.26 2003/09/02 06:59:38 jlam Exp $
#
/set type=dir uname=root gname=sys mode=0755
diff --git a/mk/IRIX.x11.dist b/mk/IRIX.x11.dist
index 655fa307252..2a974d900de 100644
--- a/mk/IRIX.x11.dist
+++ b/mk/IRIX.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: IRIX.x11.dist,v 1.4 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: IRIX.x11.dist,v 1.5 2003/09/02 06:59:38 jlam Exp $
# FreeBSD Id: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
#
diff --git a/mk/Linux.pkg.dist b/mk/Linux.pkg.dist
index 594cf1db8b7..576837d5861 100644
--- a/mk/Linux.pkg.dist
+++ b/mk/Linux.pkg.dist
@@ -1,5 +1,5 @@
# Id: BSD.local.dist,v 1.30 1997/08/01 13:16:39 phk Exp
-# $NetBSD: Linux.pkg.dist,v 1.42 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: Linux.pkg.dist,v 1.43 2003/09/02 06:59:38 jlam Exp $
#
/set type=dir uname=root gname=sys mode=0755
diff --git a/mk/Linux.x11.dist b/mk/Linux.x11.dist
index a89fb24cca3..aecbdd8494c 100644
--- a/mk/Linux.x11.dist
+++ b/mk/Linux.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: Linux.x11.dist,v 1.30 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: Linux.x11.dist,v 1.31 2003/09/02 06:59:39 jlam Exp $
# FreeBSD Id: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
#
diff --git a/mk/NetBSD.pkg.dist b/mk/NetBSD.pkg.dist
index 18d0f8a208e..abe106c01a2 100644
--- a/mk/NetBSD.pkg.dist
+++ b/mk/NetBSD.pkg.dist
@@ -1,5 +1,5 @@
# Id: BSD.local.dist,v 1.30 1997/08/01 13:16:39 phk Exp
-# $NetBSD: NetBSD.pkg.dist,v 1.52 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: NetBSD.pkg.dist,v 1.53 2003/09/02 06:59:39 jlam Exp $
#
/set type=dir uname=root gname=wheel mode=0755
diff --git a/mk/NetBSD.x11.dist b/mk/NetBSD.x11.dist
index 5bec1e78040..4bf44855911 100644
--- a/mk/NetBSD.x11.dist
+++ b/mk/NetBSD.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.x11.dist,v 1.31 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: NetBSD.x11.dist,v 1.32 2003/09/02 06:59:39 jlam Exp $
# FreeBSD Id: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
#
diff --git a/mk/OpenBSD.pkg.dist b/mk/OpenBSD.pkg.dist
index 49071816c50..ab09b2fd3de 100644
--- a/mk/OpenBSD.pkg.dist
+++ b/mk/OpenBSD.pkg.dist
@@ -1,4 +1,4 @@
-# $NetBSD: OpenBSD.pkg.dist,v 1.25 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: OpenBSD.pkg.dist,v 1.26 2003/09/02 06:59:39 jlam Exp $
#
/set type=dir uname=root gname=wheel mode=0755
diff --git a/mk/OpenBSD.x11.dist b/mk/OpenBSD.x11.dist
index ecd01c5bf98..56db781dd8b 100644
--- a/mk/OpenBSD.x11.dist
+++ b/mk/OpenBSD.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: OpenBSD.x11.dist,v 1.18 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: OpenBSD.x11.dist,v 1.19 2003/09/02 06:59:40 jlam Exp $
# OpenBSD: BSD.x11.dist,v 1.4 2002/06/09 06:15:15 todd Exp
# FreeBSD: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
diff --git a/mk/SunOS.pkg.dist b/mk/SunOS.pkg.dist
index 321fdc53f10..6302d6261f1 100644
--- a/mk/SunOS.pkg.dist
+++ b/mk/SunOS.pkg.dist
@@ -1,5 +1,5 @@
# Id: BSD.local.dist,v 1.30 1997/08/01 13:16:39 phk Exp
-# $NetBSD: SunOS.pkg.dist,v 1.47 2003/08/27 10:55:51 wiz Exp $
+# $NetBSD: SunOS.pkg.dist,v 1.48 2003/09/02 06:59:40 jlam Exp $
#
/set type=dir uname=root gname=sys mode=0755
diff --git a/mk/SunOS.x11.dist b/mk/SunOS.x11.dist
index debd9d92c76..99b4c6a534a 100644
--- a/mk/SunOS.x11.dist
+++ b/mk/SunOS.x11.dist
@@ -1,4 +1,4 @@
-# $NetBSD: SunOS.x11.dist,v 1.31 2003/08/27 10:55:52 wiz Exp $
+# $NetBSD: SunOS.x11.dist,v 1.32 2003/09/02 06:59:41 jlam Exp $
# FreeBSD Id: BSD.x11.dist,v 1.2 1997/06/10 07:55:10 asami Exp
#
diff --git a/mk/bsd.pkg.defaults.mk b/mk/bsd.pkg.defaults.mk
index 2a8ebf5c585..e40b8268912 100644
--- a/mk/bsd.pkg.defaults.mk
+++ b/mk/bsd.pkg.defaults.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.defaults.mk,v 1.176 2003/08/24 01:58:56 taca Exp $
+# $NetBSD: bsd.pkg.defaults.mk,v 1.177 2003/09/02 06:59:41 jlam Exp $
#
# A file providing defaults for pkgsrc and the packages collection.
@@ -153,6 +153,12 @@ DISTDIR?= ${_PKGSRCDIR}/distfiles
# Possible: any directories
# Default: none
+PKG_INSTALLATION_PREFS?= overwrite pkgviews
+# This is a whitespace-separated list of installation types to try when
+# building a package, in order of preference.
+# Possible: any of: overwrite, pkgviews
+# Default: overwrite pkgviews
+
PACKAGES?= ${_PKGSRCDIR}/packages
# Store generated packages on a per-architecture base
# Possible: any path you like
@@ -1465,6 +1471,16 @@ PILRC_USE_GTK?= YES
# Possible: YES, not defined
# Default: not defined
+PKG_INSTALLATION_TYPES?= overwrite
+# This is a whitespace-separated list of installation types supported
+# by the package.
+#
+# *NOTE*: This variable *must* be set in the package Makefile *before*
+# the inclusion of bsd.prefs.mk.
+#
+# Possible: any of: overwrite, pkgviews
+# Default: overwrite
+
#PKG_JVM=
# Used to choose a java virtual machine for packages which use Java.
# ${JAVA_HOME} will be set based on this choice, if unset
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index 699538ebf94..6414c938dc4 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.45 2003/08/30 22:53:39 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.46 2003/09/02 06:59:41 jlam Exp $
#
# This Makefile fragment is included by package Makefiles to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -62,9 +62,12 @@ INSTALL_SRC?= ${INSTALL_TEMPLATES}
FILES_SUBST+= PREFIX=${PREFIX}
FILES_SUBST+= LOCALBASE=${LOCALBASE}
FILES_SUBST+= X11BASE=${X11BASE}
-FILES_SUBST+= PKG_SYSCONFBASE=${PKG_SYSCONFBASE}
+FILES_SUBST+= PKG_SYSCONFBASE=${_PKG_SYSCONFBASE}
+FILES_SUBST+= PKG_SYSCONFDEPOTBASE=${PKG_SYSCONFDEPOTBASE}
+FILES_SUBST+= PKG_SYSCONFVIEWBASE=${PKG_SYSCONFVIEWBASE}
FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
FILES_SUBST+= PKGBASE=${PKGBASE}
+FILES_SUBST+= PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}
# PKG_USERS represents the users to create for the package. It is a
# space-separated list of elements of the form
@@ -246,6 +249,7 @@ FILES_SUBST+= GTAR=${GTAR:Q}
FILES_SUBST+= HEAD=${HEAD:Q}
FILES_SUBST+= ID=${ID:Q}
FILES_SUBST+= INSTALL_INFO=${INSTALL_INFO:Q}
+FILES_SUBST+= LINKFARM=${LINKFARM:Q}
FILES_SUBST+= LN=${LN:Q}
FILES_SUBST+= MKDIR=${MKDIR:Q}
FILES_SUBST+= MV=${MV:Q}
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index a5524f07237..5892c0f040f 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1251 2003/08/31 10:29:16 wiz Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1252 2003/09/02 06:59:42 jlam Exp $
#
# This file is in the public domain.
#
@@ -87,14 +87,58 @@ _DISTDIR?= ${DISTDIR}/${DIST_SUBDIR}
INTERACTIVE_STAGE?= none
-# Set the default BUILDLINK_DIR, BUILDLINK_X11PKG_DIR, BUILDLINK_X11_DIR so
-# that if no buildlink2.mk files are included, then they still point to
-# where headers and libraries for installed packages and X11R6 may be found.
+# PKG_INSTALLATION_TYPE can only be one of two values: "pkgviews" or
+# "overwrite".
+#
+.if (${PKG_INSTALLATION_TYPE} != "pkgviews") && \
+ (${PKG_INSTALLATION_TYPE} != "overwrite")
+PKG_FAIL_REASON+= "PKG_INSTALLATION_TYPE must be \`\`pkgviews'' or \`\`overwrite''."
+.endif
+
+.if empty(PKG_INSTALLATION_TYPES:M${PKG_INSTALLATION_TYPE})
+PKG_FAIL_REASON+= "This package doesn't support PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}."
+.endif
+
+# The style of PLISTs that are used by the installed package.
+# Possible: dynamic, static
+#
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+PLIST_TYPE?= dynamic
+.elif ${PKG_INSTALLATION_TYPE} == "overwrite"
+PLIST_TYPE?= static
+.else
+PLIST_TYPE?= static
+.endif
+
+# PLIST_TYPE can only be one of two values: "dynamic" or "static". If we
+# don't explicitly ask for "static", assume "dynamic".
+#
+.if (${PLIST_TYPE} != "dynamic") && (${PLIST_TYPE} != "static")
+PKG_FAIL_REASON+= "PLIST_TYPE must be \`\`dynamic'' or \`\`static''."
+.endif
+
+.if (${PKG_INSTALLATION_TYPE} == "overwrite") && (${PLIST_TYPE} != "static")
+PKG_FAIL_REASON+= "PLIST_TYPE must be \`\`static'' for \`\`overwrite'' packages."
+.endif
+
+USE_BUILDLINK2?= no # default to not using buildlink2
+USE_BUILDLINK3?= no # defualt to not using buildlink3
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+USE_BUILDLINK3= yes # pkgviews requires buildlink3
+.endif
+.if empty(USE_BUILDLINK2:M[nN][oO]) && empty(USE_BUILDLINK3:M[nN][oO])
+PKG_FAIL_REASON+= "Please undefine USE_BUILDLINK2 or USE_BUILDLINK3."
+.endif
+
+.if !empty(USE_BUILDLINK3:M[nN][oO])
+#
+# Set the default BUILDLINK_DIR, BUILDLINK_X11_DIR so that if no
+# buildlink2.mk files are included, then they still point to where headers
+# and libraries for installed packages and X11R6 may be found.
#
-USE_BUILDLINK2?= no # default to not using buildlink2
BUILDLINK_DIR?= ${LOCALBASE}
-BUILDLINK_X11PKG_DIR?= ${X11BASE}
BUILDLINK_X11_DIR?= ${X11BASE}
+.endif
.if defined(USE_IMAKE)
USE_X11BASE?= implied
@@ -121,19 +165,43 @@ _OPSYS_NEEDS_XPKGWEDGE?= yes
_OPSYS_NEEDS_XPKGWEDGE?= no
.endif
-.if defined(USE_X11BASE)
-. if !empty(_OPSYS_NEEDS_XPKGWEDGE:M[yY][eE][sS])
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+. if defined(USE_X11BASE)
+. if !empty(_OPSYS_NEEDS_XPKGWEDGE:M[yY][eE][sS])
BUILD_DEPENDS+= xpkgwedge>=1.5:../../pkgtools/xpkgwedge
-BUILDLINK_X11PKG_DIR= ${LOCALBASE}
-. endif
+. endif
PREFIX= ${X11PREFIX}
-.elif defined(USE_CROSSBASE)
+. elif defined(USE_CROSSBASE)
PREFIX= ${CROSSBASE}
NO_MTREE= yes
-.else
+. else
PREFIX= ${LOCALBASE}
+. endif
+.elif ${PKG_INSTALLATION_TYPE} == "pkgviews"
+PREFIX= ${DEPOTBASE}/${PKGNAME}
+NO_MTREE= yes
+.endif
+
+.if empty(DEPOT_SUBDIR)
+PKG_FAIL_REASON+= "DEPOT_SUBDIR may not be empty."
.endif
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+#
+# _PLIST_IGNORE_FILES basically mirrors the list of ignored files found
+# in pkg_views(1). It's used by the dynamic PLIST generator to skip
+# adding the named files to the PLIST.
+#
+_PLIST_IGNORE_FILES= +* # package metadata files
+_PLIST_IGNORE_FILES+= info/dir
+.if defined(INFO_DIR) && empty(INFO_DIR:Minfo)
+_PLIST_IGNORE_FILES+= ${INFO_DIR}/dir
+.endif
+_PLIST_IGNORE_FILES+= *[~\#] *.OLD *.orig *,v # scratch config files
+_PLIST_IGNORE_FILES+= ${PLIST_IGNORE_FILES}
+.endif
+BUILD_DEFS+= _PLIST_IGNORE_FILES
+
# We need to make sure the buildlink-x11 package is not installed since it
# breaks builds that use imake.
#
@@ -320,13 +388,17 @@ SHCOMMENT?= ${ECHO_MSG} >/dev/null '***'
DISTINFO_FILE?= ${.CURDIR}/distinfo
FIX_RPATH+= LIBS
-LDFLAGS+= -Wl,${RPATH_FLAG}${LOCALBASE}/lib
-LDFLAGS+= -L${LOCALBASE}/lib
.if defined(USE_X11)
X11_LDFLAGS= # empty
X11_LDFLAGS+= -Wl,${RPATH_FLAG}${X11BASE}/lib
X11_LDFLAGS+= -L${X11BASE}/lib
+.endif
+.if !empty(USE_BUILDLINK2:M[nN][oO]) && !empty(USE_BUILDLINK3:M[nN][oO])
+LDFLAGS+= -Wl,${RPATH_FLAG}${LOCALBASE}/lib
+LDFLAGS+= -L${LOCALBASE}/lib
+. if defined(USE_X11)
LDFLAGS+= ${X11_LDFLAGS}
+. endif
.endif
FIX_RPATH+= LDFLAGS
MAKE_ENV+= LDFLAGS="${LDFLAGS}"
@@ -501,21 +573,26 @@ DESCR_SRC?= ${PKGDIR}/DESCR
.endif
PLIST= ${WRKDIR}/.PLIST
+.if ${PLIST_TYPE} == "static"
# Automatic platform dependent PLIST handling
-.if !defined(PLIST_SRC)
-. if exists(${PKGDIR}/PLIST.common)
+. if !defined(PLIST_SRC)
+. if exists(${PKGDIR}/PLIST.common)
PLIST_SRC= ${PKGDIR}/PLIST.common
-. if exists(${PKGDIR}/PLIST.${OPSYS})
+. if exists(${PKGDIR}/PLIST.${OPSYS})
PLIST_SRC+= ${PKGDIR}/PLIST.${OPSYS}
-. endif
-. if exists(${PKGDIR}/PLIST.common_end)
+. endif
+. if exists(${PKGDIR}/PLIST.common_end)
PLIST_SRC+= ${PKGDIR}/PLIST.common_end
-. endif
-. elif exists(${PKGDIR}/PLIST.${OPSYS})
+. endif
+. elif exists(${PKGDIR}/PLIST.${OPSYS})
PLIST_SRC= ${PKGDIR}/PLIST.${OPSYS}
-. else
+. else
PLIST_SRC= ${PKGDIR}/PLIST
+. endif
. endif
+_PLIST_SRC= ${PLIST_SRC}
+.elif ${PLIST_TYPE} == "dynamic"
+_PLIST_SRC= # empty, since we're using a dynamic PLIST
.endif
DLIST= ${WRKDIR}/.DLIST
@@ -640,7 +717,7 @@ uptodate-digest:
.if defined(_OPSYS_PKGTOOLS_REQD)
PKGTOOLS_REQD= ${_OPSYS_PKGTOOLS_REQD}
.else
-PKGTOOLS_REQD= 20021123
+PKGTOOLS_REQD= 20030823
.endif
# Check that we are using up-to-date pkg_* tools with this file.
@@ -710,6 +787,11 @@ PKG_ARGS_INSTALL= -p ${PREFIX} ${PKG_ARGS_COMMON}
PKG_ARGS_BINPKG= -p ${PREFIX:S/^${DESTDIR}//} -L ${PREFIX} ${PKG_ARGS_COMMON}
.endif # !PKG_ARGS_COMMON
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+PKG_ARGS_INSTALL+= -U # don't update the pkgdb.byfile.db
+PKG_ARGS_BINPKG+= -E # create an empty views file in the binpkg
+.endif
+
PKG_SUFX?= .tgz
#PKG_SUFX?= .tbz # bzip2(1) pkgs
@@ -756,7 +838,7 @@ RMAN?= ${X11BASE}/bin/rman
.if !empty(_USE_RPATH:M[nN][oO])
. if defined(FIX_RPATH) && !empty(FIX_RPATH)
. for var in ${FIX_RPATH}
-. for _rpath_flag in ${RPATH_FLAG} -R -rpath -rpath-link
+. for _rpath_flag in ${RPATH_FLAG} -R -rpath -rpath-link --rpath --rpath-link
${var}:= ${${var}:N-Wl,${_rpath_flag}*:N${_rpath_flag}*}
. endfor
. endfor
@@ -1161,12 +1243,29 @@ PKG_SYSCONFVAR?= ${PKGBASE}
PKG_SYSCONFBASE?= ${PREFIX}/etc
.if defined(PKG_SYSCONFDIR.${PKG_SYSCONFVAR})
PKG_SYSCONFDIR= ${PKG_SYSCONFDIR.${PKG_SYSCONFVAR}}
+PKG_SYSCONFDEPOTBASE= # empty
+PKG_SYSCONFVIEWBASE= # empty
.else
PKG_SYSCONFSUBDIR?= # empty
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
+PKG_SYSCONFDEPOTBASE= # empty
+PKG_SYSCONFVIEWBASE= # empty
+_PKG_SYSCONFBASE= ${PKG_SYSCONFBASE}
+. else
+PKG_SYSCONFVIEWBASE= ${PKG_SYSCONFBASE}
+. if !empty(PKG_SYSCONFBASE:M${PREFIX}) || \
+ !empty(PKG_SYSCONFBASE:M${PREFIX}/*)
+PKG_SYSCONFDEPOTBASE= # empty
+_PKG_SYSCONFBASE= ${PKG_SYSCONFBASE}
+. else
+PKG_SYSCONFDEPOTBASE= ${PKG_SYSCONFBASE}/${DEPOT_SUBDIR}
+_PKG_SYSCONFBASE= ${PKG_SYSCONFDEPOTBASE}/${PKGNAME}
+. endif
+. endif
. if empty(PKG_SYSCONFSUBDIR)
-PKG_SYSCONFDIR= ${PKG_SYSCONFBASE}
+PKG_SYSCONFDIR= ${_PKG_SYSCONFBASE}
. else
-PKG_SYSCONFDIR= ${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}
+PKG_SYSCONFDIR= ${_PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}
. endif
.endif
@@ -1186,12 +1285,16 @@ SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
SCRIPTS_ENV+= BATCH=yes
.endif
-.if !empty(USE_BUILDLINK2:M[nN][oO])
+.if !empty(USE_BUILDLINK2:M[nN][oO]) && !empty(USE_BUILDLINK3:M[nN][oO])
NO_BUILDLINK= # defined
.endif
.if !defined(NO_BUILDLINK)
-. include "../../mk/buildlink2/bsd.buildlink2.mk"
+. if empty(USE_BUILDLINK3:M[nN][oO])
+. include "../../mk/buildlink3/bsd.buildlink3.mk"
+. elif empty(USE_BUILDLINK2:M[nN][oO])
+. include "../../mk/buildlink2/bsd.buildlink2.mk"
+. endif
.endif
.include "../../mk/tools.mk"
@@ -2349,7 +2452,8 @@ delete-package:
.PHONY: real-su-install
real-su-install: ${MESSAGE}
-.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
+.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) && \
+ (${PKG_INSTALLATION_TYPE} == "overwrite")
. if defined(CONFLICTS)
${_PKG_SILENT}${_PKG_DEBUG} \
${RM} -f ${WRKDIR}/.CONFLICTS
@@ -2362,7 +2466,7 @@ real-su-install: ${MESSAGE}
. endfor
${_PKG_SILENT}${_PKG_DEBUG} \
if [ -s ${WRKDIR}/.CONFLICTS ]; then \
- found=`${SED} -e s'|${PKG_DBDIR}/||g' ${WRKDIR}/.CONFLICTS | tr '\012' ' '`; \
+ found=`${SED} -e s'|${_PKG_DBDIR}/||g' ${WRKDIR}/.CONFLICTS | tr '\012' ' '`; \
${ECHO_MSG} "${_PKGSRC_IN}> ${PKGNAME} conflicts with installed package(s): $$found found."; \
${ECHO_MSG} "*** They install the same files into the same place."; \
${ECHO_MSG} "*** Please remove $$found first with pkg_delete(1)."; \
@@ -2381,12 +2485,35 @@ real-su-install: ${MESSAGE}
${ECHO_MSG} "*** dependencies, risking various problems."; \
exit 1; \
fi
-.endif # !NO_PKG_REGISTER && !NO_FORCE_REGISTER
+.endif # !NO_PKG_REGISTER && !NO_FORCE_REGISTER && overwrite
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ found="`${PKG_INFO} -e ${PKGNAME} || ${TRUE}`"; \
+ if [ "$$found" != "" ]; then \
+ ${ECHO_MSG} "${_PKGSRC_IN}> $$found is already installed."; \
+ exit 1; \
+ fi
+.endif
${_PKG_SILENT}${_PKG_DEBUG}if [ `${SH} -c umask` -ne ${DEF_UMASK} ]; then \
${ECHO_MSG} "${_PKGSRC_IN}> Warning: your umask is \"`${SH} -c umask`"\".; \
${ECHO_MSG} "If this is not desired, set it to an appropriate value (${DEF_UMASK})"; \
${ECHO_MSG} "and install this package again by \`\`${MAKE} deinstall reinstall''."; \
fi
+.if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS)
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} "${_PKGSRC_IN}> Creating installation directories"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ for dir in ${INSTALLATION_DIRS}; do \
+ case $$dir in \
+ /*) ;; \
+ *bin|*bin/*|*libexec|*libexec/*) \
+ ${INSTALL_PROGRAM_DIR} ${PREFIX}/$$dir ;; \
+ *man/*) \
+ ${INSTALL_MAN_DIR} ${PREFIX}/$$dir ;; \
+ *) \
+ ${INSTALL_DATA_DIR} ${PREFIX}/$$dir ;; \
+ esac; \
+ done
+.endif # INSTALLATION_DIRS
.if !defined(NO_MTREE)
${_PKG_SILENT}${_PKG_DEBUG}if [ `${ID} -u` = 0 ]; then \
if [ ! -f ${MTREE_FILE} ]; then \
@@ -2402,16 +2529,25 @@ real-su-install: ${MESSAGE}
${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
fi
+.else
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${PREFIX}
.endif # !NO_MTREE
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install-script
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} do-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install
+ ${_PKG_SILENT}#
+ ${_PKG_SILENT}# PLIST must be generated at this late point (instead of
+ ${_PKG_SILENT}# depending on it somewhere earlier), because it needs
+ ${_PKG_SILENT}# to be created _after_ the {pre,do,post}-install
+ ${_PKG_SILENT}# targets are run.
+ ${_PKG_SILENT}#
+ ${_PKG_SILENT}# We generate _before_ post-install-script is run so
+ ${_PKG_SILENT}# that the real config files and rc.d scripts aren't
+ ${_PKG_SILENT}# listed in the PLIST.
+ ${_PKG_SILENT}#
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} ${PLIST}
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install-script
- @# PLIST must be generated at this late point (instead of
- @# depending on it somewhere earlier), as the
- @# pre/do/post-install aren't run then yet:
- @${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} ${PLIST}
${_PKG_SILENT}${_PKG_DEBUG}newmanpages=`${EGREP} -h \
'^([^@/]*/)*man/([^/]*/)?(man[1-9ln]/.*\.[1-9ln]|cat[1-9ln]/.*\.0)(\.gz)?$$' \
${PLIST} 2>/dev/null || ${TRUE}`; \
@@ -2454,8 +2590,10 @@ real-su-install: ${MESSAGE}
done; \
fi
.if ${_DO_SHLIB_CHECKS} == "yes"
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
${_PKG_SILENT}${_PKG_DEBUG} \
${MAKE} ${MAKEFLAGS} do-shlib-handling SHLIB_PLIST_MODE=0
+. endif
.endif
.ifdef MESSAGE
@${ECHO_MSG} "${_PKGSRC_IN}> Please note the following:"
@@ -3265,9 +3403,10 @@ lint:
# Create a binary package from an install package using "pkg_tarup"
.PHONY: tarup
tarup:
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
${_PKG_SILENT}${_PKG_DEBUG} \
${RM} -f ${PACKAGES}/All/${PKGNAME}${PKG_SUFX}; \
- ${SETENV} PKG_DBDIR=${PKG_DBDIR} PKG_SUFX=${PKG_SUFX} \
+ ${SETENV} PKG_DBDIR=${_PKG_DBDIR} PKG_SUFX=${PKG_SUFX} \
PKGREPOSITORY=${PACKAGES}/All \
${LOCALBASE}/bin/pkg_tarup ${PKGNAME}; \
for CATEGORY in ${CATEGORIES}; do \
@@ -3276,21 +3415,22 @@ tarup:
${RM} -f ${PKGNAME}${PKG_SUFX}; \
${LN} -s ../All/${PKGNAME}${PKG_SUFX}; \
done
+.endif
# shared code for replace and undo-replace
_REPLACE= \
- if [ -f ${PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ]; then \
- ${MV} ${PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ${WRKDIR}/.req; \
+ if [ -f ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ]; then \
+ ${MV} ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ${WRKDIR}/.req; \
fi; \
${MAKE} deinstall; \
$$replace_action; \
if [ -f ${WRKDIR}/.req ]; then \
- ${MV} ${WRKDIR}/.req ${PKG_DBDIR}/$$newpkgname/+REQUIRED_BY; \
- for pkg in `${CAT} ${PKG_DBDIR}/$$newpkgname/+REQUIRED_BY`; do \
+ ${MV} ${WRKDIR}/.req ${_PKG_DBDIR}/$$newpkgname/+REQUIRED_BY; \
+ for pkg in `${CAT} ${_PKG_DBDIR}/$$newpkgname/+REQUIRED_BY`; do \
${SETENV} NEWPKGNAME=$$newpkgname \
${AWK} '/^@pkgdep '$$oldpkgname'/ { print "@pkgdep " ENVIRON["NEWPKGNAME"]; next } { print }' \
- < ${PKG_DBDIR}/$$pkg/+CONTENTS > ${PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ && \
- ${MV} ${PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ ${PKG_DBDIR}/$$pkg/+CONTENTS; \
+ < ${_PKG_DBDIR}/$$pkg/+CONTENTS > ${_PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ && \
+ ${MV} ${_PKG_DBDIR}/$$pkg/+CONTENTS.$$$$ ${_PKG_DBDIR}/$$pkg/+CONTENTS; \
done; \
fi
@@ -3651,8 +3791,14 @@ checksum: fetch uptodate-digest
BINPKG_SITES?= \
ftp://ftp.netbsd.org/pub/NetBSD/packages/$${rel}/$${arch}
-# List of flags to pass to pkg_add(8) for bin-install:
+# List of flags to pass to pkg_add(1) for bin-install:
+
BIN_INSTALL_FLAGS?= # -v
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+PKG_ARGS_ADD= -W ${LOCALBASE}
+.endif
+_BIN_INSTALL_FLAGS= ${BIN_INSTALL_FLAGS}
+_BIN_INSTALL_FLAGS+= ${PKG_ARGS_ADD}
# Install binary pkg, without strict uptodate-check first
.PHONY: bin-install
@@ -3667,13 +3813,13 @@ bin-install:
fi
@if [ -f ${PKGFILE} ] ; then \
${ECHO_MSG} "Installing from binary pkg ${PKGFILE}" ; \
- ${PKG_ADD} ${PKGFILE} ; \
+ ${PKG_ADD} ${_BIN_INSTALL_FLAGS} ${PKGFILE} ; \
else \
rel=`${UNAME} -r | ${SED} 's@\.\([0-9]*\)[\._].*@\.\1@'`; \
arch=${MACHINE_ARCH}; \
for site in ${BINPKG_SITES} ; do \
${ECHO} Trying `eval ${ECHO} $$site`/All ; \
- ${SHCOMMENT} ${ECHO} ${SETENV} PKG_PATH="`eval ${ECHO} $$site`/All" ${PKG_ADD} ${BIN_INSTALL_FLAGS} ${PKGNAME}${PKG_SUFX} ; \
+ ${SHCOMMENT} ${ECHO} ${SETENV} PKG_PATH="`eval ${ECHO} $$site`/All" ${PKG_ADD} ${_BIN_INSTALL_FLAGS} ${PKGNAME}${PKG_SUFX} ; \
if ${SETENV} PKG_PATH="`eval ${ECHO} $$site`/All" ${PKG_ADD} ${BIN_INSTALL_FLAGS} ${PKGNAME}${PKG_SUFX} ; then \
${ECHO} "${PKGNAME} successfully installed."; \
break ; \
@@ -4290,10 +4436,17 @@ print-PLIST:
| ${SED} ${SUBST_PLIST_REPLACEMENT2}
.endif # target(print-PLIST)
+# By default, all packages attempt to link into the views.
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+BUILD_VIEWS?= yes
+.endif
+
+# XXX Only support the standard view.
+PKGVIEWS= ""
# Fake installation of package so that user can pkg_delete it later.
# Also, make sure that an installed package is recognized correctly in
-# accordance to the @pkgdep directive in the packing lists
+# accordance to the @pkgdep directive in the packing lists.
.PHONY: fake-pkg
.if !target(fake-pkg)
@@ -4304,13 +4457,15 @@ fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
exit 1; \
fi
${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -d ${PKG_DBDIR} ]; then \
- ${RM} -f ${PKG_DBDIR}; \
- ${MKDIR} ${PKG_DBDIR}; \
+ if [ ! -d ${_PKG_DBDIR} ]; then \
+ ${RM} -f ${_PKG_DBDIR}; \
+ ${MKDIR} ${_PKG_DBDIR}; \
fi
. if defined(FORCE_PKG_REGISTER)
${_PKG_SILENT}${_PKG_DEBUG}${PKG_DELETE} -O ${PKGNAME}
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -rf ${PKG_DBDIR}/${PKGNAME}
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -rf ${_PKG_DBDIR}/${PKGNAME}
+. endif
. endif
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILD_VERSION_FILE} ${BUILD_INFO_FILE}
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${SIZE_PKG_FILE} ${SIZE_ALL_FILE}
@@ -4394,36 +4549,46 @@ fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
${ECHO} $$size_this >${SIZE_PKG_FILE}; \
${ECHO} $$size_this $$size_depends + p | ${DC} >${SIZE_ALL_FILE}
${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
+ doit=yes; \
+ case ${PKG_INSTALLATION_TYPE} in \
+ overwrite) if [ -d ${_PKG_DBDIR}/${PKGNAME} ]; then \
+ doit=no; \
+ fi ;; \
+ esac; \
+ case $$doit in \
+ yes) \
${ECHO_MSG} "${_PKGSRC_IN}> Registering installation for ${PKGNAME}"; \
- ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
- ${PKG_CREATE} ${PKG_ARGS_INSTALL} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
- ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
- ${ECHO} ${COMMENT:Q} > ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
- ${CP} ${BUILD_VERSION_FILE} ${PKG_DBDIR}/${PKGNAME}/+BUILD_VERSION; \
- ${CP} ${BUILD_INFO_FILE} ${PKG_DBDIR}/${PKGNAME}/+BUILD_INFO; \
+ ${MKDIR} ${_PKG_DBDIR}/${PKGNAME}; \
+ ${PKG_CREATE} ${PKG_ARGS_INSTALL} -O ${PKGFILE} > ${_PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
+ ${CP} ${DESCR} ${_PKG_DBDIR}/${PKGNAME}/+DESC; \
+ ${ECHO} ${COMMENT:Q} > ${_PKG_DBDIR}/${PKGNAME}/+COMMENT; \
+ ${CP} ${BUILD_VERSION_FILE} ${_PKG_DBDIR}/${PKGNAME}/+BUILD_VERSION; \
+ ${CP} ${BUILD_INFO_FILE} ${_PKG_DBDIR}/${PKGNAME}/+BUILD_INFO; \
if ${TEST} -e ${SIZE_PKG_FILE}; then \
- ${CP} ${SIZE_PKG_FILE} ${PKG_DBDIR}/${PKGNAME}/+SIZE_PKG; \
+ ${CP} ${SIZE_PKG_FILE} ${_PKG_DBDIR}/${PKGNAME}/+SIZE_PKG; \
fi ; \
if ${TEST} -e ${SIZE_ALL_FILE}; then \
- ${CP} ${SIZE_ALL_FILE} ${PKG_DBDIR}/${PKGNAME}/+SIZE_ALL; \
+ ${CP} ${SIZE_ALL_FILE} ${_PKG_DBDIR}/${PKGNAME}/+SIZE_ALL; \
fi ; \
if ${TEST} -e ${PRESERVE_FILE}; then \
- ${CP} ${PRESERVE_FILE} ${PKG_DBDIR}/${PKGNAME}/+PRESERVE; \
+ ${CP} ${PRESERVE_FILE} ${_PKG_DBDIR}/${PKGNAME}/+PRESERVE; \
fi ; \
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" ]; then \
+ ${TOUCH} ${_PKG_DBDIR}/${PKGNAME}/+VIEWS; \
+ fi ; \
if [ -n "${INSTALL_FILE}" ]; then \
if ${TEST} -e ${INSTALL_FILE}; then \
- ${CP} ${INSTALL_FILE} ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
+ ${CP} ${INSTALL_FILE} ${_PKG_DBDIR}/${PKGNAME}/+INSTALL; \
fi; \
fi; \
if [ -n "${DEINSTALL_FILE}" ]; then \
if ${TEST} -e ${DEINSTALL_FILE}; then \
- ${CP} ${DEINSTALL_FILE} ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
+ ${CP} ${DEINSTALL_FILE} ${_PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
fi; \
fi; \
if [ -n "${MESSAGE}" ]; then \
if ${TEST} -e ${MESSAGE}; then \
- ${CP} ${MESSAGE} ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
+ ${CP} ${MESSAGE} ${_PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
fi; \
fi; \
list="`${MAKE} ${MAKEFLAGS} run-depends-list PACKAGE_DEPENDS_QUICK=true ECHO_MSG=${TRUE} | ${SORT} -u`" ; \
@@ -4435,24 +4600,106 @@ fake-pkg: ${PLIST} ${DESCR} ${MESSAGE}
${ECHO} " Please check if this is really intended!" ; \
continue ; \
fi ; \
- done ; \
+ done ; \
for realdep in `${ECHO} $$list | ${XARGS} -n 1 ${SETENV} ${PKG_INFO} -e | ${SORT} -u`; do \
if ${TEST} -z "$$realdep"; then \
${ECHO} "$$dep not installed - dependency NOT registered" ; \
- elif [ -d ${PKG_DBDIR}/$$realdep ]; then \
- if ${TEST} ! -e ${PKG_DBDIR}/$$realdep/+REQUIRED_BY; then \
- ${TOUCH} ${PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
+ elif [ -d ${_PKG_DBDIR}/$$realdep ]; then \
+ if ${TEST} ! -e ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; then \
+ ${TOUCH} ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
fi; \
${AWK} 'BEGIN { found = 0; } \
$$0 == "${PKGNAME}" { found = 1; } \
{ print $$0; } \
END { if (!found) { printf("%s\n", "${PKGNAME}"); }}' \
- < ${PKG_DBDIR}/$$realdep/+REQUIRED_BY > ${PKG_DBDIR}/$$realdep/reqby.$$$$; \
- ${MV} ${PKG_DBDIR}/$$realdep/reqby.$$$$ ${PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
+ < ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY > ${_PKG_DBDIR}/$$realdep/reqby.$$$$; \
+ ${MV} ${_PKG_DBDIR}/$$realdep/reqby.$$$$ ${_PKG_DBDIR}/$$realdep/+REQUIRED_BY; \
${ECHO} "${PKGNAME} requires installed package $$realdep"; \
fi; \
- done; \
- fi
+ done ;; \
+ esac
+. if (${PKG_INSTALLATION_TYPE} == "pkgviews") && (${BUILD_VIEWS} == "yes")
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} build-views
+. endif # pkgviews
+.endif # !fake-pkg
+
+.PHONY: build-views
+build-views: do-su-build-views
+
+.PHONY: do-su-build-views
+do-su-build-views:
+ @${ECHO_MSG} "${_PKGSRC_IN}> Building views for ${PKGNAME}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ realtarget="real-su-build-views"; \
+ action="build-views"; \
+ ${_SU_TARGET}
+
+.PHONY: real-su-build-views
+.if !target(real-su-build-views)
+real-su-build-views:
+. if (${PKG_INSTALLATION_TYPE} == "pkgviews") && defined(PKGVIEWS)
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${MKDIR} ${LOCALBASE}; \
+ for v in ${PKGVIEWS}; do \
+ case "$$v" in \
+ "") dbdir=${PKG_DBDIR}; viewname=standard ;; \
+ *) dbdir=${LOCALBASE}/$$v/.dbdir; viewname=$$v ;; \
+ esac; \
+ ${ECHO} "=> Performing package view clash check for ${PKGNAME} in $$viewname view"; \
+ pkg=`${PKG_INFO_CMD} -K $$dbdir -e ${PKGBASE} || ${TRUE}`; \
+ case "$$pkg" in \
+ "") ;; \
+ *) ${ECHO} "*** ${PKGBASE} exists in $$viewname view - package $$pkg ***"; \
+ ${ECHO} "*** Not hoisting ${PKGNAME} into $$viewname view"; \
+ continue ;; \
+ esac; \
+ ${ECHO} "=> Performing package view overwrite check for ${PKGNAME} in $$viewname view"; \
+ dups=`${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v check ${PKGNAME} || ${TRUE}`; \
+ case "$$dups" in \
+ "") ;; \
+ *) ${ECHO} "***********************************************************"; \
+ ${ECHO} "**** The following symbolic links will be overwritten *****"; \
+ for f in $$dups; do \
+ ${LS} -l ${LOCALBASE}/$$v/$$f; \
+ done; \
+ ${ECHO} "***********************************************************"; \
+ ;; \
+ esac; \
+ ${ECHO} "=> Linking package into $$viewname view"; \
+ ${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v add ${PKGNAME}; \
+ done
+. else
+ ${_PKG_SILENT}${_PKG_DEBUG}${DO_NADA}
+. endif
+.endif
+
+.PHONY: remove-views
+remove-views: do-su-remove-views
+
+.PHONY: do-su-remove-views
+do-su-remove-views:
+ @${ECHO_MSG} "${_PKGSRC_IN}> Removing ${PKGNAME} from views"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ realtarget="real-su-remove-views"; \
+ action="remove-views"; \
+ ${_SU_TARGET}
+
+.PHONY: real-su-remove-views
+.if !target(real-su-remove-views)
+real-su-remove-views:
+. if (${PKG_INSTALLATION_TYPE} == "pkgviews") && defined(PKGVIEWS)
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ for v in ${PKGVIEWS}; do \
+ case "$$v" in \
+ "") dbdir=${PKG_DBDIR}; viewname=standard ;; \
+ *) dbdir=${LOCALBASE}/$$v/.dbdir; viewname=$$v ;; \
+ esac; \
+ ${ECHO} "=> Removing package from $$viewname view"; \
+ ${SETENV} PLIST_IGNORE_FILES="${_PLIST_IGNORE_FILES}" ${PKG_VIEW} --view=$$v delete ${PKGNAME}; \
+ done
+.else
+ ${_PKG_SILENT}${_PKG_DEBUG}${DO_NADA}
+. endif
.endif
# Depend is generally meaningless for arbitrary packages, but if someone wants
@@ -4477,7 +4724,7 @@ MANCOMPRESSED= yes
MAKE_ENV+= MANZ="${MANZ}"
.endif
-# generate ${PLIST} from ${PLIST_SRC} by:
+# generate ${PLIST} from ${_PLIST_SRC} by:
# - fixing list of man-pages according to MANCOMPRESSED/MANZ
# (we don't take any notice of MANCOMPRESSED as many packages have .gz
# pages in PLIST even when they install manpages without compressing them)
@@ -4577,14 +4824,36 @@ ${MESSAGE}: ${MESSAGE_SRC}
# GENERATE_PLIST is a sequence of commands, terminating in a semicolon,
# that outputs contents for a PLIST to stdout and is appended to
-# the contents of ${PLIST_SRC}.
+# the contents of ${_PLIST_SRC}.
#
GENERATE_PLIST?= ${TRUE};
-_GENERATE_PLIST= ${CAT} ${PLIST_SRC}; ${GENERATE_PLIST}
+.if ${PLIST_TYPE} == "dynamic"
+_PLIST_IGNORE_CMD= \
+ ( while read i; do \
+ ignore=no; \
+ for p in ${_PLIST_IGNORE_FILES}; do \
+ case "$$i" in \
+ $$p) ignore=yes; break ;; \
+ esac; \
+ done; \
+ [ "$$ignore" = "yes" ] || ${ECHO} "$$i"; \
+ done )
+_GENERATE_PLIST= \
+ ${FIND} ${PREFIX} \! -type d -print | ${SORT} | \
+ ${SED} -e "s|^${PREFIX}/||" | \
+ ${_PLIST_IGNORE_CMD}; \
+ ${FIND} ${PREFIX} -type d -print | ${SORT} -r | \
+ ${GREP} -v "^${PREFIX}$$" | \
+ ${_PLIST_IGNORE_CMD} | \
+ ${SED} -e "s|^${PREFIX}/|@unexec ${RMDIR} -p %D/|" \
+ -e "s,$$, 2>/dev/null || ${TRUE},";
+.else
+_GENERATE_PLIST= ${CAT} ${_PLIST_SRC}; ${GENERATE_PLIST}
+.endif
.PHONY: plist
plist: ${PLIST}
-${PLIST}: ${PLIST_SRC}
+${PLIST}: ${_PLIST_SRC}
${_PKG_SILENT}${_PKG_DEBUG} \
{ ${_GENERATE_PLIST} } | \
${_MANINSTALL_CMD} \
@@ -4594,7 +4863,7 @@ ${PLIST}: ${PLIST_SRC}
${_MANZ_EXPRESSION} \
> ${PLIST}; \
${MAKE} ${MAKEFLAGS} do-shlib-handling \
- SHLIB_PLIST_MODE=1 ; \
+ SHLIB_PLIST_MODE=1
# generate ${DESCR} from ${DESCR_SRC} by:
# - Appending the homepage URL, if any
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index ed8c2a357f6..604f36f3d73 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.121 2003/08/31 11:04:58 jlam Exp $
+# $NetBSD: bsd.prefs.mk,v 1.122 2003/09/02 06:59:44 jlam Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
@@ -249,6 +249,9 @@ X11PREFIX= ${X11BASE}
XMKMF_CMD?= ${X11PREFIX}/bin/xmkmf
.endif
+DEPOT_SUBDIR?= packages
+DEPOTBASE= ${LOCALBASE}/${DEPOT_SUBDIR}
+
# RPATH_FLAG publicly exports the linker flag used to specify run-time
# library search paths.
#
@@ -276,21 +279,58 @@ DIGEST_VERSION!= ${DIGEST} -V 2>/dev/null
MAKEFLAGS+= DIGEST_VERSION="${DIGEST_VERSION}"
.endif
+# Set the style of installation to be performed for the package. The
+# funky make variable modifiers just select the first word of the value
+# stored in the referenced variable.
+#
+.for _pref_ in ${PKG_INSTALLATION_PREFS}
+. if !empty(PKG_INSTALLATION_TYPES:M${_pref_})
+PKG_INSTALLATION_TYPE?= ${PKG_INSTALLATION_TYPES:M${_pref_}:S/^/_pkginsttype_/1:M_pkginsttype_*:S/^_pkginsttype_//}
+. endif
+.endfor
+PKG_INSTALLATION_TYPE?= none
+
+# This is the package database directory for the default view.
+PKG_DBDIR?= ${DESTDIR}/var/db/pkg
+
+# _PKG_DBDIR is the actual packages database directory where we register
+# packages.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+_PKG_DBDIR= ${PKG_DBDIR}
+.elif ${PKG_INSTALLATION_TYPE} == "pkgviews"
+_PKG_DBDIR= ${DEPOTBASE}
+.endif
+
PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add
PKG_ADMIN_CMD?= ${PKG_TOOLS_BIN}/pkg_admin
PKG_CREATE_CMD?= ${PKG_TOOLS_BIN}/pkg_create
PKG_DELETE_CMD?= ${PKG_TOOLS_BIN}/pkg_delete
PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info
+PKG_VIEW_CMD?= ${PKG_TOOLS_BIN}/pkg_view
+LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm
-PKG_DBDIR?= ${DESTDIR}/var/db/pkg
-PKG_ADD?= PKG_DBDIR=${PKG_DBDIR} ${PKG_ADD_CMD}
-PKG_ADMIN?= PKG_DBDIR=${PKG_DBDIR} ${PKG_ADMIN_CMD}
-PKG_CREATE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_CREATE_CMD}
-PKG_DELETE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_DELETE_CMD}
-PKG_INFO?= PKG_DBDIR=${PKG_DBDIR} ${PKG_INFO_CMD}
+# The binary pkg_install tools all need to consistently to refer to the
+# correct package database directory.
+#
+PKGTOOLS_ARGS?= -K ${_PKG_DBDIR}
+
+# Views are rooted in ${LOCALBASE}, all packages are depoted in
+# ${DEPOTBASE}, and the package database directory for the default view
+# is in ${PKG_DBDIR}.
+#
+PKG_VIEW_ARGS?= -W ${LOCALBASE} -d ${DEPOTBASE} -k ${PKG_DBDIR}
+
+PKG_ADD?= ${PKG_ADD_CMD} ${PKGTOOLS_ARGS}
+PKG_ADMIN?= ${PKG_ADMIN_CMD} ${PKGTOOLS_ARGS}
+PKG_CREATE?= ${PKG_CREATE_CMD} ${PKGTOOLS_ARGS}
+PKG_DELETE?= ${PKG_DELETE_CMD} ${PKGTOOLS_ARGS}
+PKG_INFO?= ${PKG_INFO_CMD} ${PKGTOOLS_ARGS}
+PKG_VIEW?= ${PKG_VIEW_CMD} ${PKG_VIEW_ARGS}
+LINKFARM?= ${LINKFARM_CMD}
.ifndef PKGTOOLS_VERSION
-PKGTOOLS_VERSION!= ${PKG_INFO} -V 2>/dev/null || echo 20010302
+PKGTOOLS_VERSION!= ${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
MAKEFLAGS+= PKGTOOLS_VERSION="${PKGTOOLS_VERSION}"
.endif
diff --git a/mk/buildlink2/NOTES b/mk/buildlink2/NOTES
index a09bd0e4f93..915220ea896 100644
--- a/mk/buildlink2/NOTES
+++ b/mk/buildlink2/NOTES
@@ -1,4 +1,4 @@
-$NetBSD: NOTES,v 1.13 2003/08/31 10:17:16 jlam Exp $
+$NetBSD: NOTES,v 1.14 2003/09/02 06:59:50 jlam Exp $
Caching
=======
diff --git a/mk/buildlink2/bsd.buildlink2.mk b/mk/buildlink2/bsd.buildlink2.mk
index 2b581aae1bb..16d8f6d0515 100644
--- a/mk/buildlink2/bsd.buildlink2.mk
+++ b/mk/buildlink2/bsd.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.95 2003/08/27 11:29:57 jlam Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.96 2003/09/02 06:59:50 jlam Exp $
#
# An example package buildlink2.mk file:
#
@@ -88,9 +88,7 @@ MAKE_ENV+= BUILDLINK_CACHE_ALL=yes
.if defined(USE_X11)
USE_X11_LINKS?= YES
-. if !empty(USE_X11_LINKS:M[nN][oO])
-. include "../../mk/x11.buildlink2.mk"
-. else
+. if empty(USE_X11_LINKS:M[nN][oO])
BUILD_DEPENDS+= x11-links>=0.12:../../pkgtools/x11-links
_BLNK_X11_DIR= ${LOCALBASE}/share/x11-links
. endif
@@ -332,6 +330,12 @@ _BLNK_UNPROTECT+= s:${_BLNK_MANGLE_DIR.${_dir_}}:${${_dir_}}
_BLNK_TRANSFORM+= ${_BLNK_PROTECT}
#
+# Change references to ${DEPOTBASE}/<pkg> into ${LOCALBASE} so that
+# "overwrite" packages think headers and libraries for "pkgviews" packages
+# are just found in the default view.
+#
+_BLNK_TRANSFORM+= depot:${DEPOTBASE}:${LOCALBASE}
+#
# Convert direct paths to shared libraries into "-Ldir -llib" equivalents.
#
_BLNK_TRANSFORM+= p:${X11BASE}
@@ -399,15 +403,20 @@ _REPLACE_BUILDLINK= \
# When "unbuildlinkifying" a file, we must remove references to the
# buildlink directories and change any -llib to the proper replacement
# libraries (-lreadline -> -ledit, etc.). Redundant -Idir and -Ldir
-# options are removed to optimize the resulting file.
+# options are removed to optimize the resulting file. Also, prefer the
+# .la files in ${LOCALBASE}/lib over the ones in ${DEPOTBASE}/*/lib when
+# creating new .la files. This makes "overwrite" packages look and feel
+# more like they would without the pkgviews integration.
#
-REPLACE_BUILDLINK_SED?= # empty
-_REPLACE_BUILDLINK_SED= ${REPLACE_BUILDLINK_SED}
-_REPLACE_BUILDLINK_SED+= ${LIBTOOL_ARCHIVE_UNTRANSFORM_SED}
+LIBTOOL_ARCHIVE_UNTRANSFORM_SED?= # empty
+_LIBTOOL_ARCHIVE_UNTRANSFORM_SED+= ${LIBTOOL_ARCHIVE_UNTRANSFORM_SED}
+REPLACE_BUILDLINK_SED?= # empty
+_REPLACE_BUILDLINK_SED= ${REPLACE_BUILDLINK_SED}
+_REPLACE_BUILDLINK_SED+= ${_LIBTOOL_ARCHIVE_UNTRANSFORM_SED}
SUBST_CLASSES+= unbuildlink
SUBST_STAGE.unbuildlink= post-build
-SUBST_MESSAGE.unbuildlink= \
+SUBST_MESSAGE.unbuildlink= \
"Fixing buildlink references in files-to-be-installed."
SUBST_FILES.unbuildlink= ${_REPLACE_BUILDLINK}
SUBST_SED.unbuildlink= ${_REPLACE_BUILDLINK_SED}
diff --git a/mk/buildlink2/gen-transform.sh b/mk/buildlink2/gen-transform.sh
index 1e6c01e0ed2..d4afb3b8175 100644
--- a/mk/buildlink2/gen-transform.sh
+++ b/mk/buildlink2/gen-transform.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: gen-transform.sh,v 1.12 2003/07/09 16:07:22 salo Exp $
+# $NetBSD: gen-transform.sh,v 1.13 2003/09/02 06:59:51 jlam Exp $
transform="@_BLNK_TRANSFORM_SEDFILE@"
untransform="@_BLNK_UNTRANSFORM_SEDFILE@"
@@ -144,6 +144,16 @@ EOF
;;
esac
;;
+ depot)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2/[^/ \`"':;]*\(/[^ \`"':;]\)|$3\1|g
+s|$2/[^/ \`"':;]*$|$3|g
+EOF
+ ;;
+ esac
+ ;;
esac
}
diff --git a/mk/buildlink2/libtool-fix-la b/mk/buildlink2/libtool-fix-la
index dcba4bd70d0..1fd4cb909a0 100644
--- a/mk/buildlink2/libtool-fix-la
+++ b/mk/buildlink2/libtool-fix-la
@@ -1,4 +1,4 @@
-# $NetBSD: libtool-fix-la,v 1.21 2003/08/31 08:56:39 jlam Exp $
+# $NetBSD: libtool-fix-la,v 1.22 2003/09/02 06:59:51 jlam Exp $
#
# For *.la files, in the "relink_command" line, we make the following
# replacements:
diff --git a/mk/buildlink2/libtool.sh b/mk/buildlink2/libtool.sh
index ff2f247c30d..d58f364e2b9 100644
--- a/mk/buildlink2/libtool.sh
+++ b/mk/buildlink2/libtool.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.9 2003/08/16 06:59:54 jlam Exp $
+# $NetBSD: libtool.sh,v 1.10 2003/09/02 06:59:51 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
diff --git a/mk/buildlink2/wrapper.sh b/mk/buildlink2/wrapper.sh
index bb4d78ae4e7..8368ee7c705 100644
--- a/mk/buildlink2/wrapper.sh
+++ b/mk/buildlink2/wrapper.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: wrapper.sh,v 1.8 2003/08/16 06:59:55 jlam Exp $
+# $NetBSD: wrapper.sh,v 1.9 2003/09/02 06:59:52 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
diff --git a/mk/buildlink3/README b/mk/buildlink3/README
new file mode 100644
index 00000000000..9e6fe705924
--- /dev/null
+++ b/mk/buildlink3/README
@@ -0,0 +1,159 @@
+$NetBSD: README,v 1.2 2003/09/02 06:59:52 jlam Exp $
+
+ 0 Package Views
+ ===============
+
+Package views is a pkgsrc technology that supports building and
+installing multiple versions of the same software such that they
+co-exist on a single system. Individual packages are installed into
+their own directory tree and their files are symlinked into "views".
+Users can choose amongst different software collections provided by
+different views by appropriately setting shell environment variables,
+e.g., PATH, MANPATH, etc.
+
+Package views is similar in spirit to the Encap Package Management
+System (http://www.encap.org/) and to the Carnegie Mellon University
+Depot software management system.
+
+
+ 0.1 A short history of package views
+ ====================================
+
+Package views was proposed as a solution to the problem of not being
+able to install multiple versions of the same software simultaneously
+via pkgsrc. Alistair Crooks presented a paper on package views at
+EuroBSDCon in November 2002 that described the work he did on the
+"pkgviews" branch of pkgsrc where he implemented his ideas. The paper
+is highly-recommended reading for a more complete understanding of
+package views principles and is available at:
+
+ http://www.NetBSD.org/Documentation/software/pkgviews.pdf
+
+Unfortunately, Alistair ran out of time to devote to integrating his
+work into the main pkgsrc branch. The code he developed languished on
+the "pkgviews" branch for over a year, and in the meantime much code
+was added to pkgsrc that increased the complexity and the capabilities
+of pkgsrc, including buildlink2, which conflicted with Alistair's
+implementation of package views. In July 2003, Johnny Lam attempted
+to integrate the functionality on the pkgviews branch into modern
+pkgsrc. As part of the integration, a new buildlink3 framework was
+created so that the the ability to isolate builds from differences in
+the environment wouldn't be lost.
+
+
+ 0.2 Package views terminology
+ =============================
+
+The terminology for packages in the package views world is as
+follows: a "pkgviews" package is a package that has been converted to
+build and install using package views. An "overwrite" package is one
+that hasn't. A "depoted" package describes a pkgviews package
+installed into /usr/pkg/packages in its "depot" directory. A package
+"instance" in a view describes a depoted package symlinked into a
+view.
+
+
+ 0.3 What's been done
+ ====================
+
+The pkg_install tools have been enhanced to handle both binary depoted
+packages and binary "overwrite" packages. The pkgsrc internals have
+been modified to allow building and installing depoted packages and to
+automatically add a depoted package in the the default view.
+"Overwrite" packages shouldn't be affected by the changes, and can be
+freely mixed with pkgviews packages.
+
+Packages that have been converted to use "pkgviews" should add the
+following line to their Makefiles:
+
+ PKG_INSTALLATION_TYPES= overwrite pkgviews
+
+PKG_INSTALLATION_TYPES can also just be one value or the other to
+explicitly note that the package only supports that one type of
+installation style. Users may add the following line to /etc/mk.conf:
+
+ PKG_INSTALLATION_PREFS= pkgviews overwrite
+
+to note that they prefer building using pkgviews if the package
+supports it, otherwise to build using the "overwrite" installation
+style. However, users should not change PKG_INSTALLATION_PREFS from
+the default value unless they're sure that they want to start
+migrating their package system over to using pkgviews. The default,
+"overwrite pkgviews", will cause all packages to build using the
+"overwrite" installation style.
+
+Some highlight of pkgviews packages include:
+
+ * fully dynamic PLISTs
+ * multiple version of the same package can co-exist
+
+
+ 0.4 buildlink3 pkgsrc build framework
+ =====================================
+
+A new buildlink3 framework that takes advantage of depoted packages
+has been added to pkgsrc as part of the package views changes.
+Buildlink3 uses wrapper scripts much like buildlink2. However, when
+building pkgviews packages, it doesn't symlink files into
+${BUILDLINK_DIR} since it can safely refer to only a specific
+package's files by passing the appropriate -I<dir> and -L<dir> flags
+to the compiler, where <dir> points to a location in the package's
+depot directory. When building "overwrite" packages, buildlink3 will
+act and feel very much like buildlink2 but with more advanced wrapper
+scripts, and there are provisions for allowing an "overwrite" package
+to build against the viewed instance of a depoted package. The
+implementation currently allows "overwrite" to depend on either
+"overwrite" or pkgviews packages, but pkgviews packages are restricted
+to only being able to depend on other pkgviews packages.
+
+Packages that have been converted to use buildlink3 should add the
+following line to their Makefiles:
+
+ USE_BUILDLINK3= YES
+
+A package must be converted to use the buildlink3 framework before it
+can support the pkgviews installation style.
+
+
+ 0.5 Package conversion issues
+ =============================
+
+The conversion process for a package to use buildlink3 and pkgviews
+essentially consists of changing USE_BUILDLINK2 to USE_BUILDLINK3,
+including buildlink3.mk files instead of buildlink2.mk files, and
+adding the PKG_INSTALLATION_TYPES line to the package Makefile. It's
+extremely easy and painless.
+
+Since the idea is that the user can choose to install a package using
+either installation style, the package Makefiles have to explicitly
+support this. This means that "hard" packages just got harder to
+maintain, but easy packages stay about the same. In this case, "hard"
+packages are the ones that have module packages, e.g. PHP4, perl5,
+Apache, Cyrus-SASL, etc. A package of this type must support finding
+shared modules or configuration files in directories shared with all
+of its module packages, thus requiring some hard-coding of paths
+across different packages.
+
+
+ 0.6 Future Work
+ ===============
+
+There may be some way around the problem of pkgviews packages not
+being able to depend on "overwrite" packages. That's the only thing
+standing in the way between allowing an arbitrary package to be built
+using either installation style and working seamlessly with any other
+package. The problem has to do with proper handling of metadata in
+the +REQUIRED_BY and +CONTENTS files that are split in two separate
+places. One possible route to a solution is that for each overwrite
+package, we can symlink /usr/pkg/packages/<pkg> -> /var/db/pkg/<pkg>.
+This allows depoted packages to record themselves directly in the
++REQUIRED_BY files of "overwrite" packages. If a user happens to run
+
+ pkg_delete -K /usr/pkg/packages <overwrite_pkg>
+
+then it still uses the correct +CONTENTS, +INSTALL, and +DEINSTALL
+scripts, so the package will still remove itself properly from
+/usr/pkg. However, there are some remaining issues with properly
+removing both the /var/db/pkg/<pkg> directory and the
+/usr/pkg/packages/<pkg> symlink, so the deletion won't be completely
+clean until this issue can be resolved.
diff --git a/mk/buildlink3/TODO b/mk/buildlink3/TODO
new file mode 100644
index 00000000000..c613311c298
--- /dev/null
+++ b/mk/buildlink3/TODO
@@ -0,0 +1,43 @@
+$NetBSD: TODO,v 1.2 2003/09/02 06:59:53 jlam Exp $
+
+Package views integration plan:
+==============================
+
+(1) Modify pkgsrc internals (bsd.pkg.mk & friends) to build and
+ install depoted packages if PKG_INSTALLATION_TYPE is set to
+ "pkgviews" in the package Makefile, and to add the depoted
+ package to the default view. The depoted package will include
+ all of it's metadata files in the depot directory, and we rely
+ on pkg_view to copy the metadata files into /var/db/pkg as
+ part of adding the package to the default view. We only
+ support the default view. Depoted packages will install into
+ ${LOCALBASE}/packages and the default view will be through
+ ${LOCALBASE} for all packages.
+
+Using this infrastructure, depoted packages that have been added to
+the default view should look and feel like a non-depoted package in
+all respects, down to what you find in /var/db/pkg/${PKGNAME}, so
+non-depoted packages can depend on depoted packages without change.
+
+(2) Migrate non-USE_X11BASE and non-USE_IMAKE packages to set
+ PKG_INSTALLATION_TYPE to "pkgviews". Depoted packages can only
+ depend on other depoted packages. A depoted package will have
+ <deppkg_dir>/lib and ${LOCALBASE}/lib in the run-time library
+ search path (-Wl,-R*) so that wildcard dependencies on library
+ packages will still work (so long as the major number of the shlib
+ hasn't increased).
+
+At this point, all packages in pkgsrc except for those that define
+USE_X11BASE or USE_IMAKE will be depoted.
+
+(3) Make xpkgwedge the default for pkgsrc. It would be nice to
+ enhance xpkgwedge in some way so that a package could be compiled
+ with the correct defaults for finding app-defaults files without
+ having the user fiddle with environment variables.
+
+This is a flag day change and will require bumping the PKGREVISIONs
+for every single USE_X11BASE and USE_IMAKE package and all packages
+that depend on them.
+
+(4) Migrate the USE_X11BASE and USE_IMAKE packages to set
+ PKG_INSTALLATION_TYPE to "pkgviews".
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
new file mode 100644
index 00000000000..c5f4fea88c0
--- /dev/null
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -0,0 +1,1285 @@
+# $NetBSD: bsd.buildlink3.mk,v 1.2 2003/09/02 06:59:53 jlam Exp $
+#
+# An example package buildlink3.mk file:
+#
+# -------------8<-------------8<-------------8<-------------8<-------------
+# .if !defined(FOO_BUILDLINK3_MK)
+# FOO_BUILDLINK3_MK= # defined
+# BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ # push
+#
+# .if !empty(BUILDLINK_DEPTH:M\+)
+# BUILDLINK_DEPENDS+= foo
+# .endif
+#
+# BUILDLINK_PACKAGES+= foo
+# BUILDLINK_DEPENDS.foo?= foo-lib>=1.0
+# BUILDLINK_PKGSRCDIR.foo?= ../../category/foo-lib
+#
+# # We want "-lbar" to eventually resolve to "-lfoo".
+# BUILDLINK_TRANSFORM+= l:bar:foo
+#
+# .include "../../category/baz/buildlink3.mk"
+#
+# BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/\+$//} # pop
+# .endif # FOO_BUILDLINK3_MK
+# -------------8<-------------8<-------------8<-------------8<-------------
+#
+# The different variables that may be set in a buildlink2.mk file are
+# described below.
+#
+# The variable name convention used in this Makefile are:
+#
+# BUILDLINK_* public buildlink-related variables usable in other Makefiles
+# _BLNK_* private buildlink-related variables to this Makefile
+
+ECHO_BUILDLINK_MSG?= ${TRUE}
+BUILDLINK_DIR= ${WRKDIR}/.buildlink
+BUILDLINK_X11_DIR= ${BUILDLINK_DIR:H}/.x11-buildlink
+BUILDLINK_SHELL?= ${SH}
+BUILDLINK_OPSYS?= ${OPSYS}
+
+# Prepend ${BUILDLINK_DIR}/bin to the PATH so that the wrappers are found
+# first when searching for executables.
+#
+.if defined(_OPSYS_DEFAULT_PATH)
+PATH:= ${BUILDLINK_DIR}/bin:${_OPSYS_DEFAULT_PATH}
+.else
+PATH:= ${BUILDLINK_DIR}/bin:${PATH}
+.endif
+
+# BUILDLINK_DEPENDS contains the list of packages for which we add
+# dependencies.
+#
+BUILDLINK_DEPENDS?= ${BUILDLINK_PACKAGES}
+
+X11_LINKS_SUBDIR= share/x11-links
+.if defined(USE_X11)
+USE_X11_LINKS?= YES
+. if empty(USE_X11_LINKS:M[nN][oO])
+BUILDLINK_DEPENDS+= x11-links
+_BLNK_X11_LINKS_PACKAGE= x11-links
+. else
+_BLNK_X11_LINKS_PACKAGE= # empty
+. endif
+BUILDLINK_DEPENDS.x11-links= x11-links>=0.12
+BUILDLINK_DEPMETHOD.x11-links= build
+BUILDLINK_PKGSRCDIR.x11-links= ../../pkgtools/x11-links
+_BLNK_X11_LINKS_DIR= ${BUILDLINK_PREFIX.x11-links}/${X11_LINKS_SUBDIR}
+.else
+_BLNK_X11_LINKS_PACKAGE= # empty
+.endif
+
+.for _pkg_ in ${BUILDLINK_DEPENDS}
+#
+# Add the proper dependency on each package pulled in by buildlink3.mk
+# files. BUILDLINK_DEPMETHOD.<pkg> contains a list of either "full" or
+# "build", and if any of that list if "full" then we use a full dependency
+# on <pkg>, otherwise we use a build dependency on <pkg>. By default,
+# we use a full dependency.
+#
+. if !defined(BUILDLINK_DEPMETHOD.${_pkg_})
+BUILDLINK_DEPMETHOD.${_pkg_}= full
+. endif
+. if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
+_BLNK_DEPMETHOD.${_pkg_}= DEPENDS
+. elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
+_BLNK_DEPMETHOD.${_pkg_}= BUILD_DEPENDS
+. endif
+. if defined(BUILDLINK_DEPENDS.${_pkg_}) && \
+ defined(BUILDLINK_PKGSRCDIR.${_pkg_})
+. for _depends_ in ${BUILDLINK_DEPENDS.${_pkg_}}
+${_BLNK_DEPMETHOD.${_pkg_}}+= \
+ ${_depends_}:${BUILDLINK_PKGSRCDIR.${_pkg_}}
+. endfor
+. endif
+.endfor
+
+# Generate default values for:
+#
+# BUILDLINK_PKG_DBDIR.<pkg> contains all of the package metadata
+# files for <pkg>
+#
+# BUILDLINK_PKGNAME.<pkg> the name of the package
+#
+# BUILDLINK_PREFIX.<pkg> contains all of the installed files
+# for <pkg>
+#
+# BUILDLINK_IS_DEPOT.<pkg> "yes" or "no" for whether <pkg> is a
+# depoted package.
+#
+# BUILDLINK_CPPFLAGS.<pkg>,
+# BUILDLINK_LDFLAGS.<pkg> contain extra -D..., -I... and -L.../-Wl,-R
+# options to be passed to the compiler/linker
+# so that building against <pkg> will work.
+#
+# BUILDLINK_INCDIRS.<pkg>,
+# BUILDLINK_LIBDIRS.<pkg> subdirectories of BUILDLINK_PREFIX.<pkg>
+# that should be added to the
+# compiler/linker search paths; these
+# directories are checked to see if they
+# exist before they're added to the search
+# paths.
+#
+.for _pkg_ in ${BUILDLINK_PACKAGES} ${_BLNK_X11_LINKS_PACKAGE}
+. if !defined(BUILDLINK_PKG_DBDIR.${_pkg_})
+BUILDLINK_PKG_DBDIR.${_pkg_}!= \
+ cd ${_PKG_DBDIR}; \
+ dir=`${PKG_ADMIN} -s "" lsbest "${BUILDLINK_DEPENDS.${_pkg_}}" || ${TRUE}`; \
+ case "$$dir" in \
+ "") dir="not_found" ;; \
+ esac; \
+ ${ECHO} $$dir
+. if empty(BUILDLINK_PKG_DBDIR.${_pkg_}:Mnot_found)
+MAKEFLAGS+= BUILDLINK_PKG_DBDIR.${_pkg_}=${BUILDLINK_PKG_DBDIR.${_pkg_}}
+. endif
+. endif
+BUILDLINK_PKGNAME.${_pkg_}?= ${BUILDLINK_PKG_DBDIR.${_pkg_}:T}
+. if !defined(BUILDLINK_PREFIX.${_pkg_})
+. if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+BUILDLINK_PREFIX.${_pkg_}?= ${BUILDLINK_PKG_DBDIR.${_pkg_}}
+. elif ${PKG_INSTALLATION_TYPE} == "overwrite"
+. if empty(BUILDLINK_PKG_DBDIR.${_pkg_}:Mnot_found)
+BUILDLINK_PREFIX.${_pkg_}!= \
+ ${PKG_INFO} -qp ${BUILDLINK_PKGNAME.${_pkg_}} | ${SED} -e "s,^[^/]*,,"
+. else
+BUILDLINK_PREFIX.${_pkg_}?= not_found
+. endif
+. endif
+. if empty(BUILDLINK_PREFIX.${_pkg_}:Mnot_found)
+MAKEFLAGS+= BUILDLINK_PREFIX.${_pkg_}=${BUILDLINK_PREFIX.${_pkg_}}
+. endif
+. endif
+. if exists(${BUILDLINK_PKG_DBDIR.${_pkg_}}/+VIEWS)
+BUILDLINK_IS_DEPOT.${_pkg_}?= yes
+. else
+BUILDLINK_IS_DEPOT.${_pkg_}?= no
+. endif
+BUILDLINK_CPPFLAGS.${_pkg_}?= # empty
+BUILDLINK_LDFLAGS.${_pkg_}?= # empty
+BUILDLINK_INCDIRS.${_pkg_}?= include
+BUILDLINK_LIBDIRS.${_pkg_}?= lib
+.endfor
+
+# BUILDLINK_CPPFLAGS and BUILDLINK_LDFLAGS contain the proper -I...
+# and -L.../-Wl,-R... options to be passed to the compiler and linker
+# to find the headers and libraries for the various packages at
+# configure/build time.
+#
+BUILDLINK_CPPFLAGS= # empty
+BUILDLINK_LDFLAGS= # empty
+
+.for _pkg_ in ${BUILDLINK_PACKAGES}
+. for _flag_ in ${BUILDLINK_CPPFLAGS.${_pkg_}}
+. if empty(BUILDLINK_CPPFLAGS:M${_flag_})
+BUILDLINK_CPPFLAGS+= ${_flag_}
+. endif
+. endfor
+. for _flag_ in ${BUILDLINK_LDFLAGS.${_pkg_}}
+. if empty(BUILDLINK_LDFLAGS:M${_flag_})
+BUILDLINK_LDFLAGS+= ${_flag_}
+. endif
+. endfor
+. if !empty(BUILDLINK_INCDIRS.${_pkg_})
+. for _dir_ in ${BUILDLINK_INCDIRS.${_pkg_}:S/^/${BUILDLINK_PREFIX.${_pkg_}}\//}
+. if exists(${_dir_})
+. if empty(BUILDLINK_CPPFLAGS:M-I${_dir_})
+BUILDLINK_CPPFLAGS+= -I${_dir_}
+. endif
+. endif
+. endfor
+. endif
+. if !empty(BUILDLINK_LIBDIRS.${_pkg_})
+. for _dir_ in ${BUILDLINK_LIBDIRS.${_pkg_}:S/^/${BUILDLINK_PREFIX.${_pkg_}}\//}
+. if exists(${_dir_})
+. if empty(BUILDLINK_LDFLAGS:M-L${_dir_})
+BUILDLINK_LDFLAGS+= -L${_dir_}
+. endif
+. if (${_USE_RPATH} == "yes") && \
+ empty(BUILDLINK_LDFLAGS:M${_COMPILER_LD_FLAG}${RPATH_FLAG}${_dir_})
+BUILDLINK_LDFLAGS+= ${_COMPILER_LD_FLAG}${RPATH_FLAG}${_dir_}
+. endif
+. endif
+. endfor
+. endif
+.endfor
+#
+# Add the default view library directory to the runtime library search
+# path so that wildcard dependencies on library packages can always be
+# fulfilled through the default view.
+#
+.if (${_USE_RPATH} == "yes") && \
+ empty(BUILDLINK_LDFLAGS:M${_COMPILER_LD_FLAG}${RPATH_FLAG}${LOCALBASE}/lib)
+BUILDLINK_LDFLAGS+= ${_COMPILER_LD_FLAG}${RPATH_FLAG}${LOCALBASE}/lib
+.endif
+#
+# Add the X11 library directory to the runtime library search path if
+# the package uses X11.
+#
+.if defined(USE_X11) && \
+ (${_USE_RPATH} == "yes") && \
+ empty(BUILDLINK_LDFLAGS:M${_COMPILER_LD_FLAG}${RPATH_FLAG}${X11BASE}/lib)
+BUILDLINK_LDFLAGS+= ${_COMPILER_LD_FLAG}${RPATH_FLAG}${X11BASE}/lib
+.endif
+
+.for _flag_ in ${BUILDLINK_CPPFLAGS}
+. if empty(CFLAGS:M${_flag_})
+CFLAGS+= ${_flag_}
+. endif
+. if empty(CXXFLAGS:M${_flag_})
+CXXFLAGS+= ${_flag_}
+. endif
+. if empty(CPPFLAGS:M${_flag_})
+CPPFLAGS+= ${_flag_}
+. endif
+.endfor
+.for _flag_ in ${BUILDLINK_LDFLAGS}
+. if empty(LDFLAGS:M${_flag_})
+LDFLAGS+= ${_flag_}
+. endif
+.endfor
+
+# Create the buildlink include and lib directories so that the Darwin
+# compiler/linker won't complain verbosely (on stdout, even!) when
+# those directories are passed as sub-arguments of -I and -L.
+#
+.PHONY: buildlink-directories
+do-buildlink: buildlink-directories
+buildlink-directories:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${BUILDLINK_DIR}
+.if defined(USE_X11)
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${BUILDLINK_X11_DIR}
+ ${_PKG_SILENT}${_PKG_DEBUG}${LN} -sf ${BUILDLINK_DIR} ${BUILDLINK_X11_DIR}
+. if empty(USE_X11_LINKS:M[nN][oO])
+. if exists(${_BLNK_X11_LINKS_DIR})
+ ${_PKG_SILENT}${_PKG_DEBUG}${CP} -R ${_BLNK_X11_LINKS_DIR}/* ${BUILDLINK_X11_DIR}
+. else
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} "x11-links doesn't seem to be installed."
+ ${_PKG_SILENT}${_PKG_DEBUG}${FALSE}
+. endif
+. endif
+.endif
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${BUILDLINK_DIR}/include
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${BUILDLINK_DIR}/lib
+
+# Create the buildlink wrappers before any of the other buildlink targets
+# are run, as the wrappers may need to be used in some of those targets.
+#
+do-buildlink: buildlink-wrappers buildlink-${_BLNK_OPSYS}-wrappers
+
+# The following variables are all optionally defined and control which
+# package files are symlinked into ${BUILDLINK_DIR} and how their names
+# are transformed during the symlinking:
+#
+# BUILDLINK_FILES.<pkg>
+# shell glob pattern relative to ${BUILDLINK_PREFIX.<pkg>} to be
+# symlinked into ${BUILDLINK_DIR}, e.g. include/*.h
+#
+# BUILDLINK_FILES_CMD.<pkg>
+# shell pipeline that outputs to stdout a list of files relative
+# to ${BUILDLINK_PREFIX.<pkg>}; the shell variable $${pkg_prefix}
+# may be used and is the subdirectory (ending in /) of
+# ${BUILDLINK_PREFIX.<pkg>} to which the +CONTENTS is relative,
+# e.g. if `pkg_info -qp kaffe' returns "/usr/pkg/java/kaffe",
+# then $${pkg_prefix} is "java/kaffe/". The resulting files are
+# to be symlinked into ${BUILDLINK_DIR}. By default for
+# overwrite packages, BUILDLINK_FILES_CMD.<pkg> outputs the
+# contents of the include and lib directories in the package
+# +CONTENTS.
+#
+# BUILDLINK_TRANSFORM.<pkg>
+# sed arguments used to transform the name of the source filename
+# into a destination filename, e.g. -e "s|/curses.h|/ncurses.h|g"
+#
+.for _pkg_ in ${BUILDLINK_PACKAGES}
+_BLNK_COOKIE.${_pkg_}= ${BUILDLINK_DIR}/.buildlink_${_pkg_}_done
+
+BUILDLINK_TARGETS+= buildlink-${_pkg_}
+_BLNK_TARGETS.${_pkg_}= buildlink-${_pkg_}-message
+_BLNK_TARGETS.${_pkg_}+= ${_BLNK_COOKIE.${_pkg_}}
+_BLNK_TARGETS.${_pkg_}+= buildlink-${_pkg_}-cookie
+
+.ORDER: ${_BLNK_TARGETS.${_pkg_}}
+
+.PHONY: buildlink-${_pkg_}
+buildlink-${_pkg_}: ${_BLNK_TARGETS.${_pkg_}}
+
+.PHONY: buildlink-${_pkg_}-message
+buildlink-${_pkg_}-message:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO_BUILDLINK_MSG} "=> Linking ${_pkg_} files into ${BUILDLINK_DIR}."
+
+.PHONY: buildlink-${_pkg_}-cookie
+buildlink-${_pkg_}-cookie:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${TOUCH} ${TOUCH_FLAGS} ${_BLNK_COOKIE.${_pkg_}}
+
+.if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+BUILDLINK_FILES_CMD.${_pkg_}?= ${TRUE}
+.else
+BUILDLINK_FILES_CMD.${_pkg_}?= \
+ ${PKG_INFO} -f ${BUILDLINK_PKGNAME.${_pkg_}} | \
+ ${SED} -n '/File:/s/^[ ]*File:[ ]*//p' | \
+ ${GREP} '\(include.*/\|lib.*/lib[^/]*$$\)' | \
+ ${SED} "s,^,$${pkg_prefix},"
+.endif
+
+${_BLNK_COOKIE.${_pkg_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ case ${BUILDLINK_PREFIX.${_pkg_}} in \
+ ${X11BASE}) buildlink_dir="${BUILDLINK_X11_DIR}" ;; \
+ *) buildlink_dir="${BUILDLINK_DIR}" ;; \
+ esac; \
+ cd ${BUILDLINK_PREFIX.${_pkg_}}; \
+ pkg_prefix=` \
+ ${PKG_INFO} -qp ${BUILDLINK_PKGNAME.${_pkg_}} | \
+ ${SED} -e "s,^[^/]*,," \
+ -e "s,^${BUILDLINK_PREFIX.${_pkg_}},," \
+ -e "s,^/,," \
+ `; \
+ case "$$pkg_prefix" in \
+ "") ;; \
+ *) pkg_prefix="$${pkg_prefix}/" ;; \
+ esac; \
+ files=`${BUILDLINK_FILES_CMD.${_pkg_}}`; \
+ files="$$files ${BUILDLINK_FILES.${_pkg_}}"; \
+ case "$$files" in \
+ "") ;; \
+ *) for file in $$files; do \
+ src="${BUILDLINK_PREFIX.${_pkg_}}/$$file"; \
+ if [ ! -f $$src ]; then \
+ ${ECHO} "$${file}: not found" >> ${.TARGET}; \
+ continue; \
+ fi; \
+ if [ -z "${BUILDLINK_TRANSFORM.${_pkg_}}" ]; then \
+ dest="$$buildlink_dir/$$file"; \
+ msg="$$src"; \
+ else \
+ dest=`${ECHO} $$dest | ${SED} ${BUILDLINK_TRANSFORM.${_pkg_}}`; \
+ msg="$$src -> $$dest"; \
+ fi; \
+ dir=`${DIRNAME} $$dest`; \
+ if [ ! -d $$dir ]; then \
+ ${MKDIR} $$dir; \
+ fi; \
+ ${RM} -f $$dest; \
+ case $$src in \
+ *.la) \
+ ${CAT} $$src | \
+ ${_BLNK_LT_ARCHIVE_FILTER} \
+ > $$dest; \
+ ;; \
+ *) \
+ ${LN} -sf $$src $$dest; \
+ ;; \
+ esac; \
+ ${ECHO} "$$msg" >> ${.TARGET}; \
+ done; \
+ ;; \
+ esac
+.endfor
+
+# _BLNK_LT_ARCHIVE_FILTER is a command-line filter for transforming
+# libtool archives (*.la) to allow libtool to properly interact with
+# buildlink at link time by linking against the libraries pointed to by
+# symlinks in ${BUILDLINK_DIR}. It achieves this in two ways:
+#
+# - Modifies the dependency_libs line by changing all full paths to
+# other *.la files into the canonical ${BUILDLINK_DIR} path.
+#
+# - Modifies the libdir line to point to within ${BUILDLINK_DIR}.
+# This prevents libtool from looking into the original directory
+# for other *.la files.
+#
+_BLNK_LT_ARCHIVE_FILTER= \
+ ${AWK} ' \
+ /^dependency_libs=/ { \
+ line = $$0; \
+ line = gensub("/usr(/lib/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${X11BASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
+ line = gensub("${LOCALBASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ print line; \
+ next; \
+ } \
+ /^libdir=/ { \
+ line = $$0; \
+ line = gensub("/usr(/lib/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${X11BASE}(/[^ ]*)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
+ line = gensub("${LOCALBASE}(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ print line; \
+ next; \
+ } \
+ { print } \
+ '
+
+# Add each of the targets in BUILDLINK_TARGETS as a prerequisite for the
+# do-buildlink target. This ensures that all the buildlink magic happens
+# before any configure or build commands are called.
+#
+.for _target_ in ${BUILDLINK_TARGETS}
+do-buildlink: ${_target_}
+.endfor
+
+# The configure process usually tests for outlandish or missing things
+# that we don't want polluting the argument cache.
+#
+CONFIGURE_ENV+= BUILDLINK_UPDATE_CACHE=no
+
+# The caching code, which greatly speeds up the build process, works only
+# on certain platforms.
+#
+_BLNK_CACHE_ALL= # empty
+_BLNK_CACHE_ALL+= Darwin-6*-*
+_BLNK_CACHE_ALL+= IRIX-*-*
+_BLNK_CACHE_ALL+= NetBSD-1.[5-9]*-*
+_BLNK_CACHE_ALL+= SunOS-[25].[89]-*
+
+# There are three different parts we can add to the common transforming
+# cache to speed things up:
+#
+# passthru automatically accept certain options without
+# further checking
+#
+# transform change -[IL]{${X11BASE},${LOCALBASE},${DEPOTBASE}/*}
+# to the correct ${BUILDLINK_DIR} reference
+#
+# block block certain options without further checking
+#
+# Seeding the cache appropriately lets us handle large classes of options
+# without having to go through the wrapper logic file, which generates
+# a cache hit for every single option and bloats the cache quite bit more.
+#
+_BLNK_SEED_CACHE?= passthru # transform block
+
+.for _pattern_ in ${_BLNK_CACHE_ALL}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+CONFIGURE_ENV+= BUILDLINK_CACHE_ALL=yes
+MAKE_ENV+= BUILDLINK_CACHE_ALL=yes
+. endif
+.endfor
+
+# _BLNK_ALLOWED_RPATHDIRS contains the list of directories for which we
+# allow adding to the runtime library search path. Package makefiles may
+# add to its value through ${BUILDLINK_RPATHDIRS}.
+#
+_BLNK_ALLOWED_RPATHDIRS= # empty
+#
+# Add all of the depot directories for packages whose headers and
+# libraries we use.
+#
+.for _pkg_ in ${BUILDLINK_PACKAGES}
+. if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+_BLNK_ALLOWED_RPATHDIRS+= ${BUILDLINK_PREFIX.${_pkg_}}
+. endif
+.endfor
+#
+# Add the depot directory for the package we're building.
+#
+.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
+_BLNK_ALLOWED_RPATHDIRS+= ${PREFIX}
+.endif
+#
+# Always add ${LOCALBASE}/lib to the runtime library search path so that
+# wildcard dependencies work correctly when installing from binary
+# packages.
+#
+_BLNK_ALLOWED_RPATHDIRS+= ${LOCALBASE}/lib
+#
+# Add ${X11BASE}/lib to the runtime library search path for USE_X11
+# packages so that X11 libraries can be found.
+#
+.if defined(USE_X11)
+_BLNK_ALLOWED_RPATHDIRS+= ${X11BASE}/lib
+.endif
+#
+# Allow manually adding other directories to the runtime library search
+# path, e.g. ${LOCALBASE}/qt3/lib.
+#
+.if defined(BUILDLINK_RPATHDIRS)
+. for _dir_ in ${BUILDLINK_RPATHDIRS}
+_BLNK_ALLOWED_RPATHDIRS+= ${_dir_}
+. endfor
+.endif
+
+_BLNK_MANGLE_DIRS= # empty
+_BLNK_MANGLE_DIRS+= ${BUILDLINK_DIR}
+_BLNK_MANGLE_DIRS+= ${BUILDLINK_X11_DIR}
+_BLNK_MANGLE_DIRS+= ${WRKDIR}
+_BLNK_MANGLE_DIRS+= ${_BLNK_ALLOWED_RPATHDIRS}
+
+# We only want these for the untransform case, so don't add these
+# directories to _BLNK_{,UN}PROTECT_DIRS below.
+#
+_BLNK_MANGLE_DIRS+= ${PREFIX}
+_BLNK_MANGLE_DIRS+= ${X11BASE}
+
+_BLNK_MANGLE_START= _bUiLdLiNk_
+_BLNK_MANGLE_END= \#
+.for _dir_ in ${_BLNK_MANGLE_DIRS}
+_BLNK_MANGLE_DIR.${_dir_}= \
+ ${_BLNK_MANGLE_START}${_dir_:S/\//_/g}${_BLNK_MANGLE_END}
+.endfor
+_BLNK_MANGLE_SED_PATTERN= \
+ ${_BLNK_MANGLE_START}[^/ ${_BLNK_MANGLE_END}]*${_BLNK_MANGLE_END}
+
+_BLNK_PROTECT_DIRS= # empty
+_BLNK_UNPROTECT_DIRS= # empty
+_BLNK_PROTECT= # empty
+_BLNK_UNPROTECT= # empty
+
+_BLNK_PROTECT_DIRS+= ${BUILDLINK_DIR}
+_BLNK_PROTECT_DIRS+= ${BUILDLINK_X11_DIR}
+_BLNK_PROTECT_DIRS+= ${WRKDIR}
+.for _pkg_ in ${BUILDLINK_PACKAGES}
+. if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+_BLNK_PROTECT_DIRS+= ${BUILDLINK_PREFIX.${_pkg_}}
+_BLNK_UNPROTECT_DIRS+= ${BUILDLINK_PREFIX.${_pkg_}}
+. endif
+.endfor
+_BLNK_UNPROTECT_DIRS+= ${WRKDIR}
+_BLNK_UNPROTECT_DIRS+= ${BUILDLINK_X11_DIR}
+_BLNK_UNPROTECT_DIRS+= ${BUILDLINK_DIR}
+
+# Protect work directories and the dependency directories from all the
+# transformations we're about to do.
+#
+.for _dir_ in ${_BLNK_PROTECT_DIRS}
+_BLNK_TRANSFORM+= mangle:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
+.endfor
+#
+# Protect ${PREFIX} and ${X11BASE} from change when untransforming, e.g.
+# when unbuildlinkifying files.
+#
+.for _dir_ in ${PREFIX} ${X11BASE}
+_BLNK_TRANSFORM+= untransform:mangle:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
+.endfor
+#
+# Change references to ${DEPOTBASE}/<pkg> into ${LOCALBASE} so that
+# "overwrite" packages think headers and libraries for "pkgviews" packages
+# are just found in the default view.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+_BLNK_TRANSFORM+= depot:${DEPOTBASE}:${LOCALBASE}
+.endif
+#
+# Change any buildlink directories in runtime library search paths into
+# the canonical actual installed paths.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+_BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}:${LOCALBASE}
+.endif
+#
+# Protect some directories that we allow to be specified for the runtime
+# library search path.
+#
+.for _dir_ in ${_BLNK_ALLOWED_RPATHDIRS}
+_BLNK_TRANSFORM+= rpath:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
+.endfor
+#
+# Convert direct paths to shared libraries into "-Ldir -llib" equivalents.
+#
+_BLNK_TRANSFORM+= p:${_BLNK_MANGLE_SED_PATTERN:Q}
+_BLNK_TRANSFORM+= p:
+#
+# Convert direct paths to static libraries and libtool archives in
+# ${LOCALBASE} or ${X11BASE} into references into ${BUILDLINK_DIR}.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+. if defined(USE_X11)
+_BLNK_TRANSFORM+= P:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+. endif
+_BLNK_TRANSFORM+= P:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
+.endif
+#
+# Transform references into ${X11BASE} into ${BUILDLINK_X11_DIR}.
+#
+.if defined(USE_X11)
+_BLNK_TRANSFORM+= I:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+_BLNK_TRANSFORM+= L:${X11BASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_X11_DIR}}
+.endif
+#
+# Transform references into ${LOCALBASE} into ${BUILDLINK_DIR}.
+#
+.if ${PKG_INSTALLATION_TYPE} == "overwrite"
+_BLNK_TRANSFORM+= I:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
+_BLNK_TRANSFORM+= L:${LOCALBASE}:${_BLNK_MANGLE_DIR.${BUILDLINK_DIR}}
+.endif
+#
+# Add any package specified transformations (l:, etc.)
+#
+_BLNK_TRANSFORM+= ${BUILDLINK_TRANSFORM}
+#
+# Explicitly remove everything else that's an absolute path, since we've
+# already protected the ones we care about.
+#
+_BLNK_TRANSFORM+= r:
+#
+# Remove -Wl,-R* and *-rpath* if _USE_RPATH != "yes"
+# Transform -Wl,-R* and *-rpath* if Sun compilers are used.
+#
+.if defined(_USE_RPATH) && empty(_USE_RPATH:M[yY][eE][sS])
+_BLNK_TRANSFORM+= no-rpath
+.endif
+#
+# Undo the protection for the directories that we allow to be specified
+# for the runtime library search path.
+#
+.for _dir_ in ${_BLNK_ALLOWED_RPATHDIRS}
+_BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${_dir_}}:${_dir_}
+.endfor
+#
+# Undo the protection for ${PREFIX} and ${X11BASE} so that the directory
+# names are correct, e.g. when unbuildlinkifying files.
+#
+.for _dir_ in ${PREFIX} ${X11BASE}
+_BLNK_TRANSFORM+= untransform:mangle:${_BLNK_MANGLE_DIR.${_dir_}}:${_dir_}
+.endfor
+#
+# Undo the protection so the correct directory names are passed to the
+# the wrappee.
+#
+.for _dir_ in ${_BLNK_UNPROTECT_DIRS}
+_BLNK_TRANSFORM+= mangle:${_BLNK_MANGLE_DIR.${_dir_}}:${_dir_}
+.endfor
+
+_BLNK_TRANSFORM_SED+= -f ${_BLNK_TRANSFORM_SEDFILE}
+_BLNK_UNTRANSFORM_SED+= -f ${_BLNK_UNTRANSFORM_SEDFILE}
+
+# UNBUILDLINK_PATTERNS and UNBUILDLINK_FILES list shell globs and files
+# relative to ${WRKSRC} that need to have reference to ${BUILDLINK_DIR}
+# stripped out of them.
+#
+UNBUILDLINK_PATTERNS?= # empty
+_UNBUILDLINK_PATTERNS= ${UNBUILDLINK_PATTERNS}
+_UNBUILDLINK_PATTERNS+= *-config
+_UNBUILDLINK_PATTERNS+= *Conf.sh
+_UNBUILDLINK_PATTERNS+= *.pc
+_UNBUILDLINK_PATTERNS_FIND= \
+ \( ${_UNBUILDLINK_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \)
+UNBUILDLINK_FILES?= # empty
+_UNBUILDLINK_FILES= \
+ ${UNBUILDLINK_FILES} \
+ `${FIND} . ${_UNBUILDLINK_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${SORT} -u`
+#
+# When "unbuildlinkifying" a file, we must remove references to the
+# buildlink directories and change any -llib to the proper replacement
+# libraries (-lreadline -> -ledit, etc.). Redundant -Idir and -Ldir
+# options are removed to optimize the resulting file. Also, prefer the
+# .la files in ${LOCALBASE}/lib over the ones in ${DEPOTBASE}/*/lib when
+# creating new .la files. This makes "overwrite" packages look and feel
+# more like they would without the pkgviews integration.
+#
+UNBUILDLINK_SED?= # empty
+_UNBUILDLINK_SED= ${UNBUILDLINK_SED}
+_UNBUILDLINK_SED+= ${_BLNK_UNTRANSFORM_SED}
+
+SUBST_CLASSES+= unbuildlink
+SUBST_STAGE.unbuildlink= post-build
+SUBST_MESSAGE.unbuildlink= \
+ "Fixing buildlink references in files-to-be-installed."
+SUBST_FILES.unbuildlink= ${_UNBUILDLINK_FILES}
+SUBST_SED.unbuildlink= ${_UNBUILDLINK_SED}
+
+# Generate wrapper scripts for the compiler tools that sanitize the
+# argument list by converting references to ${LOCALBASE} and ${X11BASE}
+# into references to ${BUILDLINK_DIR} and ${BUILDLINK_X11_DIR}. These
+# wrapper scripts are to be used instead of the actual compiler tools when
+# building software.
+#
+# BUILDLINK_CC, BUILDLINK_LD, etc. are the full paths to the wrapper
+# scripts.
+#
+# ALIASES.CC, ALIASES.LD, etc. are the other names by which each wrapper
+# may be invoked.
+#
+_BLNK_WRAPPEES= AS CC CXX CPP LD
+.if defined(USE_FORTRAN)
+_BLNK_WRAPPEES+= FC
+.endif
+.if defined(USE_LIBTOOL)
+PKGLIBTOOL= ${BUILDLINK_LIBTOOL}
+PKGSHLIBTOOL= ${BUILDLINK_SHLIBTOOL}
+.endif
+_BLNK_WRAPPEES+= LIBTOOL SHLIBTOOL
+.if defined(USE_X11)
+IMAKE?= ${X11BASE}/bin/imake
+_BLNK_WRAPPEES+= IMAKE
+.endif
+_ALIASES.AS= as
+_ALIASES.CC= cc gcc
+_ALIASES.CXX= c++ g++ CC
+_ALIASES.CPP= cpp
+_ALIASES.FC= f77 g77
+_ALIASES.LD= ld
+
+# _BLNK_WRAP_*.<wrappee> variables represent "template methods" of the
+# wrapper script that may be customized per wrapper:
+#
+# _BLNK_WRAP_SETENV.<wrappee> resets the value of CC, CPP, etc. in the
+# configure and make environments (CONFIGURE_ENV, MAKE_ENV) so that
+# they point to the wrappers.
+#
+# _BLNK_WRAP_{*CACHE*,*LOGIC*}.<wrappee> are parts of the wrapper script
+# system as described in pkgsrc/mk/buildlink3/README. The files not
+# ending in "-trans" represent pieces of the wrapper script that may
+# be used to form a wrapper that doesn't translate its arguments,
+# and conversely for the files ending in "-trans". By default, all
+# wrappers use the "-trans" scripts.
+#
+# _BLNK_WRAP_ENV.<wrappee> consists of shell commands to export a shell
+# environment for the wrappee.
+#
+# _BLNK_WRAP_SANITIZE_PATH.<wrappee> sets the PATH for calling executables
+# from within the wrapper. By default, it removes the buildlink
+# directory from the PATH so that sub-invocations of compiler tools
+# will use the wrappees instead of the wrappers.
+#
+_BLNK_SANITIZED_PATH!= ${ECHO} ${PATH} | ${SED} \
+ -e "s|:${BUILDLINK_DIR}[^:]*||" -e "s|${BUILDLINK_DIR}[^:]*:||"
+_BLNK_WRAP_SANITIZE_PATH= PATH="${_BLNK_SANITIZED_PATH}"
+_BLNK_EMPTY_FILE?= ${BUILDLINK_DIR}/bin/.empty
+_BLNK_WRAP_ENV?= ${BUILDLINK_WRAPPER_ENV}
+_BLNK_WRAP_MARSHALL= ${BUILDLINK_DIR}/bin/.marshall
+_BLNK_WRAP_PRE_CACHE= ${BUILDLINK_DIR}/bin/.pre-cache
+_BLNK_WRAP_CACHE_ADD= ${BUILDLINK_DIR}/bin/.cache-add
+_BLNK_WRAP_CACHE= ${BUILDLINK_DIR}/bin/.cache
+_BLNK_WRAP_CACHE_ADD_TRANSFORM= ${BUILDLINK_DIR}/bin/.cache-add-trans
+_BLNK_WRAP_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.cache-trans
+_BLNK_WRAP_POST_CACHE= ${BUILDLINK_DIR}/bin/.post-cache
+_BLNK_WRAP_LOGIC= ${BUILDLINK_DIR}/bin/.logic
+_BLNK_WRAP_LOGIC_TRANSFORM= ${BUILDLINK_DIR}/bin/.logic-trans
+_BLNK_WRAP_LOG= ${WRKLOG}
+_BLNK_LIBTOOL_DO_INSTALL= ${BUILDLINK_DIR}/bin/.libtool-do-install
+_BLNK_LIBTOOL_FIX_LA= ${BUILDLINK_DIR}/bin/.libtool-fix-la
+_BLNK_FAKE_LA= ${BUILDLINK_DIR}/bin/.fake-la
+_BLNK_GEN_TRANSFORM= ${BUILDLINK_DIR}/bin/.gen-transform
+_BLNK_TRANSFORM_SEDFILE= ${BUILDLINK_DIR}/bin/.transform.sed
+_BLNK_UNTRANSFORM_SEDFILE= ${BUILDLINK_DIR}/bin/.untransform.sed
+
+.for _wrappee_ in ${_BLNK_WRAPPEES}
+#
+# _BLNK_WRAPPER_SH.<wrappee> points to the main wrapper script used to
+# generate the wrapper for the wrappee.
+#
+_BLNK_WRAPPER_SH.${_wrappee_}= ${.CURDIR}/../../mk/buildlink3/wrapper.sh
+_BLNK_WRAP_SETENV.${_wrappee_}= ${_wrappee_}="${BUILDLINK_${_wrappee_}:T}"
+_BLNK_WRAP_SANITIZE_PATH.${_wrappee_}= ${_BLNK_WRAP_SANITIZE_PATH}
+_BLNK_WRAP_EXTRA_FLAGS.${_wrappee_}= # empty
+_BLNK_WRAP_ENV.${_wrappee_}= ${_BLNK_WRAP_ENV}
+_BLNK_WRAP_MARSHALL.${_wrappee_}= ${_BLNK_WRAP_MARSHALL}
+_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}= ${_BLNK_EMPTY_FILE}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}= ${_BLNK_EMPTY_FILE}
+_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}= ${_BLNK_EMPTY_FILE}
+_BLNK_WRAP_PRIVATE_POST_CACHE.${_wrappee_}= ${_BLNK_EMPTY_FILE}
+_BLNK_WRAP_CACHE_ADD.${_wrappee_}= ${_BLNK_WRAP_CACHE_ADD_TRANSFORM}
+_BLNK_WRAP_CACHE.${_wrappee_}= ${_BLNK_WRAP_CACHE_TRANSFORM}
+_BLNK_WRAP_LOGIC.${_wrappee_}= ${_BLNK_WRAP_LOGIC_TRANSFORM}
+_BLNK_WRAP_POST_LOGIC.${_wrappee_}= ${_BLNK_EMPTY_FILE}
+.endfor
+
+# Don't bother adding AS, CPP to the configure or make environments as
+# adding them seems to break some GNU configure scripts.
+#
+_BLNK_WRAP_SETENV.AS= # empty
+_BLNK_WRAP_SETENV.CPP= # empty
+
+# Also override any F77 value in the environment when compiling Fortran
+# code.
+#
+_BLNK_WRAP_SETENV.FC+= F77="${BUILDLINK_FC:T}"
+
+# Don't override the default LIBTOOL and SHLIBTOOL settings in the
+# environment, as they already correctly point to the correct values, and
+# don't sanitize the PATH because we want libtool to invoke the wrapper
+# scripts, too.
+#
+_BLNK_WRAP_SETENV.LIBTOOL= # empty
+_BLNK_WRAPPER_SH.LIBTOOL= ${.CURDIR}/../../mk/buildlink3/libtool.sh
+_BLNK_WRAP_SANITIZE_PATH.LIBTOOL= # empty
+#
+_BLNK_WRAP_SETENV.SHLIBTOOL= # empty
+_BLNK_WRAPPER_SH.SHLIBTOOL= ${.CURDIR}/../../mk/buildlink3/libtool.sh
+_BLNK_WRAP_SANITIZE_PATH.SHLIBTOOL= # empty
+
+# We need to "unbuildlinkify" any libtool archives.
+_BLNK_WRAP_LT_UNTRANSFORM_SED= ${_UNBUILDLINK_SED}
+
+.if defined(USE_SUNPRO)
+_BLNK_WRAP_PRIVATE_PRE_CACHE.CC= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.CC= ${BUILDLINK_DIR}/bin/.sunpro-cc-cache-add
+_BLNK_WRAP_PRIVATE_CACHE.CC= ${BUILDLINK_DIR}/bin/.sunpro-cc-cache
+_BLNK_WRAP_PRIVATE_POST_CACHE.CC= ${BUILDLINK_DIR}/bin/.sunpro-cc-post-cache
+_BLNK_WRAP_POST_LOGIC.CC= ${BUILDLINK_DIR}/bin/.sunpro-cc-post-logic
+#
+# The SunPro C++ compiler wrapper shares cache information with the C
+# compiler.
+#
+_BLNK_WRAP_PRIVATE_PRE_CACHE.CXX= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.CXX= ${BUILDLINK_DIR}/bin/.sunpro-cc-cache-add
+_BLNK_WRAP_PRIVATE_CACHE.CXX= ${BUILDLINK_DIR}/bin/.sunpro-cc-cache
+_BLNK_WRAP_PRIVATE_POST_CACHE.CXX= ${BUILDLINK_DIR}/bin/.sunpro-cc-post-cache
+_BLNK_WRAP_POST_LOGIC.CXX= ${BUILDLINK_DIR}/bin/.sunpro-cc-post-logic
+.endif # USE_SUNPRO
+
+_BLNK_WRAP_PRIVATE_PRE_CACHE.LD= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.LD= ${BUILDLINK_DIR}/bin/.ld-cache-add
+_BLNK_WRAP_PRIVATE_CACHE.LD= ${BUILDLINK_DIR}/bin/.ld-cache
+_BLNK_WRAP_PRIVATE_POST_CACHE.LD= ${BUILDLINK_DIR}/bin/.ld-post-cache
+_BLNK_WRAP_POST_LOGIC.LD= ${BUILDLINK_DIR}/bin/.ld-post-logic
+
+_BLNK_WRAP_PRIVATE_PRE_CACHE.LIBTOOL= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.LIBTOOL= ${BUILDLINK_DIR}/bin/.libtool-cache-add
+_BLNK_WRAP_PRIVATE_CACHE.LIBTOOL= ${BUILDLINK_DIR}/bin/.libtool-cache
+_BLNK_WRAP_PRIVATE_POST_CACHE.LIBTOOL= ${BUILDLINK_DIR}/bin/.libtool-post-cache
+_BLNK_WRAP_POST_LOGIC.LIBTOOL= ${BUILDLINK_DIR}/bin/.libtool-post-logic
+
+# shlibtool shares cache information with libtool.
+_BLNK_WRAP_PRIVATE_PRE_CACHE.SHLIBTOOL= ${_BLNK_WRAP_PRIVATE_PRE_CACHE.LIBTOOL}
+_BLNK_WRAP_PRIVATE_CACHE_ADD.SHLIBTOOL= ${_BLNK_WRAP_PRIVATE_CACHE_ADD.LIBTOOL}
+_BLNK_WRAP_PRIVATE_CACHE.SHLIBTOOL= ${_BLNK_WRAP_PRIVATE_CACHE.LIBTOOL}
+_BLNK_WRAP_PRIVATE_POST_CACHE.SHLIBTOOL= ${_BLNK_WRAP_PRIVATE_POST_CACHE.LIBTOOL}
+_BLNK_WRAP_POST_LOGIC.SHLIBTOOL= ${_BLNK_WRAP_POST_LOGIC.LIBTOOL}
+
+# Allow BUILDLINK_SETENV.<wrappee> to override _BLNK_WRAP_SETENV.<wrappee>.
+.for _wrappee_ in ${_BLNK_WRAPPEES}
+. if defined(BUILDLINK_SETENV.${_wrappee_})
+_BLNK_WRAP_SETENV.${_wrappee_}= ${BUILDLINK_SETENV.${_wrappee_}}
+. endif
+.endfor
+
+# Don't transform the arguments for imake, which uses the C preprocessor
+# to generate Makefiles, so that imake will find its config files.
+#
+.if defined(USE_X11)
+_BLNK_WRAP_CACHE_ADD.IMAKE= ${_BLNK_WRAP_CACHE_ADD}
+_BLNK_WRAP_CACHE.IMAKE= ${_BLNK_WRAP_CACHE}
+_BLNK_WRAP_LOGIC.IMAKE= ${_BLNK_WRAP_LOGIC}
+.endif
+
+# Silently pass the appropriate flags to the compiler/linker commands so
+# that headers and libraries in ${BUILDLINK_DIR}/{include,lib} are found
+# before the system headers and libraries.
+#
+_BLNK_CPPFLAGS= -I${BUILDLINK_DIR}/include
+_BLNK_LDFLAGS= -L${BUILDLINK_DIR}/lib
+_BLNK_WRAP_EXTRA_FLAGS.CC= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.CXX= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}}
+_BLNK_WRAP_EXTRA_FLAGS.CPP= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.FC= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.LD= ${_BLNK_LDFLAGS}
+
+.PHONY: buildlink-wrappers
+
+buildlink-wrappers: ${_BLNK_LIBTOOL_DO_INSTALL}
+buildlink-wrappers: ${_BLNK_LIBTOOL_FIX_LA}
+
+.for _wrappee_ in ${_BLNK_WRAPPEES}
+CONFIGURE_ENV+= ${_BLNK_WRAP_SETENV.${_wrappee_}}
+MAKE_ENV+= ${_BLNK_WRAP_SETENV.${_wrappee_}}
+
+BUILDLINK_${_wrappee_}= \
+ ${BUILDLINK_DIR}/bin/${${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+
+# Filter to scrunch shell scripts by removing comments and empty lines.
+_BLNK_SH_CRUNCH_FILTER= \
+ ${GREP} -v "^\#[^!]" | ${GREP} -v "^[ ][ ]*\#" | \
+ ${GREP} -v "^\#$$" | ${GREP} -v "^[ ]*$$"
+
+_BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}= \
+ -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g" \
+ -e "s|@BUILDLINK_SHELL@|${BUILDLINK_SHELL}|g" \
+ -e "s|@WRKDIR@|${WRKDIR}|g" \
+ -e "s|@WRKSRC@|${WRKSRC}|g" \
+ -e "s|@CAT@|${CAT:Q}|g" \
+ -e "s|@ECHO@|${ECHO:Q}|g" \
+ -e "s|@SED@|${SED:Q}|g" \
+ -e "s|@TEST@|${TEST:Q}|g" \
+ -e "s|@TOUCH@|${TOUCH:Q}|g" \
+ -e "s|@_BLNK_LIBTOOL_DO_INSTALL@|${_BLNK_LIBTOOL_DO_INSTALL:Q}|g" \
+ -e "s|@_BLNK_LIBTOOL_FIX_LA@|${_BLNK_LIBTOOL_FIX_LA:Q}|g" \
+ -e "s|@_BLNK_WRAP_LOG@|${_BLNK_WRAP_LOG:Q}|g" \
+ -e "s|@_BLNK_WRAP_EXTRA_FLAGS@|${_BLNK_WRAP_EXTRA_FLAGS.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_MARSHALL@|${_BLNK_WRAP_MARSHALL.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_PRIVATE_PRE_CACHE@|${_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_PRIVATE_CACHE_ADD@|${_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_PRIVATE_CACHE@|${_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_PRIVATE_POST_CACHE@|${_BLNK_WRAP_PRIVATE_POST_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_PRE_CACHE@|${_BLNK_WRAP_PRE_CACHE:Q}|g" \
+ -e "s|@_BLNK_WRAP_CACHE_ADD@|${_BLNK_WRAP_CACHE_ADD.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_CACHE@|${_BLNK_WRAP_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_POST_CACHE@|${_BLNK_WRAP_POST_CACHE:Q}|g" \
+ -e "s|@_BLNK_WRAP_LOGIC@|${_BLNK_WRAP_LOGIC.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_POST_LOGIC@|${_BLNK_WRAP_POST_LOGIC.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_ENV@|${_BLNK_WRAP_ENV.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_SANITIZE_PATH@|${_BLNK_WRAP_SANITIZE_PATH.${_wrappee_}:Q}|g"
+
+buildlink-wrappers: ${BUILDLINK_${_wrappee_}}
+.if !target(${BUILDLINK_${_wrappee_}})
+${BUILDLINK_${_wrappee_}}: \
+ ${_BLNK_WRAPPER_SH.${_wrappee_}} \
+ ${_BLNK_WRAP_MARSHALL.${_wrappee_}} \
+ ${_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}} \
+ ${_BLNK_WRAP_CACHE.${_wrappee_}} \
+ ${_BLNK_WRAP_LOGIC.${_wrappee_}} \
+ ${_BLNK_WRAP_POST_LOGIC.${_wrappee_}}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_BUILDLINK_MSG} \
+ "=> Creating wrapper: ${.TARGET}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ wrappee="${${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
+ case $${wrappee} in \
+ /*) absdir=; \
+ ;; \
+ *) OLDIFS="$$IFS"; \
+ IFS=":"; \
+ for dir in $${PATH}; do \
+ case $${dir} in \
+ *${BUILDLINK_DIR}*) \
+ ;; \
+ *) if [ -f $${dir}/$${wrappee} ] || \
+ [ -h $${dir}/$${wrappee} ] && \
+ [ -x $${dir}/$${wrappee} ]; then \
+ absdir=$${dir}/; \
+ wrappee=$${absdir}$${wrappee}; \
+ break; \
+ fi; \
+ ;; \
+ esac; \
+ done; \
+ IFS="$$OLDIFS"; \
+ if [ ! -x "$${wrappee}" ]; then \
+ ${ECHO_MSG} "Unable to create \"$${wrappee}\" wrapper script: no such file"; \
+ exit 1; \
+ fi; \
+ ;; \
+ esac; \
+ ${MKDIR} ${.TARGET:H}; \
+ ${CAT} ${_BLNK_WRAPPER_SH.${_wrappee_}} | \
+ ${SED} ${_BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}} \
+ -e "s|@WRAPPEE@|$${absdir}${${_wrappee_}:Q}|g" | \
+ ${_BLNK_SH_CRUNCH_FILTER} \
+ > ${.TARGET}; \
+ ${CHMOD} +x ${.TARGET}
+.endif
+
+. for _alias_ in ${_ALIASES.${_wrappee_}:S/^/${BUILDLINK_DIR}\/bin\//}
+. if !target(${_alias_})
+buildlink-wrappers: ${_alias_}
+${_alias_}: ${BUILDLINK_${_wrappee_}}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_BUILDLINK_MSG} \
+ "=> Linking wrapper: ${.TARGET}"
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${LN} -f ${BUILDLINK_${_wrappee_}} ${.TARGET}
+. endif
+. endfor # _alias_
+.endfor # _wrappee_
+
+# Allow BUILDLINK_ENV to override shell environment settings in
+# ${CONFIGURE_ENV} and in ${MAKE_ENV} for the configure and build processes,
+# respectively.
+#
+CONFIGURE_ENV+= ${BUILDLINK_ENV}
+MAKE_ENV+= ${BUILDLINK_ENV}
+
+# OS-specific overrides for buildlink3 wrappers
+#
+.if defined(USE_SUNPRO)
+_BLNK_WRAPPEES.SunOS?= CC CXX
+SUNWSPROBASE?= /opt/SUNWspro
+CC.SunOS?= ${SUNWSPROBASE}/bin/cc
+CXX.SunOS?= ${SUNWSPROBASE}/bin/CC
+.endif
+
+.PHONY: buildlink-${_BLNK_OPSYS}-wrappers
+buildlink-${_BLNK_OPSYS}-wrappers: buildlink-wrappers
+.for _wrappee_ in ${_BLNK_WRAPPEES.${_BLNK_OPSYS}}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ -x "${${_wrappee_}.${_BLNK_OPSYS}}" ]; then \
+ wrapper="${BUILDLINK_DIR}/bin/${${_wrappee_}.${_BLNK_OPSYS}:T}"; \
+ ${ECHO_BUILDLINK_MSG} \
+ "=> Creating ${_BLNK_OPSYS} wrapper: $${wrapper}"; \
+ ${RM} -f $${wrapper}; \
+ ${CAT} ${_BLNK_WRAPPER_SH.${_wrappee_}} | \
+ ${SED} ${_BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}} \
+ -e "s|@WRAPPEE@|${${_wrappee_}.${_BLNK_OPSYS}}|g" | \
+ ${_BLNK_SH_CRUNCH_FILTER} \
+ > $${wrapper}; \
+ ${CHMOD} +x $${wrapper}; \
+ for file in ${_ALIASES.${_wrappee_}:S/^/${BUILDLINK_DIR}\/bin\//}; do \
+ if [ "$${file}" != "$${wrappee}" ]; then \
+ ${TOUCH} $${file}; \
+ fi; \
+ done; \
+ fi
+.endfor
+
+${_BLNK_EMPTY_FILE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+${_BLNK_WRAP_MARSHALL}: ${.CURDIR}/../../mk/buildlink3/marshall
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+.for _wrappee_ in ${_BLNK_WRAPPEES}
+. if !target(${_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}})
+${_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+. endif
+. if !target(${_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}})
+${_BLNK_WRAP_PRIVATE_CACHE.${_wrappee_}}: \
+ ${_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}} \
+ ${_BLNK_WRAP_PRIVATE_CACHE_ADD.${_wrappee_}} \
+ ${_BLNK_WRAP_PRIVATE_POST_CACHE.${_wrappee_}}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+. endif
+.endfor
+
+${_BLNK_WRAP_PRIVATE_POST_CACHE.LD}: \
+ ${.CURDIR}/../../mk/buildlink3/ld-post-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_WRAP_PRIVATE_POST_CACHE.LIBTOOL}: \
+ ${.CURDIR}/../../mk/buildlink3/libtool-post-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_WRAP_PRE_CACHE}: ${.CURDIR}/../../mk/buildlink3/pre-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_WRAP_CACHE_ADD}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+${_BLNK_WRAP_CACHE}: \
+ ${_BLNK_WRAP_PRE_CACHE} \
+ ${_BLNK_WRAP_CACHE_ADD} \
+ ${_BLNK_WRAP_POST_CACHE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_CACHE_TRANSFORM}: \
+ ${_BLNK_WRAP_PRE_CACHE} \
+ ${_BLNK_WRAP_CACHE_ADD_TRANSFORM} \
+ ${_BLNK_WRAP_POST_CACHE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_POST_CACHE}: ${.CURDIR}/../../mk/buildlink3/post-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_WRAP_LOGIC}: ${.CURDIR}/../../mk/buildlink3/logic
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@LOCALBASE@|${LOCALBASE}|g" \
+ -e "s|@X11BASE@|${X11BASE}|g" \
+ -e 's|@_BLNK_TRANSFORM_SED@||g' \
+ ${.ALLSRC} | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_LOGIC_TRANSFORM}: \
+ ${.CURDIR}/../../mk/buildlink3/logic \
+ ${_BLNK_TRANSFORM_SEDFILE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@LOCALBASE@|${LOCALBASE}|g" \
+ -e "s|@X11BASE@|${X11BASE}|g" \
+ -e 's|@_BLNK_TRANSFORM_SED@|${_BLNK_TRANSFORM_SED:Q}|g' \
+ ${.CURDIR}/../../mk/buildlink3/logic \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_POST_LOGIC.LD}: ${.CURDIR}/../../mk/buildlink3/ld-post-logic
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_WRAP_POST_LOGIC.LIBTOOL}: \
+ ${.CURDIR}/../../mk/buildlink3/libtool-post-logic
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_LIBTOOL_DO_INSTALL}: ${.CURDIR}/../../mk/buildlink3/libtool-do-install
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${_BLNK_LIBTOOL_FIX_LA}: \
+ ${.CURDIR}/../../mk/buildlink3/libtool-fix-la \
+ ${_BLNK_UNTRANSFORM_SEDFILE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@LOCALBASE@|${LOCALBASE}|g" \
+ -e "s|@DEPOTBASE@|${DEPOTBASE}|g" \
+ -e "s|@WRKSRC@|${WRKSRC}|g" \
+ -e "s|@BASENAME@|${BASENAME:Q}|g" \
+ -e "s|@CP@|${CP:Q}|g" \
+ -e "s|@DIRNAME@|${DIRNAME:Q}|g" \
+ -e "s|@EGREP@|${EGREP:Q}|g" \
+ -e "s|@MV@|${MV:Q}|g" \
+ -e "s|@RM@|${RM:Q}|g" \
+ -e "s|@SED@|${SED:Q}|g" \
+ -e "s|@TOUCH@|${TOUCH:Q}|g" \
+ -e 's|@_BLNK_WRAP_LT_UNTRANSFORM_SED@|${_BLNK_WRAP_LT_UNTRANSFORM_SED:Q}|g' \
+ ${.CURDIR}/../../mk/buildlink3/libtool-fix-la \
+ | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+# Seed the common transforming cache with obvious values that greatly
+# speed up the wrappers.
+#
+_BLNK_RPATH_FLAGS= ${RPATH_FLAG}
+_BLNK_RPATH_FLAGS+= -Wl,${RPATH_FLAG}
+.for _rflag_ in \
+ -Wl,-R -Wl,-rpath, -Wl,--rpath, -Wl,-rpath-link, -Wl,--rpath-link
+. if empty(_BLNK_RPATH_FLAGS:M${_rflag_})
+_BLNK_RPATH_FLAGS+= ${_rflag_}
+. endif
+.endfor
+#
+.if !empty(_BLNK_SEED_CACHE:Mpassthru)
+#
+# Pass through all single letter options, because we don't touch those.
+#
+_BLNK_CACHE_PASSTHRU_GLOB= -?
+#
+# Directories in the ${WRKDIR} should all be allowed in -[IL]<dir>
+_BLNK_CACHE_PASSTHRU_GLOB+= -[IL]${WRKDIR}*|-[IL]${BUILDLINK_DIR}*
+#
+# Directories relative to the srcdir should be allowed in -[IL]<dir>
+_BLNK_CACHE_PASSTHRU_GLOB+= -[IL].|-[IL]./*|-[IL]..*|-[IL][!/]*
+#
+# Allow the depot directories for packages for which we need to find
+# headers and libraries for both -[IL]<dir>.
+#
+. for _pkg_ in ${BUILDLINK_PACKAGES}
+. if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+_BLNK_CACHE_PASSTHRU_GLOB+= -[IL]${BUILDLINK_PREFIX.${_pkg_}}/*
+. endif
+. endfor
+#
+# Allow all subdirs of ${_BLNK_ALLOWED_RPATHDIRS} to be in the runtime
+# library search path.
+#
+. if ${_USE_RPATH} == "yes"
+. for _dir_ in ${_BLNK_ALLOWED_RPATHDIRS}
+. for _R_ in ${_BLNK_RPATH_FLAGS}
+_BLNK_CACHE_PASSTHRU_GLOB+= ${_R_}${_dir_}|${_R_}${_dir_}/*
+. endfor
+. endfor
+. endif
+.endif # _BLNK_SEED_CACHE has "passthru"
+
+.if !empty(_BLNK_SEED_CACHE:Mblock)
+#
+# Block all other absolute paths (we handle the ${X11BASE} case below).
+#
+_BLNK_CACHE_BLOCK_GLOB= -[IL]/*
+. if ${_USE_RPATH} == "yes"
+. for _R_ in ${_BLNK_RPATH_FLAGS}
+_BLNK_CACHE_BLOCK_GLOB:= ${_BLNK_CACHE_BLOCK_GLOB}|${_R_}/*
+. endfor
+. endif
+.endif # _BLNK_SEED_CACHE has "block"
+
+${_BLNK_WRAP_CACHE_ADD_TRANSFORM}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${.TARGET}
+.if !empty(_BLNK_SEED_CACHE)
+. if !empty(_BLNK_SEED_CACHE:Mpassthru)
+. for _glob_ in ${_BLNK_CACHE_PASSTHRU_GLOB}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "${_glob_})"; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+. endfor
+. endif # _BLNK_SEED_CACHE has "passthru"
+. if !empty(_BLNK_SEED_CACHE:Mtransform)
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-I${DEPOTBASE}/*)"; \
+ ${ECHO} " arg=\"-I${BUILDLINK_DIR}/\$${arg#-I${DEPOTBASE}/[!/]*/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-L${DEPOTBASE}/*)"; \
+ ${ECHO} " arg=\"-L${BUILDLINK_DIR}/\$${arg#-I${DEPOTBASE}/[!/]*/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-I${LOCALBASE}/*)"; \
+ ${ECHO} " arg=\"-I${BUILDLINK_DIR}/\$${arg#-I${LOCALBASE}/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-L${LOCALBASE}/*)"; \
+ ${ECHO} " arg=\"-L${BUILDLINK_DIR}/\$${arg#-L${LOCALBASE}/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+. endif
+. if defined(USE_X11)
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-I${X11BASE}/*)"; \
+ ${ECHO} " arg=\"-I${BUILDLINK_X11_DIR}/\$${arg#-I${X11BASE}/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "-L${X11BASE}/*)"; \
+ ${ECHO} " arg=\"-L${BUILDLINK_X11_DIR}/\$${arg#-L${X11BASE}/}\""; \
+ ${ECHO} " cachehit=yes"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+. endif
+. endif # _BLNK_SEED_CACHE has "transform"
+. if !empty(_BLNK_SEED_CACHE:Mblock)
+. for _glob_ in ${_BLNK_CACHE_BLOCK_GLOB}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ( ${ECHO} "${_glob_})"; \
+ ${ECHO} " arg=; cachehit=yes;"; \
+ ${ECHO} " ;;"; \
+ ) >> ${.TARGET}
+. endfor
+. endif # _BLNK_SEED_CACHE has "block"
+.endif # _BLNK_SEED_CACHE
+
+${_BLNK_GEN_TRANSFORM}: ${.CURDIR}/../../mk/buildlink3/gen-transform.sh
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@_BLNK_TRANSFORM_SEDFILE@|${_BLNK_TRANSFORM_SEDFILE:Q}|g" \
+ -e "s|@_BLNK_UNTRANSFORM_SEDFILE@|${_BLNK_UNTRANSFORM_SEDFILE:Q}|g" \
+ -e "s|@_COMPILER_LD_FLAG@|${_COMPILER_LD_FLAG:Q}|g" \
+ -e "s|@_OPSYS_RPATH_NAME@|${_OPSYS_RPATH_NAME:Q}|g" \
+ -e "s|@BUILDLINK_SHELL@|${BUILDLINK_SHELL:Q}|g" \
+ -e "s|@CAT@|${CAT:Q}|g" \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_TRANSFORM_SEDFILE} ${_BLNK_UNTRANSFORM_SEDFILE}: ${_BLNK_GEN_TRANSFORM}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${_BLNK_GEN_TRANSFORM} \
+ ${_BLNK_TRANSFORM}
diff --git a/mk/buildlink3/gen-transform.sh b/mk/buildlink3/gen-transform.sh
new file mode 100644
index 00000000000..61c32222344
--- /dev/null
+++ b/mk/buildlink3/gen-transform.sh
@@ -0,0 +1,223 @@
+#!@BUILDLINK_SHELL@
+#
+# $NetBSD: gen-transform.sh,v 1.2 2003/09/02 06:59:54 jlam Exp $
+
+transform="@_BLNK_TRANSFORM_SEDFILE@"
+untransform="@_BLNK_UNTRANSFORM_SEDFILE@"
+
+# Mini-language for translating wrapper arguments into their buildlink
+# equivalents:
+#
+# mangle:src:dst mangles the directory "src" into "dst"
+# rpath:src:dst translates the directory "src" into "dst"
+# in rpath options
+# no-rpath removes "-R*", "-Wl,-R", and "-Wl,-rpath,*"
+# depot:src:dst translates "src/<dir>/" into "dst/"
+# I:src:dst translates "-Isrc" into "-Idst"
+# L:src:dst translates "-Lsrc" into "-Ldst"
+# l:foo:bar translates "-lfoo" into "-lbar"
+# P:src:dst translates "src/libfoo.{a,la}" into
+# "dst/libfoo.{a,la}"
+# p:path translates "path/*/libfoo.so" into
+# "-Lpath/* -lfoo"
+# r:dir removes "dir" and "dir/*"
+# S:foo:bar translates word "foo" into "bar"
+# s:foo:bar translates "foo" into "bar"
+#
+# Some transformations only make sense in one direction, so if a command
+# is prefixed with either "transform:" or "untransform:", then the
+# resulting sed commands are only appended the the corresponding sedfile.
+
+gen() {
+ action=$1; shift
+ case "$action" in
+ transform) sedfile="$transform" ;;
+ untransform) sedfile="$untransform" ;;
+ esac
+ save_IFS="${IFS}"; IFS=":"
+ set -- $1
+ IFS="${save_IFS}"
+ case "$1" in
+ mangle)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2\([/ \`"':;]\)|$3\1|g
+s|$2$|$3|g
+EOF
+ ;;
+ esac
+ ;;
+ rpath)
+ gen $action mangle:-Wl,--rpath-link,$2:-Wl,--rpath-link,$3
+ gen $action mangle:-Wl,--rpath,$2:-Wl,--rpath,$3
+ gen $action mangle:-Wl,-rpath-link,$2:-Wl,-rpath-link,$3
+ gen $action mangle:-Wl,-rpath,$2:-Wl,-rpath,$3
+ gen $action mangle:-Wl,-R$2:-Wl,-R$3
+ gen $action mangle:-R$2:-R$3
+ ;;
+ no-rpath)
+ gen $action _r:-Wl,--rpath-link,
+ gen $action _r:-Wl,--rpath,
+ gen $action _r:-Wl,-rpath-link,
+ gen $action _r:-Wl,-rpath,
+ gen $action _r:-Wl,-R
+ gen $action _r:-R
+ ;;
+ depot)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2/[^/ \`"':;]*\(/[^ \`"':;]\)|$3\1|g
+s|$2/[^/ \`"':;]*$|$3|g
+EOF
+ ;;
+ esac
+ ;;
+ I|L)
+ case "$action" in
+ transform)
+ @CAT@ >> $sedfile << EOF
+s|-$1$2\([ \`"':;]\)$|-$1$3\1|g
+s|-$1$2$|-$1$3|g
+s|-$1$2/|-$1$3/|g
+EOF
+ ;;
+ untransform)
+ @CAT@ >> $sedfile << EOF
+s|-$1$3\([ \`"':;]\)$|-$1$2\1|g
+s|-$1$3$|-$1$2|g
+s|-$1$3/|-$1$2/|g
+EOF
+ ;;
+ esac
+ ;;
+ l)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|-$1$2\([ "';;]\)|-$1$3\1|g
+s|-$1$2$|-$1$3|g
+s|-$1$2/|-$1$3/|g
+EOF
+ ;;
+ esac
+ ;;
+ P)
+ case "$action" in
+ transform)
+ @CAT@ >> $sedfile << EOF
+s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$3\1\2|g
+s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$3\1|g
+s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$3\1\2|g
+s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$3\1|g
+EOF
+ ;;
+ untransform)
+ @CAT@ >> $sedfile << EOF
+s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$2\1\2|g
+s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$2\1|g
+s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$2\1\2|g
+s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$2\1|g
+EOF
+ ;;
+ esac
+ ;;
+ p)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g
+s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g
+s|\($2\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g
+EOF
+ ;;
+ esac
+ ;;
+ __r)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2/[^ \`"':;]*||g
+EOF
+ ;;
+ esac
+ ;;
+ _r)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2\([ \`"':;]\)|\1|g
+s|$2$||g
+s|$2/[^ \`"':;]*||g
+EOF
+ ;;
+ esac
+ ;;
+ r)
+ case "$2" in
+ "") r=__r ;;
+ *) r=_r ;;
+ esac
+ gen $action $r:-I$2
+ gen $action $r:-L$2
+ gen $action $r:-Wl,--rpath-link,$2
+ gen $action $r:-Wl,--rpath,$2
+ gen $action $r:-Wl,-rpath-link,$2
+ gen $action $r:-Wl,-rpath,$2
+ gen $action $r:-Wl,-R$2
+ gen $action $r:-R$2
+ ;;
+ S)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2\([ \`"':;]\)|$3\1|g
+s|$2$|$3|g
+EOF
+ ;;
+ esac
+ ;;
+ s)
+ case "$action" in
+ transform|untransform)
+ @CAT@ >> $sedfile << EOF
+s|$2|$3|g
+EOF
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown arg: $arg" 1>&2
+ exit 1
+ ;;
+ esac
+}
+
+for arg; do
+ case $arg in
+ transform:*)
+ gen transform "${arg#transform:}"
+ ;;
+ untransform:*)
+ gen untransform "${arg#untransform:}"
+ ;;
+ *)
+ gen transform "$arg"
+ gen untransform "$arg"
+ ;;
+ esac
+done
diff --git a/mk/buildlink3/ld-post-cache b/mk/buildlink3/ld-post-cache
new file mode 100644
index 00000000000..2e7c8eab3f6
--- /dev/null
+++ b/mk/buildlink3/ld-post-cache
@@ -0,0 +1,11 @@
+# $NetBSD: ld-post-cache,v 1.2 2003/09/02 06:59:55 jlam Exp $
+#
+# This file implements the default action of the "ld" private cache,
+# and tells the wrapper to skip the common cache lookup for all
+# arguments that start with "-Wl,"; they will instead be handled
+# directly by ld-post-logic.
+#
+-Wl,*)
+ skipcache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/ld-post-logic b/mk/buildlink3/ld-post-logic
new file mode 100644
index 00000000000..c784a3fb4eb
--- /dev/null
+++ b/mk/buildlink3/ld-post-logic
@@ -0,0 +1,14 @@
+# $NetBSD: ld-post-logic,v 1.2 2003/09/02 06:59:55 jlam Exp $
+#
+# Strip the "-Wl," from arguments that start with that prefix and add
+# the result to the "ld" private cache (which is read before the
+# common cache). This makes "ld" silently accept "-Wl,*" arguments,
+# which are often a part of the LDFLAGS setting in pkgsrc, and allows
+# such LDFLAGS to be shared between the compiler and the linker.
+#
+case $arg in
+-Wl,*)
+ arg=`$echo "X$arg" | $Xsed -e "s|^-Wl,||g" -e "s|,| |g"`
+ addtoprivatecache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/libtool-do-install b/mk/buildlink3/libtool-do-install
new file mode 100644
index 00000000000..dc851a5e339
--- /dev/null
+++ b/mk/buildlink3/libtool-do-install
@@ -0,0 +1,25 @@
+# $NetBSD: libtool-do-install,v 1.2 2003/09/02 06:59:56 jlam Exp $
+#
+# This file is called directly by the libtool wrapper when it has
+# figured out that the libtool invocation is meant to do a file
+# installation. We simply quote the remaining command-line arguments
+# properly to build a correct libtool command line. The libtool
+# wrapper will perform the actual execution. We don't worry about
+# caching or speed, since installation is not a bottleneck for package
+# creation.
+
+cmd="$cmd $arg"
+while $test $# -gt 0; do
+ arg="$1"; shift
+ case $arg in
+ *[\`\"\$\\]*)
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ ;;
+ esac
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ cmd="$cmd $arg"
+done
diff --git a/mk/buildlink3/libtool-fix-la b/mk/buildlink3/libtool-fix-la
new file mode 100644
index 00000000000..c6ab415fb71
--- /dev/null
+++ b/mk/buildlink3/libtool-fix-la
@@ -0,0 +1,275 @@
+# $NetBSD: libtool-fix-la,v 1.2 2003/09/02 06:59:57 jlam Exp $
+#
+# For *.la files, in the "relink_command" line, we make the following
+# replacements:
+#
+# "libfoo.la" -> "-L./.libs libfoo.la"
+# "dirpath/libfoo.la" -> "-Ldirpath/.libs libfoo.la"
+#
+# This allows the libraries to be found within ${WRKSRC} during relinking.
+# We rely on the proper rpath settings to be set by libtool.
+#
+# For the *.lai files, in the "dependency_libs" line, we remove redundant
+# -Ldir and -llib options. We also make sure that we don't ever reference
+# other .la files, only referring to other libraries via the usual
+# "-L/path -llib" and making sure that /path is always somewhere under the
+# default view. This makes wildcard dependencies work for "overwrite"
+# packages by letting libtool find libraries in the default view.
+
+labase=`@BASENAME@ $lafile .la`
+ladir=`@DIRNAME@ $lafile`
+latimestamp=${ladir}/.${labase}.la.timestamp
+laifile=${ladir}/.libs/${labase}.lai
+if $test -f $lafile; then
+ . ${ladir}/${labase}.la
+
+ deps=
+ for i in ${dependency_libs}; do
+ case "$i" in
+ -R*)
+ # Skip all -R* options... rpath info shouldn't go into the
+ # dependency_libs line.
+ ;;
+ # Catch -L<dir> and remove redundant ones.
+ -L*)
+ case "$deps" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) deps="${deps} $i" ;;
+ esac
+ ;;
+ # Convert "dirpath/libfoo.la" into "-Ldirpath/.libs libfoo.la"
+ # if it's an uninstalled libtool archive. This allows
+ # proper relinking by libtool during the install stage
+ # by allowing it to find the uninstalled shared library
+ # in the .libs directory.
+ #
+ *.la)
+ fixla=0
+ ltlibsdir=`@DIRNAME@ $i`/.libs
+ case "$ltlibsdir" in
+ /*)
+ # fix if an absolute path in ${WRKSRC}
+ case "$ltlibsdir" in
+ @WRKSRC@/*) fixla=1 ;;
+ esac
+ ;;
+ *)
+ # fix all relative paths
+ fixla=1
+ ;;
+ esac
+ if $test $fixla -gt 0; then
+ case "$deps" in
+ *"-L$ltlibsdir "*) ;;
+ *"-L$ltlibsdir") ;;
+ *) deps="$deps -L$ltlibsdir" ;;
+ esac
+ fi
+ deps="${deps} $i"
+ ;;
+ # Everything else Just Belongs in the dependency_libs line.
+ *)
+ deps="${deps} $i"
+ ;;
+ esac
+ done
+
+ relink=
+ for i in ${relink_command}; do
+ case "$i" in
+ # -I* and -D* are useless for linking.
+ -I*|-D*)
+ ;;
+ # Catch -L<dir> and remove redundant ones.
+ -L*)
+ case "$relink" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) relink="${relink} $i" ;;
+ esac
+ ;;
+ # This is the .la file we're relinking... don't touch it!
+ $lafile)
+ relink="${relink} $i"
+ ;;
+ # Convert "dirpath/libfoo.la" into "-Ldirpath/.libs libfoo.la"
+ # if it's an uninstalled libtool archive. This allows
+ # proper relinking by libtool during the install stage
+ # by allowing it to find the uninstalled shared library
+ # in the .libs directory.
+ #
+ *.la)
+ fixla=0
+ ltlibsdir=`@DIRNAME@ $i`/.libs
+ case "$ltlibsdir" in
+ /*)
+ # fix if an absolute path in ${WRKSRC}
+ case "$ltlibsdir" in
+ @WRKSRC@/*) fixla=1 ;;
+ esac
+ ;;
+ *)
+ # fix all relative paths
+ fixla=1
+ ;;
+ esac
+ if $test $fixla -gt 0; then
+ case "$relink" in
+ *"-L$ltlibsdir "*) ;;
+ *"-L$ltlibsdir") ;;
+ *) relink="$relink -L$ltlibsdir" ;;
+ esac
+ fi
+ relink="${relink} $i"
+ ;;
+ # Everything else Just Belongs in the relink_command line.
+ *)
+ relink="${relink} $i"
+ ;;
+ esac
+ done
+ if $test -z "$deps" && $test -z "$relink" || \
+ @EGREP@ "^#.*modified by buildlink3" $lafile >/dev/null 2>&1; then
+ :
+ else
+ # Save the orignal .la file produced by libtool as
+ # .la.blsav, and create the new one with a signature.
+ #
+ @MV@ -f $lafile ${lafile}.blsav
+ if $test -n "$deps"; then
+ (
+ $cat ${lafile}.blsav | @SED@ -e '/^dependency_libs=/,$d'
+ $echo "dependency_libs='$deps'"
+ $cat ${lafile}.blsav | @SED@ -e '1,/^dependency_libs=/d'
+ ) > ${lafile}.tmp
+ else
+ $cat ${lafile}.blsav > ${lafile}.tmp
+ fi
+ if $test -n "$relink"; then
+ (
+ $cat ${lafile}.tmp | @SED@ -e '/^relink_command=/,$d'
+ $echo "relink_command='$relink'"
+ $cat ${lafile}.tmp | @SED@ -e '1,/^relink_command=/d'
+ ) > $lafile
+ else
+ $cat ${lafile}.tmp > $lafile
+ fi
+ $echo >> $lafile
+ $echo "# This file has been modified by buildlink3." >> $lafile
+ @RM@ ${lafile}.tmp
+ $echo "==> Fixed $lafile" >> $wrapperlog
+ fi
+ #
+ # Fix up any .lai files (libtool archives that will be installed).
+ #
+ if $test -z "$laifile" || $test ! -f "$laifile" || \
+ @EGREP@ "^#.*modified by buildlink3" $laifile >/dev/null 2>&1; then
+ :
+ else
+ @SED@ @_BLNK_WRAP_LT_UNTRANSFORM_SED@ \
+ $laifile > ${laifile}.tmp
+ . ${laifile}.tmp
+ L=; l=; lexist=; prev=
+ for i in ${dependency_libs}; do
+ case "$i" in
+ #
+ # Don't allowed repeated arguments, so "-lm -lm"
+ # becomes just "-lm".
+ #
+ $prev)
+ ;;
+ # Skip all -R* options... rpath info shouldn't go
+ # into the dependency_libs line.
+ #
+ -R*)
+ ;;
+ # Skip directories that should never appear in
+ # the -L<dir> flags. Also modify directories in
+ # ${DEPOTBASE} to point to somewhere in the
+ # default view ${LOCALBASE}, since we want "overwrite"
+ # packages to think the libraries really do just
+ # exist through the default view.
+ #
+ -L*)
+ case "$i" in
+ -L${BUILDLINK_DIR}/*)
+ ;;
+ -L@WRKSRC@|-L@WRKSRC@/*)
+ ;;
+ -L@DEPOTBASE@/*)
+ i=`$echo "X$i" | $Xsed -e "s,-L@DEPOTBASE@/[^/]*/,-L@LOCALBASE@/,"`
+ case "$L" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) L="$L $i" ;;
+ esac
+ ;;
+ *)
+ case "$L" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) L="$L $i" ;;
+ esac
+ ;;
+ esac
+ ;;
+ # Libraries really do exist, so we want to keep
+ # any -L<dir> flags we've seen in the generated
+ # dependency_libs line.
+ #
+ -l*)
+ lexist=1
+ l="$l $i"
+ ;;
+ # Libtool archives should be changed from
+ # "/path/libfoo.la" to "-L/path -lfoo", where /path
+ # is appropriately modified so that the depot
+ # directory is changed to the views directory. This
+ # allows the .la files to be used by either "overwrite"
+ # or "pkgviews" packages and works correctly with
+ # wildcard dependencies.
+ #
+ *.la)
+ dirbase=`@DIRNAME@ $i`
+ dir=`$echo "X$dirbase" | $Xsed -e "s,^@DEPOTBASE@/[^/]*/,@LOCALBASE@/,"`
+ case "$L" in
+ *"-L$dir "*) ;;
+ *"-L$dir") ;;
+ *) L="$L -L$dir" ;;
+ esac
+ libbase=`@BASENAME@ $i .la`
+ lib=`$echo "X$libbase" | $Xsed -e "s/^lib//"`
+ lexist=1
+ l="$l -l$lib"
+ ;;
+ # Everything else Just Belongs.
+ *)
+ l="$l $i"
+ ;;
+ esac
+ prev="$i"
+ done
+ if $test -z "$lexist"; then
+ L=
+ fi
+ deps="$L$l"
+ deps=`$echo "X$deps" | $Xsed -e "s/^[ ]*//"`
+ @MV@ -f $laifile ${laifile}.blsav
+ (
+ $cat ${laifile}.tmp | @SED@ -e '/^dependency_libs=/,$d'
+ $echo "dependency_libs='$deps'"
+ $cat ${laifile}.tmp | @SED@ -e '1,/^dependency_libs=/d'
+ $echo
+ $echo "# This file has been modified by buildlink3."
+ ) > ${laifile}
+ @RM@ -f ${laifile}.tmp
+ $echo "==> Fixed $laifile" >> $wrapperlog
+ if $test "$libdir" != "${BUILDLINK_DIR}/.tmp/inst" && \
+ @EGREP@ "${BUILDLINK_DIR}" $laifile >/dev/null 2>&1; then
+ $echo "==> [buildlink3] Error: buildlink3 leakage into $laifile" >> $wrapperlog
+ $echo "==> [buildlink3] Error: buildlink3 leakage into $laifile" 1>&2
+ wrapper_result=1
+ fi
+ fi
+fi
diff --git a/mk/buildlink3/libtool-post-cache b/mk/buildlink3/libtool-post-cache
new file mode 100644
index 00000000000..ebb93ec9f42
--- /dev/null
+++ b/mk/buildlink3/libtool-post-cache
@@ -0,0 +1,12 @@
+# $NetBSD: libtool-post-cache,v 1.2 2003/09/02 06:59:57 jlam Exp $
+#
+# This file implements the default action of the "libtool" private
+# cache, and tells the libtool wrapper to skip the common cache lookup
+# for all directories and library args that may reference a locally
+# linked libtool archive; the appropriate action will be taken instead
+# by libtool-post-logic.
+
+-L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*|-l*)
+ skipcache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/libtool-post-logic b/mk/buildlink3/libtool-post-logic
new file mode 100644
index 00000000000..8941f05af3e
--- /dev/null
+++ b/mk/buildlink3/libtool-post-logic
@@ -0,0 +1,57 @@
+# $NetBSD: libtool-post-logic,v 1.2 2003/09/02 06:59:58 jlam Exp $
+#
+# Workaround software authors that don't follow the libtool
+# documentation and link against uninstalled libtool archives with:
+#
+# -L../package/source/dir -lfoo
+#
+# instead of the correct (according to the libtool documentation)
+#
+# ../package/source/dir/libfoo.la
+#
+# We convert the former into the latter by remembering all "local"
+# directories that are mentioned in -L* arguments to to libtool
+# wrapper, and checking to see if <dir>/libfoo.la exists when we see
+# "-lfoo" on the libtool command line.
+
+case $arg in
+-L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*)
+ case $fixlibpath in
+ yes)
+ case $arg in
+ */.libs)
+ # ignore -L.../.libs
+ ;;
+ *)
+ $echo "*** [buildlink3] Warning: libtool detected $arg" >> $wrapperlog
+ $echo "*** [buildlink3] Warning: libtool detected $arg" 1>&2
+ lpath=`$echo "X$arg" | $Xsed -e "s/^-L//"`
+ case "$rellpath" in
+ *"$lpath "*) ;;
+ *"$lpath"*) ;;
+ *) rellpath="$rellpath $lpath" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+-l*)
+ case $fixlibpath in
+ yes)
+ lib=`$echo "X$arg" | $Xsed -e "s/^-l//"`
+ for dir in $rellpath; do
+ la="$dir/lib$lib.la"
+ if $test -f "$la"; then
+ $echo "*** [buildlink3] Warning: libtool replaced $arg with $la" >> $wrapperlog
+ $echo "*** [buildlink3] Warning: libtool replaced $arg with $la" 1>&2
+ arg="$la"
+ cachesettings='skipcache=yes'
+ break
+ fi
+ done
+ ;;
+ esac
+ addtoprivatecache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh
new file mode 100644
index 00000000000..149833b602e
--- /dev/null
+++ b/mk/buildlink3/libtool.sh
@@ -0,0 +1,98 @@
+#!@BUILDLINK_SHELL@
+#
+# $NetBSD: libtool.sh,v 1.2 2003/09/02 06:59:59 jlam Exp $
+
+Xsed='@SED@ -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+marshall="@_BLNK_WRAP_MARSHALL@"
+private_pre_cache="@_BLNK_WRAP_PRIVATE_PRE_CACHE@"
+private_cache_add="@_BLNK_WRAP_PRIVATE_CACHE_ADD@"
+private_cache="@_BLNK_WRAP_PRIVATE_CACHE@"
+private_post_cache="@_BLNK_WRAP_PRIVATE_POST_CACHE@"
+pre_cache="@_BLNK_WRAP_PRE_CACHE@"
+cache_add="@_BLNK_WRAP_CACHE_ADD@"
+cache="@_BLNK_WRAP_CACHE@"
+post_cache="@_BLNK_WRAP_POST_CACHE@"
+logic="@_BLNK_WRAP_LOGIC@"
+post_logic="@_BLNK_WRAP_POST_LOGIC@"
+
+wrapperlog="${BUILDLINK_WRAPPER_LOG-@_BLNK_WRAP_LOG@}"
+
+libtool_fix_la="@_BLNK_LIBTOOL_FIX_LA@"
+libtool_do_install="@_BLNK_LIBTOOL_DO_INSTALL@"
+fixlibpath=${BUILDLINK_FIX_IMPROPER_LIBTOOL_LIBPATH-yes}
+
+updatecache=${BUILDLINK_UPDATE_CACHE-yes}
+cacheall=${BUILDLINK_CACHE_ALL-no}
+
+cat="@CAT@"
+echo="@ECHO@"
+test="@TEST@"
+
+BUILDLINK_DIR="@BUILDLINK_DIR@"
+WRKDIR="@WRKDIR@"
+WRKSRC="@WRKSRC@"
+
+cmd="@WRAPPEE@"
+lafile=
+case "$1" in
+*install|*cp|*install-sh|*install.sh)
+ arg="$1"; shift
+ . $libtool_do_install
+ ;;
+*)
+ while $test $# -gt 0; do
+ arg="$1"; shift
+ case $arg in
+ --fix-la)
+ case "$1" in
+ *.la)
+ lafile="$1"
+ . $libtool_fix_la
+ exit
+ ;;
+ esac
+ ;;
+ --mode|--mode=install)
+ if $test "$arg" = "--mode=install" || \
+ $test "$arg" = "--mode" -a "$1" = "install"; then
+ . $libtool_do_install
+ break
+ fi
+ ;;
+ -o)
+ case "$1" in
+ *.la) lafile="$1" ;;
+ esac
+ ;;
+ *)
+ cachehit=no
+ skipcache=no
+ . $marshall
+ . $private_cache
+ case $skipcache,$cachehit in
+ no,no) . $cache ;;
+ esac
+ case $cachehit in
+ no) . $logic ;;
+ esac
+ ;;
+ esac
+ cmd="$cmd $arg"
+ done
+ ;;
+esac
+
+@_BLNK_WRAP_ENV@
+@_BLNK_WRAP_SANITIZE_PATH@
+
+$echo $cmd >> $wrapperlog
+eval $cmd
+wrapper_result=$?
+
+if $test -n "$lafile" && $test -f "$lafile"; then
+ . $libtool_fix_la
+fi
+
+exit ${wrapper_result}
diff --git a/mk/buildlink3/logic b/mk/buildlink3/logic
new file mode 100644
index 00000000000..62cbdfd37a0
--- /dev/null
+++ b/mk/buildlink3/logic
@@ -0,0 +1,75 @@
+# $NetBSD: logic,v 1.2 2003/09/02 07:00:00 jlam Exp $
+
+quotedarg=no
+addtocache=no
+addtoprivatecache=no
+cachesettings='arg="$cachearg"; cachehit=yes'
+
+# $qarg contains a correctly-quoted $arg
+case $arg in
+*[\`\"\$\\]*)
+ qarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ quotedarg=yes
+ ;;
+*)
+ qarg="$arg"
+ ;;
+esac
+case $qarg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg="\"$qarg\""
+ quotedarg=yes
+ ;;
+esac
+searcharg="$qarg"
+
+case $arg in
+-D*)
+ arg="$qarg"
+ addtocache=yes
+ ;;
+-*|/*)
+ arg=`$echo "X$qarg" | $Xsed @_BLNK_TRANSFORM_SED@`
+ addtocache=yes
+ ;;
+*)
+ arg="$qarg"
+ addtocache=no
+ ;;
+esac
+
+. $post_logic
+
+case $updatecache,$addtocache,$cacheall,$quotedarg in
+yes,yes,yes,*|yes,yes,no,no)
+ case $arg in
+ *[\`\"\$\\]*)
+ cachearg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ ;;
+ *)
+ cachearg="$arg"
+ ;;
+ esac
+ case $addtoprivatecache in
+ yes)
+ pre_cachefile=$private_pre_cache
+ cachefile_add=$private_cache_add
+ cachefile=$private_cache
+ post_cachefile=$private_post_cache
+ ;;
+ *)
+ pre_cachefile=$pre_cache
+ cachefile_add=$cache_add
+ cachefile=$cache
+ post_cachefile=$post_cache
+ ;;
+ esac
+ $cat >> $cachefile_add << EOF
+$searcharg)
+ cachearg="$cachearg"
+ $cachesettings
+ ;;
+EOF
+ $cat $pre_cachefile $cachefile_add $post_cachefile > $cachefile
+ ;;
+esac
diff --git a/mk/buildlink3/marshall b/mk/buildlink3/marshall
new file mode 100644
index 00000000000..c59f47f1a3e
--- /dev/null
+++ b/mk/buildlink3/marshall
@@ -0,0 +1,13 @@
+# $NetBSD: marshall,v 1.2 2003/09/02 07:00:00 jlam Exp $
+#
+# Merge "-Wl,--rpath -Wl,/path/to/dir" into a single argument
+# "-Wl,--rpath,/path/to/dir" so that we can look it up in the cache.
+#
+case $arg in
+-Wl,-rpath|-Wl,-rpath-link|\
+-Wl,--rpath|-Wl,--rpath-link)
+ nextarg=`$echo "X$1" | $Xsed -e "s|^-Wl,||g"`
+ arg="$arg,$nextarg"
+ shift
+ ;;
+esac
diff --git a/mk/buildlink3/post-cache b/mk/buildlink3/post-cache
new file mode 100644
index 00000000000..b93ade36cc2
--- /dev/null
+++ b/mk/buildlink3/post-cache
@@ -0,0 +1,4 @@
+# $NetBSD: post-cache,v 1.2 2003/09/02 07:00:01 jlam Exp $
+
+*) ;;
+esac
diff --git a/mk/buildlink3/pre-cache b/mk/buildlink3/pre-cache
new file mode 100644
index 00000000000..d6dd1ea05de
--- /dev/null
+++ b/mk/buildlink3/pre-cache
@@ -0,0 +1,3 @@
+# $NetBSD: pre-cache,v 1.2 2003/09/02 07:00:01 jlam Exp $
+
+case $arg in
diff --git a/mk/buildlink3/sunpro-cc-post-cache b/mk/buildlink3/sunpro-cc-post-cache
new file mode 100644
index 00000000000..40ac4ca4fa7
--- /dev/null
+++ b/mk/buildlink3/sunpro-cc-post-cache
@@ -0,0 +1,12 @@
+# $NetBSD: sunpro-cc-post-cache,v 1.2 2003/09/02 07:00:02 jlam Exp $
+#
+# This file implements the default action of the "cc" private cache
+# for the SunPro suite of compilers, and tells the wrapper to skip the
+# common cache lookup for all GCC arguments that the SunPro compiler
+# can't handle; they will instead by handled directly by
+# sunpro-cc-post-logic.
+
+-W*)
+ skipcache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/sunpro-cc-post-logic b/mk/buildlink3/sunpro-cc-post-logic
new file mode 100644
index 00000000000..d78d6bf1ea3
--- /dev/null
+++ b/mk/buildlink3/sunpro-cc-post-logic
@@ -0,0 +1,30 @@
+# $NetBSD: sunpro-cc-post-logic,v 1.2 2003/09/02 07:00:03 jlam Exp $
+#
+# Silently accept some GCC compiler arguments by silently converting
+# them to the SunPro compiler equivalents. This makes the SunPro
+# compiler wrappers work with more software that seems to assume GCC
+# nowadays.
+
+case $arg in
+-Werror)
+ # "-errwarn" is the right way to convince the SunPro compiler
+ # to stop on compilation warnings.
+ #
+ arg="-errwarn"
+ addtoprivatecache=yes
+ ;;
+-Wl,-R*)
+ # Directories for the runtime library search path are passed
+ # via simply "-R<dir>", not "-Wl,-R<dir>".
+ #
+ arg=`$echo "X$arg" | $Xsed -e "s|^-Wl,||g" -e "s|,| |g"`
+ addtoprivatecache=yes
+ ;;
+-W*)
+ # In fact, SunPro compilers don't even understand any -W*
+ # arguments, so just silently ignore them all.
+ #
+ arg=
+ addtoprivatecache=yes
+ ;;
+esac
diff --git a/mk/buildlink3/wrapper.sh b/mk/buildlink3/wrapper.sh
new file mode 100644
index 00000000000..3cd4b4e164b
--- /dev/null
+++ b/mk/buildlink3/wrapper.sh
@@ -0,0 +1,67 @@
+#!@BUILDLINK_SHELL@
+#
+# $NetBSD: wrapper.sh,v 1.2 2003/09/02 07:00:03 jlam Exp $
+
+Xsed='@SED@ -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+marshall="@_BLNK_WRAP_MARSHALL@"
+private_pre_cache="@_BLNK_WRAP_PRIVATE_PRE_CACHE@"
+private_cache_add="@_BLNK_WRAP_PRIVATE_CACHE_ADD@"
+private_cache="@_BLNK_WRAP_PRIVATE_CACHE@"
+private_post_cache="@_BLNK_WRAP_PRIVATE_POST_CACHE@"
+pre_cache="@_BLNK_WRAP_PRE_CACHE@"
+cache_add="@_BLNK_WRAP_CACHE_ADD@"
+cache="@_BLNK_WRAP_CACHE@"
+post_cache="@_BLNK_WRAP_POST_CACHE@"
+logic="@_BLNK_WRAP_LOGIC@"
+post_logic="@_BLNK_WRAP_POST_LOGIC@"
+
+wrapperlog="${BUILDLINK_WRAPPER_LOG-@_BLNK_WRAP_LOG@}"
+
+updatecache="${BUILDLINK_UPDATE_CACHE-yes}"
+cacheall="${BUILDLINK_CACHE_ALL-no}"
+
+cat="@CAT@"
+echo="@ECHO@"
+test="@TEST@"
+
+BUILDLINK_DIR="@BUILDLINK_DIR@"
+WRKDIR="@WRKDIR@"
+WRKSRC="@WRKSRC@"
+
+cmd="@WRAPPEE@ @_BLNK_WRAP_EXTRA_FLAGS@"
+while $test $# -gt 0; do
+ arg="$1"; shift
+ cachehit=no
+ skipcache=no
+ #
+ # Marshall any group of consecutive arguments into a single
+ # $arg to be checked in the cache and logic files.
+ #
+ . $marshall
+ #
+ # Check the private cache, and possibly set skipcache=yes.
+ #
+ . $private_cache
+ #
+ # Check the common cache shared by all of the other wrappers.
+ #
+ case $skipcache,$cachehit in
+ no,no) . $cache ;;
+ esac
+ #
+ # If the cache doesn't cover the arg we're examining, then
+ # run it through the transformations and cache the result.
+ #
+ case $cachehit in
+ no) . $logic ;;
+ esac
+ cmd="$cmd $arg"
+done
+
+@_BLNK_WRAP_ENV@
+@_BLNK_WRAP_SANITIZE_PATH@
+
+$echo $cmd >> $wrapperlog
+eval exec $cmd
diff --git a/mk/bulk/bsd.bulk-pkg.mk b/mk/bulk/bsd.bulk-pkg.mk
index e0ded737069..72fb63cf917 100644
--- a/mk/bulk/bsd.bulk-pkg.mk
+++ b/mk/bulk/bsd.bulk-pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.bulk-pkg.mk,v 1.48 2003/08/21 16:24:31 gavan Exp $
+# $NetBSD: bsd.bulk-pkg.mk,v 1.49 2003/09/02 07:00:04 jlam Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
@@ -289,8 +289,8 @@ bulk-package:
pkgfile=${PACKAGES}/All/$${pkgname}.tgz ;\
if ! ${PKG_INFO} -qe $$pkgname ; then \
if [ -f $$pkgfile ]; then \
- ${ECHO_MSG} "BULK> ${PKG_ADD} $$pkgfile"; \
- ${DO} ${PKG_ADD} $$pkgfile || ${ECHO_MSG} "warning: could not add $$pkgfile." ; \
+ ${ECHO_MSG} "BULK> ${PKG_ADD} ${PKG_ARGS_ADD} $$pkgfile"; \
+ ${DO} ${PKG_ADD} ${PKG_ARGS_ADD} $$pkgfile || ${ECHO_MSG} "warning: could not add $$pkgfile." ; \
else \
${ECHO_MSG} "BULK> warning: $$pkgfile does not exist. It will be rebuilt." ;\
fi ;\
@@ -378,8 +378,8 @@ bulk-install:
@if [ `${MAKE} bulk-check-uptodate REF=${PKGFILE}` = 1 ]; then \
if ! ${PKG_INFO} -qe ${PKGNAME} ; then \
${DO} ${MAKE} install-depends ; \
- ${ECHO_MSG} "BULK> " ${PKG_ADD} ${PKGFILE} ; \
- ${DO} ${PKG_ADD} ${PKGFILE} ; \
+ ${ECHO_MSG} "BULK> " ${PKG_ADD} ${PKG_ARGS_ADD} ${PKGFILE} ; \
+ ${DO} ${PKG_ADD} ${PKG_ARGS_ADD} ${PKGFILE} ; \
fi ; \
else \
${ECHO_MSG} ${MAKE} bulk-package PRECLEAN=no; \
diff --git a/mk/bulk/mksandbox b/mk/bulk/mksandbox
index 772161919aa..68e7d6ee8ba 100755
--- a/mk/bulk/mksandbox
+++ b/mk/bulk/mksandbox
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: mksandbox,v 1.24 2003/08/10 20:33:53 seb Exp $
+# $NetBSD: mksandbox,v 1.25 2003/09/02 07:00:05 jlam Exp $
#
#
# Copyright (c) 2002 Alistair G. Crooks. All rights reserved.
diff --git a/mk/bulk/post-build b/mk/bulk/post-build
index ed5b6b44e82..f52394bb8b4 100644
--- a/mk/bulk/post-build
+++ b/mk/bulk/post-build
@@ -1,5 +1,5 @@
#!/usr/pkg/bin/perl
-# $NetBSD: post-build,v 1.25 2003/08/19 15:24:01 gavan Exp $
+# $NetBSD: post-build,v 1.26 2003/09/02 07:00:05 jlam Exp $
#
# Collect stuff after a pkg bulk build
#
diff --git a/mk/bulk/pre-build b/mk/bulk/pre-build
index f0ba2530803..134147ca4cf 100644
--- a/mk/bulk/pre-build
+++ b/mk/bulk/pre-build
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: pre-build,v 1.28 2003/08/26 08:18:09 hubertf Exp $
+# $NetBSD: pre-build,v 1.29 2003/09/02 07:00:06 jlam Exp $
#
# Clean up system to be ready for bulk pkg build
#
@@ -69,33 +69,37 @@ fi
# Clean out everything and its mother
#
PKG_DBDIR=`(cd ${PKGLINT_PKG_DIR}; ${BMAKE} show-var VARNAME=PKG_DBDIR)`
-
-echo Removing all installed packages in ${PKG_DBDIR}
-
-if [ -d ${PKG_DBDIR} ]; then
- cd ${PKG_DBDIR}
- for pkg in *
- do
- if `env PKG_DBDIR=${PKG_DBDIR} pkg_info -qe $pkg`; then
- echo pkg_delete -r $pkg
- env PKG_DBDIR=${PKG_DBDIR} pkg_delete -r $pkg
- fi
- done
- # this should have removed everything. Now force any broken pkgs
- # to deinstall
- for pkg in *
- do
- if `env PKG_DBDIR=${PKG_DBDIR} pkg_info -qe $pkg`; then
- echo pkg_delete -f $pkg
- env PKG_DBDIR=${PKG_DBDIR} pkg_delete -f $pkg
- fi
- done
+DEPOTBASE=`(cd ${PKGLINT_PKG_DIR}; ${BMAKE} show-var VARNAME=DEPOTBASE)`
+
+for dbdir in ${PKG_DBDIR} ${DEPOTBASE}; do
+ echo Removing all installed packages in $dbdir
+ if [ -d $dbdir ]; then
+ cd $dbdir
+ for pkg in *
+ do
+ if `pkg_info -K $dbdir -qe $pkg`; then
+ echo pkg_delete -r $pkg
+ pkg_delete -K $dbdir -r $pkg
+ fi
+ done
+ #
+ # this should have removed everything.
+ # Now force any broken pkgs to deinstall.
+ #
+ for pkg in *
+ do
+ if `pkg_info -K $dbdir -qe $pkg`; then
+ echo pkg_delete -f $pkg
+ pkg_delete -K $dbdir -f $pkg
+ fi
+ done
- # We've tried our best to get rid of the pkgs, now do it the hard way
- # If it wasn't for stuff in $X11BASE, I wouldn't have hard feelings
- # about this!
- rm -fr *
-fi
+ # We've tried our best to get rid of the pkgs, now do it
+ # the hard way. If it wasn't for stuff in $X11BASE, I
+ # wouldn't have hard feelings about this!
+ rm -fr *
+ fi
+done
cd $LOCALBASE && rm -fr * && rm -fr .??*;
if [ x"$BMAKE" = x"bmake" ]; then
diff --git a/mk/bulk/tflat b/mk/bulk/tflat
index eaec453e421..6796df09936 100755
--- a/mk/bulk/tflat
+++ b/mk/bulk/tflat
@@ -1,4 +1,4 @@
-# $NetBSD: tflat,v 1.10 2003/07/25 11:29:33 dmcmahill Exp $
+# $NetBSD: tflat,v 1.11 2003/09/02 07:00:06 jlam Exp $
#
# Copyright (c) 2001 The NetBSD Foundation, Inc.
# All rights reserved.
diff --git a/mk/defs.Darwin.mk b/mk/defs.Darwin.mk
index d7068125fb4..cc5c6c43212 100644
--- a/mk/defs.Darwin.mk
+++ b/mk/defs.Darwin.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.Darwin.mk,v 1.52 2003/08/26 20:15:25 jlam Exp $
+# $NetBSD: defs.Darwin.mk,v 1.53 2003/09/02 06:59:44 jlam Exp $
#
# Variable definitions for the Darwin operating system.
diff --git a/mk/defs.FreeBSD.mk b/mk/defs.FreeBSD.mk
index f8c0f4410a6..397c37898ff 100644
--- a/mk/defs.FreeBSD.mk
+++ b/mk/defs.FreeBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.FreeBSD.mk,v 1.22 2003/08/26 20:15:26 jlam Exp $
+# $NetBSD: defs.FreeBSD.mk,v 1.23 2003/09/02 06:59:45 jlam Exp $
#
# Variable definitions for the FreeBSD operating system.
diff --git a/mk/defs.IRIX.mk b/mk/defs.IRIX.mk
index d31db15a58d..b1ebc0d60b5 100644
--- a/mk/defs.IRIX.mk
+++ b/mk/defs.IRIX.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.IRIX.mk,v 1.31 2003/08/26 20:15:26 jlam Exp $
+# $NetBSD: defs.IRIX.mk,v 1.32 2003/09/02 06:59:45 jlam Exp $
#
# Variable definitions for the IRIX operating system.
diff --git a/mk/defs.Linux.mk b/mk/defs.Linux.mk
index d85f1d0fb96..9f4f0025ee4 100644
--- a/mk/defs.Linux.mk
+++ b/mk/defs.Linux.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.Linux.mk,v 1.56 2003/08/26 20:15:26 jlam Exp $
+# $NetBSD: defs.Linux.mk,v 1.57 2003/09/02 06:59:45 jlam Exp $
#
# Variable definitions for the Linux operating system.
diff --git a/mk/defs.NetBSD.mk b/mk/defs.NetBSD.mk
index 135de477a63..6f91c65c975 100644
--- a/mk/defs.NetBSD.mk
+++ b/mk/defs.NetBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.NetBSD.mk,v 1.51 2003/08/26 20:15:26 jlam Exp $
+# $NetBSD: defs.NetBSD.mk,v 1.52 2003/09/02 06:59:45 jlam Exp $
#
# Variable definitions for the NetBSD operating system.
diff --git a/mk/defs.OpenBSD.mk b/mk/defs.OpenBSD.mk
index 0e76d2c3e73..e701d9bd80d 100644
--- a/mk/defs.OpenBSD.mk
+++ b/mk/defs.OpenBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.OpenBSD.mk,v 1.18 2003/08/26 20:15:26 jlam Exp $
+# $NetBSD: defs.OpenBSD.mk,v 1.19 2003/09/02 06:59:46 jlam Exp $
#
# Variable definitions for the OpenBSD operating system.
diff --git a/mk/defs.SunOS.mk b/mk/defs.SunOS.mk
index 15d0fc96d0d..067be3ad277 100644
--- a/mk/defs.SunOS.mk
+++ b/mk/defs.SunOS.mk
@@ -1,4 +1,4 @@
-# $NetBSD: defs.SunOS.mk,v 1.64 2003/08/26 20:15:27 jlam Exp $
+# $NetBSD: defs.SunOS.mk,v 1.65 2003/09/02 06:59:46 jlam Exp $
#
# Variable definitions for the SunOS/Solaris operating system.
@@ -127,7 +127,6 @@ _OPSYS_HAS_JAVA= no # Java is not standard
_OPSYS_HAS_MANZ= no # no MANZ for gzipping of man pages
_OPSYS_HAS_OSSAUDIO= no # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
-_OPSYS_PKGTOOLS_REQD= 20030417 # base version of pkg_install required
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -z # switch to patch(1) for backup suffix
diff --git a/mk/emacs.mk b/mk/emacs.mk
index 3c7e5882054..6fbe60470b5 100644
--- a/mk/emacs.mk
+++ b/mk/emacs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: emacs.mk,v 1.15 2003/08/18 13:16:24 minoura Exp $
+# $NetBSD: emacs.mk,v 1.16 2003/09/02 06:59:46 jlam Exp $
#
# A Makefile fragment for Emacs Lisp packages.
#
diff --git a/mk/gcc.buildlink2.mk b/mk/gcc.buildlink2.mk
index 70266922570..94f16ffcc43 100644
--- a/mk/gcc.buildlink2.mk
+++ b/mk/gcc.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.buildlink2.mk,v 1.5 2003/08/21 16:16:46 gavan Exp $
+# $NetBSD: gcc.buildlink2.mk,v 1.6 2003/09/02 06:59:46 jlam Exp $
#
# USE_GCC2
# If defined, use gcc from lang/gcc.
diff --git a/mk/install/deinstall b/mk/install/deinstall
index a0e041b7725..470c5ffc811 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,6 +1,6 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.17 2003/05/06 17:42:04 jmmv Exp $
+# $NetBSD: deinstall,v 1.18 2003/09/02 07:00:06 jlam Exp $
eval set -- ${PKG_USERS}
for userset; do
@@ -22,8 +22,11 @@ for groupset; do
done
eval set -- ${CONF_FILES} ${SUPPORT_FILES}
-for file; do
- ALL_FILES="${ALL_FILES} \"${file}\""
+while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ shift; shift
+ ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
+ VIEW_FILES="${VIEW_FILES} \"${file}\""
done
if [ "${_PKG_RCD_SCRIPTS}" = "YES" ]; then
eval set -- ${RCD_SCRIPTS}
@@ -39,6 +42,7 @@ while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
shift; shift; shift; shift; shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
+ VIEW_FILES="${VIEW_FILES} \"${file}\""
done
eval set -- ${RCD_SCRIPTS_DIR} ${MAKE_DIRS}
@@ -70,7 +74,37 @@ ALL_DIRS=`
`
case ${STAGE} in
+VIEW-DEINSTALL)
+ if [ "${_PKG_CONFIG}" = "YES" -a \
+ -n "${PKG_SYSCONFVIEWBASE}" -a -n "${VIEW_FILES}" ]; then
+ if [ -n "${PKG_SYSCONFDEPOTBASE}" ]; then
+ ${LINKFARM} -D -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
+ else
+ eval set -- ${VIEW_FILES}
+ for file; do
+ link=`${ECHO} ${file} | ${SED} "s,^${PREFIX}/,${PKG_PREFIX}/,"`
+ dir=`${DIRNAME} ${link}`
+ if [ -h "${link}" ]; then
+ ${RM} -f ${link}
+ ${RMDIR} -p ${dir} 2>/dev/null || ${TRUE}
+ fi
+ done
+ fi
+ fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
+ ${ECHO} "===> Updating /etc/shells"
+ ${CP} /etc/shells /etc/shells.pkgsrc."$$"
+ (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
+ ${RM} /etc/shells.pkgsrc."$$"
+ fi
+ ;;
+
DEINSTALL)
+ if [ "${PKG_INSTALLATION_TYPE}" = "overwrite" ]; then
+ ${SETENV} PKG_PREFIX="${PKG_PREFIX}" \
+ $0 ${PKGNAME} VIEW-DEINSTALL
+ fi
+
# Remove configuration files if they don't differ from the default
# config file.
#
@@ -88,12 +122,6 @@ DEINSTALL)
fi
done
fi
- if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
- ${ECHO} "===> Updating /etc/shells"
- ${CP} /etc/shells /etc/shells.pkgsrc."$$"
- (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
- ${RM} /etc/shells.pkgsrc."$$"
- fi
;;
POST-DEINSTALL)
@@ -216,11 +244,6 @@ EOF
EOF
fi
;;
-
-*)
- ${ECHO} "Unexpected argument: ${STAGE}"
- exit 1
- ;;
esac
# end of deinstall
diff --git a/mk/install/header b/mk/install/header
index a585fcbc094..a6bc0ee4692 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.18 2003/08/30 18:42:37 jlam Exp $
+# $NetBSD: header,v 1.19 2003/09/02 07:00:07 jlam Exp $
PKGNAME=$1
STAGE=$2
@@ -26,6 +26,7 @@ GROUPADD="@GROUPADD@"
GTAR="@GTAR@"
HEAD="@HEAD@"
ID="@ID@"
+LINKFARM="@LINKFARM@"
LN="@LN@"
MKDIR="@MKDIR@"
MV="@MV@"
@@ -33,6 +34,7 @@ PERL5="@PERL5@"
RM="@RM@"
RMDIR="@RMDIR@"
SED="@SED@"
+SETENV="@SETENV@"
SH="@SH@"
SORT="@SORT@"
SU="@SU@"
@@ -44,6 +46,7 @@ USERADD="@USERADD@"
XARGS="@XARGS@"
PKGBASE="@PKGBASE@"
+PREFIX="@PREFIX@"
PKG_USERS="@PKG_USERS@"
PKG_GROUPS="@PKG_GROUPS@"
@@ -64,6 +67,8 @@ OWN_DIRS="@OWN_DIRS@"
OWN_DIRS_PERMS="@OWN_DIRS_PERMS@"
PKG_SYSCONFBASE="@PKG_SYSCONFBASE@"
+PKG_SYSCONFDEPOTBASE="@PKG_SYSCONFDEPOTBASE@"
+PKG_SYSCONFVIEWBASE="@PKG_SYSCONFVIEWBASE@"
PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
PKG_REGISTER_SHELLS="@PKG_REGISTER_SHELLS@"
@@ -74,6 +79,9 @@ ALL_GROUPS=
ALL_FILES=
ALL_MAKE_DIRS=
ALL_DIRS=
+VIEW_FILES=
+
+PKG_INSTALLATION_TYPE="@PKG_INSTALLATION_TYPE@"
case "${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
diff --git a/mk/install/install b/mk/install/install
index 99e95a56f9e..d3a3505a9b0 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.20 2003/06/25 08:26:51 jlam Exp $
+# $NetBSD: install,v 1.21 2003/09/02 07:00:07 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -108,7 +108,14 @@ PRE-INSTALL)
fi
if [ "${_PKG_CONFIG}" = "YES" ]; then
${MKDIR} "${dir}"
- ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" ]; then
+ case "${dir}" in
+ ${PKG_PREFIX}|${PKG_PREFIX}/*) ;;
+ *) ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" ;;
+ esac
+ else
+ ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ fi
fi
done
eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
@@ -118,7 +125,14 @@ PRE-INSTALL)
if [ "${_PKG_CONFIG}" = "YES" ]; then
if [ ! -d "${dir}" ]; then
${MKDIR} "${dir}"
- ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" ]; then
+ case "${dir}" in
+ ${PKG_PREFIX}|${PKG_PREFIX}/*) ;;
+ *) ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" ;;
+ esac
+ else
+ ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ fi
${CHOWN} -R "${owner}" "${dir}"
${CHGRP} -R "${group}" "${dir}"
${CHMOD} -R "${mode}" "${dir}"
@@ -346,6 +360,13 @@ EOF
EOF
fi
fi
+ if [ "${PKG_INSTALLATION_TYPE}" = "overwrite" ]; then
+ ${SETENV} PKG_PREFIX="${PKG_PREFIX}" \
+ $0 ${PKGNAME} VIEW-INSTALL
+ fi
+ ;;
+
+VIEW-INSTALL)
if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
${ECHO} "===> Updating /etc/shells"
${TOUCH} /etc/shells
@@ -353,11 +374,16 @@ EOF
(${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}; ${ECHO} ${PKG_SHELL}) > /etc/shells
${RM} /etc/shells.pkgsrc."$$"
fi
- ;;
-
-*)
- ${ECHO} "Unexpected argument: ${STAGE}"
- exit 1
+ if [ "${_PKG_CONFIG}" = "YES" -a \
+ -n "${PKG_SYSCONFVIEWBASE}" -a \
+ -n "${PKG_SYSCONFDEPOTBASE}" ]; then
+ if [ -n "${CONF_FILES}" -o \
+ -n "${CONF_FILES_PERMS}" -o \
+ -n "${SUPPORT_FILES}" -o \
+ -n "${SUPPORT_FILES_PERMS}" ]; then
+ ${LINKFARM} -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
+ fi
+ fi
;;
esac
diff --git a/mk/install/install-info b/mk/install/install-info
index dca9f475bf1..bb3dc2e1c03 100644
--- a/mk/install/install-info
+++ b/mk/install/install-info
@@ -8,7 +8,7 @@ INSTALL_INFO="@INSTALL_INFO@"
INFO_DIR="@INFO_DIR@"
case ${STAGE} in
-POST-INSTALL)
+VIEW-INSTALL)
if [ -f ${PKG_PREFIX}/${INFO_DIR}/dir ]; then
_nentries="`${GREP} -c '^\*' ${PKG_PREFIX}/${INFO_DIR}/dir 2>/dev/null`"
if [ x"${_nentries}" != x -a "${_nentries}" -lt 1 ]; then
@@ -23,7 +23,7 @@ POST-INSTALL)
${PKG_PREFIX}/${INFO_DIR}/${f}
done
;;
-DEINSTALL)
+VIEW-DEINSTALL)
for f in ${INFO_FILES}; do
${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \
${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1
diff --git a/mk/java-vm.mk b/mk/java-vm.mk
index 792f337b60c..cb14a61fbf1 100644
--- a/mk/java-vm.mk
+++ b/mk/java-vm.mk
@@ -1,4 +1,4 @@
-# $NetBSD: java-vm.mk,v 1.15 2003/07/29 16:33:07 wiz Exp $
+# $NetBSD: java-vm.mk,v 1.16 2003/09/02 06:59:47 jlam Exp $
#
# This Makefile fragment handles Java dependencies and make variables,
# and is meant to be included by packages that require Java either at
diff --git a/mk/pthread.buildlink2.mk b/mk/pthread.buildlink2.mk
index 33887dc936e..e515c20dfca 100644
--- a/mk/pthread.buildlink2.mk
+++ b/mk/pthread.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pthread.buildlink2.mk,v 1.14 2003/07/23 20:15:01 jmc Exp $
+# $NetBSD: pthread.buildlink2.mk,v 1.15 2003/09/02 06:59:47 jlam Exp $
#
# The pthreads strategy for pkgsrc is to "bless" a particular pthread
# package as the Official Pthread Replacement (OPR). A package that uses
diff --git a/mk/scripts/genindex.awk b/mk/scripts/genindex.awk
index 626e253d071..0e109955939 100755
--- a/mk/scripts/genindex.awk
+++ b/mk/scripts/genindex.awk
@@ -1,5 +1,5 @@
#!/usr/bin/awk -f
-# $NetBSD: genindex.awk,v 1.3 2003/07/25 12:58:20 dmcmahill Exp $
+# $NetBSD: genindex.awk,v 1.4 2003/09/02 07:00:08 jlam Exp $
#
# Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
# All rights reserved.
diff --git a/mk/subst.mk b/mk/subst.mk
index e360d39677a..9ba3b2be3ef 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.1 2003/08/27 11:24:37 jlam Exp $
+# $NetBSD: subst.mk,v 1.2 2003/09/02 06:59:47 jlam Exp $
#
# This Makefile fragment implements a general text replacement facility
# for different classes of files in ${WRKSRC}. For each class of files,
diff --git a/mk/texinfo.mk b/mk/texinfo.mk
index 8d3d95d71a9..9a6bb1ab343 100644
--- a/mk/texinfo.mk
+++ b/mk/texinfo.mk
@@ -1,4 +1,4 @@
-# $NetBSD: texinfo.mk,v 1.21 2003/08/16 23:19:04 seb Exp $
+# $NetBSD: texinfo.mk,v 1.22 2003/09/02 06:59:48 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk when INFO_FILES is
# not empty or USE_MAKEINFO is not "no".
diff --git a/mk/tools.mk b/mk/tools.mk
index 2d506bc34da..79bb0d125f9 100644
--- a/mk/tools.mk
+++ b/mk/tools.mk
@@ -1,4 +1,4 @@
-# $NetBSD: tools.mk,v 1.12 2003/08/27 20:03:44 jlam Exp $
+# $NetBSD: tools.mk,v 1.13 2003/09/02 06:59:48 jlam Exp $
#
# This Makefile creates a ${TOOLS_DIR} directory and populates the bin
# subdir with tools that hide the ones outside of ${TOOLS_DIR}.
diff --git a/mk/x11.buildlink2.mk b/mk/x11.buildlink2.mk
deleted file mode 100644
index 163b44cec4e..00000000000
--- a/mk/x11.buildlink2.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# $NetBSD: x11.buildlink2.mk,v 1.4 2003/06/12 15:27:09 jschauma Exp $
-#
-# This file is for internal use by bsd.buildlink2.mk and should _not_ be
-# include by package Makefiles.
-
-.if !defined(X11_BUILDLINK2_MK)
-X11_BUILDLINK2_MK= # defined
-
-USE_X11?= # defined
-USE_X11_LINKS= no
-
-.include "../../mk/bsd.prefs.mk"
-
-.if ${OPSYS} == "IRIX"
-. include "../../pkgtools/x11-links/xsgi.buildlink2.mk"
-.else
-. if !empty(X11BASE:M*openwin)
-. include "../../pkgtools/x11-links/openwin.buildlink2.mk"
-. else
-. include "../../pkgtools/x11-links/xfree.buildlink2.mk"
-. endif
-.endif
-
-.endif # X11_BUILDLINK2_MK