diff options
author | joerg <joerg@pkgsrc.org> | 2007-08-02 18:19:31 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-08-02 18:19:31 +0000 |
commit | 005620851f14ccfbf69fb7ccaffc6f6e6d0f968a (patch) | |
tree | 7eeb466964543e6a95e208d441bf203db2c07e58 /mk/wrapper/bsd.wrapper.mk | |
parent | 6989e7a043e210e423d5d0252d903c71166a1096 (diff) | |
download | pkgsrc-005620851f14ccfbf69fb7ccaffc6f6e6d0f968a.tar.gz |
Add core of the infrastructure support for cross-compilation.
- USE_CROSS_COMPILATION activates it, CROSS_DESTDIR specifies root of
the target filesystem
- derive _CROSS_DESTDIR from CROSS_DESTDIR or MAKEOBJDIR
- buildlink3.mk prefixes the files to symlink with _CROSS_DESTDIR
- compiler/gcc.mk knows about the target prefix (e.g. i386--netbsdelf)
- PKG_DBDIR is prefixed with _CROSS_DESTDIR
- package-install and bin-install are not called with su
- install and strip are redirected to the tool version
- links for the target specific ar, as, ld, nm, objdump, ranlib and
strip are added
- compiler wrapper detect if linking is requested or not
- special command sinks for CPP and CC/CXX add the cross-compile magic:
- modify include dirs to get the target /usr/include
- modify linker dirs and runpath to use target /usr/lib at link time,
but keep correct rpath entries
Supported-by: Google SoC 2007
Basic tests by he@ on Sparc. Review from jlam@.
Diffstat (limited to 'mk/wrapper/bsd.wrapper.mk')
-rw-r--r-- | mk/wrapper/bsd.wrapper.mk | 23 |
1 files changed, 22 insertions, 1 deletions
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} \ |