aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk40
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