Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pkgsrc/mk from the buildlink2 branch back into the main trunk.

  • Loading branch information...
commit 93cd8e154da5cf2f0134013f4cf1a5bbc9c6b02a 1 parent f8643e4
jlam authored
View
65 mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1031 2002/08/11 16:56:51 tron Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1032 2002/08/22 08:21:26 jlam Exp $
#
# This file is in the public domain.
#
@@ -167,17 +167,19 @@ X11PREFIX= ${X11BASE}
XMKMF_CMD?= ${X11PREFIX}/bin/xmkmf
.endif
-# Set the default BUILDLINK_DIR and BUILDLINK_X11_DIR so that if no
-# buildlink.mk files are included, then they still points to a where headers
-# and libraries for installed packages and X11R6 may be found, respectively.
+# Set the default BUILDLINK_DIR, BUILDLINK_X11PKG_DIR, BUILDLINK_X11_DIR so
+# that if no buildlink.mk files are included, then they still point to
+# where headers and libraries for installed packages and X11R6 may be found.
#
BUILDLINK_DIR?= ${LOCALBASE}
+BUILDLINK_X11PKG_DIR?= ${X11BASE}
BUILDLINK_X11_DIR?= ${X11BASE}
.if defined(USE_IMAKE) || defined(USE_X11BASE)
. if exists(${LOCALBASE}/lib/X11/config/xpkgwedge.def) || \
exists(${X11BASE}/lib/X11/config/xpkgwedge.def)
BUILD_DEPENDS+= xpkgwedge>=1.5:../../pkgtools/xpkgwedge
+BUILDLINK_X11PKG_DIR= ${LOCALBASE}
. endif
PREFIX= ${X11PREFIX}
.elif defined(USE_CROSSBASE)
@@ -352,13 +354,14 @@ CONFIGURE_ENV+= CONFIG_SHELL=${CONFIG_SHELL}
LIBTOOL_REQD= 1.4.20010614nb9
.if defined(USE_LIBTOOL)
LIBTOOL= ${LOCALBASE}/bin/libtool
+PKGLIBTOOL= ${LIBTOOL}
. if defined(USE_LTDL)
DEPENDS+= libtool>=${LIBTOOL_REQD}:../../devel/libtool
. else
BUILD_DEPENDS+= libtool-base>=${LIBTOOL_REQD}:../../devel/libtool-base
. endif
-CONFIGURE_ENV+= LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
-MAKE_ENV+= LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
+CONFIGURE_ENV+= LIBTOOL="${PKGLIBTOOL} ${LIBTOOL_FLAGS}"
+MAKE_ENV+= LIBTOOL="${PKGLIBTOOL} ${LIBTOOL_FLAGS}"
.endif
.if defined(USE_XAW)
@@ -381,6 +384,7 @@ BUILD_DEPENDS+= {gettext-0.10.35nb1,gettext-m4-[0-9]*}:../../devel/gettext-m4
.endif
EXTRACT_COOKIE= ${WRKDIR}/.extract_done
+BUILDLINK_COOKIE= ${WRKDIR}/.buildlink_done
CONFIGURE_COOKIE= ${WRKDIR}/.configure_done
INSTALL_COOKIE= ${WRKDIR}/.install_done
BUILD_COOKIE= ${WRKDIR}/.build_done
@@ -1019,6 +1023,7 @@ PKGREPOSITORYSUBDIR?= All
PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
+CONFIGURE_DIRS?= ${WRKSRC}
CONFIGURE_SCRIPT?= ./configure
CONFIGURE_ENV+= PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin
@@ -1070,6 +1075,18 @@ SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
SCRIPTS_ENV+= BATCH=yes
.endif
+.if defined(USE_BUILDLINK2)
+. if (${USE_BUILDLINK2} == "NO") || (${USE_BUILDLINK2} == "no")
+NO_BUILDLINK2= # defined
+. endif
+.else
+NO_BUILDLINK2= # defined
+.endif
+
+.if !defined(NO_BUILDLINK2)
+. include "../../mk/buildlink2/bsd.buildlink2.mk"
+.endif
+
.MAIN: all
# Use aliases, so that all versions of English are acceptable
@@ -1239,9 +1256,15 @@ patch: extract
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
.endif
+# Disable buildlink
+.if defined(NO_BUILDLINK2) && !target(configure)
+buildlink: patch
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE}
+.endif
+
# Disable configure
.if defined(NO_CONFIGURE) && !target(configure)
-configure: patch
+configure: buildlink
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
.endif
@@ -1911,7 +1934,7 @@ do-ltconfig-override:
${_PKG_SILENT}${_PKG_DEBUG} \
if [ -f ${ltconfig} ]; then \
${RM} -f ${ltconfig}; \
- ${ECHO} "${RM} -f libtool; ${LN} -s ${LIBTOOL} libtool" \
+ ${ECHO} "${RM} -f libtool; ${LN} -s ${PKGLIBTOOL} libtool" \
> ${ltconfig}; \
${CHMOD} +x ${ltconfig}; \
fi
@@ -2007,7 +2030,8 @@ automake-post-override:
.if !target(do-configure)
do-configure: ${_CONFIGURE_PREREQ}
. if defined(HAS_CONFIGURE)
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC} && ${SETENV} \
+. for DIR in ${CONFIGURE_DIRS}
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${DIR} && ${SETENV} \
CC="${CC}" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" \
CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" FC="${FC}" F77="${FC}" FFLAGS="${FFLAGS}" \
INSTALL="`${TYPE} ${INSTALL} | ${AWK} '{ print $$NF }'` -c -o ${BINOWN} -g ${BINGRP}" \
@@ -2016,6 +2040,7 @@ do-configure: ${_CONFIGURE_PREREQ}
INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
+. endfor
. endif
. if defined(USE_IMAKE)
${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC} && ${SETENV} ${SCRIPTS_ENV} XPROJECTROOT=${X11BASE} ${XMKMF}
@@ -2029,7 +2054,7 @@ do-libtool-override:
${_PKG_SILENT}${_PKG_DEBUG} \
if [ -f ${libtool} ]; then \
${RM} -f ${libtool}; \
- ${LN} -sf ${LIBTOOL} ${libtool}; \
+ ${LN} -sf ${PKGLIBTOOL} ${libtool}; \
fi
. endfor
.else
@@ -2518,6 +2543,8 @@ acquire-extract-lock:
${_ACQUIRE_LOCK}
acquire-patch-lock:
${_ACQUIRE_LOCK}
+acquire-buildlink-lock:
+ ${_ACQUIRE_LOCK}
acquire-configure-lock:
${_ACQUIRE_LOCK}
acquire-build-lock:
@@ -2527,6 +2554,8 @@ release-extract-lock:
${_RELEASE_LOCK}
release-patch-lock:
${_RELEASE_LOCK}
+release-buildlink-lock:
+ ${_RELEASE_LOCK}
release-configure-lock:
${_RELEASE_LOCK}
release-build-lock:
@@ -2554,8 +2583,12 @@ extract: checksum ${WRKDIR} acquire-extract-lock ${EXTRACT_COOKIE} release-extra
patch: extract acquire-patch-lock ${PATCH_COOKIE} release-patch-lock
.endif
+.if !target(buildlink)
+buildlink: patch acquire-buildlink-lock ${BUILDLINK_COOKIE} release-buildlink-lock
+.endif
+
.if !target(configure)
-configure: patch acquire-configure-lock ${CONFIGURE_COOKIE} release-configure-lock
+configure: buildlink acquire-configure-lock ${CONFIGURE_COOKIE} release-configure-lock
.endif
.if !target(build)
@@ -2582,6 +2615,8 @@ ${EXTRACT_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET}
${PATCH_COOKIE}:
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-patch
+${BUILDLINK_COOKIE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-buildlink
${CONFIGURE_COOKIE}:
.if ${INTERACTIVE_STAGE:Mconfigure} == "configure" && defined(BATCH)
@${ECHO} "*** The configuration stage of this package requires user interaction"
@@ -2619,6 +2654,8 @@ extract-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Extracting for ${PKGNAME}"
patch-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Patching for ${PKGNAME}"
+buildlink-message:
+ @${ECHO_MSG} "${_PKGSRC_IN}> Buildlinking for ${PKGNAME}"
configure-message:
@${ECHO_MSG} "${_PKGSRC_IN}> Configuring for ${PKGNAME}"
build-message:
@@ -2628,6 +2665,8 @@ extract-cookie:
${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >> ${EXTRACT_COOKIE}
patch-cookie:
${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
+buildlink-cookie:
+ ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE}
configure-cookie:
${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
build-cookie:
@@ -2636,6 +2675,7 @@ build-cookie:
.ORDER: pre-fetch do-fetch post-fetch
.ORDER: extract-message install-depends pre-extract do-extract post-extract extract-cookie
.ORDER: patch-message pre-patch do-patch post-patch patch-cookie
+.ORDER: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie
.ORDER: configure-message pre-configure do-configure post-configure configure-cookie
.ORDER: build-message pre-build do-build post-build build-cookie
@@ -2645,6 +2685,7 @@ build-cookie:
real-fetch: pre-fetch do-fetch post-fetch
real-extract: extract-message install-depends pre-extract do-extract post-extract extract-cookie
real-patch: patch-message pre-patch do-patch post-patch patch-cookie
+real-buildlink: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie
real-configure: configure-message pre-configure do-configure post-configure configure-cookie
real-build: build-message pre-build do-build post-build build-cookie
real-install: do-su-install
@@ -2715,7 +2756,7 @@ do-su-undo-replace:
# Empty pre-* and post-* targets
-.for name in fetch extract patch configure build install-script install package
+.for name in fetch extract patch buildlink configure build install-script install package
. if !target(pre-${name})
pre-${name}:
View
38 mk/buildlink2/README
@@ -0,0 +1,38 @@
+$NetBSD: README,v 1.2 2002/08/22 08:21:28 jlam Exp $
+
+ 0 buildlink2 Wrapper Script System
+ ==================================
+
+The purpose of the buildlink2 wrapper script system is to replace calls to
+compiler tool with scripts that tranlate any arguments into their buildlink
+equivalents, then invoke the actual compiler tools with the translated
+arguments. The pkgsrc/mk/buildlink2 directory contains bits of the wrapper
+script system for the buildlink2 framework. The wrapper script system is
+composed of three parts: the main wrapper script, the "cache", and the
+"logic" script generated from the cache.
+
+ 0.1 Main wrapper script
+ =======================
+
+The main wrapper script for a compiler tool (cc, ld, as, etc.) is
+generated from wrapper.sh, except for the libtool wrapper script which is
+generated from libtool.sh. The wrapper scripts share a common set of logic
+files that translate arguments into their buildlink equivalents.
+
+ 0.2 Cache
+ =========
+
+The cache contains a series of lines that may be directly used as the
+contents of a Bourne shell "case" statement. They contain only arguments
+that have already been seen and their buildlink equivalents.
+
+ 0.3 Logic script
+ ================
+
+The logic script contains a large "case" statement that handles the
+translation of an argument into its buildlink equivalent. It is generated
+from three files: the pre-cache, cache, and post-cache files. The cache is
+described above. The pre- and post-cache files simply complete the "case"
+statement. The post-cache also contains the final case that performs the
+actual argument translation and, as an optimization, saves the result into
+the cache.
View
611 mk/buildlink2/bsd.buildlink2.mk
@@ -0,0 +1,611 @@
+# $NetBSD: bsd.buildlink2.mk,v 1.2 2002/08/22 08:21:28 jlam Exp $
+#
+# An example package buildlink2.mk file:
+#
+# -------------8<-------------8<-------------8<-------------8<-------------
+# BUILDLINK_PACKAGES+= foo
+# BUILDLINK_DEPENDS.foo?= foo>=1.0
+# BUILDLINK_PKGSRCDIR.foo?= ../../category/foo
+#
+# EVAL_PREFIX+= BUILDLINK_PREFIX.foo=foo
+# BUILDLINK_PREFIX.foo_DEFAULT= ${LOCALBASE}
+# BUILDLINK_FILES.foo= include/foo.h
+# BUILDLINK_FILES.foo+= include/bar.h
+# BUILDLINK_FILES.foo+= lib/libfoo.*
+#
+# # We need "libbar.*" to look like "libfoo.*".
+# BUILDLINK_TRANSFORM+= l:bar:foo
+#
+# BUILDLINK_TARGETS+= foo-buildlink
+#
+# foo-buildlink: _BUILDLINK_USE
+# -------------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
+_BLNK_X11PKG_DIR= ${BUILDLINK_DIR:H}/.buildlink-x11pkg
+CONFIGURE_ENV+= BUILDLINK_DIR="${BUILDLINK_DIR}"
+MAKE_ENV+= BUILDLINK_DIR="${BUILDLINK_DIR}"
+_BLNK_CPPFLAGS= -I${LOCALBASE}/include
+_BLNK_LDFLAGS= -L${LOCALBASE}/lib
+
+# 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
+
+.if defined(USE_X11) || defined(USE_X11BASE) || defined(USE_IMAKE)
+. if !defined(_FOR_X11_LINKS_ONLY)
+BUILD_DEPENDS+= x11-links>=0.8:../../pkgtools/x11-links
+. endif
+BUILDLINK_X11_DIR= ${LOCALBASE}/share/x11-links
+CONFIGURE_ENV+= BUILDLINK_X11_DIR="${BUILDLINK_X11_DIR}"
+MAKE_ENV+= BUILDLINK_X11_DIR="${BUILDLINK_X11_DIR}"
+_BLNK_CPPFLAGS+= -I${X11BASE}/include
+_BLNK_LDFLAGS+= -L${X11BASE}/lib
+.endif
+
+CFLAGS:= ${_BLNK_CPPFLAGS} ${CFLAGS}
+CXXFLAGS:= ${_BLNK_CPPFLAGS} ${CXXFLAGS}
+CPPFLAGS:= ${_BLNK_CPPFLAGS} ${CPPFLAGS}
+LDFLAGS:= ${_BLNK_LDFLAGS} ${LDFLAGS}
+
+# Prepend ${BUILDLINK_DIR}/bin to the PATH so that the wrappers are found
+# first when searching for executables.
+#
+PATH:= ${BUILDLINK_DIR}/bin:${PATH}
+
+# Add the proper dependency on each package pulled in by buildlink2.mk
+# files. BUILDLINK_DEPMETHOD.<pkg> is either "full" or "build" to represent
+# either a full dependency or a build dependency on <pkg>. By default,
+# we use a full dependency.
+#
+.for _pkg_ in ${BUILDLINK_PACKAGES}
+. if !defined(BUILDLINK_DEPMETHOD.${_pkg_})
+BUILDLINK_DEPMETHOD.${_pkg_}= full
+. endif
+. if (${BUILDLINK_DEPMETHOD.${_pkg_}} == "full")
+_BUILDLINK_DEPMETHOD.${_pkg_}= DEPENDS
+. elif (${BUILDLINK_DEPMETHOD.${_pkg_}} == "build")
+_BUILDLINK_DEPMETHOD.${_pkg_}= BUILD_DEPENDS
+. endif
+. if defined(BUILDLINK_DEPENDS.${_pkg_}) && \
+ defined(BUILDLINK_PKGSRCDIR.${_pkg_})
+${_BUILDLINK_DEPMETHOD.${_pkg_}}+= \
+ ${BUILDLINK_DEPENDS.${_pkg_}}:${BUILDLINK_PKGSRCDIR.${_pkg_}}
+. endif
+.endfor
+
+# Add each of the *-buildlink targets as a prerequisite for the
+# buildlink target. This ensures that the symlinks are created
+# before any configure scripts or build commands are called.
+#
+.for _target_ in ${BUILDLINK_TARGETS}
+do-buildlink: ${_target_}
+.endfor
+
+# _LT_ARCHIVE_TRANSFORM creates $${dest} from $${file}, where $${file} is
+# a libtool archive (*.la). It allows libtool to properly interact with
+# buildlink at link time by linking against the libraries pointed to by
+# symlinks in ${BUILDLINK_DIR}.
+#
+_LT_ARCHIVE_TRANSFORM_SED= \
+ -e "s|${LOCALBASE}\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g" \
+ -e "s|${X11BASE}\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g"
+
+_LT_ARCHIVE_TRANSFORM= \
+ ${SED} ${_LT_ARCHIVE_TRANSFORM_SED} $${file} > $${dest}
+
+# _BUILDLINK_USE is a macro target that symlinks package files into a new
+# hierarchy under ${BUILDLINK_DIR}.
+#
+# The variables required to be defined to use this target are listed
+# below. <pkgname> refers to the name of the package and should be used
+# consistently.
+#
+# The target that uses this macro target should perform no other actions
+# and be named "<pkgname>-buildlink".
+#
+# BUILDLINK_PREFIX.<pkgname> installation prefix of the package
+#
+# BUILDLINK_FILES.<pkgname> files relative to ${BUILDLINK_PREFIX.<pkgname>}
+# to be symlinked into ${BUILDLINK_DIR};
+# libtool archive files are automatically
+# filtered out and not linked
+#
+# BUILDLINK_TARGETS targets to be invoked during buildlink;
+# the targets should be appended to this variable
+# using +=
+#
+# The variables that may optionally be defined:
+#
+# BUILDLINK_TRANSFORM.<pkgname> sed arguments used to transform the name of
+# the source filename into a destination
+# filename
+#
+_BUILDLINK_USE: .USE
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cookie=${BUILDLINK_DIR}/.${.TARGET:S/-buildlink//}_buildlink_done; \
+ if [ ! -f $${cookie} ]; then \
+ ${ECHO_BUILDLINK_MSG} "Linking ${.TARGET:S/-buildlink//} files into ${BUILDLINK_DIR}."; \
+ ${MKDIR} ${BUILDLINK_DIR}; \
+ case "${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}" in \
+ ${X11BASE}) \
+ ${RM} -f ${_BLNK_X11PKG_DIR} 2>/dev/null; \
+ ${LN} -sf ${BUILDLINK_DIR} ${_BLNK_X11PKG_DIR}; \
+ buildlink_dir="${_BLNK_X11PKG_DIR}"; \
+ ;; \
+ *) \
+ buildlink_dir="${BUILDLINK_DIR}"; \
+ ;; \
+ esac; \
+ files="${BUILDLINK_FILES.${.TARGET:S/-buildlink//}:S/^/${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}\//g}"; \
+ for file in $${files}; do \
+ rel_file=`${ECHO} $${file} | ${SED} -e "s|${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}/||"`; \
+ if [ -z "${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}:Q}" ]; then \
+ dest="$${buildlink_dir}/$${rel_file}"; \
+ else \
+ dest=`${ECHO} $${buildlink_dir}/$${rel_file} | ${SED} ${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}}`; \
+ fi; \
+ if [ -f $${file} ]; then \
+ dir=`${DIRNAME} $${dest}`; \
+ if [ ! -d $${dir} ]; then \
+ ${MKDIR} $${dir}; \
+ fi; \
+ ${RM} -f $${dest}; \
+ case $${file} in \
+ *.la) \
+ ${_LT_ARCHIVE_TRANSFORM}; \
+ ;; \
+ *) \
+ ${LN} -sf $${file} $${dest}; \
+ ;; \
+ esac; \
+ if [ -z "${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}:Q}" ]; then \
+ ${ECHO} $${file} >> $${cookie}; \
+ else \
+ ${ECHO} "$${file} -> $${dest}" >> $${cookie}; \
+ fi; \
+ else \
+ ${ECHO} "$${file}: not found" >> $${cookie}; \
+ fi; \
+ done; \
+ ${TOUCH} ${TOUCH_FLAGS} $${cookie}; \
+ fi
+
+do-buildlink: buildlink-wrappers
+
+# _BLNK_TRANSFORM mini language for translating wrapper arguments into
+# their buildlink equivalents:
+#
+# I:src:dst translates "-Isrc" into "-Idst"
+# II:src:dst1,dst2 translates "-Isrc" into "-Idst1 -Idst2"
+# L:src:dst translates "-Lsrc" into "-Ldst"
+# LL:src:dst1,dst2 translates "-Lsrc" into "-Ldst1 -Ldst2"
+# l:foo:bar translates "-lfoo" into "-lbar"
+# r:dir removes "dir" and "dir/*"
+#
+_BLNK_TRANSFORM+= I:${LOCALBASE}:${BUILDLINK_DIR}
+_BLNK_TRANSFORM+= L:${LOCALBASE}:${BUILDLINK_DIR}
+_BLNK_TRANSFORM+= ${BUILDLINK_TRANSFORM}
+.if defined(USE_X11) || defined(USE_X11BASE) || defined(USE_IMAKE)
+_BLNK_TRANSFORM+= II:${X11BASE}:${_BLNK_X11PKG_DIR},${BUILDLINK_X11_DIR}
+_BLNK_TRANSFORM+= LL:${X11BASE}:${_BLNK_X11PKG_DIR},${BUILDLINK_X11_DIR}
+.endif
+.if ${LOCALBASE} != "/usr/pkg"
+_BLNK_TRANSFORM+= r:-I/usr/pkg
+_BLNK_TRANSFORM+= r:-L/usr/pkg
+.endif
+.if ${LOCALBASE} != "/usr/local"
+_BLNK_TRANSFORM+= r:-I/usr/local
+_BLNK_TRANSFORM+= r:-L/usr/local
+.endif
+#
+# Create _BLNK_TRANSFORM_SED.{1,2,3} from _BLNK_TRANSFORM. We must use
+# separate variables instead of just one because the contents are too long
+# for one variable when we substitute into a shell script later on.
+#
+# Change "/usr/pkg/lib/libfoo.so" into "-L/usr/pkg/lib -lfoo" and
+# "/usr/X11R6/lib/libbar.so" into "-L/usr/X11R6/lib -lbar".
+#
+_BLNK_TRANSFORM_SED.1+= \
+ -e "s|\(${LOCALBASE}/[^ ]*\)/lib\([^ ]*\)\.a|-L\1 -l\2|g" \
+ -e "s|\(${LOCALBASE}/[^ ]*\)/lib\([^ ]*\)\.so|-L\1 -l\2|g"
+_BLNK_TRANSFORM_SED.1+= \
+ -e "s|\(${X11BASE}/[^ ]*\)/lib\([^ ]*\)\.a|-L\1 -l\2|g" \
+ -e "s|\(${X11BASE}/[^ ]*\)/lib\([^ ]*\)\.so|-L\1 -l\2|g"
+#
+# Transform "I:/usr/pkg:/buildlink" into:
+# -e "s|-I/usr/pkg |-I/buildlink |g"
+# -e "s|-I/usr/pkg$|-I/buildlink|g"
+# -e "s|-I/usr/pkg/\([^ ]*\)|-I/buildlink/\1|g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:MI\:*\:*}
+_BLNK_TRANSFORM_SED.2+= \
+ -e "s|-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\1/} |-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\2/} |g" \
+ -e "s|-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\1/}$$|-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\2/}|g" \
+ -e "s|-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\1/}/\([^ ]*\)|-I${_transform_:C/^I\:([^\:]*)\:([^\:]*)$/\2/}/\1|g"
+.endfor
+#
+# Transform "II:/usr/X11R6:/buildlink,/x11-links" into:
+# -e "s|-I/usr/X11R6 |-I/buildlink -I/x11-links |g"
+# -e "s|-I/usr/X11R6$|-I/buildlink -I/x11-links|g"
+# -e "s|-I/usr/X11R6/\([^ ]*\)|-I/buildlink/\1 -I/x11-links/\1|g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:MII\:*\:*,*}
+_BLNK_TRANSFORM_SED.2+= \
+ -e "s|-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/} |-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/} -I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/} |g" \
+ -e "s|-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}$$|-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/} -I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}|g" \
+ -e "s|-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}/\([^ ]*\)|-I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/}/\1 -I${_transform_:C/^II\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}/\1|g"
+.endfor
+#
+# Transform "L:/usr/pkg:/buildlink" into:
+# -e "s|-L/usr/pkg |-L/buildlink |g"
+# -e "s|-L/usr/pkg$|-L/buildlink|g"
+# -e "s|-L/usr/pkg/\([^ ]*\)|-L/buildlink/\1|g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:ML\:*\:*}
+_BLNK_TRANSFORM_SED.2+= \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/} |-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/} |g" \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/}$$|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/}|g" \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/}/\([^ ]*\)|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/}/\1|g"
+_BLNK_UNTRANSFORM_SED.2+= \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/} |-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/} |g" \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/}$$|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/}|g" \
+ -e "s|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\2/}/\([^ ]*\)|-L${_transform_:C/^L\:([^\:]*)\:([^\:]*)$/\1/}/\1|g"
+.endfor
+#
+# Transform "LL:/usr/X11R6:/buildlink,/x11-links" into:
+# -e "s|-L/usr/X11R6 |-L/buildlink -L/x11-links |g"
+# -e "s|-L/usr/X11R6$|-L/buildlink -L/x11-links|g"
+# -e "s|-L/usr/X11R6/\([^ ]*\)|-L/buildlink/\1 -L/x11-links/\1|g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:MLL\:*\:*,*}
+_BLNK_TRANSFORM_SED.2+= \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/} |-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/} -L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/} |g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}$$|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/} -L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}|g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}/\([^ ]*\)|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/}/\1 -L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}/\1|g"
+_BLNK_UNTRANSFORM_SED.2+= \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/} |-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/} |g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/} |-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/} |g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/}$$|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}|g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}$$|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}|g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\2/}/\([^ ]*\)|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}/\1|g" \
+ -e "s|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\3/}/\([^ ]*\)|-L${_transform_:C/^LL\:([^\:]*)\:([^\:]*),([^\:]*)$/\1/}/\1|g"
+.endfor
+#
+# Transform "l:foo:bar" into:
+# -e "s|-lfoo |-lbar |g"
+# -e "s|-lfoo$|-lbar|g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:Ml\:*}
+_BLNK_TRANSFORM_SED.2+= \
+ -e "s|-l${_transform_:C/^l\:([^\:]*)\:([^\:]*)$/\1/} |-l${_transform_:C/^l\:([^\:]*)\:([^\:]*)$/\2/} |g" \
+ -e "s|-l${_transform_:C/^l\:([^\:]*)\:([^\:]*)$/\1/}$$|-l${_transform_:C/^l\:([^\:]*)\:([^\:]*)$/\2/}|g"
+.endfor
+#
+# Fix up references to the x11-links directory.
+#
+.if defined(USE_X11) || defined(USE_X11BASE) || defined(USE_IMAKE)
+_BLNK_TRANSFORM_SED.3+= \
+ -e "s|${BUILDLINK_DIR}/\(${BUILDLINK_X11_DIR:S/^${LOCALBASE}\///}\)|${LOCALBASE}/\1|g"
+.endif
+#
+# Transform "r:-I/usr/local" into:
+# -e "s|-I/usr/local ||g"
+# -e "s|-I/usr/local$||g"
+# -e "s|-I/usr/local/\([^ ]*\)||g"
+#
+.for _transform_ in ${_BLNK_TRANSFORM:Mr\:*}
+_BLNK_TRANSFORM_SED.3+= \
+ -e "s|${_transform_:S/^r://} ||g" \
+ -e "s|${_transform_:S/^r://}$$||g" \
+ -e "s|${_transform_:S/^r://}/[^ ]*||g"
+.endfor
+#
+# Explicitly remove "-I/usr/include" and "-L/usr/lib" as they're redundant.
+#
+_BLNK_TRANSFORM_SED.3+= \
+ -e "s|-I/usr/include ||g" \
+ -e "s|-I/usr/include$$||g" \
+ -e "s|-L/usr/lib ||g" \
+ -e "s|-L/usr/lib$$||g"
+
+# Generate wrapper scripts for the compiler tools that sanitize the
+# argument list by converting references to ${LOCALBASE} and ${X11BASE}
+# into references to ${BUILDLINK_DIR}, ${_BLNK_X11PKG_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 F77
+.endif
+.if defined(USE_LIBTOOL)
+PKGLIBTOOL= ${BUILDLINK_LIBTOOL}
+.endif
+_BLNK_WRAPPEES+= LIBTOOL
+.if defined(USE_X11) || defined(USE_X11BASE) || defined(USE_IMAKE)
+IMAKE?= ${X11BASE}/bin/imake
+_BLNK_WRAPPEES+= IMAKE
+.endif
+_ALIASES.AS= as
+_ALIASES.CC= cc gcc
+_ALIASES.CXX= c++ g++
+_ALIASES.CPP= cpp
+_ALIASES.FC= f77 g77
+_ALIASES.LD= ld
+
+# On Darwin, protect against using /bin/sh if it's zsh.
+.if ${OPSYS} == "Darwin"
+. if exists(/bin/bash)
+BUILDLINK_SHELL?= /bin/bash
+. else
+BUILD_DEPENDS+= bash-[0-9]*:../../shells/bash2
+BUILDLINK_SHELL?= ${LOCALBASE}/bin/bash
+. endif
+.else
+BUILDLINK_SHELL?= ${SH}
+.endif
+
+# _BLNK_WRAP_*.<wrappee> variables represent "template methods" of the
+
+# wrapper script that may be customized per wrapper:
+#
+# _BLNK_WRAP_ENV.<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/buildlink2/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_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_WRAP_SANITIZE_PATH= \
+ PATH="${PATH:C/:${BUILDLINK_DIR}[^:]*//:C/${BUILDLINK_DIR}[^:]*://}"
+_BLNK_WRAP_PRE_CACHE= ${BUILDLINK_DIR}/bin/.pre-cache
+_BLNK_WRAP_POST_CACHE= ${BUILDLINK_DIR}/bin/.post-cache
+_BLNK_WRAP_CACHE= ${BUILDLINK_DIR}/bin/.cache
+_BLNK_WRAP_LOGIC= ${BUILDLINK_DIR}/bin/.logic
+_BLNK_WRAP_POST_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.post-cache-trans
+_BLNK_WRAP_CACHE_TRANSFORM= ${BUILDLINK_DIR}/bin/.cache-trans
+_BLNK_WRAP_LOGIC_TRANSFORM= ${BUILDLINK_DIR}/bin/.logic-trans
+_BLNK_WRAP_LOG= ${BUILDLINK_DIR}/.wrapper.log
+_BLNK_LIBTOOL_FIX_LA= ${BUILDLINK_DIR}/bin/.libtool-fix-la
+
+.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/buildlink2/wrapper.sh
+_BLNK_WRAP_ENV.${_wrappee_}= ${_wrappee_}="${BUILDLINK_${_wrappee_}:T}"
+_BLNK_WRAP_SANITIZE_PATH.${_wrappee_}= ${_BLNK_WRAP_SANITIZE_PATH}
+_BLNK_WRAP_PRE_CACHE.${_wrappee_}= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_POST_CACHE.${_wrappee_}= ${_BLNK_WRAP_POST_CACHE_TRANSFORM}
+_BLNK_WRAP_CACHE.${_wrappee_}= ${_BLNK_WRAP_CACHE_TRANSFORM}
+_BLNK_WRAP_LOGIC.${_wrappee_}= ${_BLNK_WRAP_LOGIC_TRANSFORM}
+.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_ENV.AS= # empty
+_BLNK_WRAP_ENV.CPP= # empty
+
+# Don't override the default LIBTOOL setting in the environment, as
+# it already correctly points to ${PKGLIBTOOL}, and don't sanitize the PATH
+# because we want libtool to invoke the wrapper scripts, too.
+#
+_BLNK_WRAP_ENV.LIBTOOL= # empty
+_BLNK_WRAPPER_SH.LIBTOOL= ${.CURDIR}/../../mk/buildlink2/libtool.sh
+_BLNK_WRAP_SANITIZE_PATH.LIBTOOL= # empty
+
+# In the libtool archives, we must remove references to the buildlink
+# directories and change any -llib to the proper replacement libraries
+# (-lreadline -> -ledit, etc.). Redundant -Ldir options are removed to
+# optimize the resulting libtool archives.
+#
+_BLNK_WRAP_LT_UNTRANSFORM_SED= ${LIBTOOL_ARCHIVE_UNTRANSFORM_SED}
+_BLNK_WRAP_LT_UNTRANSFORM_SED+= ${_BLNK_UNTRANSFORM_SED.1}
+_BLNK_WRAP_LT_UNTRANSFORM_SED+= ${_BLNK_UNTRANSFORM_SED.2}
+_BLNK_WRAP_LT_UNTRANSFORM_SED+= ${_BLNK_UNTRANSFORM_SED.3}
+_BLNK_WRAP_LT_UNTRANSFORM_SED+= -e "s|-L/usr/lib ||g"
+_BLNK_WRAP_LT_UNTRANSFORM_SED+= -e "s|-L/usr/lib$$||g"
+
+# 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) || defined(USE_X11BASE) || defined(USE_IMAKE)
+_BLNK_WRAP_PRE_CACHE.IMAKE= ${_BLNK_WRAP_PRE_CACHE}
+_BLNK_WRAP_POST_CACHE.IMAKE= ${_BLNK_WRAP_POST_CACHE}
+_BLNK_WRAP_CACHE.IMAKE= ${_BLNK_WRAP_CACHE}
+_BLNK_WRAP_LOGIC.IMAKE= ${_BLNK_WRAP_LOGIC}
+.endif
+
+buildlink-wrappers: ${_BLNK_WRAP_CACHE}
+buildlink-wrappers: ${_BLNK_WRAP_CACHE_TRANSFORM}
+buildlink-wrappers: ${_BLNK_WRAP_LOGIC}
+buildlink-wrappers: ${_BLNK_WRAP_LOGIC_TRANSFORM}
+.if defined (USE_LIBTOOL)
+buildlink-wrappers: ${_BLNK_LIBTOOL_FIX_LA}
+.endif
+
+.for _wrappee_ in ${_BLNK_WRAPPEES}
+CONFIGURE_ENV+= ${_BLNK_WRAP_ENV.${_wrappee_}}
+MAKE_ENV+= ${_BLNK_WRAP_ENV.${_wrappee_}}
+
+BUILDLINK_${_wrappee_}= \
+ ${BUILDLINK_DIR}/bin/${${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+
+buildlink-wrappers: ${BUILDLINK_${_wrappee_}}
+${BUILDLINK_${_wrappee_}}: \
+ ${_BLNK_WRAPPER_SH.${_wrappee_}} \
+ ${_BLNK_WRAP_PRE_CACHE.${_wrappee_}} \
+ ${_BLNK_WRAP_POST_CACHE.${_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 [ -x $${dir}/$${wrappee} ]; then \
+ absdir=$${dir}/; \
+ wrappee=$${absdir}$${wrappee}; \
+ break; \
+ fi; \
+ ;; \
+ esac; \
+ done; \
+ IFS="$$OLDIFS"; \
+ if [ ! -x "$${wrappee}" ]; then \
+ ${ECHO_BUILDLINK_MSG} "$${wrappee}: No such file"; \
+ exit 1; \
+ fi; \
+ ;; \
+ esac; \
+ ${MKDIR} ${.TARGET:H}; \
+ ${CAT} ${_BLNK_WRAPPER_SH.${_wrappee_}} | \
+ ${SED} -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g" \
+ -e "s|@BUILDLINK_SHELL@|${BUILDLINK_SHELL}|g" \
+ -e "s|@CAT@|${CAT:Q}|g" \
+ -e "s|@ECHO@|${ECHO:Q}|g" \
+ -e "s|@SED@|${SED:Q}|g" \
+ -e "s|@TOUCH@|${TOUCH:Q}|g" \
+ -e "s|@WRAPPEE@|$${absdir}${${_wrappee_}: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_PRE_CACHE@|${_BLNK_WRAP_PRE_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_POST_CACHE@|${_BLNK_WRAP_POST_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_CACHE@|${_BLNK_WRAP_CACHE.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_LOGIC@|${_BLNK_WRAP_LOGIC.${_wrappee_}:Q}|g" \
+ -e "s|@_BLNK_WRAP_SANITIZE_PATH@|${_BLNK_WRAP_SANITIZE_PATH.${_wrappee_}:Q}|g" \
+ > ${.TARGET}; \
+ ${CHMOD} +x ${.TARGET}
+
+. 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_
+
+${_BLNK_WRAP_PRE_CACHE}: ${.CURDIR}/../../mk/buildlink2/pre-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@WRKDIR@|${WRKDIR}|g" \
+ -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g" \
+ -e "s|@BUILDLINK_X11_DIR@|${BUILDLINK_X11_DIR}|g" \
+ -e "s|@_BLNK_X11PKG_DIR@|${_BLNK_X11PKG_DIR}|g" \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_POST_CACHE}: ${.CURDIR}/../../mk/buildlink2/post-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@LOCALBASE@|${LOCALBASE}|g" \
+ -e "s|@X11BASE@|${X11BASE}|g" \
+ -e 's|@ECHO@|${ECHO}|g' \
+ -e 's|@_BLNK_TRANSFORM_SED.1@||g' \
+ -e 's|@_BLNK_TRANSFORM_SED.2@||g' \
+ -e 's|@_BLNK_TRANSFORM_SED.3@||g' \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_POST_CACHE_TRANSFORM}: ${.CURDIR}/../../mk/buildlink2/post-cache
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@LOCALBASE@|${LOCALBASE}|g" \
+ -e "s|@X11BASE@|${X11BASE}|g" \
+ -e 's|@ECHO@|${ECHO}|g' \
+ -e 's|@_BLNK_TRANSFORM_SED.1@|${_BLNK_TRANSFORM_SED.1:Q}|g' \
+ -e 's|@_BLNK_TRANSFORM_SED.2@|${_BLNK_TRANSFORM_SED.2:Q}|g' \
+ -e 's|@_BLNK_TRANSFORM_SED.3@|${_BLNK_TRANSFORM_SED.3:Q}|g' \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+${_BLNK_WRAP_CACHE}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+${_BLNK_WRAP_CACHE_TRANSFORM}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
+
+${_BLNK_WRAP_LOGIC}: \
+ ${_BLNK_WRAP_PRE_CACHE} \
+ ${_BLNK_WRAP_POST_CACHE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} > ${.TARGET}
+
+${_BLNK_WRAP_LOGIC_TRANSFORM}: \
+ ${_BLNK_WRAP_PRE_CACHE} \
+ ${_BLNK_WRAP_POST_CACHE_TRANSFORM}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} > ${.TARGET}
+
+${_BLNK_LIBTOOL_FIX_LA}: ${.CURDIR}/../../mk/buildlink2/libtool-fix-la
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${SED} \
+ -e "s|@BASENAME@|${BASENAME:Q}|g" \
+ -e "s|@CAT@|${CAT:Q}|g" \
+ -e "s|@CP@|${CP:Q}|g" \
+ -e "s|@DIRNAME@|${DIRNAME:Q}|g" \
+ -e "s|@ECHO@|${ECHO: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' \
+ ${.ALLSRC} > ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${MV} -f ${.TARGET}.tmp ${.TARGET}
+
+clear-buildlink-cache: remove-buildlink-cache buildlink-wrappers
+
+remove-buildlink-cache:
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${_BLNK_WRAP_CACHE_TRANSFORM}
+ ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${_BLNK_WRAP_LOGIC_TRANSFORM}
+
+_BLNK_CHECK_PATTERNS+= -e "-I${LOCALBASE}/[a-rt-z]"
+_BLNK_CHECK_PATTERNS+= -e "-L${LOCALBASE}/[a-rt-z]"
+_BLNK_CHECK_PATTERNS+= -e "-I${X11BASE}/"
+_BLNK_CHECK_PATTERNS+= -e "-L${X11BASE}/"
+
+buildlink-check:
+ @if [ -f ${_BLNK_WRAP_LOG} ]; then \
+ ${GREP} ${_BLNK_CHECK_PATTERNS} ${_BLNK_WRAP_LOG} || ${TRUE}; \
+ fi
View
91 mk/buildlink2/buildlink2.txt
@@ -0,0 +1,91 @@
+$NetBSD: buildlink2.txt,v 1.2 2002/08/22 08:21:29 jlam Exp $
+
+The buildlink2 framework is a departure from the original buildlink
+framework, which tries to do its work up-front before the configure
+process and fix things up after the build process. Over time, the
+buildlink framework grew overly complex to deal with software that stored
+build-time information in the installed files, e.g. GNOME packages. The
+new framework actually does its work as the software is being configured
+and built through a series of wrapper scripts that are used in place of the
+normal compiler tools. We still symlink libraries and headers into
+${BUILDLINK_DIR} to normalize the environment in which the software is
+built, but now we tell the configure process the actual installed locations
+of the libraries and headers we are using, and the compiler wrappers will
+munge them into references into ${BUILDLINK_DIR}.
+
+To-do list:
+
+ (*) regression test targets to make sure _BLNK_TRANSFORM_SED is doing
+ what it's supposed to do
+
+Here are some FAQs and answers regarding buildlink2:
+
+Q: Why is the buildlink2 framework better than the existing one?
+A: There are several reasons:
+
+ (1) The new framework makes it simpler to buildinkify a package because
+ we just convert dependencies into including the equivalent
+ buildlink2.mk files and define USE_BUILDLINK2_ONLY. We don't need
+ to lie about where libraries or headers we use are installed.
+
+ (2) All packages using the new framework are strongly buildlinked; it
+ is not possible to create weakly buildlinked packages. This
+ deprecates the need for x11.buildlink.mk.
+
+ (3) We no longer care if the configure or build processes add
+ -I${PREFIX}/include or -L${PREFIX}/lib to the compiler or linker
+ lines. We _want_ them to do so (and we actually add them
+ ourselves) since they are munged into references to
+ ${BUILDLINK_DIR) by the wrapper scripts.
+
+ (4) We no longer need to create and use config script wrappers.
+
+ (5) buildlink2.mk files now simply create the <pkg>-buildlink target
+ and can discard the REPLACE_BUILDLINK and *CONFIG_WRAPPER* lines.
+
+ (6) We no longer mess around with configure scripts or Makefiles before
+ the build process, so we don't accidentally trigger rebuilds of
+ those files if the software uses GNU autoconf/automake.
+
+ (7) We no longer mess around with libtool archives after the build
+ process, so we don't accidentally trigger rebuilds of those files
+ during the install process.
+
+Q: How does this affect packages that use the existing buildlink framework?
+A: The buildlink and buildlink2 frameworks can coexist within pkgsrc, but
+ packages that use the new framework must be use it exclusively, i.e. a
+ package Makefile can't include both buildlink.mk and buildlink2.mk
+ files. Packages that use the old framework can continue to do so, but
+ it is encouraged that they convert to the new buildlink2 framework for
+ the benefits listed earlier.
+
+Q: Can I make strongly buildlinked packages that use imake?
+A: Yes. Packages that use imake to drive the configuration and build
+ processes can now be strongly buildlinked as well.
+
+Q: How do I use compilers other than the system-supplied cc? I currently
+ set CC=/my/special/c-compiler in /etc/mk.conf.
+A: It should Just Work. The wrapper scripts automatically handle this
+ situation. The software is told to use CC=cc, which points to the
+ special compiler wrapper script in ${BUILDLINK_DIR}/bin/cc, but the
+ wrapper itself will call the CC that you explicitly set.
+
+Q: So what's bad about the new buildlink2 framework?
+A: The full build now takes longer than it used to. Since we are using
+ wrapper scripts in place of the compilers, we bear the cost of the extra
+ shell processes invoked as a result. The increased build times on the
+ platforms on which I was able to test are roughly:
+
+ NetBSD-1.5ZC/i386 ~1% (non-USE_LIBTOOL)
+ ~3% (USE_LIBTOOL)
+
+ NetBSD-1.5.1/mac68k +?% (USE_LIBTOOL)
+
+ The i386 box is an Intel P3 850MHz + UDMA IDE HD + 512MB SDRAM.
+ The mac68k box is a Quadra 650 (68040) + SCSI2 HD + 48MB RAM.
+
+Q: What happened to x11.buildlink.mk?
+A: x11.buildlink.mk is now deprecated, as it's all handled directly by
+ the buildlink2.mk framework. However, in converting packages to use
+ buildlink2, if it uses x11.buildlink.mk, then you will need to define
+ USE_X11 if USE_X11BASE is not already defined.
View
100 mk/buildlink2/libtool-fix-la
@@ -0,0 +1,100 @@
+# $NetBSD: libtool-fix-la,v 1.2 2002/08/22 08:21:29 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.
+
+labase=`@BASENAME@ $lafile .la`
+ladir=`@DIRNAME@ $lafile`
+latimestamp=${ladir}/.${labase}.la.timestamp
+laifile=${ladir}/.libs/${labase}.lai
+if [ ! -f $latimestamp ]; then
+ . ${ladir}/${labase}.la
+
+ relink=
+ for i in ${relink_command}; do
+ case "$i" in
+ -I*|-D*)
+ ;;
+ -L*)
+ case "$relink" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) relink="${relink} $i" ;;
+ esac
+ ;;
+ $lafile)
+ relink="${relink} $i"
+ ;;
+ *.la)
+ ltlibsdir=`@DIRNAME@ $i`/.libs
+ case "$relink" in
+ *"-L$ltlibsdir "*) ;;
+ *"-L$ltlibsdir") ;;
+ *) relink="$relink -L$ltlibsdir" ;;
+ esac
+ relink="${relink} $i"
+ ;;
+ *)
+ relink="${relink} $i"
+ ;;
+ esac
+ done
+ if [ -n "$relink" ]; then
+ @MV@ -f $lafile ${lafile}.blsav
+ (
+ @CAT@ ${lafile}.blsav | @SED@ -e '/^relink_command=/,$d'
+ @ECHO@ "relink_command='$relink'"
+ @CAT@ ${lafile}.blsav | @SED@ -e '1,/^relink_command=/d'
+ ) > $lafile
+ @ECHO@ "==> Fixed $lafile" >> $wrapperlog
+ fi
+ if [ -n "$laifile" ] && [ -f "$laifile" ]; then
+ @SED@ @_BLNK_WRAP_LT_UNTRANSFORM_SED@ \
+ $laifile > ${laifile}.tmp
+ . ${laifile}.tmp
+ L=; l=; lexist=; prev=
+ for i in ${dependency_libs}; do
+ case "$i" in
+ $prev)
+ ;;
+ -L*)
+ case "$L" in
+ *"$i "*) ;;
+ *"$i") ;;
+ *) L="$L $i" ;;
+ esac
+ ;;
+ -l*)
+ lexist=1
+ l="$l $i"
+ ;;
+ *)
+ l="$l $i"
+ ;;
+ esac
+ prev="$i"
+ done
+ if [ -z "$lexist" ]; then
+ L=
+ fi
+ deps="$L$l"
+ @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'
+ ) > ${laifile}
+ @RM@ -f ${laifile}.tmp
+ @ECHO@ "==> Fixed $laifile" >> $wrapperlog
+ fi
+ @TOUCH@ $latimestamp
+fi
View
80 mk/buildlink2/libtool.sh
@@ -0,0 +1,80 @@
+#!@BUILDLINK_SHELL@
+#
+# $NetBSD: libtool.sh,v 1.2 2002/08/22 08:21:29 jlam Exp $
+
+Xsed='@SED@ -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+pre_cache="@_BLNK_WRAP_PRE_CACHE@"
+cache="@_BLNK_WRAP_CACHE@"
+post_cache="@_BLNK_WRAP_POST_CACHE@"
+logic="@_BLNK_WRAP_LOGIC@"
+libtool_fix_la="@_BLNK_LIBTOOL_FIX_LA@"
+wrapperlog="@_BLNK_WRAP_LOG@"
+updatecache=${BUILDLINK_UPDATE_CACHE-yes}
+
+cmd="@WRAPPEE@"
+lafile=
+while [ $# -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 [ "$arg" = "--mode=install" ] || \
+ [ "$arg" = "--mode" -a "$1" = "install" ]; then
+ args="$args $arg"
+ while [ $# -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
+ args="$args $arg"
+ done
+ break
+ fi
+ ;;
+ -o)
+ case "$1" in
+ *.la) lafile="$1" ;;
+ esac
+ ;;
+ *)
+ cacheupdated=
+ . $logic
+ case "$cacheupdated" in
+ yes) @CAT@ $pre_cache $cache $post_cache > $logic ;;
+ esac
+ ;;
+ esac
+ args="$args $arg"
+done
+cmd="$cmd $args"
+
+@_BLNK_WRAP_SANITIZE_PATH@
+
+@ECHO@ $cmd >> $wrapperlog
+eval $cmd
+wrapper_result=$?
+
+if [ -n "$lafile" ] && [ -f "$lafile" ]; then
+ . $libtool_fix_la
+fi
+
+exit ${wrapper_result}
View
61 mk/buildlink2/post-cache
@@ -0,0 +1,61 @@
+# $NetBSD: post-cache,v 1.2 2002/08/22 08:21:29 jlam Exp $
+
+*)
+ case $arg in
+ *[\`\"\$\\])
+ arg=`@ECHO@ X$arg | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ case $updatecache in
+ yes)
+ newarg=`@ECHO@ X$arg | $Xsed -e "$sed_quote_subst"`
+ @ECHO@ "$arg) arg=\"$newarg\" ;; #1" >> $cache
+ cacheupdated=yes
+ ;;
+ esac
+ ;;
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ case $updatecache in
+ yes)
+ newarg=`@ECHO@ X$arg | $Xsed -e "$sed_quote_subst"`
+ @ECHO@ "$arg) arg=\"$newarg\" ;; #2" >> $cache
+ cacheupdated=yes
+ ;;
+ esac
+ ;;
+ -D*)
+ arg=`@ECHO@ X$arg | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ case $updatecache in
+ yes)
+ newarg=`@ECHO@ X$arg | $Xsed -e "$sed_quote_subst"`
+ @ECHO@ "$arg) arg=\"$newarg\" ;; #3" >> $cache
+ cacheupdated=yes
+ ;;
+ esac
+ ;;
+ -[ILl]*|-Wl,*|@LOCALBASE@/*/lib*|@X11BASE@/*/lib*)
+ newarg=`@ECHO@ "X$arg" | $Xsed \
+ @_BLNK_TRANSFORM_SED.1@ \
+ @_BLNK_TRANSFORM_SED.2@ \
+ @_BLNK_TRANSFORM_SED.3@ \
+ `
+ case $updatecache in
+ yes)
+ @ECHO@ "$arg) arg=\"$newarg\" ;; #4" >> $cache
+ cacheupdated=yes
+ ;;
+ esac
+ arg="$newarg"
+ ;;
+ esac
+ ;;
+esac
View
7 mk/buildlink2/pre-cache
@@ -0,0 +1,7 @@
+# $NetBSD: pre-cache,v 1.2 2002/08/22 08:21:29 jlam Exp $
+
+case $arg in
+-[IL]@WRKDIR@*|-[IL]@BUILDLINK_DIR@*|-[IL]@BUILDLINK_X11_DIR@*|-[IL]@_BLNK_X11PKG_DIR@*)
+ ;;
+-[IL].|-[IL]./..*|-[IL]..*)
+ ;;
View
29 mk/buildlink2/wrapper.sh
@@ -0,0 +1,29 @@
+#!@BUILDLINK_SHELL@
+#
+# $NetBSD: wrapper.sh,v 1.2 2002/08/22 08:21:30 jlam Exp $
+
+Xsed='@SED@ -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+pre_cache="@_BLNK_WRAP_PRE_CACHE@"
+cache="@_BLNK_WRAP_CACHE@"
+post_cache="@_BLNK_WRAP_POST_CACHE@"
+logic="@_BLNK_WRAP_LOGIC@"
+wrapperlog="@_BLNK_WRAP_LOG@"
+updatecache=${BUILDLINK_UPDATE_CACHE-yes}
+
+cmd="@WRAPPEE@"
+for arg; do
+ cacheupdated=no
+ . $logic
+ case "$cacheupdated" in
+ yes) @CAT@ $pre_cache $cache $post_cache > $logic ;;
+ esac
+ args="$args $arg"
+done
+cmd="$cmd $args"
+
+@_BLNK_WRAP_SANITIZE_PATH@
+
+@ECHO@ $cmd >> $wrapperlog
+eval exec $cmd
View
2  mk/bulk/bsd.bulk-pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.bulk-pkg.mk,v 1.39 2002/07/21 11:53:19 mrauch Exp $
+# $NetBSD: bsd.bulk-pkg.mk,v 1.40 2002/08/22 08:21:30 jlam Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
View
2  mk/bulk/build
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: build,v 1.24 2002/08/12 14:20:59 agc Exp $
+# $NetBSD: build,v 1.25 2002/08/22 08:21:30 jlam Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
View
2  mk/bulk/build.conf-example
@@ -1,5 +1,5 @@
# build.conf
-# $NetBSD: build.conf-example,v 1.12 2002/08/20 02:17:56 hubertf Exp $
+# $NetBSD: build.conf-example,v 1.13 2002/08/22 08:21:30 jlam Exp $
#
# config file in /bin/sh syntax for {,pre,post}-build
#
View
2  mk/bulk/mksandbox
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: mksandbox,v 1.8 2002/08/15 10:42:19 seb Exp $
+# $NetBSD: mksandbox,v 1.9 2002/08/22 08:21:30 jlam Exp $
#
#
# Copyright (c) 2002 Alistair G. Crooks. All rights reserved.
View
2  mk/bulk/post-build
@@ -1,5 +1,5 @@
#!/usr/pkg/bin/perl
-# $NetBSD: post-build,v 1.20 2002/08/12 08:46:54 agc Exp $
+# $NetBSD: post-build,v 1.21 2002/08/22 08:21:30 jlam Exp $
#
# Collect stuff after a pkg bulk build
#
View
2  mk/bulk/pre-build
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: pre-build,v 1.23 2002/08/20 02:17:57 hubertf Exp $
+# $NetBSD: pre-build,v 1.24 2002/08/22 08:21:31 jlam Exp $
#
# Clean up system to be ready for bulk pkg build
#
View
2  mk/bulk/printdepends
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: printdepends,v 1.10 2002/08/07 10:56:12 agc Exp $
+# $NetBSD: printdepends,v 1.11 2002/08/22 08:21:31 jlam Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
View
2  mk/bulk/printindex
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: printindex,v 1.9 2002/08/07 10:56:12 agc Exp $
+# $NetBSD: printindex,v 1.10 2002/08/22 08:21:31 jlam Exp $
#
#
# Copyright (c) 2001 The NetBSD Foundation, Inc.
View
2  mk/gnu-config/config.guess
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# $NetBSD: config.guess,v 1.2 2002/07/16 15:13:51 schmonz Exp $
+# $NetBSD: config.guess,v 1.3 2002/08/22 08:21:31 jlam Exp $
#
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
View
2  mk/gnu-config/config.sub
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# $NetBSD: config.sub,v 1.2 2002/07/16 15:13:52 schmonz Exp $
+# $NetBSD: config.sub,v 1.3 2002/08/22 08:21:31 jlam Exp $
#
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
View
2  mk/install/deinstall
@@ -1,6 +1,6 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.11 2002/07/24 20:30:06 jlam Exp $
+# $NetBSD: deinstall,v 1.12 2002/08/22 08:21:31 jlam Exp $
eval set -- ${PKG_USERS}
for userset; do
View
2  mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.12 2002/07/24 20:30:06 jlam Exp $
+# $NetBSD: header,v 1.13 2002/08/22 08:21:32 jlam Exp $
PKGNAME=$1
STAGE=$2
View
2  mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.11 2002/07/24 20:30:07 jlam Exp $
+# $NetBSD: install,v 1.12 2002/08/22 08:21:32 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
View
156 mk/motif.buildlink2.mk
@@ -0,0 +1,156 @@
+# $NetBSD: motif.buildlink2.mk,v 1.2 2002/08/22 08:21:27 jlam Exp $
+#
+# USE_MOTIF12
+# use a Motif-1.2-compatible installation, otherwise, assume
+# we want a Motif-2.0-compatible installation
+#
+# MOTIFBASE, MOTIF12BASE
+# choose the Motif-2.0 or Motif-1.2-compatible installation at the
+# named location
+#
+# MOTIF_TYPE, MOTIF12_TYPE
+# choose a specific Motif-2.0 or Motif-1.2-compatible package.
+
+.if !defined(MOTIF_BUILDLINK2_MK)
+MOTIF_BUILDLINK2_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if defined(USE_MOTIF12)
+#
+# If /usr/dt is a valid Motif-1.2 installation, then use it. Otherwise,
+# if ${X11BASE} is valid, then use it. Otherwise, use the Motif-1.2
+# specified by ${MOTIF12_TYPE_DEFAULT}.
+#
+. if exists(/usr/dt/include/Xm/Xm.h) && \
+ !exists(/usr/dt/include/Xm/Gadget.h)
+_MOTIF_TYPE= dt
+. elif exists(${X11BASE}/include/Xm/Xm.h) && \
+ !exists(${X11BASE}/include/Xm/Gadget.h)
+_MOTIF_TYPE= none
+. else
+_MOTIF_TYPE= ${MOTIF12_TYPE_DEFAULT}
+. endif
+.else
+#
+# If /usr/dt is a valid Motif-2.0 installation, then use it. Otherwise,
+# check to see if a pkgsrc Motif-2.0 is installed and valid, then use it.
+# Otherwise, if ${X11BASE} is valid, then use it. Otherwise, use the
+# Motif-2.0 specified by ${MOTIF_TYPE_DEFAULT}.
+#
+. if exists(/usr/dt/include/Xm/Xm.h) && \
+ exists(/usr/dt/include/Xm/Gadget.h)
+_MOTIF_TYPE= dt
+. elif exists(${X11BASE}/lib/X11/config/OpenMotif.tmpl) || \
+ exists(${LOCALBASE}/lib/X11/config/OpenMotif.tmpl)
+_MOTIF_TYPE= openmotif
+. elif exists(${X11BASE}/lib/X11/config/LessTif.tmpl) || \
+ exists(${LOCALBASE}/lib/X11/config/LessTif.tmpl)
+_MOTIF_TYPE= lesstif
+. elif exists(${X11BASE}/include/Xm.h) && \
+ exists(${X11BASE}/include/Xm/Gadget.h)
+_MOTIF_TYPE= none
+. else
+_MOTIF_TYPE= ${MOTIF_TYPE_DEFAULT}
+. endif
+.endif
+
+# If MOTIF_TYPE is set, then let that override the Motif-discovery just
+# performed. We only recognize the tested strings as proper values for
+# MOTIF_TYPE.
+#
+.if defined(USE_MOTIF12)
+. if defined(MOTIF12_TYPE)
+. if (${MOTIF12_TYPE} == "dt") || \
+ (${MOTIF12_TYPE} == "lesstif12")
+_MOTIF_TYPE= ${MOTIF12_TYPE}
+. endif
+. endif
+.else
+. if defined(MOTIF_TYPE)
+. if (${MOTIF_TYPE} == "dt") || \
+ (${MOTIF_TYPE} == "lesstif") || \
+ (${MOTIF_TYPE} == "openmotif")
+_MOTIF_TYPE= ${MOTIF_TYPE}
+. endif
+. endif
+.endif
+
+.if defined(USE_MOTIF12)
+#
+# If MOTIF12BASE is set, then let that override all other Motif-1.2
+# discovery just performed.
+#
+. if defined(MOTIF12BASE)
+_MOTIF_TYPE= none
+_MOTIFBASE= ${MOTIF12BASE}
+. else
+. if ${_MOTIF_TYPE} == "dt"
+_MOTIFBASE= /usr/dt
+. elif ${_MOTIF_TYPE} == "none"
+_MOTIFBASE= ${X11BASE}
+. endif
+. endif
+.else
+#
+# If MOTIFBASE is set, then let that override all other Motif-2.0
+# discovery just performed.
+#
+. if defined(MOTIFBASE)
+_MOTIF_TYPE= none
+_MOTIFBASE= ${MOTIFBASE}
+. else
+. if ${_MOTIF_TYPE} == "dt"
+_MOTIFBASE= /usr/dt
+. elif ${_MOTIF_TYPE} == "none"
+_MOTIFBASE= ${X11BASE}
+. endif
+. endif
+.endif
+
+.if ${_MOTIF_TYPE} == "openmotif"
+. include "../../x11/openmotif/buildlink2.mk"
+_MOTIFBASE= ${BUILDLINK_PREFIX.openmotif}
+.elif ${_MOTIF_TYPE} == "lesstif"
+. include "../../x11/lesstif/buildlink2.mk"
+_MOTIFBASE= ${BUILDLINK_PREFIX.lesstif}
+.elif ${_MOTIF_TYPE} == "lesstif12"
+. include "../../x11/lesstif12/buildlink2.mk"
+_MOTIFBASE= ${BUILDLINK_PREFIX.lesstif12}
+.else
+#
+# Link the pre-existing Motif libraries and headers in ${_MOTIFBASE} into
+# ${BUILDLINK_DIR}.
+#
+BUILDLINK_PREFIX.motif= ${_MOTIFBASE}
+BUILDLINK_FILES.motif= include/Mrm/*
+BUILDLINK_FILES.motif+= include/Xm/*
+BUILDLINK_FILES.motif+= include/uil/*
+BUILDLINK_FILES.motif+= lib/libMrm.*
+BUILDLINK_FILES.motif+= lib/libUil.*
+BUILDLINK_FILES.motif+= lib/libXm.*
+
+BUILDLINK_TARGETS+= motif-buildlink
+
+motif-buildlink: _BUILDLINK_USE
+.endif
+
+.if defined(USE_MOTIF12)
+. if !defined(MOTIF12BASE)
+MOTIF12_TYPE:= ${_MOTIF_TYPE}
+MOTIF12BASE= ${_MOTIFBASE}
+. endif
+.else
+. if !defined(MOTIFBASE)
+MOTIF_TYPE:= ${_MOTIF_TYPE}
+MOTIFBASE= ${_MOTIFBASE}
+. endif
+.endif
+
+USE_X11= # defined
+MAKE_ENV+= MOTIFLIB="${MOTIFLIB}"
+MAKE_ENV+= MOTIFBASE="${_MOTIFBASE}"
+LDFLAGS+= -Wl,-R${_MOTIFBASE}/lib
+MOTIFLIB?= -Wl,-R${_MOTIFBASE}/lib -Wl,-R${X11BASE}/lib -L${_MOTIFBASE}/lib -lXm -lXp
+
+.endif # MOTIF_BUILDLINK2_MK
View
40 mk/ossaudio.buildlink2.mk
@@ -0,0 +1,40 @@
+# $NetBSD: ossaudio.buildlink2.mk,v 1.2 2002/08/22 08:21:27 jlam Exp $
+
+.if !defined(OSSAUDIO_BUILDLINK2_MK)
+OSSAUDIO_BUILDLINK2_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${_OPSYS_HAS_OSSAUDIO} == "yes"
+BUILDLINK_PREFIX.ossaudio= /usr
+BUILDLINK_FILES.ossaudio= lib/libossaudio.*
+
+BUILDLINK_TARGETS+= ossaudio-buildlink
+BUILDLINK_TARGETS+= ossaudio-buildlink-soundcard-h
+
+LIBOSSAUDIO?= -lossaudio
+MAKE_ENV+= LIBOSSAUDIO="${LIBOSSAUDIO}"
+
+ossaudio-buildlink: _BUILDLINK_USE
+
+# Many programs expect <soundcard.h> to be found as <sys/soundcard.h>.
+# Also include <sys/ioctl.h> prior to include <soundcard.h> since we need
+# definitions for _IOWR and friends.
+#
+ossaudio-buildlink-soundcard-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ sys_soundcard_h=${BUILDLINK_DIR}/include/sys/soundcard.h; \
+ if [ ! -f $${sys_soundcard_h} -a \
+ -f ${BUILDLINK_PREFIX.ossaudio}/include/soundcard.h ]; then \
+ ${ECHO_BUILDLINK_MSG} "Creating $${sys_soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${sys_soundcard_h}`; \
+ ( ${ECHO} "#ifndef BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#define BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#include <sys/ioctl.h>"; \
+ ${ECHO} "#include <soundcard.h>"; \
+ ${ECHO} "#endif"; \
+ ) > $${sys_soundcard_h}; \
+ fi
+.endif
+
+.endif # OSSAUDIO_BUILDLINK2_MK
View
2  mk/pthread.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pthread.buildlink.mk,v 1.8 2002/08/08 15:34:17 jlam Exp $
+# $NetBSD: pthread.buildlink.mk,v 1.9 2002/08/22 08:21:27 jlam Exp $
#
# The pthreads strategy for pkgsrc is to "bless" a particular pthread
# package as the Official Pthread Replacement (OPR). A package that uses
View
167 mk/pthread.buildlink2.mk
@@ -0,0 +1,167 @@
+# $NetBSD: pthread.buildlink2.mk,v 1.2 2002/08/22 08:21:27 jlam Exp $
+#
+# The pthreads strategy for pkgsrc is to "bless" a particular pthread
+# package as the Official Pthread Replacement (OPR). A package that uses
+# pthreads may do one of the following:
+#
+# (1) Simply include pthread.buildlink2.mk. This will make the package
+# use the native pthread library if it's available, or else the OPR
+# package. The value of PTHREAD_TYPE may be checked to be either
+# "native", or the name of the OPR package, or "none", e.g.
+#
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink2.mk"
+#
+# .if defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "none")
+# CONFIGURE_ARGS+= --without-pthreads
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# Note that it's only safe to check and use the value of PTHREAD_TYPE
+# after all other buildlink2.mk files have been included.
+#
+# (2) Add "native" to PTHREAD_OPTS prior to including
+# pthread.buildlink2.mk. This is like case (1), but we only check for
+# the native pthread library, e.g.,
+#
+# PTHREAD_OPTS+= native
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink2.mk"
+#
+# .if defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "none")
+# CONFIGURE_ARGS+= --without-pthreads
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# (3) Add "require" to PTHREAD_OPTS prior to including
+# pthread.buildlink2.mk. This will make the package use the native
+# pthread library or else use the OPR package, and will otherwise set
+# IGNORE if neither can be used, e.g.,
+#
+# PTHREAD_OPTS+= require
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink2.mk"
+# .include "../../mk/bsd.pkg.mk"
+#
+# (4) Add both "require" and "native" to PTHREAD_OPTS prior to including
+# pthread.buildlink2.mk. This is like case (3), but we only check for
+# the native pthread library, e.g.,
+#
+# PTHREAD_OPTS+= require native
+# #
+# # more package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink2.mk"
+# .include "../../mk/bsd.pkg.mk"
+#
+# The case where a package must use either the native pthread library or
+# some pthread package aside from the OPR is a special case of (2), e.g.,
+# if the required pthread package is "ptl2", then:
+#
+# PTHREAD_OPTS+= native
+# #
+# # more package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink2.mk"
+#
+# .if defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "none")
+# . include "../../devel/ptl2/buildlink2.mk"
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# A package Makefile may add the word "optional" to PTHREAD_OPTS, which
+# will override the effects of any instance of the word "require". This
+# should _only_ be used by those packages that can be built with or
+# without pthreads _independently_ of whether any of its dependencies need
+# pthreads. Currently, this only only www/mozilla, which uses its own
+# threading library if native pthreads is unavailable, despite that it
+# uses GTK+, which _does_ need pthreads.
+#
+###########################################################################
+#
+# PTHREAD_OPTS represents whether this package requires pthreads, and also
+# whether it needs to be native. It may include the word "require"
+# to denote that a pthreads implementation is required, and may also
+# include the word "native" to denote that only native pthreads are
+# acceptable.
+#
+# _PKG_PTHREAD is the fall-back package pthread implementation use by
+# pthread.buildlink2.mk.
+#
+# _PKG_PTHREAD_COMPAT_PATTERNS matches the ONLY_FOR_PLATFORMS from the
+# Makefile for ${_PKG_PTHREAD}. It's used to see if ${_PKG_PTHREADS}
+# can actually be used to replace a native pthreads.
+#
+_PKG_PTHREAD?= pth
+_PKG_PTHREAD_DEPENDS?= pth>=1.4.1nb2
+_PKG_PTHREAD_PKGSRCDIR?= ../../devel/${_PKG_PTHREAD}
+_PKG_PTHREAD_BUILDLINK2_MK?= ${_PKG_PTHREAD_PKGSRCDIR}/buildlink2.mk
+_PKG_PTHREAD_COMPAT_PATTERNS= *-*-*
+
+.include "../../mk/bsd.prefs.mk"
+
+PTHREAD_OPTS?= # empty
+#
+# We check for a native pthreads implementation by checking for the presence
+# of /usr/include/pthread.h (we might want to make this check stricter).
+#
+.undef PTHREAD_TYPE
+PREFER_NATIVE_PTHREADS?= YES
+.if exists(/usr/include/pthread.h) && (${PREFER_NATIVE_PTHREADS} == "YES")
+PTHREAD_TYPE= native
+.else
+. if !empty(PTHREAD_OPTS:Mnative)
+PTHREAD_TYPE= none
+. if !empty(PTHREAD_OPTS:Mrequire) && empty(PTHREAD_OPTS:Moptional)
+IGNORE= "${PKGNAME} requires a native pthreads implementation."
+. endif
+. else
+PTHREAD_TYPE= none
+. for _pattern_ in ${_PKG_PTHREAD_COMPAT_PATTERNS}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+PTHREAD_TYPE= ${_PKG_PTHREAD}
+. endif
+. endfor
+. if (${PTHREAD_TYPE} == "none") && \
+ !empty(PTHREAD_OPTS:Mrequire) && empty(PTHREAD_OPTS:Moptional)
+IGNORE= "${PKGNAME} requires a working pthreads implementation."
+. endif
+. endif
+.endif
+
+.if !defined(PTHREAD_BUILDLINK2_MK)
+PTHREAD_BUILDLINK2_MK= # defined
+
+.if ${PTHREAD_TYPE} == "native"
+#
+# Link the native pthread libraries and headers into ${BUILDLINK_DIR}.
+#
+BUILDLINK_PREFIX.pthread= /usr
+BUILDLINK_FILES.pthread= include/pthread.h
+BUILDLINK_FILES.pthread+= lib/libpthread.*
+
+BUILDLINK_TARGETS+= pthread-buildlink
+
+pthread-buildlink: _BUILDLINK_USE
+
+.elif ${PTHREAD_TYPE} == "${_PKG_PTHREAD}"
+. if exists(${_PKG_PTHREAD_BUILDLINK2_MK})
+. if !empty(_PKG_PTHREAD_DEPENDS)
+DEPENDS+= ${_PKG_PTHREAD_DEPENDS}:${_PKG_PTHREAD_PKGSRCDIR}
+. endif
+. include "${_PKG_PTHREAD_BUILDLINK2_MK}"
+. else
+IGNORE= "${PKGNAME} needs pthreads, but ${_PKG_PTHREAD_BUILDLINK2_MK} is missing."
+. endif
+.endif
+
+.endif # PTHREAD_BUILDLINK2_MK
View
2  mk/x11.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: x11.buildlink.mk,v 1.19 2002/08/06 06:10:41 jlam Exp $
+# $NetBSD: x11.buildlink.mk,v 1.20 2002/08/22 08:21:27 jlam Exp $
#
# This Makefile fragment is included by packages that use X11. It's
# only purpose is to make a package strongly buildlinked, so packages
View
2  mk/xaw.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: xaw.buildlink.mk,v 1.2 2002/08/02 20:14:34 jlam Exp $
+# $NetBSD: xaw.buildlink.mk,v 1.3 2002/08/22 08:21:27 jlam Exp $
#
# This Makefile fragment is included by packages that use Xaw.
#
View
20 mk/xaw.buildlink2.mk
@@ -0,0 +1,20 @@
+# $NetBSD: xaw.buildlink2.mk,v 1.2 2002/08/22 08:21:27 jlam Exp $
+
+.if !defined(XAW_BUILDLINK2_MK)
+XAW_BUILDLINK2_MK= # defined
+
+# Pull in setting for XAW_TYPE.
+XAW_TYPE?= standard
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${XAW_TYPE} == "xpm"
+.include "../../x11/Xaw-Xpm/buildlink2.mk"
+.elif ${XAW_TYPE} == "3d"
+.include "../../x11/Xaw3d/buildlink2.mk"
+.else
+LIBXAW?= -L${X11BASE}/lib -lXaw
+.endif
+MAKE_ENV+= LIBXAW="${LIBXAW}"
+
+.endif # XAW_BUILDLINK2_MK
Please sign in to comment.
Something went wrong with that request. Please try again.