Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

34
mk/wrapper/NOTES Normal file
View File

@@ -0,0 +1,34 @@
$NetBSD: NOTES,v 1.4 2006/10/21 11:43:42 rillig Exp $
The wrapper scripts work roughly like the block diagram below.
===> {"$@"} ---> [scan]
|
v
[arg-source]
|
v
{argbuf}
| / [arg-pp-main]
v | [arg-pp]
[logic] <---------> <| [cache]
| | [transform.sed]
v \ [transform]
{cmdbuf}
|
v
[cmd-sink] <---.
| |
v |
[buildcmd] ----'
| |
v v
{cmd} {libs}
| |
| v
| [reorderlibs]
| |
| /
\ /
v v
<=== {cmd}

View File

@@ -0,0 +1,76 @@
# $NetBSD: arg-pp-darwin-gcc,v 1.2 2005/02/14 21:33:36 jlam Exp $
#
# Copyright (c) 2005 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
######################################################################
# Split direct paths to Darwin "dylib" shared libraries into the
# "-Ldir -llib" equivalent.
######################################################################
/*/lib*.dylib)
dir="${arg%/lib*.dylib}"
lib="${arg#$dir/lib}"
case $lib in
*/*) argok=yes; argmatch=yes ;;
*.dylib) lib="${lib%.dylib}" ;;
esac
case $argmatch in
yes) ;;
*) prepend_queue argbuf "-l$lib"
$debug_log $wrapperlog " (arg-pp-darwin-gcc) pre: -l$lib"
prepend_queue argbuf "-L$dir"
$debug_log $wrapperlog " (arg-pp-darwin-gcc) pre: -L$dir"
argmatch=yes
;;
esac
;;
######################################################################
# 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
argmatch=yes
;;
esac

157
mk/wrapper/arg-pp-main Normal file
View File

@@ -0,0 +1,157 @@
# $NetBSD: arg-pp-main,v 1.7 2007/09/19 13:08:19 rillig Exp $
#
# Copyright (c) 2005 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
######################################################################
# 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; argmatch=yes ;;
*.so) lib="${lib%.so}" ;;
*.so.[0-9]*) lib="${lib%.so.[0-9]*}" ;;
esac
case $argmatch in
yes) ;;
*) prepend_queue argbuf "-l$lib"
$debug_log $wrapperlog " (arg-pp-main) pre: -l$lib"
prepend_queue argbuf "-L$dir"
$debug_log $wrapperlog " (arg-pp-main) pre: -L$dir"
argmatch=yes
;;
esac
;;
/*/lib*.sl|/*/lib*.sl.[0-9]*) # HP-UX
dir="${arg%/lib*}"
lib="${arg#$dir/lib}"
case $lib in
*/*) argok=yes; argmatch=yes ;;
*.sl) lib="${lib%.sl}" ;;
*.sl.[0-9]*) lib="${lib%.sl.[0-9]*}" ;;
esac
case $argmatch in
yes) ;;
*) prepend_queue argbuf "-l$lib"
$debug_log $wrapperlog " (arg-pp-main) pre: -l$lib"
prepend_queue argbuf "-L$dir"
$debug_log $wrapperlog " (arg-pp-main) pre: -L$dir"
argmatch=yes
;;
esac
;;
######################################################################
# Remove extraneous comma in "-Wl,-R,/dir" and in "-Wl,-L,/dir".
######################################################################
-Wl,-L,*)
arg="-Wl,-L${arg#-Wl,-L,}"
$debug_log $wrapperlog " (arg-pp-main) pre: $arg"
prepend_queue argbuf "$arg"
argmatch=yes
;;
-Wl,-R,*)
arg="-Wl,-R${arg#-Wl,-R,}"
$debug_log $wrapperlog " (arg-pp-main) pre: $arg"
prepend_queue argbuf "$arg"
argmatch=yes
;;
######################################################################
# Merge "-Wl,-R -Wl,/dir" into a single "-Wl,-R/dir". Same for -Wl,-L,
# -Wl,-rpath and -Wl,-rpath-link.
######################################################################
-Wl,-[LR])
pop_queue argbuf nextarg
$debug_log $wrapperlog " (arg-pp-main) pop: $nextarg"
nextarg="${nextarg#-Wl,}"
$debug_log $wrapperlog " (arg-pp-main) pre: $arg$nextarg"
prepend_queue argbuf "$arg$nextarg"
argmatch=yes
;;
-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath)
pop_queue argbuf nextarg
$debug_log $wrapperlog " (arg-pp-main) pop: $nextarg"
nextarg="${nextarg#-Wl,}"
$debug_log $wrapperlog " (arg-pp-main) pre: $arg,$nextarg"
prepend_queue argbuf "$arg,$nextarg"
argmatch=yes
;;
######################################################################
# 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 " (arg-pp-main) drop: $arg"
argmatch=yes
;;
######################################################################
# Remove consecutive, repeated library options.
######################################################################
-l*)
head_queue argbuf nextarg
while $test "$nextarg" = "$arg"; do
pop_queue argbuf nextarg
$debug_log $wrapperlog " (arg-pp-main) drop: $nextarg"
if queue_is_empty argbuf; then
break
else
head_queue argbuf nextarg
fi
done
argok=yes
argmatch=yes
;;
#######################################################################
# The -o option takes an extra argument that should be passed unmodified.
#######################################################################
-o)
skipargs=1
argok=yes
argmatch=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
argmatch=yes
;;
esac

View File

@@ -0,0 +1,48 @@
# $NetBSD: arg-pp-mipspro-cc,v 1.1 2005/01/18 17:25:13 jlam Exp $
#
# Copyright (c) 2005 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 uses -LANG:<feature> and -LIST:<feature> as knobs for the
# compiler, but we don't want them to be confused with the usual
# -Ldir options, so just pass them verbatim onward.
######################################################################
-LANG:*|-LIST:*)
do_transform=no
argok=yes
argmatch=yes
;;
esac

View File

@@ -0,0 +1,59 @@
# $NetBSD: arg-pp-sunpro-cxx,v 1.2 2005/08/21 02:39:52 grant Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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. 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
-Qoption)
argmatch=no
pop_queue argbuf nextarg1
$debug_log $wrapperlog " (arg-pp-sunpro-cxx) pop: $nextarg1"
case $nextarg1 in
ld)
argmatch=yes
pop_queue argbuf nextarg2
$debug_log $wrapperlog " (arg-pp-sunpro-cxx) pop: $nextarg2"
case $nextarg2 in
-R*)
$debug_log $wrapperlog " (arg-pp-sunpro-cxx) pre: $nextarg2"
prepend_queue argbuf $nextarg2
;;
*)
argok=yes
$debug_log $wrapperlog " (arg-pp-sunpro-cxx) pre: $nextarg2"
prepend_queue argbuf $nextarg2
$debug_log $wrapperlog " (arg-pp-sunpro-cxx) pre: $nextarg1"
prepend_queue argbuf $nextarg1
;;
esac
;;
esac
;;
esac

173
mk/wrapper/arg-source Normal file
View File

@@ -0,0 +1,173 @@
# $NetBSD: arg-source,v 1.15 2007/09/19 13:08:19 rillig 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 in 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.
while $test $# -gt 0; do
arg="$1"; shift
case $arg in
##############################################################
# Merge "-I /dir" into a single "-I/dir". Same for -L, -R.
##############################################################
-[DILR])
nextarg="$1"; shift
case "$nextarg" in
-*) msg_log $wrapperlog "WARNING: [arg-source] An $arg option must not be followed by another option, $nextarg." ;;
esac
append_queue argbuf "$arg$nextarg"
$debug_log $wrapperlog " (arg-source) push: $arg$nextarg"
;;
##############################################################
# Split -Wl,option1,option2 into -Wl,option1 -Wl,option2 and
# process them again.
#
# XXX: The sunpro manual page says: A comma can be part of an
# argument by escaping it with an immediately preceding
# backslash. The manual pages for gcc and mipspro do not
# mention commas in those options at all.
##############################################################
-Wl,*,*)
$debug_log $wrapperlog " (arg-source) before-split: $arg $*"
saved_IFS="$IFS"
new_args=""
IFS=","
for o in ${arg#-Wl,}; do
IFS="$saved_IFS"
shquote "$o"; o="$shquoted"
new_args="$new_args -Wl,$o"
done
IFS="$saved_IFS"
eval "set args $new_args \"\$@\""; shift
$debug_log $wrapperlog " (arg-source) after-split: $*"
continue
;;
##############################################################
# Split "-Wl,-R/dir1:/dir2" into "-Wl,-R/dir1 -Wl,-R/dir2".
# Same for -R and -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
IFS="${save_IFS}"
append_queue argbuf "$R$dir"
$debug_log $wrapperlog " (arg-source) push: $R$dir"
done
IFS="${save_IFS}"
;;
##############################################################
# Merge and split "-Wl,-R -Wl,/dir1:/dir2" into
# "-Wl,-R/dir1 -Wl,-R/dir2". Same for -Wl,-rpath and
# -Wl,-rpath-link.
##############################################################
-Wl,-R|-Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath)
nextarg="$1"; shift
case $arg in
-Wl,-R) R="-Wl,-R" ;;
-Wl,-rpath) R="-Wl,-rpath," ;;
-Wl,-rpath-link) R="-Wl,-rpath-link," ;;
-Wl,--rpath) R="-Wl,--rpath," ;;
esac
nextarg="${nextarg#-Wl,}"
case $nextarg in
*:*)
save_IFS="${IFS}"; IFS=":"
for dir in $nextarg; do
IFS="${save_IFS}"
append_queue argbuf "$R$dir"
$debug_log $wrapperlog " (arg-source) push: $R$dir"
done
IFS="${save_IFS}"
;;
*)
append_queue argbuf "$R$nextarg"
$debug_log $wrapperlog " (arg-source) push: $R$nextarg"
;;
esac
;;
##############################################################
# "-Xlinker arg" is the equivalent of "-Wl,arg" so convert it
# here before queueing it up.
##############################################################
-Xlinker)
nextarg="$1"; shift
case $nextarg in
-Wl,*)
append_queue argbuf "$nextarg"
$debug_log $wrapperlog " (arg-source) push: $nextarg"
;;
*)
append_queue argbuf "-Wl,$nextarg"
$debug_log $wrapperlog " (arg-source) push: -Wl,$nextarg"
;;
esac
;;
##############################################################
# Remember whether running the linker is desired.
##############################################################
-c|-S|-E)
dont_link=yes
append_queue argbuf "$arg"
$debug_log $wrapperlog " (arg-source) push: $arg"
;;
##############################################################
# For everything else, just queue it up.
##############################################################
*)
append_queue argbuf "$arg"
$debug_log $wrapperlog " (arg-source) push: $arg"
;;
esac
done

761
mk/wrapper/bsd.wrapper.mk Normal file
View File

@@ -0,0 +1,761 @@
# $NetBSD: bsd.wrapper.mk,v 1.88 2013/03/01 13:27:38 jperkin Exp $
#
# Copyright (c) 2005 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.
# Package-settable variables:
#
# WRAPPER_REORDER_CMDS
# A list of library reordering specifications to make sure that the
# linker sees the libraries in the correct order.
#
# Each of the specifications has the form reorder:l:foo:bar, which
# means that -lfoo will always come before -lbar in the linker
# command line.
#
# Keywords: libs order reorder wrapper
#
.include "../../mk/wrapper/wrapper-defs.mk"
# pkgsrc bmake does not (yet) correctly handle ${VAR} > 0 because
# ${VAR} is treated as a string, so we must use a string comparison
# operator.
.if ${PKG_DEBUG_LEVEL} != "0" || defined(PKG_VERBOSE)
ECHO_WRAPPER_MSG?= ${ECHO}
.else
ECHO_WRAPPER_MSG?= ${TRUE}
.endif
.PHONY: generate-wrappers
.include "../../mk/buildlink3/bsd.buildlink3.mk"
# Prepend ${WRAPPER_BINDIR} to the PATH so that the wrappers are found
# first when searching for executables.
#
PREPEND_PATH+= ${WRAPPER_BINDIR}
###
### BEGIN: after the barrier
###
.if exists(${_COOKIE.barrier})
_WRAPPER_DEBUG?= no
CONFIGURE_ENV+= WRAPPER_DEBUG=${_WRAPPER_DEBUG:Q}
MAKE_ENV+= WRAPPER_DEBUG=${_WRAPPER_DEBUG:Q}
SCRIPTS_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:Q}
MAKE_ENV+= WRAPPER_UPDATE_CACHE=${WRAPPER_UPDATE_CACHE:Q}
# 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}//}
.endif
MAKEVARS+= _WRAP_PATH
# 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 !empty(USE_TOOLS:C/:.*//:Mimake)
IMAKE?= ${X11BASE}/bin/imake
WRAPPEES+= IMAKE
.endif
WRAPPEES+= LD
.if !empty(PKGSRC_COMPILER:Mxlc) && ${OPSYS} == "AIX"
CC_R?= ${_XLC_DIR}/bin/cc_r
WRAPPEES+= CC_R
CXX_R?= ${_XLC_DIR}/bin/c++_r
WRAPPEES+= CXX_R
.endif
_WRAPPEE_UNIQUE_CMDS= # empty
.for _wrappee_ in ${WRAPPEES}
_WRAPPEES+= ${_wrappee_}
_WRAPPEE_${_wrappee_}= ${${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
. if empty(_WRAPPEE_UNIQUE_CMDS:M${_WRAPPEE_${_wrappee_}})
_WRAPPEE_UNIQUE_CMDS+= ${_WRAPPEE_${_wrappee_}}
_WRAPPEES_UNIQUE+= ${_wrappee_}
. endif
.endfor # WRAPPEES
.for _wrappee_ in ${_WRAPPEES}
#
# Strip the leading paths from the toolchain variables since we manipulate
# the PATH to use the correct executable.
#
. if empty(${_wrappee_}:C/^/_asdf_/1:N_asdf_*)
${_wrappee_}:= ${${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//:T}
. else
${_wrappee_}:= ${${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//:T} ${${_wrappee_}:C/^/_asdf_/1:N_asdf_*}
. endif
#
# WRAPPER_<wrappee> is the full path to the wrapper script, plus any
# trailing arguments to <wrappee>.
#
WRAPPER_${_wrappee_}= ${WRAPPER_BINDIR}/${${_wrappee_}}
.endfor # _WRAPPEES
_WRAP_ALIASES.AS= as
_WRAP_ALIASES.CC= cc gcc ada
_WRAP_ALIASES.CXX= c++ g++ CC cxx
_WRAP_ALIASES.CPP= cpp
_WRAP_ALIASES.FC= f77 g77 gfortran
_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_PP?= ${_WRAP_EMPTY_FILE}
_WRAP_ARG_PP_MAIN?= ${WRAPPER_TMPDIR}/arg-pp-main
_WRAP_ARG_SOURCE?= ${WRAPPER_TMPDIR}/arg-source
_WRAP_BUILDCMD?= ${WRAPPER_TMPDIR}/buildcmd
_WRAP_CACHE?= ${WRAPPER_TMPDIR}/cache
_WRAP_CACHE_BODY?= ${WRAPPER_TMPDIR}/cache-body
_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?= ${WRAPPER_TMPDIR}/scan
_WRAP_SHELL_LIB?= ${WRAPPER_TMPDIR}/shell-lib
_WRAP_SUBR_SH?= ${WRAPPER_TMPDIR}/wrapper-subr.sh
_WRAP_SKIP_TRANSFORM?= no
_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)
generate-wrappers: ${_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_PP.${_wrappee_}?= ${_WRAP_ARG_PP}
_WRAP_ARG_PP_MAIN.${_wrappee_}?= ${_WRAP_ARG_PP_MAIN}
_WRAP_ARG_SOURCE.${_wrappee_}?= ${_WRAP_ARG_SOURCE}
_WRAP_BUILDCMD.${_wrappee_}?= ${_WRAP_BUILDCMD}
_WRAP_CACHE.${_wrappee_}?= ${_WRAP_CACHE}
_WRAP_CACHE_BODY.${_wrappee_}?= ${_WRAP_CACHE_BODY}
_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}
_WRAP_SKIP_TRANSFORM.${_wrappee_}?= ${_WRAP_SKIP_TRANSFORM}
_WRAP_TYPE.${_wrappee_}?= ${_wrappee_}
.endfor # _WRAPPEES
.if !empty(PKGSRC_COMPILER:Micc)
. if !empty(CC_VERSION:M8.1) || !empty(CC_VERSION:M9.0)
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-icc81-cc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
. else
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-icc-cc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
. endif
_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-icc-cc
_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-icc-cc
_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC}
.endif
.if !empty(PKGSRC_COMPILER:Mmipspro)
_WRAP_ARG_PP.CC= ${WRAPPER_TMPDIR}/arg-pp-mipspro-cc
_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-mipspro-cc
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-mipspro-cc
_WRAP_ARG_PP.CXX= ${_WRAP_ARG_PP.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:Mido)
_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-ido-cc
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-ido-cc
# enable C++ style (//) commments with the IDO cc
# just in case increase the optimization threshold from the default 1000
_WRAP_EXTRA_ARGS.CC+= -Xcpluscomm -Olimit 6000
.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_ARG_PP.CXX= ${WRAPPER_TMPDIR}/arg-pp-sunpro-cxx
_WRAP_CACHE.CXX= ${WRAPPER_TMPDIR}/cache-sunpro-cxx
_WRAP_CACHE_BODY.CXX= ${WRAPPER_TMPDIR}/cache-body-sunpro-cxx
_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC}
_WRAP_CMD_SINK.CXX= ${WRAPPER_TMPDIR}/cmd-sink-sunpro-cxx
_WRAP_CACHE_BODY.CPP= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CPP= ${_WRAP_TRANSFORM.CC}
.endif
.if !empty(PKGSRC_COMPILER:Mxlc)
. if ${OPSYS} == "AIX"
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc
_WRAP_CMD_SINK.CC_R= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.CPP= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.CXX_R= ${_WRAP_CMD_SINK.CC}
. elif ${OPSYS} == "Darwin"
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-darwin-xlc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-xlc-cc
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-xlc-cc
_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC}
. else
PKG_FAIL_REASON+= "xlc unsupported on ${OPSYS}"
. endif
.endif
.if !empty(PKGSRC_COMPILER:Mccc)
_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-ccc-cc
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-ccc-cc
_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC}
.endif
.if !empty(PKGSRC_COMPILER:Mgcc)
_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-gcc
_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC}
.endif
_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-ld
_WRAP_SKIP_TRANSFORM.IMAKE= yes
# XXX
# XXX This section is ${OPSYS}-specific and shouldn't be here.
# XXX
.if ${OPSYS} == "Interix"
_WRAP_EXTRA_ARGS.CC+= -D_ALL_SOURCE
_WRAP_EXTRA_ARGS.CXX+= -D_ALL_SOURCE
_WRAP_EXTRA_ARGS.CPP+= -D_ALL_SOURCE
_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} == "Darwin"
_WRAP_ARG_PP.CC= ${WRAPPER_TMPDIR}/arg-pp-darwin-gcc
_WRAP_ARG_PP.CXX= ${_WRAP_ARG_PP.CC}
_WRAP_ARG_PP.LD= ${_WRAP_ARG_PP.CC}
.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}
.elif ${OPSYS} == "OSF1"
_WRAP_EXTRA_ARGS.CC+= -D_POSIX_PII_SOCKET
_WRAP_EXTRA_ARGS.CXX+= -D_POSIX_PII_SOCKET -D__USE_STD_IOSTREAM
_WRAP_EXTRA_ARGS.CPP+= -D_POSIX_PII_SOCKET
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-osf1-cc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-osf1-ld
.elif ${OPSYS} == "HPUX"
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-hpux-cc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-hpux-ld
.elif ${OPSYS} == "AIX"
_WRAP_CMD_SINK.CC?= ${WRAPPER_TMPDIR}/cmd-sink-aix-cc
_WRAP_CMD_SINK.CXX?= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-aix-ld
_WRAP_CACHE_BODY.CC?= ${WRAPPER_TMPDIR}/cache-body-aix-cc
_WRAP_CACHE_BODY.CC_R?= ${WRAPPER_TMPDIR}/cache-body-aix-cc
_WRAP_TRANSFORM.CC?= ${WRAPPER_TMPDIR}/transform-aix-cc
_WRAP_TRANSFORM.CC_R?= ${WRAPPER_TMPDIR}/transform-aix-cc
_WRAP_CACHE_BODY.CXX?= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CXX?= ${_WRAP_TRANSFORM.CC}
.elif ${OPSYS} == "IRIX"
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-irix-cc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-irix-ld
.endif
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-cross-gcc
_WRAP_CMD_SINK.CPP= ${WRAPPER_TMPDIR}/cmd-sink-cross-cpp
_WRAP_CMD_SINK.CXX= ${WRAPPER_TMPDIR}/cmd-sink-cross-gxx
.endif
.if ${OPSYS} == "SunOS" && !empty(PKGSRC_COMPILER:Mgcc)
_WRAP_CMD_SINK.IMAKE= ${WRAPPER_TMPDIR}/cmd-sink-solaris-imake
_WRAP_CACHE_BODY.IMAKE= ${WRAPPER_TMPDIR}/cache-body-solaris-imake
.endif
# Filter to scrunch shell scripts by removing comments and empty lines.
_WRAP_SH_CRUNCH_FILTER= ${AWK} ' \
/^\#!/ { print } \
/^[[:space:]]*\#/ || NF == 0 { next } \
/.*/ { print } \
'
_WRAP_SUBST_SED= \
-e "s|@ABI@|${ABI:Q}|g" \
-e "s|@CAT@|${CAT:Q}|g" \
-e "s|@ECHO@|${ECHO:Q}|g" \
-e "s|@EXPR@|${EXPR:Q}|g" \
-e "s|@MV@|${MV}|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" \
-e "s|@_WRAP_SUBR_SH@|${_WRAP_SUBR_SH}|g"
.for _wrappee_ in ${_WRAPPEES}
_WRAP_SUBST_SED.${_wrappee_}= \
-e "s|@_WRAP_EMPTY_FILE@|${_WRAP_EMPTY_FILEQ}|g" \
-e "s|@_WRAP_ENV@|${_WRAP_ENV.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_EXTRA_ARGS@|${_WRAP_EXTRA_ARGS.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_ARG_PP@|${_WRAP_ARG_PP.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_ARG_PP_MAIN@|${_WRAP_ARG_PP_MAIN.${_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_BODY@|${_WRAP_CACHE_BODY.${_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" \
-e "s|@_WRAP_TRANSFORM_SED@|${_WRAP_TRANSFORM_SED.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_TYPE@|${_WRAP_TYPE.${_wrappee_}}|g" \
-e "s|@WRAPPER_DEBUG@|${_WRAPPER_DEBUG}|g" \
-e "s|@WRAPPER_UPDATE_CACHE@|${WRAPPER_UPDATE_CACHE}|g" \
${_WRAP_SUBST_SED}
_WRAP_COOKIE.${_wrappee_}= ${WRAPPER_DIR}/.wrapper_${_wrappee_}_done
.endfor # _WRAPPEES
.for _wrappee_ in ${_WRAPPEES_UNIQUE}
PKG_${_wrappee_}?= ${${_wrappee_}}
generate-wrappers: ${_WRAP_COOKIE.${_wrappee_}}
${_WRAP_COOKIE.${_wrappee_}}: \
${_WRAPPER_SH.${_wrappee_}} \
${_WRAP_ARG_PP.${_wrappee_}} \
${_WRAP_ARG_PP_MAIN.${_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_SUBR_SH} \
${_WRAP_TRANSFORM.${_wrappee_}}
${RUN} \
wrapper="${WRAPPER_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
if [ -x "$$wrapper" ]; then ${ECHO_WRAPPER_MSG} "=> $$wrapper already exists. Skipping"; exit 0; fi; \
${ECHO_WRAPPER_MSG} "=> Creating ${_wrappee_} wrapper: $$wrapper"; \
gen_wrapper=yes; \
wrappee="${PKG_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
case $$wrappee in \
/*) ;; \
*) save_IFS="$$IFS"; \
IFS=":"; \
for dir in $${PATH}; do \
IFS="$$save_IFS"; \
case $${dir} in \
*${WRAPPER_DIR}*) \
;; \
*) \
if ${TEST} -f "$${dir}/$$wrappee" -o \
-h "$${dir}/$$wrappee"; then \
wrappee="$${dir}/$$wrappee"; \
break; \
fi; \
;; \
esac; \
done; \
IFS="$$save_IFS"; \
if ${TEST} ! -x "$$wrappee"; then \
gen_wrapper=no; \
${ECHO_WRAPPER_MSG} "Warning: unable to generate ${_wrappee_} wrapper script: \`$$wrappee'"; \
fi; \
;; \
esac; \
case $$gen_wrapper in \
yes) \
${MKDIR} `${DIRNAME} $$wrapper`; \
${CAT} ${_WRAPPER_SH.${_wrappee_}} | \
${SED} ${_WRAP_SUBST_SED.${_wrappee_}} \
-e "s|@WRAPPEE@|$$wrappee|g" | \
${_WRAP_SH_CRUNCH_FILTER} \
> $$wrapper; \
${CHMOD} +x $$wrapper; \
;; \
esac
${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
. for _alias_ in ${_WRAP_ALIASES.${_wrappee_}:S/^/${WRAPPER_BINDIR}\//}
. if !target(${_alias_})
generate-wrappers: ${_alias_}
${_alias_}: ${_WRAP_COOKIE.${_wrappee_}}
${RUN} \
wrapper="${WRAPPER_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
if [ ! -x ${.TARGET} -a -x $$wrapper ]; then \
${ECHO_WRAPPER_MSG} "=> Linking ${_wrappee_} wrapper: ${.TARGET}"; \
${LN} -f${WRAPPER_USE_SYMLINK:Ds} $$wrapper ${.TARGET}; \
fi
. endif
. endfor
.endfor # _WRAPPEES_UNIQUE
.for _target_ in ${WRAPPER_TARGETS}
generate-wrappers: ${_target_}
.endfor
.for w in \
arg-pp-darwin-gcc \
arg-pp-mipspro-cc \
arg-pp-sunpro-cxx \
cmd-sink-aix-cc \
cmd-sink-aix-ld \
cmd-sink-aix-xlc \
cmd-sink-darwin-xlc \
cmd-sink-icc-cc \
cmd-sink-icc81-cc \
cmd-sink-irix-cc \
cmd-sink-irix-ld \
cmd-sink-interix-gcc \
cmd-sink-ld \
cmd-sink-osf1-cc \
cmd-sink-osf1-ld \
cmd-sink-hpux-cc \
cmd-sink-hpux-ld \
cmd-sink-solaris-imake \
cmd-sink-sunpro-cxx \
cmd-sink-unixware-gcc \
transform-aix-cc \
transform-ccc-cc \
transform-gcc \
transform-icc-cc \
transform-ido-cc \
transform-mipspro-cc \
transform-mipspro-ucode-cc \
transform-sunpro-cc \
transform-xlc-cc \
wrapper-subr.sh
${WRAPPER_TMPDIR}/${w}: ${WRAPPER_SRCDIR}/${w}
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
.endfor
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
_WRAP_CROSS_GCC_FILTER+= ${SED} \
-e "s|@CROSS_DESTDIR@|${_CROSS_DESTDIR:Q}|g" \
-e "s|@PREFIX@|${PREFIX:Q}|g"
${WRAPPER_TMPDIR}/cmd-sink-cross-gcc: ${WRAPPER_SRCDIR}/cmd-sink-cross-gcc
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_CROSS_GCC_FILTER} | \
${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
${WRAPPER_TMPDIR}/cmd-sink-cross-cpp: ${WRAPPER_SRCDIR}/cmd-sink-cross-cpp
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_CROSS_GCC_FILTER} | \
${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
${WRAPPER_TMPDIR}/cmd-sink-cross-gxx: ${WRAPPER_SRCDIR}/cmd-sink-cross-gxx
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_CROSS_GCC_FILTER} | \
${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
.endif
.if !target(${_WRAP_GEN_REORDER})
${_WRAP_GEN_REORDER}: \
${_WRAP_SHELL_LIB} \
${WRAPPER_SRCDIR}/gen-reorder.sh
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} \
${CAT} ${WRAPPER_SRCDIR}/gen-reorder.sh \
| ${SED} ${_WRAP_SUBST_SED} \
| ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
${RUN} ${CHMOD} +x ${.TARGET}
.endif
.if !target(${_WRAP_GEN_TRANSFORM})
${_WRAP_GEN_TRANSFORM}: \
${_WRAP_SHELL_LIB} \
${WRAPPER_SRCDIR}/gen-transform.sh
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} \
${CAT} ${WRAPPER_SRCDIR}/gen-transform.sh \
| ${SED} ${_WRAP_SUBST_SED} \
| ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
${RUN} ${CHMOD} +x ${.TARGET}
.endif
.if !target(${_WRAP_REORDERLIBS})
${_WRAP_REORDERLIBS}: ${_WRAP_GEN_REORDER}
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${_WRAP_GEN_REORDER} ${WRAPPER_REORDER_CMDS} > ${.TARGET}
.endif
. if !target(${_WRAP_SHELL_LIB})
${_WRAP_SHELL_LIB}: ${.CURDIR}/../../mk/scripts/shell-lib
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
.if !target(${_WRAP_TRANSFORM_SEDFILE})
${_WRAP_TRANSFORM_SEDFILE}: ${_WRAP_GEN_TRANSFORM}
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${_WRAP_GEN_TRANSFORM} transform ${_WRAP_TRANSFORM_CMDS} \
> ${.TARGET}
.endif
.if !target(${_WRAP_UNTRANSFORM_SEDFILE})
${_WRAP_UNTRANSFORM_SEDFILE}: ${_WRAP_GEN_TRANSFORM}
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} \
${_WRAP_GEN_TRANSFORM} untransform ${_WRAP_TRANSFORM_CMDS} \
> ${.TARGET}
.endif
.for _wrappee_ in ${_WRAPPEES}
. if !target(${_WRAP_EMPTY_FILE})
${_WRAP_EMPTY_FILE}:
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${TOUCH} ${TOUCH_ARGS} ${.TARGET}
. endif
. if !target(${_WRAP_ARG_PP_MAIN.${_wrappee_}})
${_WRAP_ARG_PP_MAIN.${_wrappee_}}: ${WRAPPER_SRCDIR}/arg-pp-main
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
. if !target(${_WRAP_ARG_SOURCE.${_wrappee_}})
${_WRAP_ARG_SOURCE.${_wrappee_}}: ${WRAPPER_SRCDIR}/arg-source
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
. if !target(${_WRAP_BUILDCMD.${_wrappee_}})
${_WRAP_BUILDCMD.${_wrappee_}}: ${WRAPPER_SRCDIR}/buildcmd
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
. if !target(${_WRAP_CACHE.${_wrappee_}})
${_WRAP_CACHE.${_wrappee_}}:
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} echo "cache_lookup() { cachehit=no; }" > ${.TARGET}
. endif
. if !target(${_WRAP_CACHE_BODY.${_wrappee_}})
${_WRAP_CACHE_BODY.${_wrappee_}}:
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${TOUCH} ${TOUCH_ARGS} ${.TARGET}
. endif
. if !target(${_WRAP_CMD_SINK.${_wrappee_}})
${_WRAP_CMD_SINK.${_wrappee_}}: ${WRAPPER_SRCDIR}/cmd-sink
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
. if !target(${_WRAP_LOGIC.${_wrappee_}})
${_WRAP_LOGIC.${_wrappee_}}: ${WRAPPER_SRCDIR}/logic
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
. if !target(${_WRAP_SCAN.${_wrappee_}})
${_WRAP_SCAN.${_wrappee_}}: ${WRAPPER_SRCDIR}/scan
${RUN} ${MKDIR} ${.TARGET:H}
${RUN} ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
. endif
.endfor # _WRAPPEES
# 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_cmd= \
cd ${WRKSRC} && \
${ECHO} "__dummy-entry__" && \
${FIND} . -type f \( ${_UNWRAP_PATTERNS:C/.*/-o -name "&"/g:S/-o//1} \) -print \
| ${SED} -e 's|^\./||' \
| ${SORT} -u
UNWRAP_FILES?= # empty
_UNWRAP_FILES= ${UNWRAP_FILES} \
${_UNWRAP_PATTERNS_FIND_cmd:sh:N__dummy-entry__}
_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
###
### END: after the barrier
###
######################################################################
######################################################################
######################################################################
_COOKIE.wrapper= ${WRKDIR}/.wrapper_done
.PHONY: wrapper
.if !target(wrapper)
. if exists(${_COOKIE.wrapper})
wrapper:
@${DO_NADA}
. elif defined(_PKGSRC_BARRIER)
wrapper: check-vulnerable patch acquire-wrapper-lock ${_COOKIE.wrapper} release-wrapper-lock
. else
wrapper: barrier
. endif
.endif
.PHONY: acquire-wrapper-lock release-wrapper-lock
acquire-wrapper-lock: acquire-lock
release-wrapper-lock: release-lock
.if exists(${_COOKIE.wrapper})
${_COOKIE.wrapper}:
@${DO_NADA}
.else
${_COOKIE.wrapper}: real-wrapper
.endif
.PHONY: real-wrapper
real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check
.PHONY: wrapper-message
wrapper-message:
@${PHASE_MSG} "Creating toolchain wrappers for ${PKGNAME}"
.PHONY: pre-wrapper do-wrapper post-wrapper
.if !target(do-wrapper)
do-wrapper: generate-wrappers
@${DO_NADA}
.endif
.if !target(pre-wrapper)
pre-wrapper:
@${DO_NADA}
.endif
.if !target(post-wrapper)
post-wrapper:
@${DO_NADA}
.endif
.PHONY: wrapper-cookie
wrapper-cookie:
${RUN} [ ! -f ${_COOKIE.wrapper} ]
${RUN} ${MKDIR} ${_COOKIE.wrapper:H}
${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper}

90
mk/wrapper/buildcmd Normal file
View File

@@ -0,0 +1,90 @@
# $NetBSD: buildcmd,v 1.6 2012/04/13 06:36:08 wiz 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
;;
######################################################################
# Preserve the -Wl,-Bstatic / -Wl,-Bdynamic arguments, but also
# duplicate them into the list of libraries. Someone may want to mix
# static and dynamic linking.
######################################################################
-Wl,-Bdynamic|-Wl,-Bstatic)
shquote "$arg"; arg="$shquoted"
cmd="$cmd $arg"
libs="$libs $arg"
;;
######################################################################
# Treat the '--as-needed' and '--no-as-needed' arguments to ld as if
# thay are libraries so that they still surround the given library.
# WARNING: this may not work if the wrapper reorders libraries.
######################################################################
-l*|--as-needed|--no-as-needed)
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

42
mk/wrapper/cmd-sink Normal file
View File

@@ -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

160
mk/wrapper/cmd-sink-aix-cc Normal file
View File

@@ -0,0 +1,160 @@
# $NetBSD: cmd-sink-aix-cc,v 1.9 2009/06/11 10:38:28 sno Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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=
orig_blibpath=
dynamic=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-cc) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
-Wl,-blibpath:*)
orig_blibpath=${arg#-Wl,-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-cc) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
##############################################################
# AIX ld(1) doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command 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 $wrapperlog " (cmd-sink-aix-cc) drop: $dir [adding to blibpath]"
dynamic=yes
;;
-rpath)
pop_queue cmdbuf dir
case $blibpath in
"") blibpath="$dir" ;;
*) blibpath="$blibpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-aix-cc) drop: $dir [adding to blibpath]"
;;
-pthread)
arg=-qthreaded
. $buildcmd
;;
-fexceptions)
arg=-qstrict=exceptions
. $buildcmd
;;
-fpic|-fPIC)
arg=-qpic=large
. $buildcmd
;;
-Os)
arg=-O2
. $buildcmd
arg=-qnounroll
. $buildcmd
arg=-qnoinline
. $buildcmd
;;
-shared)
arg=-qmkshrobj
. $buildcmd
arg=-bshared
. $buildcmd
;;
-Wl,-soname*)
arg=-brtl
. $buildcmd
arg=-Wl,-G
. $buildcmd
arg=-Wl,-bexpall
. $buildcmd
;;
-Wall)
arg=-qflag=w:w
. $buildcmd
arg=-qinfo
. $buildcmd
;;
-W|-Wextra)
arg=-qformat
. $buildcmd
arg=-qwarn64
. $buildcmd
;;
-Werror)
arg=-qhalt=w
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done
# AIX ld(1) uses -blibpath to set the runtime library search path.
arg="-Wl,-blibpath:/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
. $buildcmd
# If we are dynamically linking, make sure the runtime linker is used.
if $test -n "$dynamic"; then
arg=-Wl,-brtl
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
. $buildcmd
arg=-Wl,-bdynamic
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
. $buildcmd
fi

100
mk/wrapper/cmd-sink-aix-ld Normal file
View File

@@ -0,0 +1,100 @@
# $NetBSD: cmd-sink-aix-ld,v 1.5 2009/01/15 16:55:33 joerg 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.
orig_blibpath=
blibpath=
dynamic=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
##############################################################
# AIX ld(1) doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command 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 $wrapperlog " (cmd-sink-aix-ld) drop: $dir [adding to blibpath]"
dynamic=yes
;;
-q64*)
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $arg"
;;
*)
. $buildcmd
;;
esac
done
# AIX ld(1) uses -blibpath to set the runtime library search path.
arg="-blibpath:/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
. $buildcmd
# If we are dynamically linking, make sure the runtime linker is used.
if $test -n "$dynamic"; then
arg=-brtl
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
. $buildcmd
arg=-bdynamic
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
. $buildcmd
fi

154
mk/wrapper/cmd-sink-aix-xlc Normal file
View File

@@ -0,0 +1,154 @@
# $NetBSD: cmd-sink-aix-xlc,v 1.13 2009/06/11 10:38:28 sno 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=
orig_blibpath=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-xlc) drop: $dir [setting orig_blibpath]"
;;
-Wl,-blibpath:*)
orig_blibpath=${arg#-Wl,-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-xlc) drop: $dir [setting orig_blibpath]"
;;
##############################################################
# AIX xlC doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command 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 $wrapperlog " (cmd-sink-aix-xlc) drop: $dir [adding to blibpath]"
;;
# GCC and xlC allow -rpath directly, so keep this behavior.
-rpath)
pop_queue cmdbuf dir
case $blibpath in
"") blibpath="$dir" ;;
*) blibpath="$blibpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-aix-xlc) drop: $dir [adding to blibpath]"
;;
-pthread)
arg=-qthreaded
. $buildcmd
;;
-fexceptions)
arg=-qstrict=exceptions
. $buildcmd
;;
-fpic|-fPIC)
arg=-qpic=large
. $buildcmd
;;
-Os)
arg=-O2
. $buildcmd
arg=-qnounroll
. $buildcmd
arg=-qnoinline
. $buildcmd
;;
-shared)
arg=-qmkshrobj
. $buildcmd
arg=-bshared
. $buildcmd
;;
-Wl,-soname*)
arg=-brtl
. $buildcmd
arg=-Wl,-G
. $buildcmd
arg=-Wl,-bexpall
. $buildcmd
;;
-Wall)
arg=-qflag=w:w
. $buildcmd
arg=-qinfo
. $buildcmd
;;
-W|-Wextra)
arg=-qformat
. $buildcmd
arg=-qwarn64
. $buildcmd
;;
-Werror)
arg=-qhalt=w
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done
# AIX xlc uses -blibpath to set the runtime library search path.
arg="-Wl,-blibpath:/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
. $buildcmd
# Force dynamic linkage on AIX to get preference of dynamic libraries
# over library archives.
if $test "$dont_link" != "yes"; then
arg="-Wl,-brtl"
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
. $buildcmd
fi

View File

@@ -0,0 +1,41 @@
# $NetBSD: cmd-sink-cross-cpp,v 1.2 2013/05/09 23:35:29 riastradh Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
#
# This code was developed as part of Google's Summer of Code 2007 program.
#
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
# COPYRIGHT HOLDERS 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.
# Use include files and libraries from the target system image.
arg="--sysroot=@CROSS_DESTDIR@"
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
done

View File

@@ -0,0 +1,63 @@
# $NetBSD: cmd-sink-cross-gcc,v 1.3 2013/05/09 23:35:29 riastradh Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
#
# This code was developed as part of Google's Summer of Code 2007 program.
#
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
# COPYRIGHT HOLDERS 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.
# Use include files and libraries from the target system image.
arg="--sysroot=@CROSS_DESTDIR@"
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
case $arg in
-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,--rpath,*)
# First, push the option out again.
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
# Now translate the directory to be relative to the
# the target DESTDIR for the linker.
case $arg in
-R*) R="-R" ;;
-Wl,-R*) R="-Wl,-R" ;;
-Wl,-rpath,*) R="-Wl,-rpath," ;;
-Wl,--rpath,*) R="-Wl,--rpath," ;;
esac
dir="${arg#$R}"
arg="-Wl,-rpath-link,@CROSS_DESTDIR@${dir}"
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
;;
*)
$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg"
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,63 @@
# $NetBSD: cmd-sink-cross-gxx,v 1.2 2013/05/09 23:35:29 riastradh Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
#
# This code was developed as part of Google's Summer of Code 2007 program.
#
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
# COPYRIGHT HOLDERS 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.
# Use include files and libraries from the target system image.
arg="--sysroot=@CROSS_DESTDIR@"
$debug_log $wrapperlog " (cmd-sink-native-cxx) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
case $arg in
-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,--rpath,*)
# First, push the option out again.
$debug_log $wrapperlog " (cmd-sink-native-cxx) pop: $arg"
. $buildcmd
# Now translate the directory to be relative to the
# the target DESTDIR for the linker.
case $arg in
-R*) R="-R" ;;
-Wl,-R*) R="-Wl,-R" ;;
-Wl,-rpath,*) R="-Wl,-rpath," ;;
-Wl,--rpath,*) R="-Wl,--rpath," ;;
esac
dir="${arg#$R}"
arg="-Wl,-rpath-link,@CROSS_DESTDIR@${dir}"
$debug_log $wrapperlog " (cmd-sink-native-cxx) pop: $arg"
. $buildcmd
;;
*)
$debug_log $wrapperlog " (cmd-sink-native-cxx) pop: $arg"
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,59 @@
# $NetBSD: cmd-sink-darwin-xlc,v 1.1 2004/12/05 09:29:26 grant 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-darwin-xlc) pop: $arg"
case $arg in
##############################################################
# xlc doesn't support -install_name, -compatibility_version,
# -current_version, so explicitly pass them to the linker with
# the next argument.
##############################################################
-install_name|-compatibility_version|-current_version)
pop_queue cmdbuf arg2
$debug_log $wrapperlog " (cmd-sink-darwin-xlc) pop: $arg2"
$debug_log $wrapperlog " (cmd-sink-darwin-xlc) pre: -Wl,$arg2"
prepend_queue cmdbuf "-Wl,$arg2"
$debug_log $wrapperlog " (cmd-sink-darwin-xlc) pre: -Wl,$arg"
prepend_queue cmdbuf "-Wl,$arg"
;;
*)
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,64 @@
# $NetBSD $
# Empty out the command buffer and build up the command line in $cmd.
hprunpath=
hprunpathdirs=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-hpux-cc) pop: $arg"
case $arg in
##############################################################
# HP-UX ld doesn't support multiple rpath parameters, accumulate
# them into a single -Wl,+b,/path1:/path2:...:pathn
##############################################################
+b|-Wl,+b|-rpath)
pop_queue cmdbuf dir
dir="${dir#-Wl,}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-cc) drop: $dir [adding to hprunpath]"
;;
-Wl,+b,*|-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*)
case $arg in
-Wl,+b,*) R="-Wl,+b," ;;
-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}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-cc) drop: $dir [adding to hprunpath]"
;;
*)
. $buildcmd
;;
esac
done
if $test -n "$hprunpath"; then
arg="-Wl,+b,$hprunpath"
$debug_log $wrapperlog " (cmd-sink-hpux-cc) pop: $arg [aggregate]"
. $buildcmd
##############################################################################
# Turn paths from the run path into additional -L arguments. This works around
# the braindead HP-UX ld(1) which needs to relink binaries against libraries
# in ${PREFIX} to get run paths correct.
# NB: This is not optimal because it exposes the package to possibly unwanted
# libraries. (Ideally this should be done only in the installation phase.)
##############################################################################
for dir in $hprunpathdirs
do
arg="-L$dir"
$debug_log $wrapperlog " (cmd-sink-hpux-cc) pop: $arg [from run path]"
. $buildcmd
done
fi

View File

@@ -0,0 +1,72 @@
# $NetBSD: cmd-sink-hpux-ld,v 1.6 2007/05/28 11:07:00 martti Exp $
# Empty out the command buffer and build up the command line in $cmd.
hprunpath=
hprunpathdirs=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg"
case $arg in
##############################################################
# HP-UX ld doesn't support multiple rpath parameters, accumulate
# them into a single +b /path1:/path2:...:pathn
##############################################################
+b|-Wl,+b|-rpath)
pop_queue cmdbuf dir
dir="${dir#-Wl,}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-ld) drop: $dir [adding to hprunpath]"
;;
-Wl,+b,*|-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*)
case $arg in
-Wl,+b,*) R="-Wl,+b," ;;
-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}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-ld) drop: $dir [adding to hprunpath]"
;;
# Handle linker optimization flag.
-O*|+O|+O?)
arg=-O
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done
if $test -n "$hprunpath"; then
arg=+b
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg"
. $buildcmd
arg=$hprunpath
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg [aggregate]"
. $buildcmd
##############################################################################
# Turn paths from the run path into additional -L arguments. This works around
# the braindead HP-UX ld(1) which needs to relink binaries against libraries
# in ${PREFIX} to get run paths correct.
# NB: This is not optimal because it exposes the package to possibly unwanted
# libraries. (Ideally this should be done only in the installation phase.)
##############################################################################
for dir in $hprunpathdirs
do
arg="-L$dir"
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg [from run path]"
. $buildcmd
done
fi

View File

@@ -0,0 +1,59 @@
# $NetBSD: cmd-sink-icc-cc,v 1.2 2005/02/15 09:42:23 grant Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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.
# all icc built dynamic libraries and executables need to be linked
# with ${ICCBASE}/lib in the rpath, or statically linked against the
# icc provided libraries. use the static linking method so binary
# packages can be used on systems that do not have these libraries
# available.
arg=-static-libcxa
$debug_log $wrapperlog " (cmd-sink-icc-cc) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
case "$arg" in
-MT)
pop_queue cmdbuf arg2
$debug_log $wrapperlog " (cmd-sink-icc-cc) pop: $arg $arg2 [drop]"
;;
*)
$debug_log $wrapperlog " (cmd-sink-icc-cc) pop: $arg"
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,64 @@
# $NetBSD: cmd-sink-icc81-cc,v 1.2 2005/02/16 11:24:44 grant Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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.
# all icc built dynamic libraries and executables need to be linked
# with ${ICCBASE}/lib in the rpath, or statically linked against the
# icc provided libraries. use the static linking method so binary
# packages can be used on systems that do not have these libraries
# available.
arg=-i-static
$debug_log $wrapperlog " (cmd-sink-icc81-cc) pop: $arg"
. $buildcmd
# Always link against the Intel provided C++ runtime library.
arg=-cxxlib-icc
$debug_log $wrapperlog " (cmd-sink-icc81-cc) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
case "$arg" in
-MT)
pop_queue cmdbuf arg2
$debug_log $wrapperlog " (cmd-sink-icc81-cc) pop: $arg $arg2 [drop]"
;;
*)
$debug_log $wrapperlog " (cmd-sink-icc81-cc) pop: $arg"
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,50 @@
# $NetBSD: cmd-sink-interix-gcc,v 1.4 2005/01/24 21:21:45 tv 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-interix-gcc) pop: $arg"
case $arg in
-fpic|-fPIC|-pthread|-rdynamic)
$echo "$0: Interix GNU cc doesn't support \`$arg'." 1>&2
exit 1
;;
*)
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,50 @@
# $NetBSD: cmd-sink-interix-ld,v 1.2 2004/11/10 21:08:11 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-interix-ld) pop: $arg"
case $arg in
-shared|-Bshareable)
$echo "$0: Interix GNU ld doesn't support \`$arg'." 1>&2
exit 1
;;
*)
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,24 @@
# $NetBSD: cmd-sink-irix-cc,v 1.1 2008/02/19 17:36:51 tnn Exp $
# 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-irix-cc) pop: $arg"
case $arg in
-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}"
arg="-Wl,-rpath,$dir"
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,26 @@
# $NetBSD: cmd-sink-irix-ld,v 1.1 2008/02/19 17:36:51 tnn Exp $
# 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-irix-ld) pop: $arg"
case $arg in
-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}"
arg="-rpath"
. $buildcmd
arg="$dir"
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done

77
mk/wrapper/cmd-sink-ld Normal file
View File

@@ -0,0 +1,77 @@
# $NetBSD: cmd-sink-ld,v 1.4 2006/12/15 13:15:07 martti 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
IFS="${save_IFS}"
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
;;
############################################################
# Silently accept "-pthread" by dropping them. This allows
# "-pthread" to be added to LDFLAGS for use by both the
# compiler and the linker.
############################################################
-pthread)
$debug_log $wrapperlog " (cmd-sink-ld) drop: $arg"
arg=
;;
*)
. $buildcmd
;;
esac
done

View File

@@ -0,0 +1,52 @@
# $NetBSD: cmd-sink-osf1-cc,v 1.2 2006/11/03 07:28:53 rillig Exp $
# Empty out the command buffer and build up the command line in $cmd.
osf1runpath=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-osf1-cc) pop: $arg"
case $arg in
##############################################################
# OSF1 ld doesn't support multiple rpath parameters, accumulate
# them into a single -rpath /path1:/path2:...:pathn
##############################################################
-rpath)
pop_queue cmdbuf dir
case $osf1runpath in
"") osf1runpath="$dir" ;;
*) osf1runpath="$osf1runpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-osf1-cc) drop: $dir [adding to osf1runpath]"
;;
-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 $osf1runpath in
"") osf1runpath="$dir" ;;
*) osf1runpath="$osf1runpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-osf1-cc) drop: $dir [adding to osf1runpath]"
;;
-Wl,-h*)
arg="-Wl,-soname"${arg#"-Wl,-h"}
$debug_log $wrapperlog " (cmd-sink-osf1-cc) pop: $arg"
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done
if $test -n "$osf1runpath"; then
arg="-Wl,-rpath,$osf1runpath"
$debug_log $wrapperlog " (cmd-sink-osf1-cc) pop: $arg [aggregate]"
. $buildcmd
fi

View File

@@ -0,0 +1,59 @@
# $NetBSD: cmd-sink-osf1-ld,v 1.2 2006/11/03 07:28:53 rillig Exp $
# Empty out the command buffer and build up the command line in $cmd.
osf1runpath=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-osf1-ld) pop: $arg"
case $arg in
##############################################################
# OSF1 ld doesn't support multiple rpath parameters, accumulate
# them into a single -rpath /path1:/path2:...:pathn
##############################################################
-rpath)
pop_queue cmdbuf dir
case $osf1runpath in
"") osf1runpath="$dir" ;;
*) osf1runpath="$osf1runpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-osf1-ld) drop: $dir [adding to osf1runpath]"
;;
-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 $osf1runpath in
"") osf1runpath="$dir" ;;
*) osf1runpath="$osf1runpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-osf1-ld) drop: $dir [adding to osf1runpath]"
;;
-Wl,-h,*)
arg="-Wl,-soname"${arg#"-Wl,-h"}
$debug_log $wrapperlog " (cmd-sink-osf1-ld) pop: $arg"
. $buildcmd
;;
-pthread)
arg="-lpthread"
$debug_log $wrapperlog " (cmd-sink-osf1-ld) pop: $arg"
. $buildcmd
;;
*)
. $buildcmd
;;
esac
done
if $test -n "$osf1runpath"; then
arg=-rpath
$debug_log $wrapperlog " (cmd-sink-osf1-ld) pop: $arg"
. $buildcmd
arg=$osf1runpath
$debug_log $wrapperlog " (cmd-sink-osf1-ld) pop: $arg [aggregate]"
. $buildcmd
fi

View File

@@ -0,0 +1,46 @@
# $NetBSD: cmd-sink-solaris-imake,v 1.1 2005/07/23 04:45:30 grant Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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. 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.
# ensure gcc options are always passed to imake.
arg=-DHasGcc2=YES
$debug_log $wrapperlog " (cmd-sink-solaris-imake) pop: $arg"
. $buildcmd
arg=-DHasGcc2ForCplusplus=YES
$debug_log $wrapperlog " (cmd-sink-solaris-imake) pop: $arg"
. $buildcmd
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-solaris-imake) pop: $arg"
. $buildcmd
done

View File

@@ -0,0 +1,61 @@
# $NetBSD: cmd-sink-sunpro-cxx,v 1.1 2005/07/06 03:31:24 grant Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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. 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 we are linking a shared library, ensure that the C++ runtime
# libraries are linked so that all symbols can be resolved at runtime.
shlib=
libCstd=
libCrun=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-sunpro-cxx) pop: $arg"
case $arg in
-G) shlib=yes ;;
-lCstd) libCstd=yes ;;
-lCrun) libCrun=yes ;;
esac
. $buildcmd
done
if $test -n "$shlib"; then
if $test "$libCstd" != yes; then
arg=-lCstd
$debug_log $wrapperlog " (cmd-sink-sunpro-cxx) pop: $arg"
. $buildcmd
fi
if $test "$libCrun" != yes; then
arg=-lCrun
$debug_log $wrapperlog " (cmd-sink-sunpro-cxx) pop: $arg"
. $buildcmd
fi
fi

View File

@@ -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

142
mk/wrapper/gen-reorder.sh Normal file
View File

@@ -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

451
mk/wrapper/gen-transform.sh Normal file
View File

@@ -0,0 +1,451 @@
#! @WRAPPER_SHELL@
#
# $NetBSD: gen-transform.sh,v 1.8 2007/03/07 12:40:54 rillig 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. The
# "transform" action pertains to transforming command-line options,
# while the "untransform" action pertains to unwrapping *-config
# files, *.pc files, and *.lai (to-be-installed libtool archive)
# files.
######################################################################
gen()
{
_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)
gen $_action "opt-depot:$1:$2"
gen $_action "opt-depot:-I$1:-I$2"
gen $_action "opt-depot:-L$1:-L$2"
;;
###############################################################
# 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)
$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"
;;
##############################################################
# libpath:src:dst
# Change "src/*/libfoo.{a,la}" into "dst/*/libfoo.{a,la}".
##############################################################
libpath)
case $_action in
transform)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
$cat << EOF
s|^$1\(/[^$_sep]*\.la[$_sep]\)|$2\1|g
s|^$1\(/[^$_sep]*\.la\)$|$2\1|g
EOF
;;
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/*" in -I,
# -L, and rpath options, and also in full paths to
# libraries.
##############################################################
mangle)
$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"
;;
##############################################################
# no-abspath
# Remove all "dash" options that contain an absolute path.
##############################################################
no-abspath)
$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
;;
##############################################################
# no-rpath
# Removes rpath options.
##############################################################
no-rpath)
$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
;;
##############################################################
# opt:src:dst
# Change "src" into "dst", where "src" matches the whole
# option or a leading part up to a separator character.
##############################################################
opt)
case $_action in
transform)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
$cat << EOF
s|^$1\([$_sep]\)|$2\1|g
s|^$1$|$2|g
EOF
;;
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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
$cat << EOF
s|^$1/[^/$_sep]*\(/[^$_sep]*[$_sep]\)|$2\1|g
s|^$1/[^/$_sep]*\(/[^$_sep]*\)$|$2\1|g
EOF
;;
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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
gen $_action "opt-sub-trailer:$1::$2:"
;;
##############################################################
# 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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
$cat << EOF
s|^$1\(/[^$_sep]*\)$2\([$_sep]\)|$3\1$4|g
s|^$1\(/[^$_sep]*\)$2$|$3\1$4|g
EOF
;;
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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
gen $_action "opt:$1:$2"
;;
##############################################################
# rm:opt
# Remove "opt", where "opt" matches the entire option.
##############################################################
rm)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
gen $_action "opt:$1:"
;;
##############################################################
# 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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
$cat << EOF
s|^$1[^$_sep]*\([$_sep]\)|\1|g
s|^$1[^$_sep]*$||g
EOF
;;
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)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
gen $_action "opt:-I$1:"
gen $_action "rm-optarg:-I$1/"
gen $_action "opt:-L$1:"
gen $_action "rm-optarg:-L$1/"
for _R in $rpath_options; do
gen $_action "opt:$_R$1:"
gen $_action "rm-optarg:$_R$1/"
done
;;
##############################################################
# rpath:src:dst
# Change "src" into "dst" and "src/*" into "dst/*" in rpath
# options.
##############################################################
rpath)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
gen $_action "rpath-exact:$1:$2"
gen $_action "sub-rpath:$1:$2"
;;
##############################################################
# rpath-exact:src:dst
# Change "src" into "dst" in rpath options.
##############################################################
rpath-exact)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
for _R in $rpath_options; do
gen $_action "opt:$_R$1:$_R$2"
done
;;
##############################################################
# strip-slashdot:dir
# Change "dir/." into "dir" and the same in -I, -L, and
# rpath options.
##############################################################
strip-slashdot)
$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
;;
##############################################################
# sub-mangle:src:dst
# Change "src/*" into "dst/*" in -I, -L, and rpath
# options, and also in full paths to libraries.
##############################################################
sub-mangle)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
#gen $_action "opt-sub:$1:$2"
gen $_action "libpath:$1:$2"
gen $_action "opt-sub:-I$1:-I$2"
gen $_action "opt-sub:-L$1:-L$2"
gen $_action "sub-rpath:$1:$2"
;;
##############################################################
# sub-rpath:src:dst
# Change "src/*" into "dst/*" in rpath options.
##############################################################
sub-rpath)
$debug_log $wrapperlog " (gen-transform) $_cmd: $@"
for _R in $rpath_options; do
gen $_action "opt-sub:$_R$1:$_R$2"
done
;;
##############################################################
# 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

179
mk/wrapper/logic Normal file
View File

@@ -0,0 +1,179 @@
# $NetBSD: logic,v 1.16 2007/11/28 14:45:22 rillig 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.
. $cache
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
if queue_is_empty argbuf; then
argok=yes
continue
fi
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 || true`
do_transform=no
argok=yes
continue
fi
argmatch=no
. $arg_pp_main
case $argmatch in
yes) continue ;;
esac
. $arg_pp
case $argmatch in
yes) continue ;;
esac
argok=yes
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_lookup
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
split_arg=no
case $skip_transform in
yes)
$debug_log $wrapperlog " (logic) to: $arg [untransformed]"
;;
*)
shquote "$arg"; cachearg="$shquoted"
case $arg in
-*|/*)
case $transform_sed in
"") ;;
*)
arg=`$echo "X$arg" | $Xsed $transform_sed`
$debug_log $wrapperlog " (logic) to: $arg"
addtocache=yes
;;
esac
;;
*)
$debug_log $wrapperlog " (logic) to: $arg [untransformed]"
;;
esac
# Apply wrapper-specific transformations
# to $arg.
#
. $transform
;;
esac
##############################################
# Split all -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".
##############################################
case $arg in
-l*) split_arg=yes ;;
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; split_arg=$split_arg; cachehit=yes ;;
EOF
{ echo "cache_lookup() {"
echo "case \$arg in"
$cat $cache_body
echo "*) cachehit=no ;;"
echo "esac"
echo "}"
} > $cache-$$.tmp
$mv -f $cache-$$.tmp $cache
;;
esac
;;
esac
case $split_arg in
######################################################
# Split some options along whitespace. This disallows
# options that contain whitespace, but it allows us to
# handle transformations that transform one arg into
# several.
######################################################
yes)
for i in $arg; do
append_queue cmdbuf "$i"
$debug_log $wrapperlog " (logic) push: $i [split]"
done
;;
######################################################
# Everything else goes into the command buffer unchanged.
######################################################
no)
append_queue cmdbuf "$arg"
$debug_log $wrapperlog " (logic) push: $arg"
;;
esac
;;
*)
append_queue cmdbuf "$arg"
$debug_log $wrapperlog " (logic) push: $arg [untransformed]"
;;
esac
done

44
mk/wrapper/scan Normal file
View File

@@ -0,0 +1,44 @@
# $NetBSD: scan,v 1.1 2004/10/04 20:28:30 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.
#
# Don't append extra arguments if "-v" is passed to the command.
for arg do
case $arg in
-v) append_extra_args=no; break ;;
*) ;;
esac
done

41
mk/wrapper/test-transform.sh Executable file
View File

@@ -0,0 +1,41 @@
#! /bin/sh
# $NetBSD: test-transform.sh,v 1.1 2006/12/09 12:42:43 rillig Exp $
#
# NAME
# test-transform - Test for a single-argument transformation plug-in
#
# SYNOPSIS
# test-transform.sh transform-file arg...
#
# DESCRIPTION
# test-transform builds up an environment like in the wrapper.sh
# script and feeds the remaining arguments to the transformation
# file. It prints the result of the transformation on stdout,
# suitable for manual checking.
#
# EXAMPLES
# sh test-transform.sh transform-xlc-cc -E -Wall -dynamiclib
#
set -eu
wrapperdir=`dirname "$0"`
. "${wrapperdir}/../scripts/shell-lib"
. "${wrapperdir}/wrapper-subr.sh"
msg_log() {
shift
echo "[msg_log] $*"
}
debug_log="msg_log"
wrapperlog="stderr"
transformation_file="$1"; shift
for arg in "$@"; do
split_arg=no
addtocache=no
. "./$transformation_file"
echo "=> arg=$arg, split_arg=$split_arg, addtocache=$addtocache"
done

View File

@@ -0,0 +1,58 @@
# $NetBSD: transform-aix-cc,v 1.4 2006/11/30 11:51:39 rillig Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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.
transform_setname "transform-aix-cc"
case $arg in
# Standard options.
-[cEgOo] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# prepend -Wl, to linker arguments commonly passed to the compiler.
-b* |\
-H[0-9]* |\
-T[0-9]* ) transform_to "-Wl,$arg" ;;
# AIX ld(1) uses -G to create shared libraries, and we must make sure
# the runtime linker is used.
-shared ) transform_to_and_split "-Wl,-G -Wl,-brtl" ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,29 @@
# $NetBSD: transform-ccc-cc,v 1.6 2007/05/28 11:07:01 martti Exp $
#
transform_setname "transform-ccc-cc"
case $arg in
# Standard options (except -g, which is handled later).
-[cEOo] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# -g3 is required if debugging is wanted while optimizing with -O2.
-g ) transform_to "-g3" ;;
# Directories for the runtime library search path are passed via
# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
-Wl,-R* ) transform_to "-Wl,-rpath,${arg#-Wl,-R}" ;;
-W[LlSc],* ) transform_pass ;;
# Ignore options that are likely to be GCC warnings.
-W* ) transform_discard_with_warning ;;
-mieee ) transform_to "-ieee" ;;
-* ) transform_pass_with_warning ;;
esac

161
mk/wrapper/transform-gcc Normal file
View File

@@ -0,0 +1,161 @@
# $NetBSD: transform-gcc,v 1.28 2012/07/23 11:58:41 jperkin Exp $
#
# This file handles the transformations needed for gcc that can be done
# looking at only one argument at a time.
#
transform_setname "transform-gcc"
case $arg in
# Standard options.
-[EcgOos] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# Needed for the GNU configure scripts:
-V |\
-v |\
--version ) transform_pass ;;
# We occasionally override specs to force particular options.
-specs=* |\
-specs ) transform_pass ;;
# GCC extensions.
- |\
-dynamic |\
-export-dynamic |\
-falign-functions=* |\
-falign-loops=* |\
-falign-jumps=* |\
-fexpensive-optimizations |\
-ffast-math |\
-ffloat-store |\
-fhonour-copts |\
-finline-functions |\
-fno-align-* |\
-fno-builtin* |\
-fno-common |\
-fno-implicit-templates |\
-fno-inline-functions |\
-fno-strict-aliasing |\
-fomit-frame-pointer |\
-fPIC |\
-fpic |\
-fpcc-struct-return |\
-freg-struct-return |\
-frename-registers |\
-fsigned-char |\
-funroll-loops |\
-funsigned-char |\
-fweb |\
-fwrapv |\
-ggdb |\
-M |\
-M[DFMPT] |\
-MMD |\
-m32 |\
-m64 |\
-mabi=* |\
-march=* |\
-mcpu=* |\
-momit-leaf-frame-pointer |\
-mpreferred-stack-boundary=* |\
-mpush-args |\
-mschedule=* |\
-mieee-fp |\
-O[23s] |\
-pedantic |\
-pedantic-errors |\
-pipe |\
-pthread |\
-print-prog-name=* |\
-print-search-dirs |\
-S |\
-shared |\
-static |\
-std=c99 |\
-std=gnu89 |\
-std=gnu99 |\
-W |\
-W[cLlS],* |\
-Wall |\
-Wbounded |\
-Wcast-align |\
-Wcast-qual |\
-Wchar-subscripts |\
-Wconversion |\
-Wextra |\
-Werror |\
-Werror-implicit-function-declaration |\
-Wformat* |\
-Wmissing-declarations |\
-Wmissing-format-attribute |\
-Wmissing-prototypes |\
-Wnested-externs |\
-Wno-error |\
-Wno-format-y2k |\
-Wno-format-zero-length |\
-Wno-implicit-int |\
-Wno-import |\
-Wno-inline |\
-Wno-long-long |\
-Wno-sign-compare |\
-Wno-traditional |\
-Wno-undef |\
-Wno-uninitialized |\
-Wno-unused |\
-Wno-unused-parameter |\
-Wno-write-strings |\
-Wparentheses |\
-Wpointer-arith |\
-Wreturn-type |\
-Wshadow |\
-Wsign-compare |\
-Wstrict-aliasing |\
-Wstrict-prototypes |\
-Wswitch |\
-Wunused |\
-Wundef |\
-Wwrite-strings ) transform_pass ;;
# There are some packages suppressing all warnings. We don't want that.
-w ) transform_discard ;;
# Options specific to g++.
-fexceptions |\
-fmessage-length=* |\
-fno-check-new |\
-fno-exceptions |\
-fno-rtti |\
-Wno-non-virtual-dtor |\
-ftemplate-depth=* ) transform_pass ;;
# Options specific to Objective C
-fgnu-runtime |\
-fconstant-string-class=* ) transform_pass ;;
# Old-style rpath specifier, may come from autoconf's AC_PATH_XTRA.
# Our gcc re-orders -R args relative to -Wl,-R specifiers (puts -R
# args at the front of the "ld" invocation), which messes up the relative
# search order. Fix this by rewriting -R to -Wl,-R.
-R* ) transform_to "-Wl,$arg" ;;
# Other compiler's options that have corresponding GCC options.
-Kpic |\
-kpic |\
-KPIC |\
-kPIC ) transform_to "-fPIC" ;;
-mt ) transform_to "-threads" ;;
-64 ) transform_to "-m64" ;;
# Ignore SunPRO flags to prevent it from being recognized as a entry point
# option for `ld'.
-errwarn=* |\
-errwarn ) transform_discard_with_warning ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,72 @@
# $NetBSD: transform-icc-cc,v 1.7 2006/11/30 12:18:32 rillig Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Grant Beattie.
#
# 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.
transform_setname "transform-icc-cc"
case $arg in
# Standard options (except -s, which is handled below).
-[cEgOo] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# ignore flags that icc doesn't understand.
-fexceptions |\
-ffast-math |\
-fomit-frame-pointer |\
-MP |\
-OPT:* |\
-pedantic |\
-pipe |\
-s ) transform_discard ;;
-finline-functions ) transform_to "-Ob2" ;;
-funroll-all-loops |\
-funroll-loops ) transform_to "-unroll" ;;
-O[4-9] |\
-O[12][0-9] ) transform_to "-O3" ;;
-Wall |\
-Wl,* ) transform_pass ;;
-W* ) transform_discard_with_warning ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

113
mk/wrapper/transform-ido-cc Normal file
View File

@@ -0,0 +1,113 @@
# $NetBSD: transform-ido-cc,v 1.5 2006/11/30 12:34:30 rillig Exp $
#
# Copyright (c) 2005 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.
#
transform_setname "transform-ido-cc"
case $arg in
# Standard options.
-[cEgOos] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# IDO 5.3 knows some more optimization options.
-O2 |\
-Olimit ) transform_pass ;;
# IDO 5.3 seems to have problems with -O3, so downgrade it.
-O3 ) transform_to "-O2" ;;
######################################################################
# Directories for the runtime library search path are passed via
# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
# Path elements are separated by ":".
######################################################################
-Wl,-R*)
arg=`$echo "X$arg" | $Xsed -e "s|,|:|g" -e "s|^-Wl:-R|-Wl,-rpath,|"`
transform_to "$arg" ;;
-Wl,-rpath,*)
arg=`$echo "X$arg" | $Xsed -e "s|,|:|g" -e "s|^-Wl:-rpath:|-Wl,-rpath,|"`
transform_to "$arg" ;;
-rpath*)
arg=`$echo "X$arg" | $Xsed -e "s|,|:|g" -e "s|^-rpath.|-Wl,-rpath,|"`
transform_to "$arg" ;;
-R*)
arg=`$echo "X$arg" | $Xsed -e "s|,|:|g" -e "s|^-R|-Wl,-rpath,|"`
transform_to "$arg" ;;
# different syntax
-fsigned-char |\
-fno-unsigned-char) transform_to "-signed" ;;
# use -g3 in order to prevent disabling optimization
-g ) transform_to "-g3" ;;
# The IDO 5.3 compiler accepts these -W* directives, so just pass them
# on through.
-W[pKMfjusmocabyz]*,*) transform_pass ;;
######################################################################
# Ignore all of the other -W*, -O*, -f*, -m* directives, which are
# likely to be GCCisms.
# Ignore -pipe
# Kill all -nostd* directives, since the standard libs and headers
# will not be considered by buildlink3 even if a respective
# -L or -I option is issued.
# ignore options that should prevent the use of shared libraries.
# ignore -n32, which is a MIPSpro-specific option.
######################################################################
-[WOfm]* |\
-pipe |\
-MM |\
-nostd* |\
--disable-shared|\
-non_shared |\
-n32 ) transform_discard_with_warning ;;
# different syntax for profiling
-pg ) transform_to "-p" ;;
# different syntax
-static ) transform_to_and_split "-B static" ;;
# different syntax
-notall ) transform_to "-none" ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,103 @@
# $NetBSD: transform-mipspro-cc,v 1.11 2007/06/15 15:34:31 rillig 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.
transform_setname "transform-mipspro-cc"
# usage: mipspro_check_abi "abi"
mipspro_check_abi() {
if [ "$wrapper_abi" = "$1" ]; then
transform_pass
else
transform_fail "Wrong ABI argument $arg for ABI $wrapper_abi."
fi
}
case $arg in
# Standard options.
-[cEgOos] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# MIPSpro can handle -O[23] and -Ofast[=platform], so just pass them
# on through.
-O[23] |\
-Ofast |\
-Ofast=* |\
-OPT:* ) transform_pass ;;
# Ignore all other -O* options.
-O* ) transform_discard_with_warning ;;
# Directories for the runtime library search path are passed via
# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
-R* ) transform_to "-Wl,-rpath,${arg#-R}" ;;
-Wl,-R* ) transform_to "-Wl,-rpath,${arg#-Wl,-R}" ;;
# The MIPSpro compiler accepts these -W* directives, so just pass them
# on through.
-W[ablfpR]*,* ) transform_pass ;;
-diag_error |\
-diag_remark |\
-diag_suppress |\
-diag_warning |\
-woff ) transform_pass ;;
-32 |\
-o32 ) mipspro_check_abi "" ;;
-n32 ) mipspro_check_abi "32" ;;
-64 ) mipspro_check_abi "64" ;;
-c99 |\
-M |\
-MDupdate ) transform_pass ;;
-W |\
-Wall ) transform_to "-fullwarn" ;;
# Ignore all of the other -W* directives, which are likely to be
# GCCisms.
-W* ) transform_discard_with_warning ;;
-[fKk]PIC ) transform_to "-KPIC" ;;
-g3 ) transform_to "-g" ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,70 @@
# $NetBSD: transform-mipspro-ucode-cc,v 1.4 2006/11/30 13:00:16 rillig 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.
transform_setname "transform-mipspro-ucode-cc"
case $arg in
# Standard options.
-[cEgOos] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
# MIPSpro can handle -O[23] so just pass them on through.
-O[23] ) transform_pass ;;
# Ignore all other -O* options.
-O* ) transform_discard_with_warning ;;
# Directories for the runtime library search path are passed via
# "-Wl,-rpath,<dir>", not "-Wl,-R<dir>".
-Wl,-R* ) transform_to "-Wl,-rpath,${arg#-Wl,-R}" ;;
# The MIPSpro compiler accepts -Wl,* so just pass it on through.
-Wl,* ) transform_pass ;;
# Ignore all of the other -W* directives, which are likely to be
# GCCisms.
-W* ) transform_discard_with_warning ;;
# The MIPSpro compiler uses -KPIC to create position independent code.
-fPIC |\
-fpic ) transform_to "-KPIC" ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,165 @@
# $NetBSD: transform-sunpro-cc,v 1.31 2012/02/07 09:42:05 shattered 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.
transform_setname "transform-sunpro-cc"
case $arg in
# libstdc++ is specific to the GNU C++ compiler.
-lstdc++ ) transform_discard_with_warning ;;
# Standard options, except -O0 and -O1.
-[cEgOos] |\
-[DILlU]?* ) transform_pass ;;
# Create dependency lines for Makefiles
-MM ) transform_to "-xM1" ;;
# SunPro can handle -xO<n> (n={0|1|2|3|4|5}), so optimistically
# convert those GCC -O<n> values to -xO<n>.
-O[012345] ) transform_to "-xO${arg#-O}" ;;
# Ignore all other -O* options.
-O* ) transform_discard_with_warning ;;
# Directories for the runtime library search path are passed via
# simply "-R<dir>", not "-Wl,-R<dir>". This is because the C++ compiler
# does not know about the -W?,* options.
-Wl,-R* ) transform_to "${arg#-Wl,}" ;;
-R* ) transform_pass ;;
# SunPro uses -h to set the shared object name.
-Wl,-soname=* ) transform_to "-h${arg#-Wl,-soname=}" ;;
# Solaris' linker exports all dynamic symbols by default when
# building a shared object.
-export-dynamic |\
-Wl,--export-dynamic |\
-Wl,-E ) transform_discard ;;
-W[02aclmop],* ) case $wrapper_type in
CC) transform_pass ;;
CXX) transform_discard_with_warning ;;
*) echo "ERROR: [transform-sunpro-cc] unknown wrapper type: $wrapper_type"; exit 1 ;;
esac ;;
-Wall |\
-W ) case $wrapper_type in
CC) transform_to "-v" ;;
CXX) transform_to_and_split "+w +w2" ;;
*) echo "ERROR: [transform-sunpro-cc] unknown wrapper type: $wrapper_type"; exit 1 ;;
esac ;;
# Ignore options that are probably meant for GCC.
-W* |\
-Xc ) transform_discard_with_warning ;;
-static ) transform_to "-Bstatic" ;;
--export-dynamic |\
-shared ) transform_to "-G" ;;
# SunPro on amd64 does not know the -xcode= option (see PR 35555).
-fpic |\
-Kpic |\
-xcode=pic13 ) transform_to "-Kpic" ;;
-fPIC |\
-KPIC |\
-xcode=pic32 ) transform_to "-KPIC" ;;
# SunPro needs -mt -lpthread for POSIX threads.
-pthread ) transform_to_and_split "-mt -lpthread" ;;
# -fast implies -xlibmopt, which uses the optimized math
# routines in libsunmath. libsunmath is only available as part of
# SunPro, so disable the use of the optimized math library
# (at least until it can be statically linked).
-fast ) transform_to_and_split "-fast -xnolibmopt" ;;
# Pass through those options that SunPro understands.
-#* |\
-Bdynamic |\
-Bstatic |\
-fd |\
-features* |\
-flags |\
-flteval* |\
-fnonstd* |\
-fns* |\
-fprecision* |\
-fround* |\
-fsimple* |\
-fsingle |\
-fstore |\
-ftrap* |\
-G |\
-h*.so.* |\
-m32 |\
-m64 |\
-mcpu=* |\
-mt |\
-S |\
-template=* |\
-V |\
-v |\
-xarch=* |\
-xcode=* |\
-xdepend |\
-xstrconst |\
-xtarget=* ) transform_pass ;;
#-std=gnu99 ) transform_to "-xc99" ;;
#-xc99 ) transform_to_and_split "-xc99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" ;;
-ggdb* ) transform_to "-g" ;;
# Ignore some flags that are unnecessary for SunPro.
-ansi |\
-fPIE |\
-fpie |\
-pedantic |\
-pie |\
-pipe |\
-rdynamic |\
-traditional ) transform_discard ;;
# Ignore all other -f flags.
-f* ) transform_discard_with_warning ;;
# Unknown options.
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,72 @@
# $NetBSD: transform-xlc-cc,v 1.9 2006/12/10 03:14:59 rillig 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.
transform_setname "transform-xlc-cc"
case $arg in
# Standard options.
-[cEgOos] |\
-[DILlU]?* |\
-O[01] ) transform_pass ;;
-Wl,* ) transform_pass ;;
-W* ) transform_discard_with_warning ;;
# xlc uses -qmkshrobj to create shared objects, and we also need to
# tell the linker to use a flat namespace and allow undefined symbols.
-dynamiclib ) transform_to_and_split "-qmkshrobj -Wl,-flat_namespace -Wl,-undefined -Wl,suppress" ;;
# -qnocommon is the xlc argument to allocate uninitialized globals in
# the data section for PIC.
-fPIC |\
-fno-common ) transform_to "-qnocommon" ;;
######################################################################
# Ignore some flags that are unnecessary for XL C.
######################################################################
-ansi |\
-fno-gnu-keywords |\
-fstrict-prototypes |\
-no-cpp-precomp |\
-pedantic |\
-pipe ) transform_discard_with_warning ;;
-* ) transform_pass_with_warning ;;
esac

View File

@@ -0,0 +1,47 @@
# $NetBSD: wrapper-defs.mk,v 1.3 2009/05/06 10:28:01 tron 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 !defined(WRAPPER_DEFS_MK)
WRAPPER_DEFS_MK= defined
WRAPPER_DIR= ${WRKDIR}/.wrapper
WRAPPER_BINDIR= ${WRAPPER_DIR}/bin
WRAPPER_TMPDIR= ${WRAPPER_DIR}/tmp
WRAPPER_SRCDIR= ${.CURDIR}/../../mk/wrapper
WRAPPER_BIN_SH?= ${SH}
WRAPPER_SHELL?= ${WRAPPER_BIN_SH}
.endif # WRAPPER_DEFS_MK

View File

@@ -0,0 +1,69 @@
# $NetBSD: wrapper-subr.sh,v 1.10 2007/02/22 14:54:32 rillig Exp $
#
# This file contains shell functions that are useful to the wrapper
# scripts.
#
# usage: transform_setname "current-file"
transform_setname() {
wrapsubr_name="$1"
}
# usage: transform_to "newarg"
transform_to() {
arg="$1"
$debug_log $wrapperlog " ($wrapsubr_name) to: $1"
addtocache=yes
}
# usage: transform_to_and_split "newarg"
transform_to_and_split() {
arg="$1"
$debug_log $wrapperlog " ($wrapsubr_name) to: $1 [split]"
addtocache=yes
split_arg=yes
}
# usage: transform_discard
transform_discard() {
$debug_log $wrapperlog " ($wrapsubr_name) discarded: $arg"
arg=""
addtocache=yes
split_arg=yes
}
# usage: transform_discard_with_warning [warning]
transform_discard_with_warning() {
_warning=${1-"discarding option $arg"}
msg_log "$wrapperlog" "WARNING: [$wrapsubr_name] $_warning"
transform_discard
addtocache=no
}
# usage: transform_pass
transform_pass() {
$debug_log $wrapperlog " ($wrapsubr_name) to: $arg [unchanged]"
addtocache=yes
}
# usage: transform_pass_with_warning [warning]
transform_pass_with_warning() {
_warning=${1-"passing unknown option $arg"}
msg_log "$wrapperlog" "WARNING: [$wrapsubr_name] $_warning"
$debug_log $wrapperlog " ($wrapsubr_name) to: $arg [unchanged]"
addtocache=no
}
# usage: transform_fail "error message"
transform_fail() {
msg_log "$wrapperlog" "ERROR: [$wrapsubr_name] $1"
msg_log stderr "ERROR: [$wrapsubr_name] $1"
exit 1
}
# usage: fail "source-file" "error message"
fail() {
msg_log "$wrapperlog" "ERROR: [$1] $2"
msg_log stderr "ERROR: [$1] $2"
exit 1
}

150
mk/wrapper/wrapper.sh Normal file
View File

@@ -0,0 +1,150 @@
#! @WRAPPER_SHELL@
#
# $NetBSD: wrapper.sh,v 1.22 2013/04/21 03:51:27 uebayasi 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.
#set -eu
# The list of include files for the wrapper.
empty_file="@_WRAP_EMPTY_FILE@"
arg_pp="@_WRAP_ARG_PP@"
arg_pp_main="@_WRAP_ARG_PP_MAIN@"
arg_source="@_WRAP_ARG_SOURCE@"
buildcmd="@_WRAP_BUILDCMD@"
cache="@_WRAP_CACHE@"
cache_body="@_WRAP_CACHE_BODY@"
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@"
transform_sed="@_WRAP_TRANSFORM_SED@"
wrapper_subr_sh="@_WRAP_SUBR_SH@"
# Information about the wrapper and its environment.
wrapper_abi="@ABI@" # see ABI in mk/defaults/mk.conf
wrapper_type="@_WRAP_TYPE@" # one of AS, CC, CXX, FC, IMAKE, LD, LIBTOOL.
wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}"
skip_transform="${WRAPPER_SKIP_TRANSFORM-@_WRAP_SKIP_TRANSFORM@}"
debug="${WRAPPER_DEBUG-@WRAPPER_DEBUG@}"
# Tools that can be used by the wrapper.
# XXX: Why is this necessary? Isn't the wrapper only called with
# TOOLS_DIR/bin in the PATH?
#
cat="@CAT@"
echo="@ECHO@"
expr="@EXPR@"
mv="@MV@"
sed="@SED@"
test="@TEST@"
Xsed="$sed -e 1s/^X//"
. $shell_lib
. "$wrapper_subr_sh"
updatecache=${WRAPPER_UPDATE_CACHE-@WRAPPER_UPDATE_CACHE@}
reorder=${WRAPPER_REORDER-no}
case $debug in
yes) debug_log="msg_log" ;;
*) debug_log=":" ;;
esac
qcmd="$0"; for arg in ${1+"$@"}; do shquote "$arg"; qcmd="$qcmd $shquoted"; done
msg_log "$wrapperlog" "[*] $0 $qcmd"
cmd="@WRAPPEE@"
case "$*" in
--wrappee-name) $echo $cmd ; exit ;;
esac
libs=""
rellpath=""
do_transform=yes
init_queue argbuf
init_queue cmdbuf
append_extra_args=yes
. $scan
case $append_extra_args in
yes)
$debug_log $wrapperlog " (wrapper.sh) append args: @_WRAP_EXTRA_ARGS@"
set -- "$@" @_WRAP_EXTRA_ARGS@
;;
*)
;;
esac
. $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"
if [ "${empty_file}" = "${cleanup}" ] && [ "$debug" != "yes" ]; then
eval "exec $cmd"
wrapper_result=$?
else
wrapper_result=0
eval "$cmd" || wrapper_result="$?"
fi
. $cleanup
[ $wrapper_result -eq 0 ] || [ "$debug" != "yes" ] || {
echo ""
echo "[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:"
echo "$cmd"
} 1>&2
exit ${wrapper_result}