diff options
author | bapt <bapt@FreeBSD.org> | 2016-09-09 05:34:48 +0800 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2016-09-09 05:34:48 +0800 |
commit | 32f26f47ae8eef94732988c4f85906f1e70c55a4 (patch) | |
tree | 1c2b18f7271fcb9d282e7295d186027dfb956762 /Mk | |
parent | 50a7d8c8a9a8399e34ede00bcd34b6f51061abcb (diff) | |
download | freebsd-ports-gnome-32f26f47ae8eef94732988c4f85906f1e70c55a4.tar.gz freebsd-ports-gnome-32f26f47ae8eef94732988c4f85906f1e70c55a4.tar.zst freebsd-ports-gnome-32f26f47ae8eef94732988c4f85906f1e70c55a4.zip |
Rework the cross build framework so that it uses the external toolchain
It allows to cross build everything wich is not expecting target dependencies
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.port.mk | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index bd23061d5538..e9f3fbe8f255 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1052,24 +1052,28 @@ MINIMAL_PKG_VERSION= 1.6.0 .include "${PORTSDIR}/Mk/bsd.commands.mk" -.if defined(X_BUILD_FOR) +.if defined(CROSS_TOOLCHAIN) .if !defined(.PARSEDIR) IGNORE= Cross building can only be done when using bmake(1) as make(1) .endif +.if !defined(CROSS_SYSROOT) +IGNORE= CROSS_SYSROOT should be defined +.endif +.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" # Do not define CPP on purpose .if !defined(HOSTCC) HOSTCC:= ${CC} HOSTCXX:= ${CXX} .endif -.if !exists(/usr/${X_BUILD_FOR}/usr/bin/cc) -X_SYSROOT= ${LOCALBASE}/${X_BUILD_FOR} -.else -X_SYSROOT= /usr/${X_BUILD_FOR} -.endif -CC= ${X_SYSROOT}/usr/bin/cc -CXX= ${X_SYSROOT}/usr/bin/c++ -NM= ${X_BUILD_FOR}-nm -STRIP_CMD= ${X_BUILD_FOR}-strip +CC= ${XCC} +CXX= ${XCXX} +CFLAGS+= --sysroot=${CROSS_SYSROOT} -isystem ${CROSS_SYSROOT}/usr/include +CXXFLAGS+= --sysroot=${CROSS_SYSROOT} -isystem ${CROSS_SYSROOT}/usr/include/c++/v1 -nostdinc++ +LDFLAGS+= --sysroot=${CROSS_SYSROOT} +.for _tool in AS AR LD NM OBJCOPY RANLIB SIZE STRINGS +${_tool}= ${CROSS_BINUTILS_PREFIX}${tool:tl} +.endfor +STRIP_CMD= ${CROSS_BINUTILS_PREFIX}strip # only bmake support the below STRIPBIN= ${STRIP_CMD} .export.env STRIPBIN @@ -1517,13 +1521,12 @@ CO_ENV+= STAGEDIR=${STAGEDIR} \ PORT_OPTIONS="${PORT_OPTIONS}" \ PORTSDIR="${PORTSDIR}" -.if defined(X_BUILD_FOR) -BUILD_DEPENDS+= ${X_BUILD_FOR}-cc:devel/${X_BUILD_FOR}-xdev -PKG_ENV+= ABI_FILE=${X_SYSROOT}/usr/lib/crt1.o +.if defined(CROSS_SYSROOT) +PKG_ENV+= ABI_FILE=${CROSS_SYSROOT}/bin/sh MAKE_ENV+= NM=${NM} \ - STRIPBIN=${X_BUILD_FOR}-strip \ - PKG_CONFIG_SYSROOT_DIR="${X_SYSROOT}" -CONFIGURE_ENV+= PKG_CONFIG_SYSROOT_DIR="${X_SYSROOT}" + STRIPBIN=${STRIPBIN} \ + PKG_CONFIG_SYSROOT_DIR="${CROSS_SYSROOT}" +CONFIGURE_ENV+= PKG_CONFIG_SYSROOT_DIR="${CROSS_SYSROOT}" .endif WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work @@ -2488,8 +2491,9 @@ GNU_CONFIGURE_PREFIX?= ${PREFIX} GNU_CONFIGURE_MANPREFIX?= ${MANPREFIX} CONFIG_SITE?= ${PORTSDIR}/Templates/config.site CONFIGURE_ARGS+= --prefix=${GNU_CONFIGURE_PREFIX} $${_LATE_CONFIGURE_ARGS} -.if defined(X_BUILD_FOR) -CONFIGURE_ARGS+= --host=${X_BUILD_FOR} +.if defined(CROSS_TOOLCHAIN) +CROSS_HOST= ${CROSS_TOOLCHAIN:C,-.*$,,}-${OPSYS:tl} +CONFIGURE_ARGS+= --host=${CROSS_HOST} .endif CONFIGURE_ENV+= CONFIG_SITE=${CONFIG_SITE} lt_cv_sys_max_cmd_len=${CONFIGURE_MAX_CMD_LEN} HAS_CONFIGURE= yes |