Skip to content

Commit

Permalink
Introduce automatic setting of BUILD_TARGET.
Browse files Browse the repository at this point in the history
If cross-building, one needs to use the "dist" build target.
Also, due to rust-lang/rust#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).
  • Loading branch information
he32 committed Jan 3, 2021
1 parent caabb54 commit 737c17c
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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} \
Expand Down

0 comments on commit 737c17c

Please sign in to comment.