diff options
Diffstat (limited to 'mk')
55 files changed, 3446 insertions, 2328 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index dca58d4925b..392b816f9c6 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1498 2004/09/15 15:26:10 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1499 2004/09/21 15:01:38 jlam Exp $ # # This file is in the public domain. # @@ -161,16 +161,6 @@ PKG_FAIL_REASON+= "PLIST_TYPE must be \`\`dynamic'' or \`\`static''." PKG_FAIL_REASON+= "PLIST_TYPE must be \`\`static'' for \`\`overwrite'' packages." .endif -.if !empty(USE_BUILDLINK3:M[nN][oO]) -# -# Set the default BUILDLINK_DIR, BUILDLINK_X11_DIR so that if no -# buildlink3.mk files are included, then they still point to where headers -# and libraries for installed packages and X11R6 may be found. -# -BUILDLINK_DIR?= ${LOCALBASE} -BUILDLINK_X11_DIR?= ${X11BASE} -.endif - .if defined(USE_IMAKE) PREPEND_PATH+= ${X11BASE}/bin USE_X11BASE?= implied @@ -186,9 +176,9 @@ PLIST_SUBST+= IMAKE_MAN_SOURCE_PATH=${IMAKE_MAN_SOURCE_PATH} \ IMAKE_FILEMAN_SUFFIX=${IMAKE_FILEMAN_SUFFIX} \ IMAKE_MISCMAN_SUFFIX=${IMAKE_MISCMAN_SUFFIX} \ IMAKE_MANNEWSUFFIX=${IMAKE_MANNEWSUFFIX} -. if empty(USE_BUILDLINK3:M[nN][oO]) +. if !empty(USE_BUILDLINK3:M[yY][eE][sS]) MAKE_FLAGS+= CC="${CC}" CXX="${CXX}" -. endif +. endif .endif .if defined(USE_X11BASE) USE_X11?= implied @@ -362,7 +352,7 @@ PKG_FC?= f2c-f77 . if (${PKG_FC} == "f2c-f77") # this is a DEPENDS not BUILD_DEPENDS because of the # shared Fortran libs -. if empty(USE_BUILDLINK3:M[nN][oO]) +. if !empty(USE_BUILDLINK3:M[yY][eE][sS]) . include "../../lang/f2c/buildlink3.mk" . else DEPENDS+= f2c>=20001205nb3:../../lang/f2c @@ -428,7 +418,7 @@ BUILD_DEPENDS+= gettext>=0.10.35nb1:../../devel/gettext .endif EXTRACT_COOKIE= ${WRKDIR}/.extract_done -BUILDLINK_COOKIE= ${WRKDIR}/.buildlink_done +WRAPPER_COOKIE= ${WRKDIR}/.wrapper_done CONFIGURE_COOKIE= ${WRKDIR}/.configure_done INSTALL_COOKIE= ${WRKDIR}/.install_done TEST_COOKIE= ${WRKDIR}/.test_done @@ -1215,13 +1205,8 @@ USE_LANGUAGES?= # empty .include "../../mk/tools.mk" -.if !empty(USE_BUILDLINK3:M[nN][oO]) -NO_BUILDLINK= # defined -.endif -.if !defined(NO_BUILDLINK) -. if empty(USE_BUILDLINK3:M[nN][oO]) -. include "../../mk/buildlink3/bsd.buildlink3.mk" -. endif +.if !defined(NO_WRAPPER) +. include "../../mk/wrapper/bsd.wrapper.mk" .endif .if defined(RECOMMENDED) @@ -1433,17 +1418,17 @@ tools: patch ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE} .endif -# Disable buildlink -.PHONY: buildlink -.if defined(NO_BUILDLINK) && !target(buildlink) -buildlink: tools - ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE} +# Disable wrapper +.PHONY: wrapper +.if defined(NO_WRAPPER) && !target(wrapper) +wrapper: tools + ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${WRAPPER_COOKIE} .endif # Disable configure .PHONY: configure .if defined(NO_CONFIGURE) && !target(configure) -configure: buildlink +configure: wrapper ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} .endif @@ -2996,7 +2981,7 @@ show-shlib-type: .endif .PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock -.PHONY: acquire-buildlink-lock acquire-configure-lock acquire-build-lock +.PHONY: acquire-wrapper-lock acquire-configure-lock acquire-build-lock .PHONY: acquire-install-lock acquire-package-lock acquire-extract-lock: ${_ACQUIRE_LOCK} @@ -3004,7 +2989,7 @@ acquire-patch-lock: ${_ACQUIRE_LOCK} acquire-tools-lock: ${_ACQUIRE_LOCK} -acquire-buildlink-lock: +acquire-wrapper-lock: ${_ACQUIRE_LOCK} acquire-configure-lock: ${_ACQUIRE_LOCK} @@ -3016,7 +3001,7 @@ acquire-package-lock: ${_ACQUIRE_LOCK} .PHONY: release-extract-lock release-patch-lock release-tools-lock -.PHONY: release-buildlink-lock release-configure-lock release-build-lock +.PHONY: release-wrapper-lock release-configure-lock release-build-lock .PHONY: release-install-lock release-package-lock release-extract-lock: ${_RELEASE_LOCK} @@ -3024,7 +3009,7 @@ release-patch-lock: ${_RELEASE_LOCK} release-tools-lock: ${_RELEASE_LOCK} -release-buildlink-lock: +release-wrapper-lock: ${_RELEASE_LOCK} release-configure-lock: ${_RELEASE_LOCK} @@ -3065,14 +3050,14 @@ patch: extract acquire-patch-lock ${PATCH_COOKIE} release-patch-lock tools: patch acquire-tools-lock ${TOOLS_COOKIE} release-tools-lock .endif -.PHONY: buildlink -.if !target(buildlink) -buildlink: tools acquire-buildlink-lock ${BUILDLINK_COOKIE} release-buildlink-lock +.PHONY: wrapper +.if !target(wrapper) +wrapper: tools acquire-wrapper-lock ${WRAPPER_COOKIE} release-wrapper-lock .endif .PHONY: configure .if !target(configure) -configure: buildlink acquire-configure-lock ${CONFIGURE_COOKIE} release-configure-lock +configure: wrapper acquire-configure-lock ${CONFIGURE_COOKIE} release-configure-lock .endif .PHONY: build @@ -3121,8 +3106,8 @@ ${PATCH_COOKIE}: ${TOOLS_COOKIE}: ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools PKG_PHASE=tools -${BUILDLINK_COOKIE}: - ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-buildlink PKG_PHASE=buildlink +${WRAPPER_COOKIE}: + ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-wrapper PKG_PHASE=wrapper ${CONFIGURE_COOKIE}: .if ${INTERACTIVE_STAGE:Mconfigure} == "configure" && defined(BATCH) @@ -3160,7 +3145,7 @@ ${INSTALL_COOKIE}: ${PACKAGE_COOKIE}: ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package -.PHONY: extract-message patch-message tools-message buildlink-message +.PHONY: extract-message patch-message tools-message wrapper-message .PHONY: configure-message build-message test-message extract-message: @${ECHO_MSG} "${_PKGSRC_IN}> Extracting for ${PKGNAME}" @@ -3168,8 +3153,8 @@ patch-message: @${ECHO_MSG} "${_PKGSRC_IN}> Patching for ${PKGNAME}" tools-message: @${ECHO_MSG} "${_PKGSRC_IN}> Overriding tools for ${PKGNAME}" -buildlink-message: - @${ECHO_MSG} "${_PKGSRC_IN}> Buildlinking for ${PKGNAME}" +wrapper-message: + @${ECHO_MSG} "${_PKGSRC_IN}> Creating toolchain wrappers for ${PKGNAME}" configure-message: @${ECHO_MSG} "${_PKGSRC_IN}> Configuring for ${PKGNAME}" build-message: @@ -3177,7 +3162,7 @@ build-message: test-message: @${ECHO_MSG} "${_PKGSRC_IN}> Testing for ${PKGNAME}" -.PHONY: extract-cookie patch-cookie tools-cookie buildlink-cookie +.PHONY: extract-cookie patch-cookie tools-cookie wrapper-cookie .PHONY: configure-cookie build-cookie test-cookie extract-cookie: ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} >> ${EXTRACT_COOKIE} @@ -3185,8 +3170,8 @@ patch-cookie: ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} tools-cookie: ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${TOOLS_COOKIE} -buildlink-cookie: - ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_COOKIE} +wrapper-cookie: + ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${WRAPPER_COOKIE} configure-cookie: ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} build-cookie: @@ -3198,7 +3183,7 @@ test-cookie: .ORDER: extract-message install-depends pre-extract do-extract post-extract extract-cookie .ORDER: patch-message pre-patch do-patch post-patch patch-cookie .ORDER: tools-message pre-tools do-tools post-tools tools-cookie -.ORDER: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie +.ORDER: wrapper-message pre-wrapper do-wrapper post-wrapper wrapper-cookie .ORDER: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie .ORDER: build-message pre-build do-build post-build build-cookie .ORDER: test-message pre-test do-test post-test test-cookie @@ -3206,14 +3191,15 @@ test-cookie: # Please note that the order of the following targets is important, and # should not be modified (.ORDER is not recognised by make(1) in a serial # make i.e. without -j n) -.PHONY: real-fetch real-extract real-patch real-tools real-buildlink +.PHONY: real-fetch real-extract real-patch +.PHONY: real-tools real-wrapper .PHONY: real-configure real-build real-test real-install real-package .PHONY: real-replace real-undo-replace real-fetch: pre-fetch do-fetch post-fetch real-extract: extract-message install-depends pre-extract do-extract post-extract extract-cookie real-patch: patch-message pre-patch do-patch post-patch patch-cookie real-tools: tools-message pre-tools do-tools post-tools tools-cookie -real-buildlink: buildlink-message pre-buildlink do-buildlink post-buildlink buildlink-cookie +real-wrapper: wrapper-message pre-wrapper do-wrapper post-wrapper wrapper-cookie real-configure: configure-message pre-configure pre-configure-override do-configure post-configure configure-cookie real-build: build-message pre-build do-build post-build build-cookie real-test: test-message pre-test do-test post-test test-cookie @@ -3289,7 +3275,7 @@ do-su-undo-replace: # Empty pre-* and post-* targets -.for name in fetch extract patch tools buildlink configure build test install-script install package +.for name in fetch extract patch tools wrapper configure build test install-script install package . if !target(pre-${name}) pre-${name}: diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index bad614c97d3..1e13e8d5e0f 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.165 2004/08/27 06:29:09 jlam Exp $ +# $NetBSD: bsd.prefs.mk,v 1.166 2004/09/21 15:01:39 jlam Exp $ # # Make file, included to get the site preferences, if any. Should # only be included by package Makefiles before any .if defined() @@ -275,8 +275,8 @@ PKG_PHASE?= none PHASES_AFTER_FETCH= fetch ${PHASES_AFTER_EXTRACT} PHASES_AFTER_EXTRACT= extract ${PHASES_AFTER_PATCH} PHASES_AFTER_PATCH= patch ${PHASES_AFTER_TOOLS} -PHASES_AFTER_TOOLS= tools ${PHASES_AFTER_BUILDLINK} -PHASES_AFTER_BUILDLINK= buildlink ${PHASES_AFTER_CONFIGURE} +PHASES_AFTER_TOOLS= tools ${PHASES_AFTER_WRAPPER} +PHASES_AFTER_WRAPPER= wrapper ${PHASES_AFTER_CONFIGURE} PHASES_AFTER_CONFIGURE= configure ${PHASES_AFTER_BUILD} PHASES_AFTER_BUILD= build ${PHASES_AFTER_INSTALL} PHASES_AFTER_INSTALL= install ${PHASES_AFTER_PACKAGE} 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 diff --git a/mk/compiler.mk b/mk/compiler.mk index ed05b1347a0..58708537b3b 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -1,4 +1,4 @@ -# $NetBSD: compiler.mk,v 1.34 2004/07/04 00:38:15 wiz Exp $ +# $NetBSD: compiler.mk,v 1.35 2004/09/21 15:01:39 jlam Exp $ # # This Makefile fragment implements handling for supported C/C++/Fortran # compilers. @@ -132,4 +132,10 @@ _PKGSRC_COMPILER:= ${_COMPILER} ${_PKGSRC_COMPILER} . include "../../mk/compiler/${_compiler_}.mk" .endfor +.if defined(ABI) && !empty(ABI) +_WRAP_EXTRA_ARGS.CC+= ${_COMPILER_ABI_FLAG.${ABI}} +_WRAP_EXTRA_ARGS.CXX+= ${_COMPILER_ABI_FLAG.${ABI}} +_WRAP_EXTRA_ARGS.LD+= ${_LINKER_ABI_FLAG.${ABI}} +.endif + .endif # BSD_COMPILER_MK diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk index 4e0a92f910a..cccaa5d6a53 100644 --- a/mk/compiler/mipspro.mk +++ b/mk/compiler/mipspro.mk @@ -1,4 +1,4 @@ -# $NetBSD: mipspro.mk,v 1.25 2004/08/27 06:29:09 jlam Exp $ +# $NetBSD: mipspro.mk,v 1.26 2004/09/21 15:01:41 jlam Exp $ .if !defined(COMPILER_MIPSPRO_MK) COMPILER_MIPSPRO_MK= defined @@ -47,6 +47,14 @@ _LINKER_RPATH_FLAG= -rpath # MIPSPro passes rpath directives to the linker using "-Wl,-rpath,". _COMPILER_RPATH_FLAG= -Wl,${_LINKER_RPATH_FLAG}, +# MIPSPro supports compiling/linking objects for several ABIs: n32, o32, +# and 64 bit. +# +_COMPILER_ABI_FLAG.32= -n32 # ABI == "32" is an alias for ABI == "n32" +_COMPILER_ABI_FLAG.o32= # empty +_COMPILER_ABI_FLAG.n32= -n32 +_COMPILER_ABI_FLAG.64= -64 + # Prepend the path to the compiler to the PATH. .if !empty(_LANGUAGES.mipspro) PREPEND_PATH+= ${_MIPSPRO_DIR}/bin diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk index ba67f68fab2..9bd69b67e7e 100644 --- a/mk/compiler/sunpro.mk +++ b/mk/compiler/sunpro.mk @@ -1,4 +1,4 @@ -# $NetBSD: sunpro.mk,v 1.21 2004/08/27 06:29:09 jlam Exp $ +# $NetBSD: sunpro.mk,v 1.22 2004/09/21 15:01:41 jlam Exp $ .if !defined(COMPILER_SUNPRO_MK) COMPILER_SUNPRO_MK= defined @@ -38,6 +38,9 @@ _LINKER_RPATH_FLAG= -R # SunPro passes rpath directives to the linker using "-R". _COMPILER_RPATH_FLAG= -R +# SunPro compiler must be passed certain flags to compile/link 64-bit code. +_COMPILER_ABI_FLAG.64= -xtarget=ultra -xarch=v9 + .if exists(${SUNWSPROBASE}/bin/cc) CC_VERSION_STRING!= ${SUNWSPROBASE}/bin/cc -V 2>&1 || ${TRUE} CC_VERSION!= ${SUNWSPROBASE}/bin/cc -V 2>&1 | ${GREP} '^cc' diff --git a/mk/defs.Interix.mk b/mk/defs.Interix.mk index 3f082bf1fe9..39ba02ec9a6 100644 --- a/mk/defs.Interix.mk +++ b/mk/defs.Interix.mk @@ -1,4 +1,4 @@ -# $NetBSD: defs.Interix.mk,v 1.27 2004/08/27 06:29:09 jlam Exp $ +# $NetBSD: defs.Interix.mk,v 1.28 2004/09/21 15:01:40 jlam Exp $ # # Variable definitions for the Interix operating system. @@ -170,10 +170,6 @@ CPPFLAGS+= -D_ALL_SOURCE CONFIGURE_ENV+= ac_cv_header_poll_h=no ac_cv_func_poll=no .endif -# Interix gcc "PIC" is broken, but non-"PIC" is shlib linkable. -# We need to AVOID -fpic/-fPIC options to gcc. -BUILDLINK_TRANSFORM+= S:-fpic: S:-fPIC: - # check for maximum command line length and set it in configure's environment, # to avoid a test required by the libtool script that takes forever. .if defined(GNU_CONFIGURE) && defined(USE_LIBTOOL) diff --git a/mk/defs.UnixWare.mk b/mk/defs.UnixWare.mk index 281af759a3e..08c8ab5a9da 100644 --- a/mk/defs.UnixWare.mk +++ b/mk/defs.UnixWare.mk @@ -1,4 +1,4 @@ -# $NetBSD: defs.UnixWare.mk,v 1.7 2004/08/27 06:29:09 jlam Exp $ +# $NetBSD: defs.UnixWare.mk,v 1.8 2004/09/21 15:01:40 jlam Exp $ # # Variable definitions for the UnixWare 7 operating system. @@ -129,7 +129,12 @@ _PATCH_CAN_BACKUP= yes # native patch(1) can make backups _PATCH_BACKUP_ARG?= -b -V simple -z # switch to patch(1) for backup suffix _PREFORMATTED_MAN_DIR= man # directory where catman pages are _USE_GNU_GETTEXT= yes # Use GNU gettext -_USE_RPATH= no # add rpath to LDFLAGS +# +# The native linker for UnixWare doesn't really support an option to pass +# rpath directives, but pretend it does anyway since the wrapper scripts +# will correctly convert it into the the proper LD_RUN_PATH variable. +# +_USE_RPATH= yes # add rpath to LDFLAGS # flags passed to the linker to extract all symbols from static archives. # this is the standard Solaris linker, /usr/ccs/bin/ld. The use of GNU diff --git a/mk/wrapper/NOTES b/mk/wrapper/NOTES new file mode 100644 index 00000000000..0a84bf22672 --- /dev/null +++ b/mk/wrapper/NOTES @@ -0,0 +1,31 @@ +$NetBSD: NOTES,v 1.1 2004/09/21 15:01:41 jlam Exp $ + + + ==> {"$@"} ,--> {argbuf} ,--> {cmdbuf} + | | + ^ | | | | | + | `------. | | | | + | | | | | | + v v | | | | + | | + [scan] [arg-source] `--> [logic] `--> [cmd-sink] + + ^ ^ ^ ^ + | | | | + ,-----------------' | | | + | ,-------' `---. | + | | | | + v v v v + + [cache] [transform.sed] [transform] [buildcmd] + + | + ,-- {cmd} <--| + {cmd} <===| | + `-- {libs} <--' + + ^ + | + v + + [reorderlibs] diff --git a/mk/wrapper/arg-source b/mk/wrapper/arg-source new file mode 100644 index 00000000000..bcd148f690b --- /dev/null +++ b/mk/wrapper/arg-source @@ -0,0 +1,113 @@ +# $NetBSD: arg-source,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. + +# This script manages a buffer through which arguments from the command +# line are funneled. Along the way, the arguments are potentially +# merged and split an various ways to canonicalize their representation. +# This script should be sourced within a loop and upon exiting returns +# an argument in $arg. +# +# This is done by pushing the next command-line argument onto a queue, +# then using a processing loop to pop an argument off of the top of +# the queue, transform it, and possibly push more arguments back onto +# the queue. + +# Push arguments from the command line into the argument buffer. +skipargs=0 +while $test $# -gt 0; do + arg="$1"; shift + case $arg in + ############################################################## + # Merge "-I /dir" into a single "-I/dir". Same for -L, -R. + ############################################################## + -[ILR]) + nextarg="$1"; shift + shquote "$nextarg"; nextarg="$shquoted" + append_queue argbuf "$arg$nextarg" + $debug_log $wrapperlog " (arg-source) push: $arg$nextarg" + ;; + ############################################################## + # Split "-Wl,-R/dir1:/dir2" into "-Wl,-R/dir1 -Wl,-R/dir2". + # Same for -Wl,-rpath and -Wl,-rpath-link. + ############################################################## + -R*:*|-Wl,-R*:*|\ + -Wl,-rpath,*:*|-Wl,-rpath-link,*:*|-Wl,--rpath,*:*) + 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," ;; + esac + list="${arg#$R}" + save_IFS="${IFS}"; IFS=":" + for dir in $list; do + shquote "$dir"; dir="$shquoted" + append_queue argbuf "$R$dir" + $debug_log $wrapperlog " (arg-source) push: $R$dir" + done + IFS="${save_IFS}" + ;; + ############################################################## + # "-Xlinker arg" is the equivalent of "-Wl,arg" so convert it + # here before queueing it up. We also need to keep converting + # as long as there are consecutive "-Xlinker ..." options + # because they are most likely part of the same long option + # list for the linker. + ############################################################## + -Xlinker) + nextarg="$1"; shift + case $nextarg in + -Wl,*) + append_queue argbuf "$nextarg" + $debug_log $wrapperlog " (arg-source) push: $nextarg" + ;; + *) + shquote "$nextarg"; nextarg="$shquoted" + append_queue argbuf "-Wl,$nextarg" + $debug_log $wrapperlog " (arg-source) push: -Wl,$nextarg" + ;; + esac + ;; + ############################################################## + # For everything else, just queue it up. + ############################################################## + *) + append_queue argbuf "$arg" + $debug_log $wrapperlog " (arg-source) push: $arg" + ;; + esac +done diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk new file mode 100644 index 00000000000..9450dea4756 --- /dev/null +++ b/mk/wrapper/bsd.wrapper.mk @@ -0,0 +1,589 @@ +# $NetBSD: bsd.wrapper.mk,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. + +.if ${PKG_DEBUG_LEVEL} > 0 +ECHO_WRAPPER_MSG?= ${ECHO} +.else +ECHO_WRAPPER_MSG?= ${TRUE} +.endif +WRAPPER_DIR= ${WRKDIR}/.wrapper +WRAPPER_BINDIR= ${WRAPPER_DIR}/bin +WRAPPER_TMPDIR= ${WRAPPER_DIR}/tmp +WRAPPER_SRCDIR= ${.CURDIR}/../../mk/wrapper +WRAPPER_SHELL= ${SH} +_WRAP_VARS_MK= ${WRAPPER_DIR}/vars.mk + +.if exists(${_WRAP_VARS_MK}) +. include "${_WRAP_VARS_MK}" +.endif + +.PHONY: do-wrapper + +# USE_BUILDLINK3 == "no" implies NO_BUILDLINK +.if !empty(USE_BUILDLINK3:M[nN][oO]) +NO_BUILDLINK= yes +.endif +.if !defined(NO_BUILDLINK) +. include "../../mk/buildlink3/bsd.buildlink3.mk" +.endif + +# Create the saved variables Makefile fragment to pass variables +# through to sub-make processes invoked on the same Makefile. +# +do-wrapper: ${_WRAP_VARS_MK} + +# Prepend ${WRAPPER_BINDIR} to the PATH so that the wrappers are found +# first when searching for executables. +# +PREPEND_PATH+= ${WRAPPER_BINDIR} + +### +### BEGIN: after "wrapper" phase +### +.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE}) + +WRAPPER_DEBUG?= yes +CONFIGURE_ENV+= WRAPPER_DEBUG="${WRAPPER_DEBUG}" +MAKE_ENV+= WRAPPER_DEBUG="${WRAPPER_DEBUG}" + +# The caching code, which greatly speeds up the build process, doesn't +# work correctly on certain platforms. +# +_WRAP_BROKEN_CACHE= Darwin-5.*-* + +.if !defined(WRAPPER_UPDATE_CACHE) +WRAPPER_UPDATE_CACHE?= yes +. for _pattern_ in ${_WRAP_BROKEN_CACHE} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) +WRAPPER_UPDATE_CACHE= no +. endif +. endfor +.endif +CONFIGURE_ENV+= WRAPPER_UPDATE_CACHE="${WRAPPER_UPDATE_CACHE}" +MAKE_ENV+= WRAPPER_UPDATE_CACHE="${WRAPPER_UPDATE_CACHE}" + +# Only do the (expensive) reordering step if we have reordering +# transformations. +# +WRAPPER_REORDER_CMDS?= # empty +.if !empty(WRAPPER_REORDER_CMDS) +MAKE_ENV+= WRAPPER_REORDER=yes +.endif + +# Remove rpath options if _USE_RPATH is "no". +.if defined(_USE_RPATH) && !empty(_USE_RPATH:M[nN][oO]) +_WRAP_TRANSFORM_CMDS+= no-rpath +.endif + +# Add any package-specified transformations. +_WRAP_TRANSFORM_CMDS+= ${WRAPPER_TRANSFORM_CMDS} + +# _WRAP_PATH is the path we embed in the wrapper scripts for subsequent +# calls to the toolchain. We don't need to wrap them again because they +# are already being called with the correct arguments. +# +.if !defined(_WRAP_PATH) +_WRAP_PATH= ${PATH:S/${WRAPPER_BINDIR}://:S/:${WRAPPER_BINDIR}//} +WRAPPER_VARS+= _WRAP_PATH +.endif + +# Generate wrapper scripts for the compiler tools. These wrapper +# scripts are to be used instead of the actual compiler tools when +# building software. +# +# WRAPPER_CC, WRAPPER_LD, etc. are the full paths to the wrapper +# scripts. +# +# _WRAP_ALIASES.CC, _WRAP_ALIASES.LD, etc. are the other names by +# which each wrapper may be invoked. +# +_WRAPPEES+= AS +_WRAPPEES+= CC +_WRAPPEES+= CPP +_WRAPPEES+= CXX +_WRAPPEES+= FC +.if defined(USE_X11) +IMAKE?= ${X11BASE}/bin/imake +_WRAPPEES+= IMAKE +.endif +_WRAPPEES+= LD + +_WRAP_ALIASES.AS= as +_WRAP_ALIASES.CC= cc gcc +_WRAP_ALIASES.CXX= c++ g++ CC +_WRAP_ALIASES.CPP= cpp +_WRAP_ALIASES.FC= f77 g77 +_WRAP_ALIASES.IMAKE= imake +_WRAP_ALIASES.LD= ld + +# _WRAP_*.<wrappee> variables represent "template methods" of the main +# wrapper script. This allows individual wrappers to be customized to +# some degree: +# +_WRAP_ENV?= PATH="${_WRAP_PATH}"; export PATH +_WRAP_EMPTY_FILE?= ${WRAPPER_TMPDIR}/empty +_WRAP_ARG_SOURCE?= ${WRAPPER_TMPDIR}/arg-source +_WRAP_BUILDCMD?= ${WRAPPER_TMPDIR}/buildcmd +_WRAP_CACHE?= ${WRAPPER_TMPDIR}/cache +_WRAP_CACHE_HEADER?= ${WRAPPER_TMPDIR}/cache-header +_WRAP_CACHE_BODY?= ${WRAPPER_TMPDIR}/cache-body +_WRAP_CACHE_FOOTER?= ${WRAPPER_TMPDIR}/cache-footer +_WRAP_CLEANUP?= ${_WRAP_EMPTY_FILE} +_WRAP_CMD_SINK?= ${WRAPPER_TMPDIR}/cmd-sink +_WRAP_GEN_REORDER?= ${WRAPPER_TMPDIR}/gen-reorder +_WRAP_GEN_TRANSFORM?= ${WRAPPER_TMPDIR}/gen-transform +_WRAP_LOG?= ${WRKLOG} +_WRAP_LOGIC?= ${WRAPPER_TMPDIR}/logic +_WRAP_REORDERLIBS?= ${WRAPPER_TMPDIR}/reorderlibs +_WRAP_SCAN?= ${_WRAP_EMPTY_FILE} +_WRAP_SHELL_LIB?= ${WRAPPER_TMPDIR}/shell-lib +_WRAP_SKIP_TRANSFORM?= yes +_WRAP_TRANSFORM?= ${_WRAP_EMPTY_FILE} +_WRAP_TRANSFORM_SED?= # empty +_WRAP_TRANSFORM_SEDFILE?= ${WRAPPER_TMPDIR}/transform.sed +_WRAP_UNTRANSFORM_SEDFILE?= ${WRAPPER_TMPDIR}/untransform.sed + +# Generate the transformation sedfiles if we need them. +.if !empty(_WRAP_TRANSFORM_CMDS) +do-wrapper: ${_WRAP_TRANSFORM_SEDFILE} ${_WRAP_UNTRANSFORM_SEDFILE} +_WRAP_TRANSFORM_SED+= -f ${_WRAP_TRANSFORM_SEDFILE} +_UNWRAP_SED= -f ${_WRAP_UNTRANSFORM_SEDFILE} +.endif + +.for _wrappee_ in ${_WRAPPEES} +_WRAPPER_SH.${_wrappee_}= ${WRAPPER_SRCDIR}/wrapper.sh +_WRAP_ENV.${_wrappee_}?= ${_WRAP_ENV} +_WRAP_EXTRA_ARGS.${_wrappee_}?= # empty +_WRAP_ARG_SOURCE.${_wrappee_}?= ${_WRAP_ARG_SOURCE} +_WRAP_BUILDCMD.${_wrappee_}?= ${_WRAP_BUILDCMD} +_WRAP_CACHE.${_wrappee_}?= ${_WRAP_CACHE} +_WRAP_CACHE_HEADER.${_wrappee_}?= ${_WRAP_CACHE_HEADER} +_WRAP_CACHE_BODY.${_wrappee_}?= ${_WRAP_CACHE_BODY} +_WRAP_CACHE_FOOTER.${_wrappee_}?= ${_WRAP_CACHE_FOOTER} +_WRAP_CLEANUP.${_wrappee_}?= ${_WRAP_CLEANUP} +_WRAP_CMD_SINK.${_wrappee_}?= ${_WRAP_CMD_SINK} +_WRAP_LOG.${_wrappee_}?= ${_WRAP_LOG} +_WRAP_LOGIC.${_wrappee_}?= ${_WRAP_LOGIC} +_WRAP_SCAN.${_wrappee_}?= ${_WRAP_SCAN} +_WRAP_TRANSFORM.${_wrappee_}?= ${_WRAP_TRANSFORM} +_WRAP_TRANSFORM_SED.${_wrappee_}?= ${_WRAP_TRANSFORM_SED} +. if !empty(_WRAP_TRANSFORM_SED.${_wrappee_}) +_WRAP_SKIP_TRANSFORM.${_wrappee_}?= no +. else +_WRAP_SKIP_TRANSFORM.${_wrappee_}?= ${_WRAP_SKIP_TRANSFORM} +. endif +.endfor + +.if !empty(PKGSRC_COMPILER:Maix-xlc) +_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc +_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC} +_WRAP_CMD_SINK.LD= ${_WRAP_CMD_SINK.CC} +.endif + +.if !empty(PKGSRC_COMPILER:Mmipspro) +_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-mipspro-cc +_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-mipspro-cc +_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} +_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} +.endif + +.if !empty(PKGSRC_COMPILER:Mmipspro-ucode) +_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-mipspro-ucode-cc +_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-mipspro-ucode-cc +_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} +_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} +.endif + +.if !empty(PKGSRC_COMPILER:Msunpro) +_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-sunpro-cc +_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-sunpro-cc +_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} +_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} +.endif + +_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-ld +_WRAP_TRANSFORM_SED.IMAKE= # empty + +# XXX +# XXX This section is ${OPSYS}-specific and shouldn't be here. +# XXX +.if ${OPSYS} == "Interix" +_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-interix-gcc +_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC} +_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-interix-ld +.elif ${OPSYS} == "UnixWare" +_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-unixware-gcc +_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC} +_WRAP_CMD_SINK.LD= ${_WRAP_CMD_SINK.CC} +.endif + +# Filter to scrunch shell scripts by removing comments and empty lines. +_WRAP_SH_CRUNCH_FILTER= \ + ${GREP} -v "^\#[^!]" | ${GREP} -v "^[ ][ ]*\#" | \ + ${GREP} -v "^\#$$" | ${GREP} -v "^[ ]*$$" + +_WRAP_SUBST_SED= \ + -e "s|@CAT@|${CAT:Q}|g" \ + -e "s|@ECHO@|${ECHO:Q}|g" \ + -e "s|@EXPR@|${EXPR:Q}|g" \ + -e "s|@SED@|${SED:Q}|g" \ + -e "s|@TEST@|${TEST:Q}|g" \ + -e "s|@WRAPPER_SHELL@|${WRAPPER_SHELL:Q}|g" \ + -e "s|@_WRAP_LOG@|${_WRAP_LOG:Q}|g" \ + -e "s|@_WRAP_REORDERLIBS@|${_WRAP_REORDERLIBS:Q}|g" \ + -e "s|@_WRAP_SHELL_LIB@|${_WRAP_SHELL_LIB:Q}|g" + +.for _wrappee_ in ${_WRAPPEES} +. if defined(PKG_${_wrappee_}) +_WRAP_PKG_${_wrappee_}= ${PKG_${_wrappee_}} +. else +_WRAP_PKG_${_wrappee_}= ${${_wrappee_}} +. endif + +WRAPPER_${_wrappee_}= \ + ${WRAPPER_BINDIR}/${_WRAP_PKG_${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} +${_wrappee_}:= ${WRAPPER_${_wrappee_}:T} + +_WRAP_SUBST_SED.${_wrappee_}= \ + -e "s|@_WRAP_ENV@|${_WRAP_ENV.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_EXTRA_ARGS@|${_WRAP_EXTRA_ARGS.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_ARG_SOURCE@|${_WRAP_ARG_SOURCE.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_BUILDCMD@|${_WRAP_BUILDCMD.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CACHE@|${_WRAP_CACHE.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CACHE_HEADER@|${_WRAP_CACHE_HEADER.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CACHE_BODY@|${_WRAP_CACHE_BODY.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CACHE_FOOTER@|${_WRAP_CACHE_FOOTER.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CLEANUP@|${_WRAP_CLEANUP.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_CMD_SINK@|${_WRAP_CMD_SINK.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_LOG@|${_WRAP_LOG.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_LOGIC@|${_WRAP_LOGIC.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_SCAN@|${_WRAP_SCAN.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_SKIP_TRANSFORM@|${_WRAP_SKIP_TRANSFORM.${_wrappee_}:Q}|g" \ + -e "s|@_WRAP_TRANSFORM@|${_WRAP_TRANSFORM.${_wrappee_}:Q}|g" \ + ${_WRAP_SUBST_SED} + +_WRAP_COOKIE.${_wrappee_}= ${WRAPPER_DIR}/.wrapper_${_wrappee_}_done + +do-wrapper: ${_WRAP_COOKIE.${_wrappee_}} +${_WRAP_COOKIE.${_wrappee_}}: \ + ${_WRAPPER_SH.${_wrappee_}} \ + ${_WRAP_ARG_SOURCE.${_wrappee_}} \ + ${_WRAP_BUILDCMD.${_wrappee_}} \ + ${_WRAP_CACHE.${_wrappee_}} \ + ${_WRAP_CLEANUP.${_wrappee_}} \ + ${_WRAP_CMD_SINK.${_wrappee_}} \ + ${_WRAP_LOGIC.${_wrappee_}} \ + ${_WRAP_REORDERLIBS} \ + ${_WRAP_SCAN.${_wrappee_}} \ + ${_WRAP_SHELL_LIB} \ + ${_WRAP_TRANSFORM.${_wrappee_}} + ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_WRAPPER_MSG} \ + "=> Creating wrapper: ${WRAPPER_${_wrappee_}}" + ${_PKG_SILENT}${_PKG_DEBUG} \ + wrappee="${_WRAP_PKG_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \ + gen_wrapper=yes; \ + case $${wrappee} in \ + /*) \ + absdir=; \ + ;; \ + *) \ + save_IFS="$$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="$$save_IFS"; \ + if [ ! -x "$${wrappee}" ]; then \ + gen_wrapper=no; \ + ${ECHO_WRAPPER_MSG} "Warning: unable to create \`$${wrappee}' wrapper script"; \ + fi; \ + ;; \ + esac; \ + case $$gen_wrapper in \ + yes) \ + ${MKDIR} ${WRAPPER_${_wrappee_}:H}; \ + ${CAT} ${_WRAPPER_SH.${_wrappee_}} | \ + ${SED} ${_WRAP_SUBST_SED.${_wrappee_}} \ + -e "s|@WRAPPEE@|$${absdir}${_WRAP_PKG_${_wrappee_}:Q}|g" | \ + ${_WRAP_SH_CRUNCH_FILTER} \ + > ${WRAPPER_${_wrappee_}}; \ + ${CHMOD} +x ${WRAPPER_${_wrappee_}}; \ + ;; \ + esac + ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET} + +. for _alias_ in ${_WRAP_ALIASES.${_wrappee_}:S/^/${WRAPPER_BINDIR}\//} +. if !target(${_alias_}) +do-wrapper: ${_alias_} +${_alias_}: ${_WRAP_COOKIE.${_wrappee_}} + ${_PKG_SILENT}${_PKG_DEBUG} \ + if [ ! -x ${_alias_} -a -x ${WRAPPER_${_wrappee_}} ]; then \ + ${ECHO_WRAPPER_MSG} "=> Linking wrapper: ${_alias_}"; \ + ${LN} -f ${WRAPPER_${_wrappee_}} ${_alias_}; \ + fi +. endif +. endfor +.endfor # _WRAPPEES + +.for _target_ in ${WRAPPER_TARGETS} +do-wrapper: ${_target_} +.endfor + +${WRAPPER_TMPDIR}/cmd-sink-aix-xlc: \ + ${WRAPPER_SRCDIR}/cmd-sink-aix-xlc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/cmd-sink-interix-gcc: \ + ${WRAPPER_SRCDIR}/cmd-sink-interix-gcc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/cmd-sink-ld: \ + ${WRAPPER_SRCDIR}/cmd-sink-ld + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/cmd-sink-unixware-gcc: \ + ${WRAPPER_SRCDIR}/cmd-sink-unixware-gcc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/transform-mipspro-cc: \ + ${WRAPPER_SRCDIR}/transform-mipspro-cc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/transform-mipspro-ucode-cc: \ + ${WRAPPER_SRCDIR}/transform-mipspro-ucode-cc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +${WRAPPER_TMPDIR}/transform-sunpro-cc: \ + ${WRAPPER_SRCDIR}/transform-sunpro-cc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + +.if !target(${_WRAP_GEN_REORDER}) +${_WRAP_GEN_REORDER}: \ + ${_WRAP_SHELL_LIB} \ + ${WRAPPER_SRCDIR}/gen-reorder.sh + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${CAT} ${WRAPPER_SRCDIR}/gen-reorder.sh \ + | ${SED} ${_WRAP_SUBST_SED} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET} +.endif + +.if !target(${_WRAP_GEN_TRANSFORM}) +${_WRAP_GEN_TRANSFORM}: \ + ${_WRAP_SHELL_LIB} \ + ${WRAPPER_SRCDIR}/gen-transform.sh + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${CAT} ${WRAPPER_SRCDIR}/gen-transform.sh \ + | ${SED} ${_WRAP_SUBST_SED} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET} +.endif + +.if !target(${_WRAP_REORDERLIBS}) +${_WRAP_REORDERLIBS}: ${_WRAP_GEN_REORDER} + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${_WRAP_GEN_REORDER} ${WRAPPER_REORDER_CMDS} > ${.TARGET} +.endif + +. if !target(${_WRAP_SHELL_LIB}) +${_WRAP_SHELL_LIB}: ${.CURDIR}/../../mk/scripts/shell-lib + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +.if !target(${_WRAP_TRANSFORM_SEDFILE}) +${_WRAP_TRANSFORM_SEDFILE}: ${_WRAP_GEN_TRANSFORM} + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${_WRAP_GEN_TRANSFORM} transform ${_WRAP_TRANSFORM_CMDS} \ + > ${.TARGET} +.endif + +.if !target(${_WRAP_UNTRANSFORM_SEDFILE}) +${_WRAP_UNTRANSFORM_SEDFILE}: ${_WRAP_GEN_TRANSFORM} + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${_WRAP_GEN_TRANSFORM} untransform ${_WRAP_TRANSFORM_CMDS} \ + > ${.TARGET} +.endif + +.for _wrappee_ in ${_WRAPPEES} +. if !target$(${_WRAP_EMPTY_FILE}) +${_WRAP_EMPTY_FILE}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET} +. endif + +. if !target(${_WRAP_ARG_SOURCE.${_wrappee_}}) +${_WRAP_ARG_SOURCE.${_wrappee_}}: ${WRAPPER_SRCDIR}/arg-source + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_BUILDCMD.${_wrappee_}}) +${_WRAP_BUILDCMD.${_wrappee_}}: ${WRAPPER_SRCDIR}/buildcmd + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_CACHE.${_wrappee_}}) +${_WRAP_CACHE.${_wrappee_}}: \ + ${_WRAP_CACHE_HEADER.${_wrappee_}} \ + ${_WRAP_CACHE_BODY.${_wrappee_}} \ + ${_WRAP_CACHE_FOOTER.${_wrappee_}} + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_CACHE_HEADER.${_wrappee_}}) +${_WRAP_CACHE_HEADER.${_wrappee_}}: ${WRAPPER_SRCDIR}/cache-header + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_CACHE_BODY.${_wrappee_}}) +${_WRAP_CACHE_BODY.${_wrappee_}}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_ARGS} ${.TARGET} +. endif + +. if !target(${_WRAP_CACHE_FOOTER.${_wrappee_}}) +${_WRAP_CACHE_FOOTER.${_wrappee_}}: ${WRAPPER_SRCDIR}/cache-footer + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_CMD_SINK.${_wrappee_}}) +${_WRAP_CMD_SINK.${_wrappee_}}: ${WRAPPER_SRCDIR}/cmd-sink + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif + +. if !target(${_WRAP_LOGIC.${_wrappee_}}) +${_WRAP_LOGIC.${_wrappee_}}: ${WRAPPER_SRCDIR}/logic + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${SED} -e "s|@_WRAP_TRANSFORM_SED@|${_WRAP_TRANSFORM_SED.${_wrappee_}:Q}|g" \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +. endif +.endfor # _WRAPPEES + +.if !target(${_WRAP_VARS_MK}) +${_WRAP_VARS_MK}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET}.tmp +. for _var_ in ${WRAPPER_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 + +# UNWRAP_PATTERNS and UNWRAP_FILES list shell globs and files relative to +# ${WRKSRC} that need to be "unwrapped". +# +UNWRAP_PATTERNS?= # empty +_UNWRAP_PATTERNS= ${UNWRAP_PATTERNS} +_UNWRAP_PATTERNS+= *-config +_UNWRAP_PATTERNS+= *Conf.sh +_UNWRAP_PATTERNS+= *.pc +_UNWRAP_PATTERNS_FIND= \ + \( ${_UNWRAP_PATTERNS:S/$/!/:S/^/-o -name !/:S/!/"/g:S/-o//1} \) +UNWRAP_FILES?= # empty +_UNWRAP_FILES= \ + ${UNWRAP_FILES} \ + `${FIND} . ${_UNWRAP_PATTERNS_FIND} -print | ${SED} -e 's|^\./||' | ${SORT} -u` +_UNWRAP_SED?= # empty + +SUBST_CLASSES+= unwrap +SUBST_STAGE.unwrap= post-build +SUBST_MESSAGE.unwrap= "Unwrapping files-to-be-installed." +SUBST_FILES.unwrap= ${_UNWRAP_FILES} +SUBST_SED.unwrap= ${_UNWRAP_SED} +.if defined(WRAPPER_DEBUG) && !empty(WRAPPER_DEBUG:M[yY][eE][sS]) +SUBST_POSTCMD.unwrap= ${DO_NADA} +.endif + +.endif # PHASES_AFTER_WRAPPER +### +### END: after "wrapper" phase +### + +.if !target(do-wrapper) +do-wrapper: + @${DO_NADA} +.endif diff --git a/mk/wrapper/buildcmd b/mk/wrapper/buildcmd new file mode 100644 index 00000000000..42fb3575857 --- /dev/null +++ b/mk/wrapper/buildcmd @@ -0,0 +1,75 @@ +# $NetBSD: buildcmd,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. + +case $arg in +###################################################################### +# Don't append empty arguments to the command line. +###################################################################### +"") + ;; +###################################################################### +# Reduce command length by not appending options that we've already +# seen. We also ensure that all of the -l options come after the -L +# options, and 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" + libs="$libs $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/wrapper/cache-footer b/mk/wrapper/cache-footer new file mode 100644 index 00000000000..4af7e981975 --- /dev/null +++ b/mk/wrapper/cache-footer @@ -0,0 +1,38 @@ +# $NetBSD: cache-footer,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. + +*) cachehit=no ;; +esac diff --git a/mk/wrapper/cache-header b/mk/wrapper/cache-header new file mode 100644 index 00000000000..fa4200e56b0 --- /dev/null +++ b/mk/wrapper/cache-header @@ -0,0 +1,37 @@ +# $NetBSD: cache-header,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. + +case $arg in diff --git a/mk/wrapper/cmd-sink b/mk/wrapper/cmd-sink new file mode 100644 index 00000000000..94f25d4ac63 --- /dev/null +++ b/mk/wrapper/cmd-sink @@ -0,0 +1,42 @@ +# $NetBSD: cmd-sink,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. + +# 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) pop: $arg" + . $buildcmd +done diff --git a/mk/wrapper/cmd-sink-aix-xlc b/mk/wrapper/cmd-sink-aix-xlc new file mode 100644 index 00000000000..4ffd919b82e --- /dev/null +++ b/mk/wrapper/cmd-sink-aix-xlc @@ -0,0 +1,74 @@ +# $NetBSD: cmd-sink-aix-xlc,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. + +# Empty out the command buffer and build up the command line in $cmd. +blibpath= +while ! queue_is_empty cmdbuf; do + pop_queue cmdbuf arg + $debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg" + case $arg in + ############################################################## + # AIX xlC doesn't support -Wl,-rpath,* but accumulate them + # into a path collection we can later append to comand line + # using -blibpath. + ############################################################## + -R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*) + 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," ;; + esac + dir="${arg#$R}" + case $blibpath in + "") blibpath="$dir" ;; + *) blibpath="$blibpath:$dir" ;; + esac + $debug_log " (cmd-sink-aix-xlc) drop: $dir [adding to blibpath]" + ;; + *) + . $buildcmd + ;; + esac +done + +# AIX xlc uses -blibpath to set the runtime library search path. +if $test -n "$blibpath"; then + arg="-blibpath:$blibpath" + $debug_log " (cmd-sink-aix-xlc) pop: $arg" + . $buildcmd +fi diff --git a/mk/wrapper/cmd-sink-interix-gcc b/mk/wrapper/cmd-sink-interix-gcc new file mode 100644 index 00000000000..b5adf1c8c24 --- /dev/null +++ b/mk/wrapper/cmd-sink-interix-gcc @@ -0,0 +1,50 @@ +# $NetBSD: cmd-sink-interix-gcc,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. + +# 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) pop: $arg" + case $arg in + -fpic|-fPIC) + $echo "$0: Interix GNU cc doesn't support \`$arg'." 1>&2 + exit 1 + ;; + *) + . $buildcmd + ;; + esac +done diff --git a/mk/wrapper/cmd-sink-interix-ld b/mk/wrapper/cmd-sink-interix-ld new file mode 100644 index 00000000000..bb16e9c40a0 --- /dev/null +++ b/mk/wrapper/cmd-sink-interix-ld @@ -0,0 +1,50 @@ +# $NetBSD: cmd-sink-interix-ld,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. + +# 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) pop: $arg" + case $arg in + -shared|-Bshareable) + $echo "$0: Interix GNU ld doesn't support \`$arg'." 1>&2 + exit 1 + ;; + *) + . $buildcmd + ;; + esac +done diff --git a/mk/wrapper/cmd-sink-ld b/mk/wrapper/cmd-sink-ld new file mode 100644 index 00000000000..1c62c6044e1 --- /dev/null +++ b/mk/wrapper/cmd-sink-ld @@ -0,0 +1,67 @@ +# $NetBSD: cmd-sink-ld,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. + +# 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-ld) pop: $arg" + case $arg in + ############################################################ + # Strip the "-Wl," from arguments that start with that prefix + # and add the result to the "ld" 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. + ############################################################ + -Wl,*) + list="${arg#-Wl,}" + save_IFS="${IFS}"; IFS="," + revlist= + for opt in $list; do + shquote "$opt"; opt="$shquoted" + revlist="$opt $revlist" + done + IFS="${save_IFS}" + for opt in $revlist; do + $debug_log $wrapperlog " (cmd-sink-ld) pre: $opt" + prepend_queue cmdbuf "$opt" + done + ;; + *) + . $buildcmd + ;; + esac +done diff --git a/mk/wrapper/cmd-sink-unixware-gcc b/mk/wrapper/cmd-sink-unixware-gcc new file mode 100644 index 00000000000..9e96dbf6278 --- /dev/null +++ b/mk/wrapper/cmd-sink-unixware-gcc @@ -0,0 +1,72 @@ +# $NetBSD: cmd-sink-unixware-gcc,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. + +# Empty out the command buffer and build up the command line in $cmd. +ldrunpath= +while ! queue_is_empty cmdbuf; do + pop_queue cmdbuf arg + $debug_log $wrapperlog " (cmd-sink-unixware-gcc) pop: $arg" + case $arg in + ############################################################## + # UnixWare's GCC doesn't support -Wl,-rpath,* but accumulate + # them into LD_RUN_PATH to set in the environment. + ############################################################## + -R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*) + 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," ;; + esac + dir="${arg#$R}" + case $ldrunpath in + "") ldrunpath="$dir" ;; + *) ldrunpath="$ldrunpath:$dir" ;; + esac + $debug_log $wrapperlog " (cmd-sink-unixware-gcc) drop: $dir [adding to LD_RUN_PATH]" + arg= + ;; + *) + . $buildcmd + ;; + esac +done + +if $test -n "$ldrunpath"; then + $debug_log $wrapperlog " (cmd-sink-unixware-gcc) LD_RUN_PATH=\"$ldrunpath\"" + LD_RUN_PATH="$ldrunpath"; export LD_RUN_PATH +fi diff --git a/mk/wrapper/gen-reorder.sh b/mk/wrapper/gen-reorder.sh new file mode 100644 index 00000000000..4b2fe2bee84 --- /dev/null +++ b/mk/wrapper/gen-reorder.sh @@ -0,0 +1,142 @@ +#! @WRAPPER_SHELL@ +# +# $NetBSD: gen-reorder.sh,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. + +shell_lib="@_WRAP_SHELL_LIB@" +wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}" +debug="${WRAPPER_DEBUG-no}" + +cat="@CAT@" + +. $shell_lib + +case $debug in +yes) debug_log="msg_log" ;; +*) debug_log=":" ;; +esac + +###################################################################### +# gen reorder:l:foo:bar +# Outputs a branch of a shell case statement that reorders +# libs to ensure that "-lfoo" occurs before "-lbar". +###################################################################### +gen() { + save_IFS="${IFS}"; IFS=":" + set -- $1 + IFS="${save_IFS}" + _cmd="$1"; shift + case $_cmd in + reorder) + $debug_log $wrapperlog " (gen-reorder) $_cmd: $@" + case $1 in + l) + $cat << EOF + # -l$2 comes before -l$3 + -l$2) + case "\${_libs}" in + -l$3|-l$3" "*) + _libs="\$l \${_libs}" + ;; + *" "-l$3) + _libs="\${_libs%%-l$3}\$l -l$3" + ;; + *" "-l$3" "*) + _libs="\${_libs%% -l$3 *} \$l -l$3 \${_libs#* -l$3 }" + ;; + *) + _libs="\${_libs} \$l" + ;; + esac + ;; +EOF + ;; + esac + ;; + *) + $debug_log $wrapperlog " (gen-reorder) $_cmd: $@ [unknown]" + ;; + esac +} + +###################################################################### +# Header for reorder script +###################################################################### +$cat << 'EOF' +msg_log $wrapperlog "==> Reordering libraries: $libs" +prevlibs= +while $test "$libs" != "$prevlibs"; do + _libs= + for l in $libs; do + case $l in +EOF + +###################################################################### +# Generate body for reorder script. +###################################################################### +for arg do + gen "$arg" +done + +###################################################################### +# Footer for reorder script +###################################################################### +$cat << 'EOF' + *) + _libs="${_libs} $l" + ;; + esac + _libs="${_libs# }" + _libs="${_libs% }" + done + prevlibs="$libs" + libs="${_libs}" +done + +# This section suppresses 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 + +exit 0 diff --git a/mk/wrapper/gen-transform.sh b/mk/wrapper/gen-transform.sh new file mode 100644 index 00000000000..ceb9b25e213 --- /dev/null +++ b/mk/wrapper/gen-transform.sh @@ -0,0 +1,466 @@ +#! @WRAPPER_SHELL@ +# +# $NetBSD: gen-transform.sh,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. + +shell_lib="@_WRAP_SHELL_LIB@" +wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}" +debug="${WRAPPER_DEBUG-no}" + +cat="@CAT@" +test="@TEST@" + +. $shell_lib + +case $debug in +yes) debug_log="msg_log" ;; +*) debug_log=":" ;; +esac + +rpath_options="-Wl,--rpath, -Wl,-rpath-link, -Wl,-rpath, -Wl,-R -R" + +###################################################################### +# gen action arg +# Outputs sed commands that correspond to $action for $arg. +###################################################################### +gen() +{ + _sep=" \`\"':;," + _ws_sep=" " + + _action=$1; shift + save_IFS="${IFS}"; IFS=":" + set -- $1 + IFS="${save_IFS}" + _cmd="$1"; shift + + case $_cmd in + ############################################################### + # depot:src:dst + # Change "src/<dir>/*" into "dst/*", and the same in -I and + # -L options. + ############################################################### + depot) + case $_action in + transform|untransform) + gen $_action "opt-depot:$1:$2" + gen $_action "opt-depot:-I$1:-I$2" + gen $_action "opt-depot:-L$1:-L$2" + ;; + esac + ;; + ############################################################### + # I:src:dst + # Change "src" into "dst" and "src/*" into "dst/*" in -I + # options for transform, and back for untransform. + ############################################################### + I) + case $_action in + transform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:-I$1:-I$2" + gen $_action "opt-sub:-I$1:-I$2" + ;; + untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:-I$2:-I$1" + gen $_action "opt-sub:-I$2:-I$1" + ;; + esac + ;; + ############################################################### + # L:src:dst + # Change "src" into "dst" and "src/*" into "dst/*" in -L + # options for transform, and back for untransform. + ############################################################### + L) + case $_action in + transform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:-L$1:-L$2" + gen $_action "opt-sub:-L$1:-L$2" + ;; + untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:-L$2:-L$1" + gen $_action "opt-sub:-L$2:-L$1" + ;; + esac + ;; + ############################################################### + # l:foo:bar[:baz1...] + # Change "-lfoo" into "-lbar [-lbaz...]" + ############################################################### + l) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + tolibs= + fromlib="-l$1"; shift + while $test $# -gt 0; do + case $1 in + "") ;; + *) case $tolibs in + "") tolibs="-l$1" ;; + *) tolibs="$tolibs -l$1" ;; + esac + ;; + esac + shift + done + gen $_action "opt:$fromlib:$tolibs" + ;; + esac + ;; + ############################################################## + # libpath:src:dst + # Change "src/*/libfoo.{a,la}" into "dst/*/libfoo.{a,la}". + ############################################################## + libpath) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + $cat << EOF +s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1\(/[^$_sep]*\.la[$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1\(/[^$_sep]*\.la\)$|\1$2\2|g +s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g +s|^$1\(/[^$_sep]*\.la\)$|$2\1|g +EOF + ;; + esac + ;; + ############################################################## + # mangle:src:dst + # Change "src" into "dst" and "src/*" into "dst/*", and the + # same in -I, -L, and rpath options. + ############################################################## + mangle) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + #gen $_action "opt:$1:$2" + gen $_action "opt:-I$1:-I$2" + gen $_action "opt:-L$1:-L$2" + gen $_action "rpath-exact:$1:$2" + gen $_action "sub-mangle:$1:$2" + ;; + esac + ;; + ############################################################## + # no-abspath + # Remove all "dash" options that contain an absolute path. + ############################################################## + no-abspath) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd" + gen $_action "rm-optarg:-I/" + gen $_action "rm-optarg:-L/" + for _R in $rpath_options; do + gen $_action "rm-optarg:$_R/" + done + ;; + esac + ;; + ############################################################## + # no-rpath + # Removes rpath options. + ############################################################## + no-rpath) + case "$_action" in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd" + gen $_action rm-optarg:-Wl,--rpath, + gen $_action rm-optarg:-Wl,-rpath-link, + gen $_action rm-optarg:-Wl,-rpath, + gen $_action rm-optarg:-Wl,-R + gen $_action rm-optarg:-R + ;; + esac + ;; + ############################################################## + # opt:src:dst + # Change "src" into "dst", where "src" matches the whole + # option. + ############################################################## + opt) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + $cat << EOF +s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1$|\1$2|g +s|^$1\([$_sep]\)|$2\1|g +s|^$1$|$2|g +EOF + ;; + esac + ;; + ############################################################### + # opt-depot:src:dst + # Change "src/<dir>/*" into "dst/*". + ############################################################### + opt-depot) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + $cat << EOF +s|\([$_sep]\)$1/[^/$_sep]*\(/[^$_sep]*[$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1/[^/$_sep]*\(/[^$_sep]*[$_sep]\)|\1$2\2|g +s|\([$_sep]\)$1/[^/$_sep]*\(/[^$_sep]*\)$|\1$2\2|g +s|^$1/[^/$_sep]*\(/[^$_sep]*[$_sep]\)|$2\1|g +s|^$1/[^/$_sep]*\(/[^$_sep]*\)$|$2\1|g +EOF + ;; + esac + ;; + ############################################################## + # opt-sub:src:dst + # Change "src/*" into "dst/*". + ############################################################## + opt-sub) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt-sub-trailer:$1::$2:" + ;; + esac + ;; + ############################################################## + # opt-sub-trailer:src:src_trailer:dst:dst_trailer + # Change "src/*src_trailer" into "dst/*dst_trailer", + # where "src/*" matches "src" plus subdirectories. + ############################################################## + opt-sub-trailer) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + $cat << EOF +s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g +s|\([$_sep]\)$1\(/[^$_sep]*\)$2\([$_sep]\)|\1$3\2$4\3|g +s|\([$_sep]\)$1\(/[^$_sep]*\)$2$|\1$3\2$4|g +s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g +s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g +EOF + ;; + esac + ;; + ############################################################## + # P:src:dst + # Change "src/*/libfoo.{a,la}" into "dst/*/libfoo.{a,la}" + # for transform, and back for untransform. + ############################################################## + P) + case $_action in + transform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "libpath:$1:$2" + ;; + untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "libpath:$2:$1" + ;; + esac + ;; + ############################################################## + # rename:src:dst + # Synonym for "opt:src:dst". + ############################################################## + rename) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:$1:$2" + ;; + esac + ;; + ############################################################## + # rm:opt + # Remove "opt", where "opt" matches the entire option. + ############################################################## + rm) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:$1:" + esac + ;; + ############################################################## + # rm-optarg:opt + # Remove "opt" and any argument of that option where the + # two are combined in one word. + ############################################################## + rm-optarg) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + $cat << EOF +s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g +s|\([$_sep]\)$1[^$_sep]*\([$_sep]\)|\1\2|g +s|\([$_sep]\)$1[^$_sep]*$|\1|g +s|^$1[^$_sep]*\([$_sep]\)|\1|g +s|^$1[^$_sep]*$||g +EOF + ;; + esac + ;; + ############################################################## + # rmdir:dir + # Remove all "dash" options that contain "dir" or "dir/*". + ############################################################## + rmdir) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt:-I$1:" + gen $_action "opt-sub:-I$1:" + gen $_action "opt:-L$1:" + gen $_action "opt-sub:-L$1:" + for _R in $rpath_options; do + gen $_action "opt:$_R$1:" + gen $_action "opt-sub:$_R$1:" + done + ;; + esac + ;; + ############################################################## + # rpath:src:dst + # Change "src" into "dst" and "src/*" into "dst/*" in rpath + # options. + ############################################################## + rpath) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "rpath-exact:$1:$2" + gen $_action "sub-rpath:$1:$2" + ;; + esac + ;; + ############################################################## + # rpath-exact:src:dst + # Change "src" into "dst" in rpath options. + ############################################################## + rpath-exact) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + for _R in $rpath_options; do + gen $_action "opt:$_R$1:$_R$2" + done + ;; + esac + ;; + ############################################################## + # strip-slashdot:dir + # Change "dir/." into "dir" and the same in -I, -L, and + # rpath options. + ############################################################## + strip-slashdot) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + gen $_action "opt-sub-trailer:$1:/\.:$1:" + gen $_action "opt-sub-trailer:-I$1:/\.:-I$1:" + gen $_action "opt-sub-trailer:-L$1:/\.:-L$1:" + for _R in $rpath_options; do + gen $_action "opt-sub-trailer:$_R$1:/\.:$_R$1:" + done + ;; + esac + ;; + ############################################################## + # sub-mangle:src:dst + # Change "src/*" into "dst/*", and the same in -I, -L, and + # rpath options. + ############################################################## + sub-mangle) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + #gen $_action "opt-sub:$1:$2" + gen $_action "opt-sub:-I$1:-I$2" + gen $_action "opt-sub:-L$1:-L$2" + gen $_action "sub-rpath:$1:$2" + ;; + esac + ;; + ############################################################## + # sub-rpath:src:dst + # Change "src/*" into "dst/*" in rpath options. + ############################################################## + sub-rpath) + case $_action in + transform|untransform) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@" + for _R in $rpath_options; do + gen $_action "opt-sub:$_R$1:$_R$2" + done + ;; + esac + ;; + ############################################################## + # Everything else is ignored. + ############################################################## + *) + $debug_log $wrapperlog " (gen-transform) $_cmd: $@ [unknown]" + ;; + esac +} + +###################################################################### +# Generate sed script. +###################################################################### +action="$1"; shift +for arg do + case $arg in + transform:*) + case $action in + transform) gen $action "${arg#transform:}" ;; + esac + ;; + untransform:*) + case $action in + untransform) gen $action "${arg#untransform:}" ;; + esac + ;; + *) + gen $action "$arg" + ;; + esac +done diff --git a/mk/wrapper/logic b/mk/wrapper/logic new file mode 100644 index 00000000000..11818488e3c --- /dev/null +++ b/mk/wrapper/logic @@ -0,0 +1,270 @@ +# $NetBSD: logic,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. + +# Empty out the argument buffer and fill up the command buffer. +skipargs=0 +while ! queue_is_empty argbuf; do + # + # Grab the next argument from the head of the argument buffer + # and return it in $arg. + # + argok=no + while $test "$argok" = "no"; do + pop_queue argbuf arg + $debug_log $wrapperlog " (logic) pop: $arg" + # + # Toggle whether we want to transform $arg or if we + # want to pass it unmodified into the command buffer. + # + if $test $skipargs -eq 0; then + do_transform=yes + else + skipargs=`$expr $skipargs - 1` + do_transform=no + argok=yes + continue + fi + + case $arg in + ###################################################### + # Split direct paths to shared libraries into the + # "-Ldir -llib" equivalent + ###################################################### + /*/lib*.so|/*/lib*.so.[0-9]*) + dir="${arg%/lib*}" + lib="${arg#$dir/lib}" + case $lib in + */*) argok=yes; continue ;; + *.so) lib="${lib%.so}" ;; + *.so.[0-9]*) lib="${lib%.so.[0-9]*}" ;; + esac + prepend_queue argbuf "-l$lib" + $debug_log $wrapperlog " (logic) pre: -l$lib" + prepend_queue argbuf "-L$dir" + $debug_log $wrapperlog " (logic) pre: -L$dir" + ;; + /*/lib*.dylib) # Darwin + dir="${arg%/lib*.dylib}" + lib="${arg#$dir/lib}" + case $lib in + */*) argok=yes; continue ;; + *.[0-9]*.dylib) lib="${lib%%.[0-9]*.dylib}" ;; + *.dylib) lib="${lib%.dylib}" ;; + esac + prepend_queue argbuf "-l$lib" + $debug_log $wrapperlog " (logic) pre: -l$lib" + prepend_queue argbuf "-L$dir" + $debug_log $wrapperlog " (logic) pre: -L$dir" + ;; + ###################################################### + # Merge "-Wl,-R -Wl,/dir" into a single "-Wl,-R/dir". + # Same for -Wl,-L, -Wl,-rpath and -Wl,-rpath-link. + ###################################################### + -Wl,-[LR]) + if queue_is_empty argbuf; then + argok=yes + continue + fi + pop_queue argbuf nextarg + $debug_log $wrapperlog " (logic) pop: $nextarg" + shquote "${nextarg#-Wl,}"; nextarg="$shquoted" + $debug_log $wrapperlog " (logic) pre: $arg$nextarg" + prepend_queue argbuf "$arg$nextarg" + ;; + -Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath) + if queue_is_empty argbuf; then + argok=yes + continue + fi + pop_queue argbuf nextarg + $debug_log $wrapperlog " (logic) pop: $nextarg" + shquote "${nextarg#-Wl,}"; nextarg="$shquoted" + $debug_log $wrapperlog " (logic) pre: $arg,$nextarg" + prepend_queue argbuf "$arg,$nextarg" + ;; + ###################################################### + # Remove rpath options that try to add relative paths + # to the runtime library search path. This basically + # cleans up after lazy programmers who can't write + # Makefiles. + ###################################################### + -R[!/]*|-Wl,-R[!/]*|\ + -Wl,-rpath,[!/]*|-Wl,-rpath-link,[!/]*|-Wl,--rpath,[!/]*) + $debug_log $wrapperlog " (logic) drop: $arg" + ;; + ###################################################### + # Remove consecutive, repeated library options. + ###################################################### + -l*) + if queue_is_empty argbuf; then + argok=yes + continue + fi + head_queue argbuf nextarg + while $test "$nextarg" = "$arg"; do + pop_queue argbuf nextarg + $debug_log $wrapperlog " (logic) drop: $nextarg" + if queue_is_empty argbuf; then + break + else + head_queue argbuf nextarg + fi + done + argok=yes + ;; + ###################################################### + # The -o option takes an extra argument that should + # be passed unmodified. + ####################################################### + -o) + skipargs=1 + argok=yes + ;; + ###################################################### + # GNU ld uses "--dynamic-linker /path/to/shared/object" + # to set the dynamic linker code for ELF executables. + ###################################################### + --dynamic-linker) + skipargs=1 + argok=yes + ;; + ###################################################### + # 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 pass the extra + # argument unmodified. The purpose of + # -seg_addr_table_filename is more obscure, but Darwin's + # imake rules use it. + ###################################################### + -dylib_file|-dylib_install_name|-install_name|\ + -seg_addr_table_filename) + skipargs=1 + argok=yes + ;; + ###################################################### + # Leave all else untouched. + ###################################################### + *) + argok=yes + esac + done + + # Try to look up the transformed $arg in the cache, but if + # not there, then apply the transformations and save the result + # in the cache. + # + case $do_transform in + yes) + . $cache + case $cachehit in + yes) + # The cache was hit and $arg is set. + $debug_log $wrapperlog " (logic) to: $arg [cached]" + ;; + *) + # Apply transformations to $arg. + addtocache=no + case $skip_transform in + yes) + $debug_log $wrapperlog " (logic) to: $arg [untransformed]" + ;; + *) + shquote "$arg"; cachearg="$shquoted" + case $arg in + -*|/*) + arg=`$echo "X$arg" | $Xsed @_WRAP_TRANSFORM_SED@` + $debug_log $wrapperlog " (logic) to: $arg" + addtocache=yes + ;; + *) + $debug_log $wrapperlog " (logic) to: $arg [untransformed]" + ;; + esac + + # Apply wrapper-specific transformations + # to $arg. + # + . $transform + ;; + esac + + # Re-create the cache file if we're adding to it. + case $updatecache,$addtocache in + yes,yes) + shquote "$arg"; cachedarg="$shquoted" + $cat >> $cache_body << EOF +$cachearg) arg=$cachedarg; cachehit=yes ;; +EOF + $cat $cache_header \ + $cache_body \ + $cache_footer > $cache + ;; + esac + ;; + esac + case $arg in + ###################################################### + # Split -l options along whitespace. This disallows + # library names with whitespace, but it allows us to + # handle transformations that look like, e.g. + # "-lreadline" -> "-ledit -ltermcap". + ###################################################### + -l*) + for lib in $arg; do + append_queue cmdbuf "$lib" + $debug_log $wrapperlog " (logic) push: $lib" + done + ;; + ###################################################### + # Everything is goes into the command buffer unchanged. + ###################################################### + *) + append_queue cmdbuf "$arg" + $debug_log $wrapperlog " (logic) push: $arg" + ;; + esac + ;; + *) + append_queue cmdbuf "$arg" + $debug_log $wrapperlog " (logic) push: $arg" + ;; + esac +done diff --git a/mk/wrapper/transform-mipspro-cc b/mk/wrapper/transform-mipspro-cc new file mode 100644 index 00000000000..f2e553dd9bd --- /dev/null +++ b/mk/wrapper/transform-mipspro-cc @@ -0,0 +1,78 @@ +# $NetBSD: transform-mipspro-cc,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. + +case $arg in +###################################################################### +# MIPSpro can handle -O[123] and -Ofast[=platform], so just pass them +# on through. +###################################################################### +-O[123]|-Ofast|-Ofast=*) + addtocache=yes + ;; +###################################################################### +# Ignore all other -O* options. +###################################################################### +-O*) + arg= + msg_log $wrapperlog " (transform-mipspro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Directories for the runtime library search path are passed via +# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>". +###################################################################### +-Wl,-R*) + arg="-Wl,-rpath,${arg#-Wl,-R}" + msg_log $wrapperlog " (transform-mipspro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# The MIPSpro compiler accepts these -W* directives, so just pass them +# on through. +###################################################################### +-W[ablfpR]*,*) + addtocache=yes + ;; +###################################################################### +# Ignore all of the other -W* directives, which are likely to be +# GCCisms. +###################################################################### +-W*) + arg= + msg_log $wrapperlog " (transform-mipspro-cc) to: $arg" + addtocache=yes + ;; +esac diff --git a/mk/wrapper/transform-mipspro-ucode-cc b/mk/wrapper/transform-mipspro-ucode-cc new file mode 100644 index 00000000000..4243eb7d1ad --- /dev/null +++ b/mk/wrapper/transform-mipspro-ucode-cc @@ -0,0 +1,84 @@ +# $NetBSD: transform-mipspro-ucode-cc,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. + +case $arg in +###################################################################### +# MIPSpro can handle -O[0123] so just pass them on through. +###################################################################### +-O[0123]) + addtocache=yes + ;; +###################################################################### +# Ignore all other -O* options. +###################################################################### +-O*) + arg= + msg_log $wrapperlog " (transform-mipspro-ucode-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Directories for the runtime library search path are passed via +# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>". +###################################################################### +-Wl,-R*) + arg="-Wl,-rpath,${arg#-Wl,-R}" + msg_log $wrapperlog " (transform-mipspro-ucode-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# The MIPSpro compiler accepts -Wl,* so just pass it on through. +###################################################################### +-Wl,*) + addtocache=yes + ;; +###################################################################### +# Ignore all of the other -W* directives, which are likely to be +# GCCisms. +###################################################################### +-W*) + arg= + msg_log $wrapperlog " (transform-mipspro-ucode-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# The MIPSpro compiler uses -KPIC to create position independent code. +###################################################################### +-f[Pp][Ii][Cc]) + arg="-KPIC" + msg_log $wrapperlog " (transform-mipspro-ucode-cc) to: $arg" + addtocache=yes + ;; +esac diff --git a/mk/wrapper/transform-sunpro-cc b/mk/wrapper/transform-sunpro-cc new file mode 100644 index 00000000000..5d15f6ad81a --- /dev/null +++ b/mk/wrapper/transform-sunpro-cc @@ -0,0 +1,115 @@ +# $NetBSD: transform-sunpro-cc,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. + +case $arg in +###################################################################### +# SunPro can handle -xO<n> (n={1|2|3|4|5}), so optimistically convert +# those GCC -O<n> values to -xO<n>. +###################################################################### +-O[12345]) + arg="-xO${arg#-O}" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Silently ignore all other -O* options, except for "-O", which SunPro +# interprets as asking for the default optimization level. +###################################################################### +-O?*) + arg= + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Directories for the runtime library search path are passed via simply +# "-R<dir>", not "-Wl,-R<dir>". +###################################################################### +-Wl,-R*) + arg="${arg#-Wl,}" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# SunPro compilers don't even understand any -W* arguments, so just +# silently ignore them all. +###################################################################### +-W*) + arg= + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Solaris' linker uses -Bstatic to create static objects. +###################################################################### +-static) + arg="-Bstatic" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Solaris' linker uses -G to create shared objects. +###################################################################### +--export-dynamic|-shared) + arg="-G" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# SunPro uses -Kpic to create position independent code. +###################################################################### +-f[Pp][Ii][Cc]) + arg="-Kpic" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# SunPro doesn't understand -pthread, and only -lpthread is needed on +# Solaris. +###################################################################### +-pthread) + arg="-lpthread" + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Ignore some flags that are unnecessary for SunPro. +###################################################################### +-ansi|-fno-gnu-keywords|-fstrict-prototypes|-pedantic) + arg= + msg_log $wrapperlog " (transform-sunpro-cc) to: $arg" + addtocache=yes + ;; +esac diff --git a/mk/wrapper/wrapper.sh b/mk/wrapper/wrapper.sh new file mode 100644 index 00000000000..d6d029d26f2 --- /dev/null +++ b/mk/wrapper/wrapper.sh @@ -0,0 +1,107 @@ +#! @WRAPPER_SHELL@ +# +# $NetBSD: wrapper.sh,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. + +arg_source="@_WRAP_ARG_SOURCE@" +buildcmd="@_WRAP_BUILDCMD@" +cache="@_WRAP_CACHE@" +cache_header="@_WRAP_CACHE_HEADER@" +cache_body="@_WRAP_CACHE_BODY@" +cache_footer="@_WRAP_CACHE_FOOTER@" +cleanup="@_WRAP_CLEANUP@" +cmd_sink="@_WRAP_CMD_SINK@" +logic="@_WRAP_LOGIC@" +reorderlibs="@_WRAP_REORDERLIBS@" +shell_lib="@_WRAP_SHELL_LIB@" +scan="@_WRAP_SCAN@" +transform="@_WRAP_TRANSFORM@" +wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}" +skip_transform="${WRAPPER_SKIP_TRANSFORM-@_WRAP_SKIP_TRANSFORM@}" +debug="${WRAPPER_DEBUG-no}" + +cat="@CAT@" +echo="@ECHO@" +expr="@EXPR@" +sed="@SED@" +test="@TEST@" +Xsed="$sed -e 1s/^X//" + +. $shell_lib + +updatecache=${WRAPPER_UPDATE_CACHE-yes} +reorder=${WRAPPER_REORDER-no} + +case $debug in +yes) debug_log="msg_log" ;; +*) debug_log=":" ;; +esac + +original_cmd="$0 $@" +msg_log $wrapperlog "[*]" $original_cmd + +cmd="@WRAPPEE@" +do_transform=yes +init_queue argbuf +init_queue cmdbuf + +. $scan + +set -- "$@" @_WRAP_EXTRA_ARGS@ +. $arg_source +. $logic +. $cmd_sink + +# Reorder the libraries so that the library dependencies are correct. +case $reorder in +yes) + if $test -n "$libs"; then + . $reorderlibs + fi + ;; +esac + +cmd="$cmd $libs" + +@_WRAP_ENV@ + +msg_log $wrapperlog "<.>" $cmd +eval $cmd +wrapper_result=$? + +. $cleanup + +exit ${wrapper_result} |