diff options
-rw-r--r-- | mk/bsd.prefs.mk | 24 | ||||
-rw-r--r-- | mk/buildlink3/bsd.buildlink3.mk | 4 | ||||
-rw-r--r-- | mk/compiler/gcc.mk | 31 | ||||
-rw-r--r-- | mk/flavor/pkg/flavor-vars.mk | 6 | ||||
-rw-r--r-- | mk/flavor/pkg/package.mk | 14 | ||||
-rw-r--r-- | mk/install/bin-install.mk | 6 | ||||
-rw-r--r-- | mk/tools/tools.NetBSD.mk | 23 | ||||
-rw-r--r-- | mk/wrapper/arg-source | 10 | ||||
-rw-r--r-- | mk/wrapper/bsd.wrapper.mk | 23 | ||||
-rw-r--r-- | mk/wrapper/cmd-sink-cross-cpp | 50 | ||||
-rw-r--r-- | mk/wrapper/cmd-sink-cross-gcc | 96 |
11 files changed, 262 insertions, 25 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index 0b7eb62f03c..5bf5c2ca15c 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.260 2007/08/01 16:14:17 joerg Exp $ +# $NetBSD: bsd.prefs.mk,v 1.261 2007/08/02 18:19:31 joerg Exp $ # # Make file, included to get the site preferences, if any. Should # only be included by package Makefiles before any .if defined() @@ -399,6 +399,28 @@ _MAKE_INSTALL_AS_ROOT?= yes _MAKE_PACKAGE_AS_ROOT?= yes # Whether to run the package target as root. +# When cross-compilation support is requested, the following options +# must be specified as well or guessable: +# - MACHINE_ARCH is set to TARGET_ARCH if set. +# - CROSS_DESTDIR is guessed from MAKEOBJDIR and MACHINE_ARCH. +# - PKG_DBDIR is expanded and prefixed with CROSS_DESTDIR +# - DESTDIR support is required +# +# _CROSS_DESTDIR is set for internal use to avoid conditionalising +# the use. + +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +. if defined(TARGET_ARCH) +MACHINE_ARCH= ${TARGET_ARCH} +. endif +CROSS_DESTDIR?= ${MAKEOBJDIR}/destdir.${MACHINE_ARCH} +. if !exists(${CROSS_DESTDIR}/usr/include/stddef.h) +PKG_FAIL_REASON+= "The cross-compiling root ${CROSS_DESTDIR:Q} is incomplete" +. else +_CROSS_DESTDIR= ${CROSS_DESTDIR} +. endif +.endif + PKG_INSTALLATION_TYPES?= overwrite # This is a whitespace-separated list of installation types supported # by the package. diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk index baa1e7ac354..0c66ba8350d 100644 --- a/mk/buildlink3/bsd.buildlink3.mk +++ b/mk/buildlink3/bsd.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.buildlink3.mk,v 1.196 2007/07/27 13:15:41 joerg Exp $ +# $NetBSD: bsd.buildlink3.mk,v 1.197 2007/08/02 18:19:31 joerg Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -600,7 +600,7 @@ ${_BLNK_COOKIE.${_pkg_}}: cd ${BUILDLINK_PREFIX.${_pkg_}}; \ ${_BLNK_FILES_CMD.${_pkg_}} | \ while read file; do \ - src="${BUILDLINK_PREFIX.${_pkg_}}/$$file"; \ + src="${_CROSS_DESTDIR}${BUILDLINK_PREFIX.${_pkg_}}/$$file"; \ if [ ! -f "$$src" ]; then \ msg="$$src: not found"; \ else \ diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk index 6f3ef9e3b24..9af346dcfd4 100644 --- a/mk/compiler/gcc.mk +++ b/mk/compiler/gcc.mk @@ -1,4 +1,4 @@ -# $NetBSD: gcc.mk,v 1.90 2007/02/10 08:59:07 rillig Exp $ +# $NetBSD: gcc.mk,v 1.91 2007/08/02 18:19:32 joerg Exp $ # # This is the compiler definition for the GNU Compiler Collection. # @@ -353,33 +353,36 @@ _GCCBINDIR= ${_GCC_PREFIX}bin .elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS]) _GCCBINDIR= ${_CC:H} .endif -.if exists(${_GCCBINDIR}/gcc) +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +_GCC_BIN_PREFIX= ${MACHINE_GNU_PLATFORM}- +.endif +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc) _GCC_VARS+= CC -_GCC_CC= ${_GCC_DIR}/bin/gcc +_GCC_CC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}gcc _ALIASES.CC= cc gcc -CCPATH= ${_GCCBINDIR}/gcc +CCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}gcc PKG_CC:= ${_GCC_CC} .endif -.if exists(${_GCCBINDIR}/cpp) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp) _GCC_VARS+= CPP -_GCC_CPP= ${_GCC_DIR}/bin/cpp +_GCC_CPP= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}cpp _ALIASES.CPP= cpp -CPPPATH= ${_GCCBINDIR}/cpp +CPPPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}cpp PKG_CPP:= ${_GCC_CPP} .endif -.if exists(${_GCCBINDIR}/g++) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++) _GCC_VARS+= CXX -_GCC_CXX= ${_GCC_DIR}/bin/g++ +_GCC_CXX= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g++ _ALIASES.CXX= c++ g++ -CXXPATH= ${_GCCBINDIR}/g++ +CXXPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g++ PKG_CXX:= ${_GCC_CXX} .endif -.if exists(${_GCCBINDIR}/g77) +.if exists(${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77) _GCC_VARS+= FC -_GCC_FC= ${_GCC_DIR}/bin/g77 +_GCC_FC= ${_GCC_DIR}/bin/${_GCC_BIN_PREFIX}g77 _ALIASES.FC= f77 g77 -FCPATH= ${_GCCBINDIR}/g77 -F77PATH= ${_GCCBINDIR}/g77 +FCPATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 +F77PATH= ${_GCCBINDIR}/${_GCC_BIN_PREFIX}g77 PKG_FC:= ${_GCC_FC} .endif _COMPILER_STRIP_VARS+= ${_GCC_VARS} diff --git a/mk/flavor/pkg/flavor-vars.mk b/mk/flavor/pkg/flavor-vars.mk index a293620b9d4..cc18e6a373f 100644 --- a/mk/flavor/pkg/flavor-vars.mk +++ b/mk/flavor/pkg/flavor-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: flavor-vars.mk,v 1.3 2007/01/05 17:54:02 rillig Exp $ +# $NetBSD: flavor-vars.mk,v 1.4 2007/08/02 18:19:32 joerg Exp $ # # This Makefile fragment is included indirectly by bsd.prefs.mk and # defines some variables which must be defined earlier than where @@ -22,9 +22,9 @@ PKG_DBDIR?= /var/db/pkg # packages. # .if ${PKG_INSTALLATION_TYPE} == "overwrite" -_PKG_DBDIR= ${PKG_DBDIR} +_PKG_DBDIR= ${_CROSS_DESTDIR}${PKG_DBDIR} .elif ${PKG_INSTALLATION_TYPE} == "pkgviews" -_PKG_DBDIR= ${DEPOTBASE} +_PKG_DBDIR= ${_CROSS_DESTDIR}${DEPOTBASE} .endif PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add diff --git a/mk/flavor/pkg/package.mk b/mk/flavor/pkg/package.mk index fe79404a1dd..0fc86cd9ab0 100644 --- a/mk/flavor/pkg/package.mk +++ b/mk/flavor/pkg/package.mk @@ -1,4 +1,4 @@ -# $NetBSD: package.mk,v 1.7 2007/07/13 14:42:53 joerg Exp $ +# $NetBSD: package.mk,v 1.8 2007/08/02 18:19:32 joerg Exp $ PKG_SUFX?= .tgz PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} @@ -128,7 +128,11 @@ package-install: barrier .endif .if ${_USE_DESTDIR} != "no" +. if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +real-package-install: su-real-package-install +. else real-package-install: su-target +. endif .else real-package-install: @${DO_NADA} @@ -136,4 +140,12 @@ real-package-install: su-real-package-install: @${PHASE_MSG} "Install binary package of "${PKGNAME:Q} +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) + @${MKDIR} ${_CROSS_DESTDIR}${PREFIX} + ${PKG_ADD} -f -I -p ${_CROSS_DESTDIR}${PREFIX} ${PKGFILE} + @${ECHO} "Fixing recorded cwd..." + @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp + @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS +.else ${PKG_ADD} ${PKGFILE} +.endif diff --git a/mk/install/bin-install.mk b/mk/install/bin-install.mk index f617359efbd..83eb54a58a5 100644 --- a/mk/install/bin-install.mk +++ b/mk/install/bin-install.mk @@ -1,4 +1,4 @@ -# $NetBSD: bin-install.mk,v 1.9 2007/03/09 03:28:58 rillig Exp $ +# $NetBSD: bin-install.mk,v 1.10 2007/08/02 18:19:32 joerg Exp $ # # This file provides the following targets: @@ -36,7 +36,11 @@ bin-install: \ do-bin-install \ do-bin-install-from-source +. if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +do-bin-install: su-do-bin-install +. else do-bin-install: su-target +. endif @${PHASE_MSG} "Binary install for "${PKGNAME_REQD:U${PKGNAME}:Q} su-do-bin-install: \ diff --git a/mk/tools/tools.NetBSD.mk b/mk/tools/tools.NetBSD.mk index 1a7b05f1e8a..f3061bf0e00 100644 --- a/mk/tools/tools.NetBSD.mk +++ b/mk/tools/tools.NetBSD.mk @@ -1,4 +1,4 @@ -# $NetBSD: tools.NetBSD.mk,v 1.35 2007/06/19 17:01:13 joerg Exp $ +# $NetBSD: tools.NetBSD.mk,v 1.36 2007/08/02 18:19:32 joerg Exp $ # # System-supplied tools for the NetBSD operating system. @@ -45,7 +45,11 @@ TOOLS_PLATFORM.head?= /usr/bin/head TOOLS_PLATFORM.hostname?= /bin/hostname TOOLS_PLATFORM.id?= /usr/bin/id TOOLS_PLATFORM.ident?= /usr/bin/ident +.if empty(USE_CROSS_COMPILE:M[yY][eE][sS]) TOOLS_PLATFORM.install?= /usr/bin/install +.else +TOOLS_PLATFORM.install?= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install +.endif .if exists(/usr/bin/install-info) TOOLS_PLATFORM.install-info?= /usr/bin/install-info .endif @@ -84,7 +88,12 @@ TOOLS_PLATFORM.shlock?= /usr/bin/shlock TOOLS_PLATFORM.sleep?= /bin/sleep TOOLS_PLATFORM.soelim?= /usr/bin/soelim TOOLS_PLATFORM.sort?= /usr/bin/sort +.if empty(USE_CROSS_COMPILE:M[yY][eE][sS]) TOOLS_PLATFORM.strip?= /usr/bin/strip +.else +TOOLS_PLATFORM.strip?= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip +.endif + TOOLS_PLATFORM.tail?= /usr/bin/tail .if exists(/bin/tar) TOOLS_PLATFORM.tar?= /bin/tar @@ -104,3 +113,15 @@ TOOLS_PLATFORM.xargs?= /usr/bin/xargs TOOLS_PLATFORM.xgettext?= /usr/bin/xgettext .endif TOOLS_PLATFORM.yacc?= /usr/bin/yacc + +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +.for _t_ in ar as ld nm objdump ranlib strip +TOOLS_PATH.${MACHINE_GNU_PLATFORM}-${_t_}?= \ + ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-${_t_} +TOOLS_CREATE+= ${MACHINE_GNU_PLATFORM}-${_t_} +.endfor + +NATIVE_CC:= /usr/bin/cc +CC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc + +.endif diff --git a/mk/wrapper/arg-source b/mk/wrapper/arg-source index bf4ce639fcb..00d840bb304 100644 --- a/mk/wrapper/arg-source +++ b/mk/wrapper/arg-source @@ -1,4 +1,4 @@ -# $NetBSD: arg-source,v 1.12 2007/02/23 00:31:29 rillig Exp $ +# $NetBSD: arg-source,v 1.13 2007/08/02 18:19:32 joerg Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -160,6 +160,14 @@ while $test $# -gt 0; do 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. ############################################################## *) diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index 9e08e9e777f..0bf1bcd5df1 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.70 2007/06/18 07:33:34 rillig Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.71 2007/08/02 18:19:32 joerg Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -349,6 +349,12 @@ _WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} _WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} .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= ${_WRAP_CMD_SINK.CC} +.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 @@ -512,6 +518,21 @@ ${WRAPPER_TMPDIR}/${w}: ${WRAPPER_SRCDIR}/${w} ${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} +.endif + .if !target(${_WRAP_GEN_REORDER}) ${_WRAP_GEN_REORDER}: \ ${_WRAP_SHELL_LIB} \ diff --git a/mk/wrapper/cmd-sink-cross-cpp b/mk/wrapper/cmd-sink-cross-cpp new file mode 100644 index 00000000000..62f69cef5e7 --- /dev/null +++ b/mk/wrapper/cmd-sink-cross-cpp @@ -0,0 +1,50 @@ +# $NetBSD: cmd-sink-cross-cpp,v 1.1 2007/08/02 18:19:32 joerg 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. + +# Don't use standard include path. +arg="-nostdinc" +$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" +. $buildcmd + +# Compiler searches for headers in /usr/include, emulate. +arg="-isystem" +$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" +. $buildcmd + +arg="@CROSS_DESTDIR@/usr/include" +$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 diff --git a/mk/wrapper/cmd-sink-cross-gcc b/mk/wrapper/cmd-sink-cross-gcc new file mode 100644 index 00000000000..d9e91aa539c --- /dev/null +++ b/mk/wrapper/cmd-sink-cross-gcc @@ -0,0 +1,96 @@ +# $NetBSD: cmd-sink-cross-gcc,v 1.1 2007/08/02 18:19:33 joerg 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. + +if [ "${dont_link}" != yes ]; then + # Don't use standard search paths + arg="-Wl,-nostdlib" + $debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" + . $buildcmd + + # All normal library locations should be checked for + for libdir in /usr/lib @PREFIX@/lib; do + arg="-Wl,-rpath-link,@CROSS_DESTDIR@${libdir}" + $debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" + . $buildcmd + done + + # Compiler searches for libraries in /usr/lib, emulate. + arg="-L@CROSS_DESTDIR@/usr/lib" + $debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" + . $buildcmd + + # crt1.o and friends needs to be found as well. + arg="-B@CROSS_DESTDIR@/usr/lib" + $debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" + . $buildcmd +fi + +# Don't use standard include path. +arg="-nostdinc" +$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" +. $buildcmd + +# Compiler searches for headers in /usr/include, emulate. +arg="-isystem" +$debug_log $wrapperlog " (cmd-sink-native-cc) pop: $arg" +. $buildcmd + +arg="@CROSS_DESTDIR@/usr/include" +$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 |