pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Introduce automatic setting of BUILD_TARGET.



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Sun Jan 3 14:02:30 2021 +0100
Changeset:	737c17c90bf6b2fc7df58d62e742e2ed377f9401

Modified Files:
	rust/Makefile

Log Message:
Introduce automatic setting of BUILD_TARGET.

If cross-building, one needs to use the "dist" build target.
Also, due to https://github.com/rust-lang/rust/issues/73132, one
needs to unset DESTDIR for such a build.  Automatically detect this
if we are cross-building (TARGET from cross.mk is non-empty).

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=737c17c90bf6b2fc7df58d62e742e2ed377f9401

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/Makefile | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diffs:
diff --git a/rust/Makefile b/rust/Makefile
index 70c4fe9516..02d25c976d 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -46,6 +46,13 @@ CONFIGURE_ARGS+=		--disable-ninja
 # Include (optional) settings to cross-build rust
 .include "cross.mk"
 
+.if !empty(TARGET)
+# Use "dist" build target for cross compile of bootstrap
+BUILD_TARGET=	dist
+.else
+BUILD_TARGET=	build
+.endif
+
 # Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
 # uncommenting the LD_LIBRARY_PATH setting may be required to run
 # the bootstrap
@@ -359,10 +366,17 @@ pre-build: pre-build-fix
 do-build:
 	${RUN}${_ULIMIT_CMD}						\
 	cd ${WRKSRC} &&							\
-	${SETENV} ${MAKE_ENV} ${PYTHONBIN} ./x.py -v			\
-	    build --stage 2 -j ${_MAKE_JOBS_N} &&			\
-	${SETENV} ${MAKE_ENV} ${PYTHONBIN} ./x.py -v			\
-	    doc --stage 2 -j ${_MAKE_JOBS_N}
+	${SETENV} ${MAKE_ENV} 						\
+	sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then 		\
+		unset DESTDIR; 						\
+		${PYTHONBIN} ./x.py -v					\
+		    ${BUILD_TARGET} -j ${_MAKE_JOBS_N}			\
+	else								\
+		${PYTHONBIN} ./x.py -v					\
+		    ${BUILD_TARGET} --stage 2 -j ${_MAKE_JOBS_N} &&	\
+		${SETENV} ${MAKE_ENV} ${PYTHONBIN} ./x.py -v		\
+		    doc --stage 2 -j ${_MAKE_JOBS_N};			\
+	fi"
 
 do-test:
 	${RUN}${_ULIMIT_CMD}						\


Home | Main Index | Thread Index | Old Index