Commit a7eeb607 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

build system: Persist CrossCompiling in binary distributions

The build system uses the CrossCompiling variable to decide whether or
not we should build various packages that must be built using the
compiler.  Consequently, it is important that we persist its value in
the binary distribution so we know during `make install` not to go
looking for files that would have been built for these packages. Failing
to do this causes #13325.

Test Plan: Cross compile, `make binary-dist`, and try installing the
binary distribution on the target

Reviewers: hvr, austin, trofi, rwbarton

Reviewed By: trofi, rwbarton

Subscribers: carter, trofi, rwbarton, erikd, thomie, snowleopard, davean

Differential Revision: https://phabricator.haskell.org/D3187
parent 9bc4311f
......@@ -1073,6 +1073,17 @@ endif
BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
# Note [Persist CrossCompiling in binary distributions]
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# The build system uses the CrossCompiling variable to decide whether or not we
# should build various packages that must be built using the compiler.
# Consequently, it is important that we persist its value in the binary
# distribution so we know during `make install` not to go looking for files that
# would have been built for these packages. Failing to do this causes #13325.
#
# See Note [No stage2 packages when CrossCompiling or Stage1Only].
unix-binary-dist-prep:
$(call removeTrees,bindistprep/)
"$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
......@@ -1083,6 +1094,8 @@ unix-binary-dist-prep:
echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK)
echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK)
echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK)
# See Note [Persist CrossCompiling in binary distributions]
echo "CrossCompiling = $(CrossCompiling)" >> $(BIN_DIST_MK)
cd $(BIN_DIST_PREP_DIR) && autoreconf
$(call removeFiles,$(BIN_DIST_PREP_TAR))
# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
......@@ -1484,6 +1497,11 @@ endif
# [5]. Therefore in this case we also have to exclude the stage2 packages
# from the build.
#
# Because we omit certain packages from the build when CrossCompiling=YES,
# it is important that we remember the value of CrossCompiling in binary
# distributions that we produce. See Note [Persist CrossCompiling in binary
# distributions].
#
# [1] find utils -name ghc.mk | xargs grep -l 'build-prog.*,2'
#
# [2]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment