Mon Jul 6 19:09:29 2020 UTC ()
Based on suggestion, add the "cross.mk" file which contains
settings which may be tweaked to do a cross-build of rust.
Include it from the main Makefile.


(he)
diff -r1.184 -r1.185 pkgsrc/lang/rust/Makefile
diff -r0 -r1.1 pkgsrc/lang/rust/cross.mk

cvs diff -r1.184 -r1.185 pkgsrc/lang/rust/Makefile (expand / switch to unified diff)

--- pkgsrc/lang/rust/Makefile 2020/07/06 16:12:14 1.184
+++ pkgsrc/lang/rust/Makefile 2020/07/06 19:09:29 1.185
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.184 2020/07/06 16:12:14 he Exp $ 1# $NetBSD: Makefile,v 1.185 2020/07/06 19:09:29 he Exp $
2 2
3DISTNAME= rustc-1.44.0-src 3DISTNAME= rustc-1.44.0-src
4PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//} 4PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
5CATEGORIES= lang 5CATEGORIES= lang
6MASTER_SITES= http://static.rust-lang.org/dist/ 6MASTER_SITES= http://static.rust-lang.org/dist/
7 7
8MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://www.rust-lang.org/ 9HOMEPAGE= https://www.rust-lang.org/
10COMMENT= Safe, concurrent, practical language 10COMMENT= Safe, concurrent, practical language
11LICENSE= mit OR apache-2.0 11LICENSE= mit OR apache-2.0
12 12
13CONFLICTS+= rust-bin-[0-9]* 13CONFLICTS+= rust-bin-[0-9]*
14 14
@@ -38,26 +38,29 @@ CONFIGURE_ARGS+= --local-rust-root=${RU @@ -38,26 +38,29 @@ CONFIGURE_ARGS+= --local-rust-root=${RU
38CONFIGURE_ARGS+= --enable-extended # Build and install cargo too. 38CONFIGURE_ARGS+= --enable-extended # Build and install cargo too.
39CONFIGURE_ARGS+= --enable-rpath 39CONFIGURE_ARGS+= --enable-rpath
40CONFIGURE_ARGS+= --disable-codegen-tests 40CONFIGURE_ARGS+= --disable-codegen-tests
41CONFIGURE_ARGS+= --disable-dist-src 41CONFIGURE_ARGS+= --disable-dist-src
42CONFIGURE_ARGS+= --disable-llvm-static-stdcpp 42CONFIGURE_ARGS+= --disable-llvm-static-stdcpp
43CONFIGURE_ARGS+= --disable-ninja 43CONFIGURE_ARGS+= --disable-ninja
44# XXX: to be enabled in the future 44# XXX: to be enabled in the future
45#CONFIGURE_ARGS+= --jemalloc-root=${BUILDLINK_PREFIX.jemalloc}/lib 45#CONFIGURE_ARGS+= --jemalloc-root=${BUILDLINK_PREFIX.jemalloc}/lib
46 46
47# Use "dist" build target for cross compile of bootstrap 47# Use "dist" build target for cross compile of bootstrap
48#BUILD_TARGET= dist 48#BUILD_TARGET= dist
49BUILD_TARGET= build 49BUILD_TARGET= build
50 50
 51# Include (optional) settings to cross-build rust
 52.include "cross.mk"
 53
51# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so 54# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
52# uncommenting the LD_LIBRARY_PATH setting may be required to run 55# uncommenting the LD_LIBRARY_PATH setting may be required to run
53# the bootstrap 56# the bootstrap
54PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${RUST_BOOTSTRAP_PATH:Q}/lib 57PKGSRC_MAKE_ENV+= LD_LIBRARY_PATH=${RUST_BOOTSTRAP_PATH:Q}/lib
55 58
56# This should allow us to perform "offline" builds (so cargo doesn't fetch 59# This should allow us to perform "offline" builds (so cargo doesn't fetch
57# dependencies during the build stage) but this isn't hooked up yet. 60# dependencies during the build stage) but this isn't hooked up yet.
58CONFIGURE_ARGS+= --enable-vendor 61CONFIGURE_ARGS+= --enable-vendor
59 62
60# cargo defaults to using the number of available CPUs 63# cargo defaults to using the number of available CPUs
61MAKE_ENV+= CARGO_BUILD_JOBS=${_MAKE_JOBS_N} 64MAKE_ENV+= CARGO_BUILD_JOBS=${_MAKE_JOBS_N}
62 65
63CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS 66CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS

File Added: pkgsrc/lang/rust/cross.mk
# $Id: cross.mk,v 1.1 2020/07/06 19:09:29 he Exp $

# These settings may be used to cross-build rust.
#
# They interact with the files/gcc-wrap script to pick the
# right compiler for the different phases of the build, and
# use the headers for the target when required.  Note that the
# cross-root tree will need to have the required binary packages
# installed (curl etc., see list of buildlink3.mk includes in main
# Makefile).

# The gcc-wrap / c++-wrap script takes CROSS_ROOT environment variable
# to do a cross-build.  The wrapper script assumes dest/ and tools/
# as a result of a cross-build of NetBSD as subdirectories of this root
#CROSS_ROOT=		/u/evbarm-armv7hf
#CROSS_ROOT=		/u/sparc64
#CROSS_ROOT=		/u/macppc
#CROSS_ROOT=		/u/9.0-macppc
#CROSS_ROOT=		/u/evbarm64
#CROSS_ROOT=		/u/i386
#MAKE_ENV+=		CROSS_ROOT=${CROSS_ROOT}

# The GNU cross target designation
#GNU_CROSS_TARGET=	armv7--netbsdelf-eabihf
#GNU_CROSS_TARGET=	sparc64--netbsd
#GNU_CROSS_TARGET=	i486--netbsdelf
#GNU_CROSS_TARGET=	powerpc--netbsd
#GNU_CROSS_TARGET=	aarch64--netbsd
#MAKE_ENV+=		GNU_CROSS_TARGET=${GNU_CROSS_TARGET}

# To cross-build rust, you need to specify
# the ultimate target to built for, as well as the
# host the compiler is supposed to run on.
# Rust's target designation
#TARGET= 		armv7-unknown-netbsd-eabihf
#TARGET= 		sparc64-unknown-netbsd
#TARGET= 		powerpc-unknown-netbsd
#TARGET= 		aarch64-unknown-netbsd
#TARGET= 		i686-unknown-netbsd
#
#SCRIPTS=		${WRKDIR}/scripts
#CONFIGURE_ARGS+=	--host=${TARGET}
#CONFIGURE_ARGS+=	--target=${TARGET}
#CONFIGURE_ARGS+=	--set=target.${TARGET}.cc=${SCRIPTS}/gcc-wrap
#CONFIGURE_ARGS+=	--set=target.${TARGET}.cxx=${SCRIPTS}/c++-wrap
#CONFIGURE_ARGS+=	--set=target.${TARGET}.linker=${SCRIPTS}/gcc-wrap
#CONFIGURE_ARGS+=	--set=target.${TARGET}.ar=${CROSS_ROOT}/tools/bin/${GNU_CROSS_TARGET}-ar

# May be required when cross-building on NetBSD
#MAKE_ENV+=		OPENSSL_DIR=/usr