Date: Thu, 8 Sep 2016 21:34:48 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r421583 - head/Mk Message-ID: <201609082134.u88LYmL9036197@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Thu Sep 8 21:34:48 2016 New Revision: 421583 URL: https://svnweb.freebsd.org/changeset/ports/421583 Log: Rework the cross build framework so that it uses the external toolchain It allows to cross build everything wich is not expecting target dependencies Modified: head/Mk/bsd.port.mk Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Thu Sep 8 21:04:00 2016 (r421582) +++ head/Mk/bsd.port.mk Thu Sep 8 21:34:48 2016 (r421583) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609082134.u88LYmL9036197>