summaryrefslogtreecommitdiff
path: root/mk/buildlink3
diff options
context:
space:
mode:
authorjlam <jlam>2004-09-21 15:01:38 +0000
committerjlam <jlam>2004-09-21 15:01:38 +0000
commit2a59126b867d7adc55f10cc6866febf0a0a5dd54 (patch)
treee090baf88a9c4da9d6fa5d6398e63775525f7060 /mk/buildlink3
parentb22f32c68eed2763be14a9ac6160b7f533be2905 (diff)
downloadpkgsrc-2a59126b867d7adc55f10cc6866febf0a0a5dd54.tar.gz
Initial commit of a new wrapper script framework that encapsulates
the non-buildlink-related code and moves it out of mk/buildlink3 into mk/wrapper. The buildlink3 code is modified to simply hook its transformations into the wrapper script framework. The wrapper script framework has some new features: * Support automatically passing "ABI" flags to the compiler and linker depending on the value of ${ABI}. Currently supports the SunPro compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as any of 32, n32, o32, and 64. * making UnixWare GCC accept -rpath options and silently converting them into an appropriate LD_RUN_PATH * Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out when it sees -fpic/-fPIC and -shared/-Bshareable, respectively (requested by <tv>). * Much improved debugging output. It's possible to output the wrapper work log in-line with normal output by setting WRAPPER_LOG to "stderr". Important differences in behaviour from the old buildlink3 code include: * Only move the -l options to the end of the command line, leaving the -L options in-place. * Extend the autodetection of the libtool mode to detect "compile" and "uninstall". * Fix problem noted in both PR pkg/24760 and PR pkg/25500, where -L/usr/lib/* was being mangled improperly. * Remove the top-level "buildlink" target; instead, make buildlinking occur as part of the "wrapper" target. * mangle and sub-mangle are only meant to transform directories in -I, -L, and rpath options, so remove the lines in buildlink3/gen-transform.sh that transformed bare directories. * Add the ability for the libtool wrapper to be called just to unwrap an existing libtool archive by running: libtool --mode=unwrap -o libfoo.la The old --fix-la syntax no longer works. 20040818 ======== * Initial release of a new wrapper script framework that encapsulates the non-buildlink-related code and moves it out of mk/buildlink3. These features include: * making MIPSpro accept GCC options * making MIPSpro "ucode" accept GCC options * making SunPro accept GCC options * making "ld" accept -Wl,* options and silently removing the "-Wl," * (NEW) making UnixWare GCC accept -rpath options and silently converting them into an appropriate LD_RUN_PATH One major benefit of this is that the buildlink3 code is now much tighter and easier to understand since it concerns itself solely with buildlink-related details. I haven't yet optimized the wrapper cache, so the new wrapper scripts may take slightly longer to execute than the old buildlink3 wrapper scripts, but I'll be improving this over time. 20040821 ======== * Move the inclusion of $cmd_sink outside of the main loop in wrapper.sh so that the $cmd_sink script can be used to globally scan and process the arguments. Move the LD_RUN_PATH code to a cmd-sink-unixware-gcc script. Garbage-collect the now unused export_vars-related code. * Add cmd-sink-aix-xlc for AIX xlc that munges -Wl,-R* into an appropriate -blibpath option. * Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out when it sees -fpic/-fPIC and -shared/-Bshareable, respectively (requested by <tv>). * Move the code that converts full paths to shared libraries into the "-Ldir -llib" equivalents from the buildlink3 code into wrapper/logic. Remove the same from bsd.buildlink3.mk and gen-transform.sh. * Move the code that checks for absolute rpaths from the buildlink3 code into wrapper/arg-source. Remove the same from bsd.buildlink3.mk and gen-transform.sh. * Only move the -l options to the end of the command line, leaving the -L options in-place. * Add more debugging code. 20040824 ======== * Fix quoting problems after arguments are transformed. Remove the hack that was inserted that magically made almost everything work because we do it the right way now. * Move the inclusion of $logic outside of the main loop in wrapper.sh so that the $logic script doesn't have to worry about underflowing the argument buffer. * Encapsulate the loop in wrapper.sh that fills the argument buffer entirely within the arg-source script. * Move from the logic script into the arg-source script the transformations that merge or split arguments. * Fix bug where skipargs was effectively being ignored if it was more than 1. * Handle the whitespace in transformations in the logic script that turn one library option into multiple library options, e.g. "-lreadline" -> "-ledit -ltermcap". * Allow you to specify an environment variable WRAPPER_SKIP_TRANSFORM for whether you wish to skip the transformation step in the logic script. This is intended for testing purposes. * Added check_prog() and init_lib() functions to the shell code library to make it more reusable outside of the wrapper framework. * Allow the msg_log() function to output to "stdout" or "stderr". If you want to have all of the logging appear on the screen, then you can now set WRAPPER_LOG=stderr. * Make some of the script components not overridable on a per-wrapper basis. * Add a gen-transform.sh script that generates transformation sedfiles. The "transform" script is used to transform arguments, while the "untransform" script is used to unwrap files. Move the no-rpath logic from buildlink3/gen-transform.sh into wrapper/gen-transform.sh since it's not buildlink3-specific. * Check for a non-empty blibpath before adding the option in cmd-sink-aix-xlc. * Extend the autodetection of the libtool mode to detect "compile" and "uninstall". * Add a cmd-sink-libtool script that doesn't pass linker options to libtool unless we're in "link" mode. * Set _USE_RPATH to "yes" for UnixWare so that the wrappers will see the rpath options and convert them to a LD_RUN_PATH definition. * Add more debugging code. 20040826 ======== * Rewrite buildlink3/gen-transform.sh to produce more precise sed commands. Drop some unused commands from the mini-language, and add a few more that are more restrictive in their scope. * Fix problem where repeated options weren't properly handled by some of sed commands. It's not enough that they're "global replace", since some patterns match separator characters before and after each option. We must repeat those patterns twice to catch all instances correctly. * Fix problem noted in both PR pkg/24760 and PR pkg/25500, where -L/usr/lib/* was being mangled improperly. * Remove the top-level "buildlink" target; instead, make buildlinking occur as part of the "wrapper" target. * Add more debugging code. 20040828 ======== * Added a head_queue function to shell-lib that returns the head of the named queue without popping it off the front of the queue. * Strip consecutive, repeated library options from the command line when we read it in the logic script. * Be more careful about not underflowing the argument buffer. 20040906 ======== * shell-lib was moved into pkgsrc/mk/scripts; correct references to that file in the wrapper code. * Use opt-sub instead of sub-mangle when protecting -I/usr/include/* and -L/usr/lib/* from buildlink transformations. This avoids adding lines that look like "-I-I..." in the transformation sedfiles. * mangle and sub-mangle are only meant to transform directories in -I, -L, and rpath options, so remove the lines in buildlink3/gen-transform.sh that transformed bare directories. * Fix bug in strip-slashdot where the "." wasn't backquoted and thus matched all characters instead of only the "." character. * Change the libtool wrapper to use a modified buildcmd script that doesn't rearrange any of the arguments. This should fix spurious problems where libtool doesn't understand how to parse the command line when the -l options are moved to the end of the argument list. * Fix bug in the logic script where the $cachearg and $cachedarg weren't being properly set at all times, which caused the cache to contain the wrong transformed argument. 20040907 ======== * Support automatically passing "ABI" flags to the compiler and linker depending on the value of ${ABI}. Currently supports the SunPro compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as any of 32, n32, o32, and 64. * Move back the code that splits absolute paths to shared libraries from arg-source back into logic. This allows us to correctly skip splitting those paths based on the previous option. Also add a sanity check that the library name in the split argument doesn't contain a "/" since shell globs are not as precise as REs. * Don't transform the path given after --dynamic-linker (used by GNU ld for ELF linkage). * Add the ability for the libtool wrapper to be called just to unwrap an existing libtool archive by running: libtool --mode=unwrap -o libfoo.la 20040914 ======== * Add a loop in libtool-fix-la to ensure that all of the options listed in the dependency_libs lines of *.lai files are processed. This fixes a buildlink3 leakage bug. * Merge the gen-transform.sh scripts between buildlink3 and wrapper and place them all in wrapper. This makes sense since the commands simply allow for many types of transformations, which buildlink3 takes advantage of, but there is nothing inherently buildlink-ish about those commands. * Don't directly manipulate SUBST_SED.unwrap. Instead, create the value of SUBST_SED.unwrap by combining several other variables (currently just _UNWRAP_SED) to ensure that the correct ordering is preserved. * Correct some confusing debugging messages.
Diffstat (limited to 'mk/buildlink3')
-rw-r--r--mk/buildlink3/BUILDLINK3_DG23
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk1035
-rw-r--r--mk/buildlink3/bsd.builtin.mk36
-rw-r--r--mk/buildlink3/buffer61
-rw-r--r--mk/buildlink3/buildcmd55
-rw-r--r--mk/buildlink3/buildcmd-libtool74
-rw-r--r--mk/buildlink3/cleanup-libtool41
-rw-r--r--mk/buildlink3/cmd-sink-libtool60
-rw-r--r--mk/buildlink3/gen-transform.sh359
-rw-r--r--mk/buildlink3/ld-post-cache11
-rw-r--r--mk/buildlink3/ld-post-logic14
-rw-r--r--mk/buildlink3/libtool-fix-la376
-rw-r--r--mk/buildlink3/libtool-post-cache22
-rw-r--r--mk/buildlink3/libtool-post-logic85
-rw-r--r--mk/buildlink3/libtool.sh194
-rw-r--r--mk/buildlink3/logic60
-rw-r--r--mk/buildlink3/marshall74
-rw-r--r--mk/buildlink3/mipspro-cc-post-cache12
-rw-r--r--mk/buildlink3/mipspro-cc-post-logic36
-rw-r--r--mk/buildlink3/mipspro-ucode-cc-post-cache12
-rw-r--r--mk/buildlink3/mipspro-ucode-cc-post-logic41
-rw-r--r--mk/buildlink3/post-cache4
-rw-r--r--mk/buildlink3/pre-cache3
-rw-r--r--mk/buildlink3/quotearg20
-rw-r--r--mk/buildlink3/scan-libtool125
-rw-r--r--mk/buildlink3/sunpro-cc-post-cache12
-rw-r--r--mk/buildlink3/sunpro-cc-post-logic89
-rw-r--r--mk/buildlink3/transform-libtool119
-rw-r--r--mk/buildlink3/wrapper.sh95
29 files changed, 881 insertions, 2267 deletions
diff --git a/mk/buildlink3/BUILDLINK3_DG b/mk/buildlink3/BUILDLINK3_DG
index 4ab79a25bff..866ba4b8546 100644
--- a/mk/buildlink3/BUILDLINK3_DG
+++ b/mk/buildlink3/BUILDLINK3_DG
@@ -1,4 +1,4 @@
-$NetBSD: BUILDLINK3_DG,v 1.5 2004/07/30 20:52:44 jlam Exp $
+$NetBSD: BUILDLINK3_DG,v 1.6 2004/09/21 15:01:40 jlam Exp $
0 Developer's guide to buildlink3
=================================
@@ -28,18 +28,7 @@ archives to work around cases where the pkgsrc libraries were being
used instead of the system libraries if they shared the same name.
- 1.3 Support for native compilers
- ================================
-
-The buildlink3 wrapper scripts have better support for using SunPro
-and MIPSpro compilers to build pkgsrc software. For the most part,
-packages can use any compiler, but some third-party software is
-written assuming that it will be compiled using GCC. The buildlink3
-wrapper scripts can capture some common GCC options and convert them
-into native toolchain equivalents.
-
-
- 1.4 New buildlink3.mk file structure
+ 1.2 New buildlink3.mk file structure
====================================
buildlink3.mk files have two major differences over buildlink2.mk
@@ -54,7 +43,7 @@ packages that want to add a dependency must directly include the
buildlink3.mk file for that dependency.
- 1.5 Support for pkgviews
+ 1.3 Support for pkgviews
========================
When building pkgviews packages, buildlink3 doesn't symlink files
@@ -98,7 +87,7 @@ A3: You should examine the contents of the ${WRKDIR}/.work.log file.
Q4: Why can't I check the values of variables set by the buildlink3
framework using 'make show-var VARNAME=...'?
-A4: Some buildlink3 variables are only defined for a subset of a
- package build phases. Try instead:
+A4: Some variables are only defined for a subset of the package build
+ phases. Try instead:
- make show-var PKG_PHASE=buildlink VARNAME=...'
+ make show-var PKG_PHASE=wrapper VARNAME=...
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index 75f51b4ac50..5960f16d7f9 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,5 +1,39 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.153 2004/09/08 08:02:00 jlam Exp $
-#
+# $NetBSD: bsd.buildlink3.mk,v 1.154 2004/09/21 15:01:40 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
# An example package buildlink3.mk file:
#
# -------------8<-------------8<-------------8<-------------8<-------------
@@ -47,21 +81,20 @@
# BUILDLINK_* public buildlink-related variables usable in other Makefiles
# _BLNK_* private buildlink-related variables to this Makefile
-ECHO_BUILDLINK_MSG?= ${TRUE}
+.if ${PKG_DEBUG_LEVEL} > 0
+ECHO_BUILDLINK_MSG?= ${ECHO}
+.else
+ECHO_BUILDLINK_MSG?= ${ECHO_WRAPPER_MSG}
+.endif
BUILDLINK_DIR= ${WRKDIR}/.buildlink
+BUILDLINK_BINDIR= ${BUILDLINK_DIR}/bin
+BUILDLINK_SRCDIR= ${.CURDIR}/../../mk/buildlink3
BUILDLINK_X11_DIR= ${BUILDLINK_DIR:H}/.x11-buildlink
-BUILDLINK_SHELL?= ${SH}
-BUILDLINK_OPSYS?= ${OPSYS}
-_BLNK_VARS_MK= ${BUILDLINK_DIR}/vars.mk
-.if exists(${_BLNK_VARS_MK})
-. include "${_BLNK_VARS_MK}"
-.endif
+.PHONY: pre-buildlink do-buildlink post-buildlink
-# Prepend ${BUILDLINK_DIR}/bin to the PATH so that the wrappers are found
-# first when searching for executables.
-#
-PREPEND_PATH+= ${BUILDLINK_DIR}/bin
+# Prepend ${BUILDLINK_BINDIR} to the PATH.
+PREPEND_PATH+= ${BUILDLINK_BINDIR}
# BUILDLINK_DEPENDS contains the list of packages for which we add
# dependencies.
@@ -253,7 +286,11 @@ ${_depmethod_}+= ${_BLNK_ADD_TO.${_depmethod_}}
. endif
.endfor # _BLNK_DEPENDS_LIST
-.if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE})
+###
+### BEGIN: after "wrapper" phase
+###
+.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE})
+
# Generate default values for:
#
# _BLNK_PKG_DBDIR.<pkg> contains all of the package metadata
@@ -321,7 +358,7 @@ _BLNK_PKG_DBDIR.${_pkg_}!= \
. endif
. endfor
. if empty(_BLNK_PKG_DBDIR.${_pkg_}:M*not_found)
-BUILDLINK_VARS+= _BLNK_PKG_DBDIR.${_pkg_}
+WRAPPER_VARS+= _BLNK_PKG_DBDIR.${_pkg_}
. endif
. endif
@@ -352,7 +389,7 @@ BUILDLINK_PREFIX.${_pkg_}= BUILDLINK_PREFIX.${_pkg_}_not_found
. endif
. endif
. if empty(BUILDLINK_PREFIX.${_pkg_}:M*not_found)
-BUILDLINK_VARS+= BUILDLINK_PREFIX.${_pkg_}
+WRAPPER_VARS+= BUILDLINK_PREFIX.${_pkg_}
. endif
. endif
@@ -411,7 +448,7 @@ BUILDLINK_LDFLAGS+= -L${_dir_}
. endif
. endfor
. endif
-. if !empty(BUILDLINK_RPATHDIRS.${_pkg_}) && (${_USE_RPATH} == "yes")
+. if !empty(BUILDLINK_RPATHDIRS.${_pkg_})
. for _dir_ in ${BUILDLINK_RPATHDIRS.${_pkg_}:S/^/${BUILDLINK_PREFIX.${_pkg_}}\//}
. if exists(${_dir_})
. if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${_dir_})
@@ -426,8 +463,7 @@ BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${_dir_}
# runtime library search path.
#
.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
-. if (${_USE_RPATH} == "yes") && \
- empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${PREFIX}/lib)
+. if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${PREFIX}/lib)
BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib
. endif
.endif
@@ -437,7 +473,7 @@ BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib
# fulfilled through the default view.
#
.for _pkg_ in ${_BLNK_PACKAGES}
-. if !empty(BUILDLINK_RPATHDIRS.${_pkg_}) && (${_USE_RPATH} == "yes")
+. if !empty(BUILDLINK_RPATHDIRS.${_pkg_})
. for _dir_ in ${BUILDLINK_RPATHDIRS.${_pkg_}:S/^/${LOCALBASE}\//}
. if exists(${_dir_})
. if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${_dir_})
@@ -450,8 +486,7 @@ BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${_dir_}
#
# Ensure that ${LOCALBASE}/lib is in the runtime library search path.
#
-.if (${_USE_RPATH} == "yes") && \
- empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${LOCALBASE}/lib)
+.if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${LOCALBASE}/lib)
BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib
.endif
#
@@ -462,8 +497,7 @@ BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib
. if empty(BUILDLINK_LDFLAGS:M-L${X11BASE}/lib${ABI})
BUILDLINK_LDFLAGS+= -L${X11BASE}/lib${ABI}
. endif
-. if (${_USE_RPATH} == "yes") && \
- empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${X11BASE}/lib${ABI})
+. if empty(BUILDLINK_LDFLAGS:M${COMPILER_RPATH_FLAG}${X11BASE}/lib${ABI})
BUILDLINK_LDFLAGS+= ${COMPILER_RPATH_FLAG}${X11BASE}/lib${ABI}
. endif
.endif
@@ -512,16 +546,6 @@ buildlink-directories:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${BUILDLINK_DIR}/include
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${BUILDLINK_DIR}/lib${ABI}
-# Create the saved variables Makefile fragment to pass variables through
-# to sub-make processes invoked on the same Makefile.
-#
-do-buildlink: ${_BLNK_VARS_MK}
-
-# 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:
@@ -647,9 +671,8 @@ ${_BLNK_COOKIE.${_pkg_}}:
# _BLNK_LT_ARCHIVE_FILTER.${_pkg_} is a command-line filter used in
# the previous target 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}.
+# allow libtool to properly interact with buildlink at link time by
+# linking against the libraries pointed to by symlinks in ${BUILDLINK_DIR}.
#
_BLNK_LT_ARCHIVE_FILTER.${_pkg_}= \
${SED} ${_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}}
@@ -657,24 +680,50 @@ _BLNK_LT_ARCHIVE_FILTER.${_pkg_}= \
_BLNK_SEP= \ \`\"':;,
_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}= # empty
#
-# - Modify the dependency_libs line by changing all full paths to
-# other *.la files into the canonical ${BUILDLINK_DIR} path.
+# Modify the dependency_libs line by changing all full paths to other *.la
+# files into the canonical ${BUILDLINK_DIR} path.
#
_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}+= \
- -e "/^dependency_libs=/s,/usr\(/lib/lib[^/${_BLNK_SEP}]*\.la\),${BUILDLINK_DIR}\\1,g" \
- -e "/^dependency_libs=/s,${DEPOTBASE}/[^${_BLNK_SEP}]*\(/[^${_BLNK_SEP}]*/lib[^/${_BLNK_SEP}]*\.la\),${BUILDLINK_DIR}\\1,g" \
- -e "/^dependency_libs=/s,${X11BASE}\(/[^${_BLNK_SEP}]*/lib[^/${_BLNK_SEP}]*\.la\),${BUILDLINK_X11_DIR}\\1,g" \
- -e "/^dependency_libs=/s,${LOCALBASE}\(/[^${_BLNK_SEP}]*/lib[^/${_BLNK_SEP}]*\.la\),${BUILDLINK_DIR}\\1,g" \
- -e "/^dependency_libs=/s,-L/usr/lib[^/${_BLNK_SEP}]*[ ]*,,g" \
- -e "/^dependency_libs=/s,-L${X11BASE}/[^${_BLNK_SEP}]*[ ]*,,g" \
- -e "/^dependency_libs=/s,-L${LOCALBASE}/[^${_BLNK_SEP}]*[ ]*,,g"
-. if (${PKG_INSTALLATION_TYPE} == "overwrite") || \
- !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[nN][oO])
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)/usr\(/lib/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)/usr\(/lib/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${DEPOTBASE}/[^/${_BLNK_SEP}]*\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${DEPOTBASE}/[^/${_BLNK_SEP}]*\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${X11BASE}\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_X11_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${X11BASE}\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_X11_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${LOCALBASE}\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)${LOCALBASE}\(/[^${_BLNK_SEP}]*lib[^/${_BLNK_SEP}]*\.la[${_BLNK_SEP}]\),\\1${BUILDLINK_DIR}\\2,g"
+#
+# Modify the dependency_libs line by removing -L/usr/lib, which is implied.
#
-# - Modify 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_SED_SCRIPT.${_pkg_}+= \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L/usr/lib\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L/usr/lib\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L/usr/lib/\.\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L/usr/lib/\.\([${_BLNK_SEP}]\),\\1\\2,g"
+#
+# Modify the dependency_libs line by removing -L${LOCALBASE}/* and
+# -L${X11BASE}/*, since those are automatically added by the buildlink3.mk
+# files.
+#
+_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}+= \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L${X11BASE}/[^${_BLNK_SEP}]*\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L${X11BASE}/[^${_BLNK_SEP}]*\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L${LOCALBASE}/[^${_BLNK_SEP}]*\([${_BLNK_SEP}]\),\\1\\2,g" \
+ -e "/^dependency_libs=/s,\([${_BLNK_SEP}]\)-L${LOCALBASE}/[^${_BLNK_SEP}]*\([${_BLNK_SEP}]\),\\1\\2,g"
+#
+# Modify the dependency_libs line by cleaning up any leading and trailing
+# whitespace.
+#
+_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}+= \
+ -e "/^dependency_libs=/s,^\(dependency_libs='\) *,\\1,g" \
+ -e "/^dependency_libs=/s, *'$$,',g"
#
+# Modify the libdir line to point to within ${BUILDLINK_DIR}.
+# This prevents libtool from looking into the original directory
+# for other *.la files.
+#
+. if (${PKG_INSTALLATION_TYPE} == "overwrite") || \
+ !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[nN][oO])
_BLNK_LT_ARCHIVE_FILTER_SED_SCRIPT.${_pkg_}+= \
-e "/^libdir=/s,/usr\(/lib/[^${_BLNK_SEP}]*\),${BUILDLINK_DIR}\\1,g" \
-e "/^libdir=/s,${DEPOTBASE}/[^/${_BLNK_SEP}]*\(/[^${_BLNK_SEP}]*\),${BUILDLINK_DIR}\\1,g" \
@@ -696,39 +745,6 @@ _BLNK_TARGETS+= ${BUILDLINK_TARGETS}
do-buildlink: ${_target_}
.endfor
-# 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
-
-# The caching code, which greatly speeds up the build process, doesn't
-# work completely correctly on certain platforms.
-#
-_BLNK_PARTIAL_CACHE_ONLY= Darwin-5.*-*
-
-_BLNK_FULL_CACHING?= YES
-.for _pattern_ in ${_BLNK_PARTIAL_CACHE_ONLY}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-_BLNK_FULL_CACHING= NO
-. endif
-.endfor
-.if !empty(_BLNK_FULL_CACHING:M[yY][eE][sS])
-CONFIGURE_ENV+= BUILDLINK_CACHE_ALL=yes
-MAKE_ENV+= BUILDLINK_CACHE_ALL=yes
-.endif
-
# _BLNK_PASSTHRU_DIRS contains the list of directories which we allow in
# preprocessor's header, linker's library, or the runtime library
# search paths. The values of this list represent entire directory
@@ -863,23 +879,10 @@ _BLNK_PHYSICAL_PATH.${_var_}!= \
else \
${ECHO} ${${_var_}}; \
fi
-BUILDLINK_VARS+= _BLNK_PHYSICAL_PATH.${_var_}
+WRAPPER_VARS+= _BLNK_PHYSICAL_PATH.${_var_}
. endif
.endfor
-# Remove -Wl,-R* and *-rpath* if _USE_RPATH == "no".
-# Transform -Wl,-R* and *-rpath* if Sun compilers are used.
-#
-.if defined(_USE_RPATH) && !empty(_USE_RPATH:M[nN][oO])
-_BLNK_TRANSFORM+= no-rpath
-.endif
-#
-# Remove rpath options that try to add relative paths to the runtime
-# library search path. This basically partly cleans up after lazy
-# programmers.
-#
-_BLNK_TRANSFORM+= abs-rpath
-#
# Transform all references to the physical paths to some important
# directories into their given names.
#
@@ -890,6 +893,10 @@ _BLNK_TRANSFORM+= mangle:${_BLNK_PHYSICAL_PATH.${_var_}}:${${_var_}}
. endif
.endfor
#
+# Strip trailing /. from options.
+#
+_BLNK_TRANSFORM+= strip-slashdot:
+#
# Protect work directories and the dependency directories from all the
# transformations we're about to do.
#
@@ -900,8 +907,8 @@ _BLNK_TRANSFORM+= mangle:${_dir_}:${_BLNK_MANGLE_DIR.${_dir_}}
# Protect -I/usr/include/* and -L/usr/lib/* from transformations (these
# aren't part of the normal header or library search paths).
#
-_BLNK_TRANSFORM+= sub-mangle:-I/usr/include:-I${_BLNK_MANGLE_DIR./usr/include}
-_BLNK_TRANSFORM+= sub-mangle:-L/usr/lib:-L${_BLNK_MANGLE_DIR./usr/lib}
+_BLNK_TRANSFORM+= opt-sub:-I/usr/include:-I${_BLNK_MANGLE_DIR./usr/include}
+_BLNK_TRANSFORM+= opt-sub:-L/usr/lib:-L${_BLNK_MANGLE_DIR./usr/lib}
#
# Change any buildlink directories in runtime library search paths into
# the canonical actual installed paths.
@@ -931,11 +938,6 @@ _BLNK_TRANSFORM+= sub-rpath:/usr/lib:${_BLNK_MANGLE_DIR./usr/lib}
_BLNK_TRANSFORM+= depot:${DEPOTBASE}:${LOCALBASE}
.endif
#
-# 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}.
#
@@ -977,7 +979,7 @@ _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:/
+_BLNK_TRANSFORM+= no-abspath
#
# Undo the protection for the directories that we allow to be specified
# for the runtime library search path.
@@ -993,48 +995,7 @@ _BLNK_TRANSFORM+= rpath:${_BLNK_MANGLE_DIR.${_dir_}}:${_dir_}
_BLNK_TRANSFORM+= mangle:${_BLNK_MANGLE_DIR.${_dir_}}:${_dir_}
.endfor
-# Only do the (expensive) reordering step if we have reordering
-# transformations.
-#
-.if !empty(_BLNK_TRANSFORM:Mreorder\:*)
-MAKE_ENV+= BUILDLINK_REORDER=yes
-.endif
-
-_BLNK_TRANSFORM_SED+= -f ${_BLNK_TRANSFORM_SEDFILE}
-_BLNK_UNTRANSFORM_SED+= -f ${_BLNK_UNTRANSFORM_SEDFILE}
-
-# UNWRAP_PATTERNS and UNWRAP_FILES list shell globs and files relative to
-# ${WRKSRC} that need to have reference to ${BUILDLINK_DIR} stripped out
-# of them.
-#
-_UNBUILDLINK_PATTERNS= ${UNWRAP_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= \
- ${UNWRAP_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}
+WRAPPER_TRANSFORM_CMDS+= ${_BLNK_TRANSFORM}
# Generate wrapper scripts for the compiler tools that sanitize the
# argument list by converting references to ${LOCALBASE} and ${X11BASE}
@@ -1048,188 +1009,41 @@ SUBST_SED.unbuildlink= ${_UNBUILDLINK_SED}
# ALIASES.CC, ALIASES.LD, etc. are the other names by which each wrapper
# may be invoked.
#
-_BLNK_WRAPPEES+= AS
-_BLNK_WRAPPEES+= CC
-_BLNK_WRAPPEES+= CPP
-_BLNK_WRAPPEES+= CXX
-_BLNK_WRAPPEES+= LD
-_BLNK_WRAPPEES+= FC
-_BLNK_WRAPPEES+= LIBTOOL SHLIBTOOL
.if defined(USE_LIBTOOL)
-_LIBTOOL= ${BUILDLINK_LIBTOOL}
-_SHLIBTOOL= ${BUILDLINK_SHLIBTOOL}
-.endif
-.if defined(USE_X11)
-IMAKE?= ${X11BASE}/bin/imake
-_BLNK_WRAPPEES+= IMAKE
+_WRAPPEES+= LIBTOOL
+_WRAPPEES+= SHLIBTOOL
+_LIBTOOL= ${WRAPPER_LIBTOOL}
+_SHLIBTOOL= ${WRAPPER_SHLIBTOOL}
.endif
-_ALIASES.AS= as
-_ALIASES.CC= cc gcc
-_ALIASES.CXX= c++ g++ CC
-_ALIASES.CPP= cpp
-_ALIASES.FC= f77 g77
-_ALIASES.LD= ld
+_WRAP_ALIASES.LIBTOOL= libtool
+_WRAP_ALIASES.SHLIBTOOL= shlibtool
-# _BLNK_WRAP_*.<wrappee> variables represent "template methods" of the
-# wrapper script that may be customized per wrapper:
-#
-# _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_BUILDCMD= ${BUILDLINK_DIR}/bin/.buildcmd
-_BLNK_WRAP_QUOTEARG= ${BUILDLINK_DIR}/bin/.quotearg
-_BLNK_WRAP_BUFFER= ${BUILDLINK_DIR}/bin/.buffer
-_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_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
-_BLNK_REORDERLIBS= ${BUILDLINK_DIR}/bin/.reorderlibs
+_BLNK_LIBTOOL_FIX_LA= ${WRAPPER_TMPDIR}/libtool-fix-la
-.if defined(BUILDLINK_WRAPPER_LOG)
-MAKE_ENV+= BUILDLINK_WRAPPER_LOG=${BUILDLINK_WRAPPER_LOG}
-.endif
-
-.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_SANITIZE_PATH.${_wrappee_}= ${_BLNK_WRAP_SANITIZE_PATH}
-_BLNK_WRAP_EXTRA_FLAGS.${_wrappee_}= # empty
-_BLNK_WRAP_ENV.${_wrappee_}= ${_BLNK_WRAP_ENV}
-_BLNK_WRAP_BUILDCMD.${_wrappee_}= ${_BLNK_WRAP_BUILDCMD}
-_BLNK_WRAP_QUOTEARG.${_wrappee_}= ${_BLNK_WRAP_QUOTEARG}
-_BLNK_WRAP_BUFFER.${_wrappee_}= ${_BLNK_WRAP_BUFFER}
-_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 sanitize the PATH because we want libtool to invoke the wrapper
-# scripts, too.
-#
-_BLNK_WRAPPER_SH.LIBTOOL= ${.CURDIR}/../../mk/buildlink3/libtool.sh
-_BLNK_WRAP_SANITIZE_PATH.LIBTOOL= # empty
-#
-_BLNK_WRAPPER_SH.SHLIBTOOL= ${.CURDIR}/../../mk/buildlink3/libtool.sh
-_BLNK_WRAP_SANITIZE_PATH.SHLIBTOOL= # empty
+# We want libtool to invoke the wrapper scripts, too.
+_WRAPPER_SH.LIBTOOL= ${BUILDLINK_SRCDIR}/libtool.sh
+_WRAP_ENV.LIBTOOL= PATH="${WRAPPER_BINDIR}:${_WRAP_PATH}"; export PATH
+_WRAPPER_SH.SHLIBTOOL= ${_WRAPPER_SH.LIBTOOL}
+_WRAP_ENV.SHLIBTOOL= ${_WRAP_ENV.LIBTOOL}
# We need to "unbuildlinkify" any libtool archives.
-_BLNK_WRAP_LT_UNTRANSFORM_SED= ${_UNBUILDLINK_SED}
-
-.if !empty(PKGSRC_COMPILER:Mmipspro)
-_BLNK_WRAP_PRIVATE_PRE_CACHE.CC= ${_BLNK_WRAP_PRE_CACHE}
-_BLNK_WRAP_PRIVATE_CACHE_ADD.CC= ${BUILDLINK_DIR}/bin/.mipspro-cc-cache-add
-_BLNK_WRAP_PRIVATE_CACHE.CC= ${BUILDLINK_DIR}/bin/.mipspro-cc-cache
-_BLNK_WRAP_PRIVATE_POST_CACHE.CC= ${BUILDLINK_DIR}/bin/.mipspro-cc-post-cache
-_BLNK_WRAP_POST_LOGIC.CC= ${BUILDLINK_DIR}/bin/.mipspro-cc-post-logic
-#
-# The MIPSpro 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/.mipspro-cc-cache-add
-_BLNK_WRAP_PRIVATE_CACHE.CXX= ${BUILDLINK_DIR}/bin/.mipspro-cc-cache
-_BLNK_WRAP_PRIVATE_POST_CACHE.CXX= ${BUILDLINK_DIR}/bin/.mipspro-cc-post-cache
-_BLNK_WRAP_POST_LOGIC.CXX= ${BUILDLINK_DIR}/bin/.mipspro-cc-post-logic
-.endif # mipspro
-
-.if !empty(PKGSRC_COMPILER:Mmipspro-ucode)
-_BLNK_WRAP_PRIVATE_PRE_CACHE.CC= ${_BLNK_WRAP_PRE_CACHE}
-_BLNK_WRAP_PRIVATE_CACHE_ADD.CC= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-cache-add
-_BLNK_WRAP_PRIVATE_CACHE.CC= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-cache
-_BLNK_WRAP_PRIVATE_POST_CACHE.CC= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-cache
-_BLNK_WRAP_POST_LOGIC.CC= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-logic
-#
-# The MIPSpro ucode 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/.mipspro-ucode-cc-cache-add
-_BLNK_WRAP_PRIVATE_CACHE.CXX= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-cache
-_BLNK_WRAP_PRIVATE_POST_CACHE.CXX= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-cache
-_BLNK_WRAP_POST_LOGIC.CXX= ${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-logic
-.endif # mipspro-ucode
-
-.if !empty(PKGSRC_COMPILER:Msunpro)
-_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 # 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}
-
-# 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
+_BLNK_WRAP_LT_UNTRANSFORM_SED= ${SUBST_SED.unwrap}
+
+_WRAP_BUILDCMD.LIBTOOL= ${WRAPPER_TMPDIR}/buildcmd-libtool
+_WRAP_CACHE.LIBTOOL= ${WRAPPER_TMPDIR}/cache-libtool
+_WRAP_CACHE_BODY.LIBTOOL= ${WRAPPER_TMPDIR}/cache-body-libtool
+_WRAP_CLEANUP.LIBTOOL= ${WRAPPER_TMPDIR}/cleanup-libtool
+_WRAP_CMD_SINK.LIBTOOL= ${WRAPPER_TMPDIR}/cmd-sink-libtool
+_WRAP_SCAN.LIBTOOL= ${WRAPPER_TMPDIR}/scan-libtool
+_WRAP_TRANSFORM.LIBTOOL= ${WRAPPER_TMPDIR}/transform-libtool
+
+_WRAP_BUILDCMD.SHLIBTOOL= ${_WRAP_BUILDCMD.LIBTOOL}
+_WRAP_CACHE.SHLIBTOOL= ${_WRAP_CACHE.LIBTOOL}
+_WRAP_CACHE_BODY.SHLIBTOOL= ${_WRAP_CACHE_BODY.LIBTOOL}
+_WRAP_CLEANUP.SHLIBTOOL= ${_WRAP_CLEANUP.LIBTOOL}
+_WRAP_CMD_SINK.SHLIBTOOL= ${_WRAP_CMD_SINK.LIBTOOL}
+_WRAP_SCAN.SHLIBTOOL= ${_WRAP_SCAN.LIBTOOL}
+_WRAP_TRANSFORM.SHLIBTOOL= ${_WRAP_TRANSFORM.LIBTOOL}
# Silently pass the appropriate flags to the compiler/linker commands so
# that headers and libraries in ${BUILDLINK_DIR}/{include,lib} are found
@@ -1237,539 +1051,78 @@ _BLNK_WRAP_LOGIC.IMAKE= ${_BLNK_WRAP_LOGIC}
#
_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_WRAP_EXTRA_FLAGS.FC= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
-_BLNK_WRAP_EXTRA_FLAGS.LD= ${_BLNK_LDFLAGS}
-_BLNK_WRAP_EXTRA_FLAGS.LIBTOOL= ${_BLNK_LDFLAGS}
-_BLNK_WRAP_EXTRA_FLAGS.SHLIBTOOL= ${_BLNK_WRAP_EXTRA_FLAGS.LIBTOOL}
-
-.PHONY: buildlink-wrappers
-
-buildlink-wrappers: ${_BLNK_LIBTOOL_FIX_LA}
-
-.for _wrappee_ in ${_BLNK_WRAPPEES}
-. if defined(PKG_${_wrappee_})
-_BLNK_PKG_${_wrappee_}= ${PKG_${_wrappee_}}
-. else
-_BLNK_PKG_${_wrappee_}= ${${_wrappee_}}
-. endif
-
-BUILDLINK_${_wrappee_}= \
- ${BUILDLINK_DIR}/bin/${_BLNK_PKG_${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
-${_wrappee_}:= ${BUILDLINK_${_wrappee_}:T}
-
-# 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|@BASENAME@|${BASENAME:Q}|g" \
- -e "s|@CAT@|${CAT:Q}|g" \
- -e "s|@DIRNAME@|${DIRNAME:Q}|g" \
- -e "s|@ECHO@|${ECHO:Q}|g" \
- -e "s|@EXPR@|${EXPR:Q}|g" \
- -e "s|@PWD_CMD@|${PWD_CMD:Q}|g" \
- -e "s|@SED@|${SED:Q}|g" \
- -e "s|@TEST@|${TEST:Q}|g" \
- -e "s|@TOUCH@|${TOUCH:Q}|g" \
- -e "s|@_BLNK_LIBTOOL_FIX_LA@|${_BLNK_LIBTOOL_FIX_LA:Q}|g" \
- -e "s|@_BLNK_REORDERLIBS@|${_BLNK_REORDERLIBS: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_BUILDCMD@|${_BLNK_WRAP_BUILDCMD.${_wrappee_}:Q}|g" \
- -e "s|@_BLNK_WRAP_QUOTEARG@|${_BLNK_WRAP_QUOTEARG.${_wrappee_}:Q}|g" \
- -e "s|@_BLNK_WRAP_BUFFER@|${_BLNK_WRAP_BUFFER.${_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"
-
-_BLNK_WRAPPEE_COOKIE.${_wrappee_}= \
- ${BUILDLINK_DIR}/.buildlink_wrapper_${_wrappee_}_done
-
-buildlink-wrappers: ${_BLNK_WRAPPEE_COOKIE.${_wrappee_}}
-${_BLNK_WRAPPEE_COOKIE.${_wrappee_}}: \
- ${_BLNK_WRAPPER_SH.${_wrappee_}} \
- ${_BLNK_WRAP_BUILDCMD.${_wrappee_}} \
- ${_BLNK_WRAP_QUOTEARG.${_wrappee_}} \
- ${_BLNK_WRAP_BUFFER.${_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: ${BUILDLINK_${_wrappee_}}"
- ${_PKG_SILENT}${_PKG_DEBUG} \
- wrappee="${_BLNK_PKG_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
- gen=yes; \
- 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 \
- gen=no; \
- ${ECHO_BUILDLINK_MSG} "Warning: unable to create \"$${wrappee}\" wrapper script"; \
- fi; \
- ;; \
- esac; \
- case $$gen in \
- yes) \
- ${MKDIR} ${BUILDLINK_${_wrappee_}:H}; \
- ${CAT} ${_BLNK_WRAPPER_SH.${_wrappee_}} | \
- ${SED} ${_BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}} \
- -e "s|@WRAPPEE@|$${absdir}${_BLNK_PKG_${_wrappee_}:Q}|g" | \
- ${_BLNK_SH_CRUNCH_FILTER} \
- > ${BUILDLINK_${_wrappee_}}; \
- ${CHMOD} +x ${BUILDLINK_${_wrappee_}}; \
- ;; \
- esac
-. for _alias_ in ${_ALIASES.${_wrappee_}:S/^/${BUILDLINK_DIR}\/bin\//}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -x ${_alias_} -a -x ${BUILDLINK_${_wrappee_}} ]; then \
- ${ECHO_BUILDLINK_MSG} "=> Linking wrapper: ${_alias_}"; \
- ${LN} -f ${BUILDLINK_${_wrappee_}} ${_alias_}; \
- fi
-. endfor
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
-.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}
-
-.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
-
-.if !target(${_BLNK_EMPTY_FILE})
-${_BLNK_EMPTY_FILE}:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
-.endif
-
-.if !target(${_BLNK_WRAP_BUILDCMD})
-${_BLNK_WRAP_BUILDCMD}: ${.CURDIR}/../../mk/buildlink3/buildcmd
+_WRAP_EXTRA_ARGS.CC+= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_WRAP_EXTRA_ARGS.CXX+= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_WRAP_EXTRA_ARGS.CPP+= ${_BLNK_CPPFLAGS}
+_WRAP_EXTRA_ARGS.FC+= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_WRAP_EXTRA_ARGS.LD+= ${_BLNK_LDFLAGS}
+_BLNK_LIBTOOL_LDFLAGS= ${_BLNK_LDFLAGS}
+
+${WRAPPER_TMPDIR}/libtool-fix-la: ${BUILDLINK_SRCDIR}/libtool-fix-la
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-.endif
-
-.if !target(${_BLNK_WRAP_QUOTEARG})
-${_BLNK_WRAP_QUOTEARG}: ${.CURDIR}/../../mk/buildlink3/quotearg
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-.endif
-
-.if !target(${_BLNK_WRAP_BUFFER})
-${_BLNK_WRAP_BUFFER}: ${.CURDIR}/../../mk/buildlink3/buffer
+ | ${SED} -e "s|@_BLNK_WRAP_LT_UNTRANSFORM_SED@|${_BLNK_WRAP_LT_UNTRANSFORM_SED:Q}|g" \
+ -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR:Q}|g" \
+ -e "s|@DEPOTBASE@|${DEPOTBASE:Q}|g" \
+ -e "s|@LOCALBASE@|${LOCALBASE:Q}|g" \
+ -e "s|@WRKSRC@|${WRKSRC:Q}|g" \
+ -e "s|@BASENAME@|${BASENAME: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" \
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+
+${WRAPPER_TMPDIR}/buildcmd-libtool: ${BUILDLINK_SRCDIR}/buildcmd-libtool
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-.endif
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
-.if !target(${_BLNK_WRAP_MARSHALL})
-${_BLNK_WRAP_MARSHALL}: ${.CURDIR}/../../mk/buildlink3/marshall
+${WRAPPER_TMPDIR}/cleanup-libtool: \
+ ${BUILDLINK_SRCDIR}/cleanup-libtool \
+ ${_BLNK_LIBTOOL_FIX_LA}
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-.endif
-
-.if !target(${_BLNK_WRAP_PRE_CACHE})
-${_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}
-.endif
-
-.if !target(${_BLNK_WRAP_CACHE_ADD})
-${_BLNK_WRAP_CACHE_ADD}:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
-.endif
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${CAT} ${BUILDLINK_SRCDIR}/cleanup-libtool \
+ | ${SED} -e "s|@_BLNK_LIBTOOL_FIX_LA@|${_BLNK_LIBTOOL_FIX_LA:Q}|g" \
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
-.if !target(${_BLNK_WRAP_CACHE})
-${_BLNK_WRAP_CACHE}: \
- ${_BLNK_WRAP_PRE_CACHE} \
- ${_BLNK_WRAP_CACHE_ADD} \
- ${_BLNK_WRAP_POST_CACHE}
+${WRAPPER_TMPDIR}/cmd-sink-libtool: ${BUILDLINK_SRCDIR}/cmd-sink-libtool
${_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
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
-.if !target(${_BLNK_WRAP_CACHE_TRANSFORM})
-${_BLNK_WRAP_CACHE_TRANSFORM}: \
- ${_BLNK_WRAP_PRE_CACHE} \
- ${_BLNK_WRAP_CACHE_ADD_TRANSFORM} \
- ${_BLNK_WRAP_POST_CACHE}
+${WRAPPER_TMPDIR}/scan-libtool: ${BUILDLINK_SRCDIR}/scan-libtool
${_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
+ | ${SED} -e "s|@_BLNK_LIBTOOL_LDFLAGS@|${_BLNK_LIBTOOL_LDFLAGS:Q}|g" \
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
-.if !target(${_BLNK_WRAP_POST_CACHE})
-${_BLNK_WRAP_POST_CACHE}: ${.CURDIR}/../../mk/buildlink3/post-cache
+${WRAPPER_TMPDIR}/transform-libtool: ${BUILDLINK_SRCDIR}/transform-libtool
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
+ | ${SED} -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR:Q}|g" \
+ -e "s|@WRKSRC@|${WRKSRC:Q}|g" \
+ -e "s|@BASENAME@|${BASENAME:Q}|g" \
+ -e "s|@DIRNAME@|${DIRNAME:Q}|g" \
+ -e "s|@PWD@|${PWD_CMD:Q}|g" \
+ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+
+WRAPPER_TARGETS+= pre-buildlink do-buildlink post-buildlink
+.if !target(pre-buildlink)
+pre-buildlink:
+ @${DO_NADA}
.endif
-
-${BUILDLINK_DIR}/bin/.mipspro-cc-post-cache: \
- ${.CURDIR}/../../mk/buildlink3/mipspro-cc-post-cache
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-cache: \
- ${.CURDIR}/../../mk/buildlink3/mipspro-ucode-cc-post-cache
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.sunpro-cc-post-cache: \
- ${.CURDIR}/../../mk/buildlink3/sunpro-cc-post-cache
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.ld-post-cache: \
- ${.CURDIR}/../../mk/buildlink3/ld-post-cache
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.libtool-post-cache: \
- ${.CURDIR}/../../mk/buildlink3/libtool-post-cache
- ${_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_PRE_CACHE.${_wrappee_}})
-${_BLNK_WRAP_PRIVATE_PRE_CACHE.${_wrappee_}}:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
-. endif
-. 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_POST_CACHE.${_wrappee_}})
-${_BLNK_WRAP_PRIVATE_POST_CACHE.${_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
-
-.if !target(${_BLNK_WRAP_LOGIC})
-${_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}
+.if !target(do-buildlink)
+do-buildlink:
+ @${DO_NADA}
.endif
-
-.if !target(${_BLNK_WRAP_LOGIC_TRANSFORM})
-${_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}
+.if !target(post-buildlink)
+post-buildlink:
+ @${DO_NADA}
.endif
-${BUILDLINK_DIR}/bin/.mipspro-cc-post-logic: \
- ${.CURDIR}/../../mk/buildlink3/mipspro-cc-post-logic
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.mipspro-ucode-cc-post-logic: \
- ${.CURDIR}/../../mk/buildlink3/mipspro-ucode-cc-post-logic
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.sunpro-cc-post-logic: \
- ${.CURDIR}/../../mk/buildlink3/sunpro-cc-post-logic
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.ld-post-logic: \
- ${.CURDIR}/../../mk/buildlink3/ld-post-logic
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
- | ${_BLNK_SH_CRUNCH_FILTER} > ${.TARGET}
-
-${BUILDLINK_DIR}/bin/.libtool-post-logic: \
- ${.CURDIR}/../../mk/buildlink3/libtool-post-logic
- ${_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_POST_LOGIC.${_wrappee_}})
-${_BLNK_WRAP_PRIVATE_POST_LOGIC.${_wrappee_}}:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET}
-. endif
-.endfor
-
-${BUILDLINK_DIR}/bin/.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= # empty
-.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>.
-#
-. if ${PKG_INSTALLATION_TYPE} == "pkgviews"
-. for _pkg_ in ${_BLNK_PACKAGES}
-. if !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
-_BLNK_CACHE_PASSTHRU_GLOB+= -[IL]${BUILDLINK_PREFIX.${_pkg_}}/*
-. endif
-. endfor
-. endif
-#
-# Allow all subdirs of ${_BLNK_PASSTHRU_DIRS} and ${_BLNK_PASSTHRU_RPATHDIRS}
-# to be in the runtime library search path.
-#
-. if ${_USE_RPATH} == "yes"
-. for _dir_ in ${_BLNK_PASSTHRU_DIRS} ${_BLNK_PASSTHRU_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|@_BLNK_REORDERLIBS@|${_BLNK_REORDERLIBS: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_REORDERLIBS}: \
- ${_BLNK_GEN_TRANSFORM}
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${_BLNK_GEN_TRANSFORM} \
- ${_BLNK_TRANSFORM}
-.endif # BUILDLINK_PHASES
-
-.PHONY: buildlink-vars-mk
-buildlink-vars-mk: ${_BLNK_VARS_MK}
-${_BLNK_VARS_MK}:
- ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET}.tmp
-.for _var_ in ${BUILDLINK_VARS}
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO} "${_var_}= ${${_var_}}" >> ${.TARGET}.tmp
-.endfor
- ${_PKG_SILENT}${_PKG_DEBUG} \
- if [ -f ${.TARGET}.tmp ]; then \
- ${SORT} -u ${.TARGET}.tmp > ${.TARGET}; \
- ${RM} -f ${.TARGET}.tmp; \
- fi
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
+.endif # PHASES_AFTER_WRAPPER
+###
+### END: after "wrapper" phase
+###
diff --git a/mk/buildlink3/bsd.builtin.mk b/mk/buildlink3/bsd.builtin.mk
index 2eaa8165d86..3c69a39169e 100644
--- a/mk/buildlink3/bsd.builtin.mk
+++ b/mk/buildlink3/bsd.builtin.mk
@@ -1,5 +1,39 @@
-# $NetBSD: bsd.builtin.mk,v 1.1 2004/03/21 00:03:32 jlam Exp $
+# $NetBSD: bsd.builtin.mk,v 1.2 2004/09/21 15:01:40 jlam Exp $
#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
# Include this file to set the value of USE_BUILTIN.<pkg> for each
# package listed in BUILDLINK_PACKAGES. Note that this file may
# indirectly add additional values to BUILDLINK_PACKAGES.
diff --git a/mk/buildlink3/buffer b/mk/buildlink3/buffer
deleted file mode 100644
index 4d6d743790e..00000000000
--- a/mk/buildlink3/buffer
+++ /dev/null
@@ -1,61 +0,0 @@
-# $NetBSD: buffer,v 1.7 2004/01/30 13:44:52 jlam Exp $
-#
-# Push arguments onto the argument stack and shift the arguments. The
-# next argument checked by the cache and logic files is take from the
-# the top of the stack.
-#
-if $test -z "$depth"; then
- arg="$1"; shift
- #
- # Marshall any group of consecutive arguments into a single
- # $arg to be checked in the cache and logic files.
- #
- . $marshall
- #
- # Push the argument onto the stack.
- #
- depth=${depth}0
- eval stack${depth}="\$arg"
-fi
-
-argok=no
-while $test "$argok" = "no"; do
- #
- # Take $arg from the top of the stack.
- #
- eval arg="\$stack${depth}"
- depth=${depth%0}
- argok=yes
-
- case $arg in
- #
- # Change "-<rpath_flag>/path1:/path2" into
- # "-<rpath_flag>/path1 -<rpath_flag>/path2" so that
- # they can be checked correctly in the cache and logic
- # files.
- #
- -R*:*|-Wl,-R*:*|-Wl,-rpath,*:*|-Wl,-rpath-link,*:*|\
- -Wl,--rpath,*:*|-Wl,--rpath-link,*:*)
- case $arg in
- -R*) R="-R" ;;
- -Wl,-R*) R="-Wl,-R" ;;
- -Wl,-rpath,*) R="-Wl,-rpath," ;;
- -Wl,-rpath-link,*) R="-Wl,-rpath-link," ;;
- -Wl,--rpath,*) R="-Wl,--rpath," ;;
- -Wl,--rpath-link,*) R="-Wl,--rpath-link," ;;
- esac
- arg=`$echo "X$arg" | $Xsed -e "s|^"$R"||g"`
- save_IFS="${IFS}"; IFS=":"
- revarg=
- for dir in $arg; do
- revarg="$dir $revarg"
- done
- IFS="${save_IFS}"
- for dir in $revarg; do
- depth=${depth}0
- eval stack${depth}="\$R\$dir"
- done
- argok=no
- ;;
- esac
-done
diff --git a/mk/buildlink3/buildcmd b/mk/buildlink3/buildcmd
deleted file mode 100644
index d8889296809..00000000000
--- a/mk/buildlink3/buildcmd
+++ /dev/null
@@ -1,55 +0,0 @@
-# $NetBSD: buildcmd,v 1.4 2004/01/30 10:56:11 jlam Exp $
-#
-# Append $arg to $cmd to build up the command line to be executed, but
-# directly add the next few arguments to $cmd if $skipargs > 0.
-#
-if $test $skipargs -gt 0; then
- cmd="$cmd $arg"
- while $test $skipargs -gt 0; do
- arg=$1; shift
- . $quotearg
- arg="$qarg"
- cmd="$cmd $arg"
- skipargs=`$expr $skipargs - 1`
- done
-else
- #
- # Reduce command length by not appending options that we've
- # already seen to the command.
- #
- case $arg in
- -[DILR]*|-Wl,-R*|-Wl,-*,/*)
- #
- # These options are only ever useful the first time
- # they're given. All other instances are redundant.
- #
- case $arg in
- -L*)
- case "$ldflags" in
- *" "$arg|*" "$arg" "*) ;;
- *) ldflags="$ldflags $arg" ;;
- esac
- ;;
- *)
- case "$cmd" in
- *" "$arg|*" "$arg" "*) ;;
- *) cmd="$cmd $arg" ;;
- esac
- ;;
- esac
- ;;
- -l*)
- #
- # Suppressed sequentially repeated libraries,
- # e.g. "-lm -lm -lm -lm" -> "-lm".
- #
- case "$libs" in
- *" "$arg) ;;
- *) libs="$libs $arg" ;;
- esac
- ;;
- *)
- cmd="$cmd $arg"
- ;;
- esac
-fi
diff --git a/mk/buildlink3/buildcmd-libtool b/mk/buildlink3/buildcmd-libtool
new file mode 100644
index 00000000000..495d6a8aaad
--- /dev/null
+++ b/mk/buildlink3/buildcmd-libtool
@@ -0,0 +1,74 @@
+# $NetBSD: buildcmd-libtool,v 1.1 2004/09/21 15:01:40 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+case $arg in
+######################################################################
+# Don't append empty arguments to the command line.
+######################################################################
+"")
+ ;;
+######################################################################
+# Reduce command length by not appending options that we've already
+# seen. Also, suppress consecutive repeated libraries.
+######################################################################
+-[DILR]*|-Wl,-R*|-Wl,-*,/*)
+ case $cmd in
+ *" "$arg|*" "$arg" "*)
+ ;;
+ *)
+ shquote "$arg"; arg="$shquoted"
+ cmd="$cmd $arg"
+ ;;
+ esac
+ ;;
+-l*)
+ case $libs in
+ *" "$arg)
+ ;;
+ *)
+ shquote "$arg"; arg="$shquoted"
+ cmd="$cmd $arg"
+ ;;
+ esac
+ ;;
+######################################################################
+# Append $arg to $cmd to build up the command line to be executed.
+######################################################################
+*)
+ shquote "$arg"; arg="$shquoted"
+ cmd="$cmd $arg"
+ ;;
+esac
diff --git a/mk/buildlink3/cleanup-libtool b/mk/buildlink3/cleanup-libtool
new file mode 100644
index 00000000000..ef57ff59a2a
--- /dev/null
+++ b/mk/buildlink3/cleanup-libtool
@@ -0,0 +1,41 @@
+# $NetBSD: cleanup-libtool,v 1.1 2004/09/21 15:01:40 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+libtool_fix_la="@_BLNK_LIBTOOL_FIX_LA@"
+
+if $test -n "$lafile" && $test -f "$lafile"; then
+ . $libtool_fix_la
+fi
diff --git a/mk/buildlink3/cmd-sink-libtool b/mk/buildlink3/cmd-sink-libtool
new file mode 100644
index 00000000000..44311d935d0
--- /dev/null
+++ b/mk/buildlink3/cmd-sink-libtool
@@ -0,0 +1,60 @@
+# $NetBSD: cmd-sink-libtool,v 1.1 2004/09/21 15:01:40 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Empty out the command buffer and build up the command line in $cmd.
+while ! queue_is_empty cmdbuf; do
+ pop_queue cmdbuf arg
+ $debug_log $wrapperlog " (cmd-sink-libtool) pop: $arg"
+ case $arg in
+ ##############################################################
+ # If we're in "compile" mode, then don't add any linker options
+ # to the command line.
+ ##############################################################
+ -L*|-l*|-Wl,*)
+ case $lt_mode in
+ link)
+ . $buildcmd
+ ;;
+ *)
+ $debug_log $wrapperlog " (cmd-sink-libtool) drop: $arg"
+ ;;
+ esac
+ ;;
+ *)
+ . $buildcmd
+ ;;
+ esac
+done
diff --git a/mk/buildlink3/gen-transform.sh b/mk/buildlink3/gen-transform.sh
deleted file mode 100644
index 4bc24e93e87..00000000000
--- a/mk/buildlink3/gen-transform.sh
+++ /dev/null
@@ -1,359 +0,0 @@
-#!@BUILDLINK_SHELL@
-#
-# $NetBSD: gen-transform.sh,v 1.31 2004/08/28 06:02:21 jlam Exp $
-
-transform="@_BLNK_TRANSFORM_SEDFILE@"
-untransform="@_BLNK_UNTRANSFORM_SEDFILE@"
-reorderlibs="@_BLNK_REORDERLIBS@"
-
-# Mini-language for translating wrapper arguments into their buildlink
-# equivalents:
-#
-# mangle:src:dst mangles the directory "src" into "dst"
-# sub-mangle:src:dst mangles "src/*" into "dst/*"
-# rpath:src:dst translates the directory "src" into "dst"
-# in rpath options
-# sub-rpath:src:dst translates "src/*" into "dst/*" in rpath
-# options
-# abs-rpath removes all rpath options that try to add
-# relative paths
-# no-rpath removes "-R*", "-Wl,-R", and "-Wl,-rpath,*"
-# reorder:l:foo:bar reorders libs to ensure that "-lfoo"
-# occurs before "-lbar"
-# 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[:baz1...] translates "-lfoo" into "-lbar [-lbaz...]"
-# 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.
-
-_sep=" \`\"':;,"
-
-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\([/$_sep]\)|$3\1|g
-s|^$2$|$3|g
-s|\([$_sep]\)$2\([/$_sep]\)|\1$3\2|g
-s|\([$_sep]\)$2$|\1$3|g
-EOF
- case "$2" in
- -*) ;;
- *)
- @CAT@ >> $sedfile << EOF
-s|\(-[ILR]\)$2\([/$_sep]\)|\1$3\2|g
-s|\(-[ILR]\)$2$|\1$3|g
-EOF
- ;;
- esac
- ;;
- esac
- ;;
- sub-mangle)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|^$2\(/[^/$_sep]\)|$3\1|g
-s|\([$_sep]\)$2\(/[^/$_sep]\)|\1$3\2|g
-EOF
- case "$2" in
- -*) ;;
- *)
- @CAT@ >> $sedfile << EOF
-s|\(-[ILR]\)$2\(/[^/$_sep]\)|\1$3\2|g
-EOF
- ;;
- esac
- ;;
- 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
- ;;
- sub-rpath)
- gen $action sub-mangle:-Wl,--rpath-link,$2:-Wl,--rpath-link,$3
- gen $action sub-mangle:-Wl,--rpath,$2:-Wl,--rpath,$3
- gen $action sub-mangle:-Wl,-rpath-link,$2:-Wl,-rpath-link,$3
- gen $action sub-mangle:-Wl,-rpath,$2:-Wl,-rpath,$3
- gen $action sub-mangle:-Wl,-R$2:-Wl,-R$3
- gen $action sub-mangle:-R$2:-R$3
- ;;
- abs-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\\.
- ;;
- 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
- ;;
- reorder)
- case "$action" in
- transform)
- shift
- case $1 in
- l)
- @CAT@ >> $reorderlibs << EOF
- # -l$2 comes before -l$3
- -l$2)
- case "\${_libs}" in
- -l$3" "*|*" "-l$3" "*)
- _libs="\${_libs%%-l$3 *}-l$2 -l$3 \${_libs#*-l$3 }"
- ;;
- -l$3|*" "-l$3)
- _libs="\${_libs%%-l$3}-l$2 -l$3"
- ;;
- *)
- _libs="\${_libs} \$l"
- ;;
- esac
- ;;
-EOF
- ;;
- esac
- ;;
- esac
- ;;
- depot)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|^$2/[^/$_sep]*\(/[^$_sep]\)|$3\1|g
-s|^$2/[^/$_sep]*$|$3|g
-s|\([$_sep]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g
-s|\([$_sep]\)$2/[^/$_sep]*$|\1$3|g
-s|\(-[ILR]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g
-s|\(-[ILR]\)$2/[^/$_sep]*$|\1$3|g
-EOF
- ;;
- esac
- ;;
- I|L)
- case "$action" in
- transform)
- @CAT@ >> $sedfile << EOF
-s|-$1$2\([$_sep]\)|-$1$3\1|g
-s|-$1$2$|-$1$3|g
-s|-$1$2/|-$1$3/|g
-EOF
- ;;
- untransform)
- @CAT@ >> $sedfile << EOF
-s|-$1$3\([$_sep]\)|-$1$2\1|g
-s|-$1$3$|-$1$2|g
-s|-$1$3/|-$1$2/|g
-EOF
- ;;
- esac
- ;;
- l)
- case "$action" in
- transform|untransform)
- shift
- tolibs=
- fromlib="-l$1"; shift
- while [ $# -gt 0 ]; do
- case $1 in
- "") ;;
- *) case $tolibs in
- "") tolibs="-l$1" ;;
- *) tolibs="$tolibs -l$1"
- esac
- ;;
- esac
- shift
- done
- @CAT@ >> $sedfile << EOF
-s|$fromlib\([$_sep]\)|$tolibs\1|g
-s|$fromlib$|$tolibs|g
-EOF
- ;;
- esac
- ;;
- P)
- case "$action" in
- transform)
- @CAT@ >> $sedfile << EOF
-s|$2\(/[^$_sep]*/lib[^/$_sep]*\.la\)\([$_sep]\)|$3\1\2|g
-s|$2\(/[^$_sep]*/lib[^/$_sep]*\.la\)$|$3\1|g
-s|$2\(/[^$_sep]*/lib[^/$_sep]*\.a\)\([$_sep]\)|$3\1\2|g
-s|$2\(/[^$_sep]*/lib[^/$_sep]*\.a\)$|$3\1|g
-EOF
- ;;
- untransform)
- @CAT@ >> $sedfile << EOF
-s|$3\(/[^$_sep]*/lib[^/$_sep]*\.a\)\([$_sep]\)|$2\1\2|g
-s|$3\(/[^$_sep]*/lib[^/$_sep]*\.a\)$|$2\1|g
-s|$3\(/[^$_sep]*/lib[^/$_sep]*\.la\)\([$_sep]\)|$2\1\2|g
-s|$3\(/[^$_sep]*/lib[^/$_sep]*\.la\)$|$2\1|g
-EOF
- ;;
- esac
- ;;
- p)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*\([$_sep]\)|-L\1 -l\2\4|g
-s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*$|-L\1 -l\2|g
-s|\($2\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*\([$_sep]\)|-L\1 -l\2\4|g
-s|\($2\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*$|-L\1 -l\2|g
-s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.dylib\([$_sep]\)|-L\1 -l\2\3|g
-s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.dylib$|-L\1 -l\2|g
-s|\($2\)/lib\([^/$_sep]*\)\.dylib\([$_sep]\)|-L\1 -l\2\3|g
-s|\($2\)/lib\([^/$_sep]*\)\.dylib$|-L\1 -l\2|g
-EOF
- ;;
- esac
- ;;
- __r)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|$2[^$_sep]*||g
-EOF
- ;;
- esac
- ;;
- _r)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|$2\([$_sep]\)|\1|g
-s|$2$||g
-s|$2/[^$_sep]*||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
- ;;
- rmdir)
- gen $action r:$2
- ;;
- S)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|$2\([$_sep]\)|$3\1|g
-s|$2$|$3|g
-EOF
- ;;
- esac
- ;;
- rename)
- gen $action S:$2:$3
- ;;
- rm)
- gen $action S:$2:
- ;;
- s)
- case "$action" in
- transform|untransform)
- @CAT@ >> $sedfile << EOF
-s|$2|$3|g
-EOF
- ;;
- esac
- ;;
- *)
- echo "Unknown arg: $arg" 1>&2
- ;;
- esac
-}
-
-# Write out header for reorderlibs
-@CAT@ > $reorderlibs << EOF
-\$echo "==> Reordering libraries: \$libs" >> \$wrapperlog
-prevlibs=
-while \$test "\$libs" != "\$prevlibs"; do
- _libs=
- for l in \$libs; do
- case \$l in
-EOF
-
-# Parse arguments
-for arg do
- case $arg in
- transform:*)
- gen transform "${arg#transform:}"
- ;;
- untransform:*)
- gen untransform "${arg#untransform:}"
- ;;
- *)
- gen transform "$arg"
- gen untransform "$arg"
- ;;
- esac
-done
-
-# Write out footer for reorderlibs
-@CAT@ >> $reorderlibs << EOF
- *)
- _libs="\${_libs} \$l"
- ;;
- esac
- _libs="\${_libs# }"
- _libs="\${_libs% }"
- done
- prevlibs="\$libs"
- libs="\${_libs}"
-done
-
-# This section suppress duplicate libraries in sequence.
-_libs=
-for l in \$libs; do
- case "\${_libs}" in
- \$l|*" "\$l) ;;
- *) _libs="\${_libs} \$l" ;;
- esac
-done
-_libs="\${_libs# }"
-_libs="\${_libs% }"
-libs="\${_libs}"
-EOF
diff --git a/mk/buildlink3/ld-post-cache b/mk/buildlink3/ld-post-cache
deleted file mode 100644
index 2e7c8eab3f6..00000000000
--- a/mk/buildlink3/ld-post-cache
+++ /dev/null
@@ -1,11 +0,0 @@
-# $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
deleted file mode 100644
index c784a3fb4eb..00000000000
--- a/mk/buildlink3/ld-post-logic
+++ /dev/null
@@ -1,14 +0,0 @@
-# $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-fix-la b/mk/buildlink3/libtool-fix-la
index 58b222f6afb..2c29464e1b9 100644
--- a/mk/buildlink3/libtool-fix-la
+++ b/mk/buildlink3/libtool-fix-la
@@ -1,23 +1,69 @@
-# $NetBSD: libtool-fix-la,v 1.4 2004/03/30 17:25:19 jlam Exp $
+# $NetBSD: libtool-fix-la,v 1.5 2004/09/21 15:01:40 jlam Exp $
#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
# 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.
+# 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.
+# 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.
+
+BUILDLINK_DIR="@BUILDLINK_DIR@"
+DEPOTBASE="@DEPOTBASE@"
+LOCALBASE="@LOCALBASE@"
+WRKSRC="@WRKSRC@"
+
+basename="@BASENAME@"
+dirname="@DIRNAME@"
+egrep="@EGREP@"
+mv="@MV@"
+rm="@RM@"
-labase=`@BASENAME@ $lafile .la`
-ladir=`@DIRNAME@ $lafile`
+labase=`$basename $lafile .la`
+ladir=`$dirname $lafile`
latimestamp=${ladir}/.${labase}.la.timestamp
laifile=${ladir}/.libs/${labase}.lai
if $test -f $lafile; then
@@ -25,33 +71,38 @@ if $test -f $lafile; then
deps=
for i in ${dependency_libs}; do
- case "$i" in
+ case $i in
+ ####################################################
+ # Skip all -R* options... rpath info shouldn't go into
+ # the dependency_libs line.
+ ####################################################
-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
+ case $deps in
*"$i "*) ;;
*"$i") ;;
- *) deps="${deps} $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.
- #
+ ####################################################
+ # 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
+ ltlibsdir=`$dirname $i`/.libs
+ case $ltlibsdir in
/*)
# fix if an absolute path in ${WRKSRC}
- case "$ltlibsdir" in
- @WRKSRC@/*) fixla=1 ;;
+ case $ltlibsdir in
+ ${WRKSRC}/*) fixla=1 ;;
esac
;;
*)
@@ -60,53 +111,61 @@ if $test -f $lafile; then
;;
esac
if $test $fixla -gt 0; then
- case "$deps" in
+ case $deps in
*"-L$ltlibsdir "*) ;;
*"-L$ltlibsdir") ;;
*) deps="$deps -L$ltlibsdir" ;;
esac
fi
- deps="${deps} $i"
+ deps="$deps $i"
;;
- # Everything else Just Belongs in the dependency_libs line.
+ ####################################################
+ # Everything else Just Belongs in the dependency_libs
+ # line.
+ ####################################################
*)
- deps="${deps} $i"
+ deps="$deps $i"
;;
esac
done
relink=
for i in ${relink_command}; do
- case "$i" in
+ case $i in
+ ####################################################
# -I* and -D* are useless for linking.
+ ####################################################
-I*|-D*)
;;
+ ####################################################
# Catch -L<dir> and remove redundant ones.
+ ####################################################
-L*)
- case "$relink" in
+ case $relink in
*"$i "*) ;;
*"$i") ;;
- *) relink="${relink} $i" ;;
+ *) relink="$relink $i" ;;
esac
;;
# This is the .la file we're relinking... don't touch it!
$lafile)
- relink="${relink} $i"
+ 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.
- #
+ ####################################################
+ # 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
+ ltlibsdir=`$dirname $i`/.libs
+ case $ltlibsdir in
/*)
# fix if an absolute path in ${WRKSRC}
- case "$ltlibsdir" in
- @WRKSRC@/*) fixla=1 ;;
+ case $ltlibsdir in
+ ${WRKSRC}/*) fixla=1 ;;
esac
;;
*)
@@ -115,39 +174,42 @@ if $test -f $lafile; then
;;
esac
if $test $fixla -gt 0; then
- case "$relink" in
+ case $relink in
*"-L$ltlibsdir "*) ;;
*"-L$ltlibsdir") ;;
*) relink="$relink -L$ltlibsdir" ;;
esac
fi
- relink="${relink} $i"
+ relink="$relink $i"
;;
- # Everything else Just Belongs in the relink_command line.
+ ####################################################
+ # Everything else Just Belongs in the relink_command
+ # line.
+ ####################################################
*)
- relink="${relink} $i"
+ relink="$relink $i"
;;
esac
done
- #
- # Save the orignal .la file produced by libtool as
- # .la.blsav, and create the new one with a signature.
- #
- @MV@ -f $lafile ${lafile}.blsav
+ ##############################################################
+ # 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'
+ $cat ${lafile}.blsav | $sed -e '/^dependency_libs=/,$d'
$echo "dependency_libs='$deps'"
- $cat ${lafile}.blsav | @SED@ -e '1,/^dependency_libs=/d'
+ $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'
+ $cat ${lafile}.tmp | $sed -e '/^relink_command=/,$d'
$echo "relink_command='$relink'"
- $cat ${lafile}.tmp | @SED@ -e '1,/^relink_command=/d'
+ $cat ${lafile}.tmp | $sed -e '1,/^relink_command=/d'
) > $lafile
else
$cat ${lafile}.tmp > $lafile
@@ -157,116 +219,132 @@ if $test -f $lafile; then
$echo "buildlibdir='"`cd .; $pwd`"'" >> $lafile
$echo >> $lafile
$echo "# This file has been modified by buildlink3." >> $lafile
- @RM@ ${lafile}.tmp
- $echo "==> Fixed $lafile" >> $wrapperlog
- #
- # Fix up any .lai files (libtool archives that will be installed).
- #
+ $rm ${lafile}.tmp
+ msg_log $wrapperlog "==> Fixed $lafile"
+ ##############################################################
+ # 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
+ $egrep "^#.*modified by buildlink3" $laifile >/dev/null 2>&1; then
:
else
- @SED@ @_BLNK_WRAP_LT_UNTRANSFORM_SED@ \
+ $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}/*)
+ deps_ok=no
+ deps="${dependency_libs}"
+ while $test "$deps_ok" = "no"; do
+ deps_ok=yes
+ L=; l=; lexist=; prev=
+ for i in $deps; do
+ case $i in
+ ######################################
+ # Don't allowed repeated arguments, so
+ # "-lm -lm" becomes just "-lm".
+ ######################################
+ $prev)
;;
- -L@WRKSRC@|-L@WRKSRC@/*)
+ ######################################
+ # Skip all -R* options... rpath info
+ # shouldn't go into the dependency_libs
+ # line.
+ ######################################
+ -R*)
;;
- -L@DEPOTBASE@/*)
- i=`$echo "X$i" | $Xsed -e "s,-L@DEPOTBASE@/[^/]*/,-L@LOCALBASE@/,"`
- case "$L" in
- *"$i "*) ;;
- *"$i") ;;
- *) L="$L $i" ;;
+ ######################################
+ # 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 "$i" | $sed -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
;;
- *)
- case "$L" in
- *"$i "*) ;;
- *"$i") ;;
- *) L="$L $i" ;;
+ ######################################
+ # 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="${libbase#lib}"
+ lexist=1
+ l="$l -l$lib"
+ deps_ok=no
+ ;;
+ ######################################
+ # Everything else Just Belongs.
+ ######################################
+ *)
+ l="$l $i"
;;
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"
+ prev="$i"
+ done
+ if $test -z "$lexist"; then
+ L=
+ fi
+ deps="$L$l"
+ deps=`$echo "X$deps" | $Xsed -e "s/^[ ]*//"`
done
- if $test -z "$lexist"; then
- L=
- fi
- deps="$L$l"
- deps=`$echo "X$deps" | $Xsed -e "s/^[ ]*//"`
- @MV@ -f $laifile ${laifile}.blsav
+ $mv -f $laifile ${laifile}.blsav
(
- $cat ${laifile}.tmp | @SED@ -e '/^dependency_libs=/,$d'
+ $cat ${laifile}.tmp | $sed -e '/^dependency_libs=/,$d'
$echo "dependency_libs='$deps'"
- $cat ${laifile}.tmp | @SED@ -e '1,/^dependency_libs=/d'
+ $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
+ $rm -f ${laifile}.tmp
+ msg_log $wrapperlog "==> Fixed $laifile"
+ if $egrep "${BUILDLINK_DIR}" $laifile >/dev/null 2>&1; then
+ msg_log $wrapperlog "==> [buildlink3] Error: buildlink3 leakage into $laifile"
$echo "==> [buildlink3] Error: buildlink3 leakage into $laifile" 1>&2
wrapper_result=1
fi
diff --git a/mk/buildlink3/libtool-post-cache b/mk/buildlink3/libtool-post-cache
deleted file mode 100644
index 3c4486461d0..00000000000
--- a/mk/buildlink3/libtool-post-cache
+++ /dev/null
@@ -1,22 +0,0 @@
-# $NetBSD: libtool-post-cache,v 1.5 2004/05/17 10:37:57 jlam Exp $
-#
-# This file implements the default action of the "libtool" private
-# cache.
-
-# Skip the common cache lookup for all directories and library args that
-# may reference a locally-linked libtool archive. Avoid matching the
-# buildlink directory here for the WRKSRC == WRKDIR case.
-#
--L${BUILDLINK_DIR}/*)
- ;;
--L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*|-l*)
- skipcache=yes
- ;;
-
-# Skip the common cache lookup for all libtool archives that reference a
-# locally-linked libtool archive.
-#
-./*.la|../*.la|[!-/]*.la|${WRKSRC}/*.la)
- skipcache=yes
- ;;
-esac
diff --git a/mk/buildlink3/libtool-post-logic b/mk/buildlink3/libtool-post-logic
deleted file mode 100644
index b5592f4a935..00000000000
--- a/mk/buildlink3/libtool-post-logic
+++ /dev/null
@@ -1,85 +0,0 @@
-# $NetBSD: libtool-post-logic,v 1.8 2004/05/17 10:37:57 jlam Exp $
-
-case $arg in
-#
-# 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. Avoid matching the buildlink
-# directory here for the WRKSRC == WRKDIR case.
-#
--L${BUILDLINK_DIR}/*)
- ;;
--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
- addtocache=no
- ;;
- 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
- ldir=`cd $dir; $pwd`
- buildlibdir=`. $la; $echo $buildlibdir`
- if $test "$ldir" != "$buildlibdir"; then
- la="$buildlibdir/lib$lib.la"
- fi
- $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
- ;;
-
-# Replace all references to locally-linked libtool archives with the full
-# paths to the archives in $buildlibdir if $buildlibdir differs from the
-# referenced directory. This makes linking against a symlinked local
-# libtool archive possible.
-#
-./*.la|../*.la|[!-/]*.la|${WRKSRC}/*.la)
- labase=`$basename $arg`
- ladir=`$dirname $arg`
- ldir=`cd $ladir; $pwd`
- buildlibdir=`. $ladir/$labase; $echo $buildlibdir`
- if $test -n "$buildlibdir" -a "$ldir" != "$buildlibdir" -a -e "$buildlibdir/$labase"; then
- arg="$buildlibdir/$labase"
- $echo "*** [buildlink3] Warning: libtool replaced $ladir/$labase with $arg" >> $wrapperlog
- $echo "*** [buildlink3] Warning: libtool replaced $ladir/$labase with $arg" 1>&2
- fi
- addtoprivatecache=yes
- ;;
-esac
diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh
deleted file mode 100644
index 2faa1d1a0fe..00000000000
--- a/mk/buildlink3/libtool.sh
+++ /dev/null
@@ -1,194 +0,0 @@
-#!@BUILDLINK_SHELL@
-#
-# $NetBSD: libtool.sh,v 1.18 2004/07/04 09:52:04 wiz Exp $
-
-Xsed='@SED@ -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-
-buildcmd="@_BLNK_WRAP_BUILDCMD@"
-quotearg="@_BLNK_WRAP_QUOTEARG@"
-buffer="@_BLNK_WRAP_BUFFER@"
-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@"
-reorderlibs="@_BLNK_REORDERLIBS@"
-
-wrapperlog="${BUILDLINK_WRAPPER_LOG-@_BLNK_WRAP_LOG@}"
-
-libtool_fix_la="@_BLNK_LIBTOOL_FIX_LA@"
-fixlibpath=${BUILDLINK_FIX_IMPROPER_LIBTOOL_LIBPATH-yes}
-
-updatecache="${BUILDLINK_UPDATE_CACHE-yes}"
-cacheall="${BUILDLINK_CACHE_ALL-no}"
-reorder="${BUILDLINK_REORDER-no}"
-
-basename="@BASENAME@"
-cat="@CAT@"
-dirname="@DIRNAME@"
-echo="@ECHO@"
-expr="@EXPR@"
-pwd="@PWD_CMD@"
-test="@TEST@"
-
-BUILDLINK_DIR="@BUILDLINK_DIR@"
-WRKDIR="@WRKDIR@"
-WRKSRC="@WRKSRC@"
-
-# Argument stack depth
-depth=
-
-original_cmd="$0 $@"
-$echo [*] $original_cmd >> $wrapperlog
-
-# Discover the libtool mode by examining the argument list.
-mode=link
-prevopt=
-nonopt=
-lafile=
-for arg do
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
- if $test -n "$prevopt"; then
- case $prevopt in
- --mode)
- mode="$arg"
- ;;
- --fix-la|-o)
- case $arg in
- *.la) lafile="$arg" ;;
- esac
- ;;
- esac
- prevopt=
- continue
- fi
- case $arg in
- --mode|--fix-la|-o)
- prevopt="$arg"
- ;;
- --mode=*)
- mode="$optarg"
- ;;
- -*)
- if $test -n "$nonopt" -a "$mode" != "install"; then
- case $arg in
- -c) mode=compile ;;
- esac
- fi
- ;;
- *)
- if $test -z "$nonopt"; then
- nonopt="$arg"
- case $arg in
- *cc|*++|gcc*|*-gcc*|*CC) mode=link ;;
- *install*|cp|mv) mode=install ;;
- esac
- fi
- ;;
- esac
-done
-
-cmd="@WRAPPEE@"
-ldflags=
-libs=
-case $mode in
-execute|install)
- #
- # We're doing libtool installation, so just quote all of the
- # command-line arguments and append them to $cmd. We don't worry
- # about caching or speed, since installation is not a bottleneck
- # for package creation.
- #
- while $test $# -gt 0; do
- arg="$1"; shift
- . $quotearg
- arg="$qarg"
- cmd="$cmd $arg"
- done
- ;;
-*)
- while $test $# -gt 0 -o -n "$depth"; do
- skipargs=0
- #
- # Get the next argument from the buffer.
- #
- . $buffer
-
- case $arg in
- --fix-la)
- . $libtool_fix_la
- exit
- ;;
- *cc|*++|gcc*|*-gcc*|*CC)
- case $mode in
- link)
- set -- "$@" @_BLNK_WRAP_EXTRA_FLAGS@
- ;;
- esac
- ;;
- *)
- cachehit=no
- skipcache=no
- #
- # 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
- ;;
- esac
- #
- # Build up the command-line.
- #
- . $buildcmd
- done
- ;;
-esac
-
-# Reorder the libraries so that the library dependencies are correct.
-case $reorder in
-yes)
- if $test -n "$libs"; then
- . $reorderlibs
- fi
- ;;
-esac
-
-cmd="$cmd $ldflags $libs"
-
-@_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
deleted file mode 100644
index d2ef9482f0d..00000000000
--- a/mk/buildlink3/logic
+++ /dev/null
@@ -1,60 +0,0 @@
-# $NetBSD: logic,v 1.6 2004/04/15 09:31:48 jmmv Exp $
-#
-# If the wrapper caches don't cover the $arg we're examining, then run
-# it through the transformations and any wrapper-specific post-logic
-# and cache the result.
-#
-quotedarg=no
-addtocache=no
-addtoprivatecache=no
-cachesettings='arg="$cachearg"; cachehit=yes'
-
-. $quotearg
-searcharg="$qarg"
-
-case $arg in
--*|/*)
- 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) # $0
- cachearg="$cachearg"
- $cachesettings
- ;;
-EOF
- $cat $pre_cachefile $cachefile_add $post_cachefile > $cachefile
- ;;
-esac
diff --git a/mk/buildlink3/marshall b/mk/buildlink3/marshall
deleted file mode 100644
index 4d3d32762db..00000000000
--- a/mk/buildlink3/marshall
+++ /dev/null
@@ -1,74 +0,0 @@
-# $NetBSD: marshall,v 1.12 2004/08/29 14:25:10 wiz Exp $
-#
-# Handle cases where multiple consecutive arguments must be processed
-# together, either by merging the arguments or "skipping" the extra
-# arguments.
-#
-case $arg in
-#
-# If we see "-I dir" (or -L/-R), we convert it to "-Idir" so that it may be
-# transformed correctly.
-#
--[ILR])
- arg="$arg$1"
- shift
- ;;
-#
-# Merge "-Wl,-R -Wl,/path/to/dir" into a single argument
-# "-Wl,-R/path/to/dir" and merge "-Wl,--rpath -Wl,/path/to/dir" into
-# "-Wl,--rpath,/path/to/dir" so that we can look them up in the cache.
-# Also deal with "-Xlinker" being equivalent to "-Wl,".
-#
--Xlinker|-Wl,-R|-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath|-Wl,--rpath-link)
- R=
- case $arg in
- -Xlinker)
- case $1 in
- -Wl,-R) R="$1"; shift ;;
- -Wl,-rpath|-Wl,-rpath-link) R="$1,"; shift ;;
- -Wl,--rpath|-Wl,--rpath-link) R="$1,"; shift ;;
- -Wl,*) arg="$1"; shift ;;
- -R) R="-Wl,$1"; shift ;;
- -rpath|-rpath-link) R="-Wl,$1,"; shift ;;
- --rpath|--rpath-link) R="-Wl,$1,"; shift ;;
- esac
- ;;
- -Wl,-R) R="$arg" ;;
- -Wl,-rpath|-Wl,-rpath-link) R="$arg," ;;
- -Wl,--rpath|-Wl,--rpath-link) R="$arg," ;;
- esac
- if $test -n "$R"; then
- nextarg=$1; shift
- case $nextarg in
- -Xlinker) nextarg=$1; shift ;;
- esac
- case $nextarg in
- -Wl,*) nextarg=`$echo "X$nextarg" | $Xsed -e "s|^-Wl,||g"` ;;
- esac
- arg="$R$nextarg"
- fi
- ;;
-#
-# If we're linking a shared library by "cc -shared -o /srcdir/shlib",
-# we need to protect the full path after "-o" from being transformed
-# from "/srcdir/shlib" to "-L/srcdir -lshlib"
-#
--o)
- skipargs=1
- ;;
-#
-# Darwin's linker uses:
-#
-# -dylib_file /path/shlib:/path2/shlib
-# -dylib_install_name /path/shlib
-# -install_name /path/shlib
-#
-# to pass the installed locations for the shared libraries to the linker,
-# and we need to protect the full path from "/path/shlib" -> "-L/path -lshlib"
-# transformation. (-seg_addr_table_filename's purpose is more obscure,
-# but darwin's imake rules use it.)
-#
--dylib_file|-dylib_install_name|-install_name|-seg_addr_table_filename)
- skipargs=1
- ;;
-esac
diff --git a/mk/buildlink3/mipspro-cc-post-cache b/mk/buildlink3/mipspro-cc-post-cache
deleted file mode 100644
index 36b058cf386..00000000000
--- a/mk/buildlink3/mipspro-cc-post-cache
+++ /dev/null
@@ -1,12 +0,0 @@
-# $NetBSD: mipspro-cc-post-cache,v 1.1 2004/01/07 20:45:59 jlam Exp $
-#
-# This file implements the default action of the "cc" private cache
-# for the MIPSpro suite of compilers, and tells the wrapper to skip the
-# common cache lookup for all GCC arguments that the MIPSpro compiler
-# can't handle; they will instead by handled directly by
-# mipspro-cc-post-logic.
-
--[OW]*)
- skipcache=yes
- ;;
-esac
diff --git a/mk/buildlink3/mipspro-cc-post-logic b/mk/buildlink3/mipspro-cc-post-logic
deleted file mode 100644
index 6671c523089..00000000000
--- a/mk/buildlink3/mipspro-cc-post-logic
+++ /dev/null
@@ -1,36 +0,0 @@
-# $NetBSD: mipspro-cc-post-logic,v 1.1 2004/01/07 20:45:59 jlam Exp $
-#
-# Silently accept some GCC compiler arguments by silently converting
-# them to the MIPSpro compiler equivalents. This makes the MIPSpro
-# compiler wrappers work with more software that seems to assume GCC
-# nowadays.
-
-case $arg in
--O[123]|-Ofast|-Ofast=*)
- # MIPSpro can handle -O[123] and -Ofast[=platform], so just pass
- # them on through.
- ;;
--O*)
- # Ignore all other -O* options.
- arg=
- addtoprivatecache=yes
- ;;
--Wl,-R*)
- # Directories for the runtime library search path are passed
- # via "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
- #
- arg=`$echo "X$arg" | $Xsed -e "s|^-Wl,-R|-Wl,-rpath,|g"`
- addtoprivatecache=yes
- ;;
--W[ablfpR]*,*)
- # The MIPSpro compiler accepts these -W* directives, so just
- # accept them and pass them on through.
- ;;
--W*)
- # Ignore all of the other -W* directives, which are likely to
- # be GCCisms.
- #
- arg=
- addtoprivatecache=yes
- ;;
-esac
diff --git a/mk/buildlink3/mipspro-ucode-cc-post-cache b/mk/buildlink3/mipspro-ucode-cc-post-cache
deleted file mode 100644
index 10d7931918f..00000000000
--- a/mk/buildlink3/mipspro-ucode-cc-post-cache
+++ /dev/null
@@ -1,12 +0,0 @@
-# $NetBSD: mipspro-ucode-cc-post-cache,v 1.1 2004/02/18 11:18:42 jlam Exp $
-#
-# This file implements the default action of the "cc" private cache
-# for the MIPSpro ucode suite of compilers, and tells the wrapper to skip
-# the common cache lookup for all GCC arguments that the MIPSpro compiler
-# can't handle; they will instead by handled directly by
-# mipspro-cc-post-logic.
-
--[OW]*|-f[pP][iI][cC])
- skipcache=yes
- ;;
-esac
diff --git a/mk/buildlink3/mipspro-ucode-cc-post-logic b/mk/buildlink3/mipspro-ucode-cc-post-logic
deleted file mode 100644
index 1f2a28e2322..00000000000
--- a/mk/buildlink3/mipspro-ucode-cc-post-logic
+++ /dev/null
@@ -1,41 +0,0 @@
-# $NetBSD: mipspro-ucode-cc-post-logic,v 1.2 2004/03/13 03:41:13 uebayasi Exp $
-#
-# Silently accept some GCC compiler arguments by silently converting
-# them to the MIPSpro compiler equivalents. This makes the MIPSpro
-# compiler wrappers work with more software that seems to assume GCC
-# nowadays.
-
-case $arg in
--O[0123])
- # MIPSpro can handle -O[0123] so just pass them on through.
- ;;
--O*)
- # Ignore all other -O* options.
- arg=
- addtoprivatecache=yes
- ;;
--Wl,-R*)
- # Directories for the runtime library search path are passed
- # via "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
- #
- arg=`$echo "X$arg" | $Xsed -e "s|^-Wl,-R|-Wl,-rpath,|g"`
- addtoprivatecache=yes
- ;;
--Wl,*)
- # The MIPSpro compiler accepts these -W* directives, so just
- # accept them and pass them on through.
- ;;
--W*)
- # Ignore all of the other -W* directives, which are likely to
- # be GCCisms.
- #
- arg=
- addtoprivatecache=yes
- ;;
--f[Pp][Ii][Cc])
- # The MIPSpro compiler uses -KPIC to create position independent code.
- #
- arg=-KPIC
- addtoprivatecache=yes
- ;;
-esac
diff --git a/mk/buildlink3/post-cache b/mk/buildlink3/post-cache
deleted file mode 100644
index b93ade36cc2..00000000000
--- a/mk/buildlink3/post-cache
+++ /dev/null
@@ -1,4 +0,0 @@
-# $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
deleted file mode 100644
index d6dd1ea05de..00000000000
--- a/mk/buildlink3/pre-cache
+++ /dev/null
@@ -1,3 +0,0 @@
-# $NetBSD: pre-cache,v 1.2 2003/09/02 07:00:01 jlam Exp $
-
-case $arg in
diff --git a/mk/buildlink3/quotearg b/mk/buildlink3/quotearg
deleted file mode 100644
index 0cdbe2438ec..00000000000
--- a/mk/buildlink3/quotearg
+++ /dev/null
@@ -1,20 +0,0 @@
-# $NetBSD: quotearg,v 1.2 2004/03/13 03:41:13 uebayasi Exp $
-#
-# Returns $qarg, which contains a correctly-quoted $arg. Also sets
-# $quotedarg to "yes" if the $arg needed to be quoted.
-#
-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
diff --git a/mk/buildlink3/scan-libtool b/mk/buildlink3/scan-libtool
new file mode 100644
index 00000000000..ae6bd258940
--- /dev/null
+++ b/mk/buildlink3/scan-libtool
@@ -0,0 +1,125 @@
+# $NetBSD: scan-libtool,v 1.1 2004/09/21 15:01:41 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Discover the libtool mode by scanning the argument list.
+lt_mode=link
+prevopt=
+nonopt=
+lafile=
+for arg do
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+ if $test -n "$prevopt"; then
+ case $prevopt in
+ --mode)
+ lt_mode="$arg"
+ ;;
+ -o)
+ case $arg in
+ *.la) lafile="$arg" ;;
+ esac
+ ;;
+ esac
+ prevopt=
+ continue
+ fi
+ case $arg in
+ --mode|-o)
+ prevopt="$arg"
+ ;;
+ --mode=*)
+ lt_mode="$optarg"
+ ;;
+ -*)
+ if $test -n "$nonopt" -a "$lt_mode" != "install"; then
+ case $arg in
+ -c) lt_mode=compile ;;
+ esac
+ fi
+ ;;
+ *)
+ if $test -z "$nonopt"; then
+ nonopt="$arg"
+ case $nonopt in
+ *cc|*++|gcc*|*-gcc*|xlc*|*CC)
+ lt_mode=link
+ for arg do
+ case $arg in
+ -c) lt_mode=compile; break ;;
+ esac
+ done
+ ;;
+ *install*|cp|mv)
+ lt_mode=install
+ ;;
+ *rm)
+ lt_mode=uninstall
+ ;;
+ esac
+ fi
+ ;;
+ esac
+done
+
+$debug_log $wrapperlog " (scan-libtool) mode: $lt_mode"
+case $lt_mode in
+######################################################################
+# We're just being invoked to unwrap a libtool archive, so just
+# invoke the cleanup script.
+######################################################################
+unwrap)
+ . $cleanup
+ exit 0
+ ;;
+######################################################################
+# In case we're in "link" mode, we should add the extra LDFLAGS to the
+# argument list so that libtool finds all of our libraries and libtool
+# archives.
+######################################################################
+link)
+ set -- "$@" @_BLNK_LIBTOOL_LDFLAGS@
+ ;;
+######################################################################
+# We're doing libtool execution or installation, so just invoke the
+# real libtool with all of the given arguments.
+######################################################################
+execute|install)
+ msg_log $wrapperlog "<.> $cmd $@"
+ exec $cmd "$@"
+ ;;
+esac
diff --git a/mk/buildlink3/sunpro-cc-post-cache b/mk/buildlink3/sunpro-cc-post-cache
deleted file mode 100644
index 27d779c1387..00000000000
--- a/mk/buildlink3/sunpro-cc-post-cache
+++ /dev/null
@@ -1,12 +0,0 @@
-# $NetBSD: sunpro-cc-post-cache,v 1.9 2004/07/04 08:30:46 grant 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.
-
--[OW]*|-ansi|--export-dynamic|-f[pP][iI][cC]|-fno-gnu-keywords|-fstrict-prototypes|-pedantic|-pthread|-shared|-static)
- skipcache=yes
- ;;
-esac
diff --git a/mk/buildlink3/sunpro-cc-post-logic b/mk/buildlink3/sunpro-cc-post-logic
deleted file mode 100644
index 039fe78c78b..00000000000
--- a/mk/buildlink3/sunpro-cc-post-logic
+++ /dev/null
@@ -1,89 +0,0 @@
-# $NetBSD: sunpro-cc-post-logic,v 1.12 2004/07/10 12:55:08 grant 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
--O[12345])
- # SunPro can handle -xO<n> (n={1|2|3|4|5}), so optimistically
- # convert those GCC -O<n> values to -xO<n>.
- #
- arg=`$echo "X$arg" | $Xsed -e "s|^-O|-xO|g"`
- addtoprivatecache=yes
- ;;
--O?*)
- # Siliently ignore all other -O* options, except for "-O",
- # which SunPro interprets as asking for the default
- # optimization level.
- #
- arg=
- 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
- ;;
--Wl,*)
- # Explicitly do nothing to preserve arguments to be passed to
- # the linker.
- ;;
--W*)
- # In fact, SunPro compilers don't even understand any -W*
- # arguments, so just silently ignore them all.
- #
- arg=
- addtoprivatecache=yes
- ;;
--ansi)
- # No flag is required to specify ANSI C.
- arg=
- addtoprivatecache=yes
- ;;
---export-dynamic)
- # Solaris' linker uses -G to create shared objects.
- arg=-G
- addtoprivatecache=yes
- ;;
--f[Pp][Ii][Cc])
- # SunPro uses -Kpic to create position independent code.
- #
- arg=-Kpic
- addtoprivatecache=yes
- ;;
--fno-gnu-keywords)
- arg=
- addtoprivatecache=yes
- ;;
- # No flag is required to enforce strict prototypes.
--fstrict-prototypes)
- arg=
- addtoprivatecache=yes
- ;;
--pedantic)
- # No flag is required for SunPro to be pedantic.
- arg=
- addtoprivatecache=yes
- ;;
--pthread)
- # SunPro doesn't understand -pthread, and only -lpthread is
- # needed on Solaris.
- arg=-lpthread
- addtoprivatecache=yes
- ;;
--shared)
- # Solaris' linker uses -G to create shared objects.
- #
- arg=-G
- addtoprivatecache=yes
- ;;
--static)
- # Solaris' linker uses -Bstatic to create static objects.
- #
- arg=-Bstatic
- addtoprivatecache=yes
-esac
diff --git a/mk/buildlink3/transform-libtool b/mk/buildlink3/transform-libtool
new file mode 100644
index 00000000000..51aaa13e4ef
--- /dev/null
+++ b/mk/buildlink3/transform-libtool
@@ -0,0 +1,119 @@
+# $NetBSD: transform-libtool,v 1.1 2004/09/21 15:01:41 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+BUILDLINK_DIR="@BUILDLINK_DIR@"
+WRKSRC="@WRKSRC@"
+
+basename="@BASENAME@"
+dirname="@DIRNAME@"
+pwd="@PWD@"
+
+case $arg in
+######################################################################
+# 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. Avoid matching the buildlink
+# directory here for the WRKSRC == WRKDIR case.
+######################################################################
+-L${BUILDLINK_DIR}/*)
+ ;;
+-L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*)
+ case $arg in
+ */.libs)
+ # ignore -L.../.libs
+ ;;
+ *)
+ msg_log $wrapperlog "*** [buildlink3] Warning: libtool detected $arg"
+ lpath="${arg#-L}"
+ case $rellpath in
+ *"$lpath "*) ;;
+ *"$lpath"*) ;;
+ *) rellpath="$rellpath $lpath" ;;
+ esac
+ addtocache=no
+ ;;
+ esac
+ ;;
+-l*)
+ lib="${arg#-l}"
+ for dir in $rellpath; do
+ la="$dir/lib$lib.la"
+ if $test -f "$la"; then
+ ldir=`cd $dir; $pwd`
+ buildlibdir=`. $la; $echo $buildlibdir`
+ if $test -n "$buildlibdir" -a \
+ "$ldir" != "$buildlibdir"; then
+ la="$buildlibdir/lib$lib.la"
+ fi
+ $debug_log $wrapperlog " (transform-libtool) to: $la"
+ msg_log $wrapperlog "*** [buildlink3] Warning: libtool replaced $arg with $la"
+ $echo "*** [buildlink3] Warning: libtool replaced $arg with $la" 1>&2
+ arg="$la"
+ addtocache=yes
+ break
+ fi
+ done
+ ;;
+######################################################################
+# Replace all references to locally-linked libtool archives with the
+# full paths to the archives in $buildlibdir if $buildlibdir differs
+# from the referenced directory. This makes linking against a symlinked
+# local libtool archive possible.
+######################################################################
+./*.la|../*.la|[!-/]*.la|${WRKSRC}/*.la)
+ labase=`$basename $arg`
+ ladir=`$dirname $arg`
+ ldir=`cd $ladir; $pwd`
+ buildlibdir=`. $ladir/$labase; $echo $buildlibdir`
+ if $test -n "$buildlibdir" -a "$ldir" != "$buildlibdir" -a \
+ -e "$buildlibdir/$labase"; then
+ arg="$buildlibdir/$labase"
+ $debug_log $wrapperlog " (transform-libtool) to: $arg"
+ msg_log $wrapperlog "*** [buildlink3] Warning: libtool replaced $ladir/$labase with $arg"
+ addtocache=yes
+ fi
+ ;;
+esac
diff --git a/mk/buildlink3/wrapper.sh b/mk/buildlink3/wrapper.sh
deleted file mode 100644
index 372d6d863e3..00000000000
--- a/mk/buildlink3/wrapper.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!@BUILDLINK_SHELL@
-#
-# $NetBSD: wrapper.sh,v 1.11 2004/02/12 20:29:34 jlam Exp $
-
-Xsed='@SED@ -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-
-buildcmd="@_BLNK_WRAP_BUILDCMD@"
-quotearg="@_BLNK_WRAP_QUOTEARG@"
-buffer="@_BLNK_WRAP_BUFFER@"
-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@"
-reorderlibs="@_BLNK_REORDERLIBS@"
-
-wrapperlog="${BUILDLINK_WRAPPER_LOG-@_BLNK_WRAP_LOG@}"
-
-updatecache="${BUILDLINK_UPDATE_CACHE-yes}"
-cacheall="${BUILDLINK_CACHE_ALL-no}"
-reorder="${BUILDLINK_REORDER-no}"
-
-cat="@CAT@"
-echo="@ECHO@"
-expr="@EXPR@"
-test="@TEST@"
-
-BUILDLINK_DIR="@BUILDLINK_DIR@"
-WRKDIR="@WRKDIR@"
-WRKSRC="@WRKSRC@"
-
-# Argument stack depth
-depth=
-
-original_cmd="$0 $@"
-$echo [*] $original_cmd >> $wrapperlog
-
-cmd="@WRAPPEE@"
-ldflags=
-libs=
-set -- "$@" @_BLNK_WRAP_EXTRA_FLAGS@
-while $test $# -gt 0 -o -n "$depth"; do
- cachehit=no
- skipcache=no
- skipargs=0
- #
- # Get the next argument from the buffer.
- #
- . $buffer
- #
- # 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
- #
- # Build up the command-line.
- #
- . $buildcmd
-done
-
-# Reorder the libraries so that the library dependencies are correct.
-case $reorder in
-yes)
- if $test -n "$libs"; then
- . $reorderlibs
- fi
- ;;
-esac
-
-cmd="$cmd $ldflags $libs"
-
-@_BLNK_WRAP_ENV@
-@_BLNK_WRAP_SANITIZE_PATH@
-
-$echo "<.>" $cmd >> $wrapperlog
-eval exec $cmd