Added wrapper-subr.sh, which provides shell functions that are useful to
make the wrapper code less frightening. For example, instead of arg="${arg#-Wl,}" $debug_log $wrapperlog " (transform-sunpro-cc) to: $arg" addtocache=yes one can simply write transform_to "${arg-Wl,}" The functions that are currently implemented are: transform_to, transform_discard, transform_to_nocache, transform_discard, transform_pass and transform_pass_unknown.
This commit is contained in:
parent
46aab65a30
commit
b11cdc1a44
3 changed files with 51 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: bsd.wrapper.mk,v 1.56 2006/11/02 23:25:00 rillig Exp $
|
||||
# $NetBSD: bsd.wrapper.mk,v 1.57 2006/11/11 07:44:46 rillig Exp $
|
||||
#
|
||||
# Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -184,6 +184,7 @@ _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
|
||||
|
@ -349,7 +350,8 @@ _WRAP_SUBST_SED= \
|
|||
-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_SHELL_LIB@|${_WRAP_SHELL_LIB:Q}|g" \
|
||||
-e "s|@_WRAP_SUBR_SH@|${_WRAP_SUBR_SH}|g"
|
||||
|
||||
.for _wrappee_ in ${_WRAPPEES}
|
||||
_WRAP_SUBST_SED.${_wrappee_}= \
|
||||
|
@ -394,6 +396,7 @@ ${_WRAP_COOKIE.${_wrappee_}}: \
|
|||
${_WRAP_REORDERLIBS} \
|
||||
${_WRAP_SCAN.${_wrappee_}} \
|
||||
${_WRAP_SHELL_LIB} \
|
||||
${_WRAP_SUBR_SH} \
|
||||
${_WRAP_TRANSFORM.${_wrappee_}}
|
||||
${_PKG_SILENT}${_PKG_DEBUG} \
|
||||
wrapper="${WRAPPER_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
|
||||
|
@ -481,7 +484,8 @@ generate-wrappers: ${_target_}
|
|||
transform-mipspro-ucode-cc \
|
||||
transform-solaris-gcc \
|
||||
transform-sunpro-cc \
|
||||
transform-xlc-cc
|
||||
transform-xlc-cc \
|
||||
wrapper-subr.sh
|
||||
${WRAPPER_TMPDIR}/${w}: ${WRAPPER_SRCDIR}/${w}
|
||||
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
|
||||
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \
|
||||
|
|
41
mk/wrapper/wrapper-subr.sh
Normal file
41
mk/wrapper/wrapper-subr.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
# $NetBSD: wrapper-subr.sh,v 1.1 2006/11/11 07:44:46 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_nocache "newarg"
|
||||
transform_to_nocache() {
|
||||
arg="$1"
|
||||
$debug_log $wrapperlog " ($wrapsubr_name) to: $1"
|
||||
addtocache=no
|
||||
}
|
||||
|
||||
# usage: transform_discard
|
||||
transform_discard() {
|
||||
transform_to ""
|
||||
}
|
||||
|
||||
# usage: transform_pass
|
||||
transform_pass() {
|
||||
addtocache=yes
|
||||
}
|
||||
|
||||
# usage: transform_pass_unknown
|
||||
transform_pass_unknown() {
|
||||
#echo "warning: $wrapsubr_name: unknown option $arg" 1>/dev/tty
|
||||
addtocache=no
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#! @WRAPPER_SHELL@
|
||||
#
|
||||
# $NetBSD: wrapper.sh,v 1.6 2006/10/21 11:42:25 rillig Exp $
|
||||
# $NetBSD: wrapper.sh,v 1.7 2006/11/11 07:44:46 rillig Exp $
|
||||
#
|
||||
# Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -54,6 +54,7 @@ shell_lib="@_WRAP_SHELL_LIB@"
|
|||
scan="@_WRAP_SCAN@"
|
||||
transform="@_WRAP_TRANSFORM@"
|
||||
transform_sed="@_WRAP_TRANSFORM_SED@"
|
||||
wrapper_subr_sh="@_WRAP_SUBR_SH@"
|
||||
wrapperlog="${WRAPPER_LOG-@_WRAP_LOG@}"
|
||||
skip_transform="${WRAPPER_SKIP_TRANSFORM-@_WRAP_SKIP_TRANSFORM@}"
|
||||
debug="${WRAPPER_DEBUG-@WRAPPER_DEBUG@}"
|
||||
|
@ -68,6 +69,7 @@ test="@TEST@"
|
|||
Xsed="$sed -e 1s/^X//"
|
||||
|
||||
. $shell_lib
|
||||
. "$wrapper_subr_sh"
|
||||
|
||||
updatecache=${WRAPPER_UPDATE_CACHE-@WRAPPER_UPDATE_CACHE@}
|
||||
reorder=${WRAPPER_REORDER-no}
|
||||
|
|
Loading…
Reference in a new issue