diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-10-19 16:02:51 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-10-19 16:02:51 -0400 |
commit | f5276c9029dc0e0472eee085f606ec04e7c62791 (patch) | |
tree | 3b95a2d307ad14eece4d277392fc4adfc752e01a | |
parent | c0b4d46f00393179c4e5fbb62e99aa7a3438ee9f (diff) | |
download | haskell-wip/T20267.tar.gz |
hadrian: Fix binary-dist support for cross-compilerswip/T20267
Previously the logic which called ghc-pkg failed to account for the fact
that the executable name may be prefixed with a triple. Moreover, the
call must occur before we delete the settings file as ghc-pkg needs the
latter.
Fixes #20267.
-rw-r--r-- | distrib/configure.ac.in | 2 | ||||
-rw-r--r-- | hadrian/bindist/Makefile | 2 | ||||
-rw-r--r-- | hadrian/src/Rules/BinaryDist.hs | 19 |
3 files changed, 15 insertions, 8 deletions
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 7a29369000..d3aee52220 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -50,7 +50,7 @@ FP_FIND_ROOT # ToDo: if Stage1Only=YES, should be YES CrossCompiling=NO -CrossCompilePrefix="" +CrossCompilePrefix="@CrossCompilePrefix@" TargetPlatformFull="${target}" TablesNextToCode="@TablesNextToCode@" diff --git a/hadrian/bindist/Makefile b/hadrian/bindist/Makefile index 7dea178000..f43111725d 100644 --- a/hadrian/bindist/Makefile +++ b/hadrian/bindist/Makefile @@ -203,7 +203,7 @@ update_package_db: install_bin install_lib @echo "Updating the package DB" $(foreach p, $(PKG_CONFS),\ $(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-\([0-9]*[0-9]\.\)*conf//g'),$(shell echo "$p" | sed 's:xxx: :g'),$(docdir),$(shell realpath --relative-to="$(ActualLibsDir)" "$(docdir)"))) - '$(WrapperBinsDir)/ghc-pkg' recache + '$(WrapperBinsDir)/$(CrossCompilePrefix)ghc-pkg' recache install_mingw: @echo "Installing MingGW" diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index 1887314659..dc86af3c4f 100644 --- a/hadrian/src/Rules/BinaryDist.hs +++ b/hadrian/src/Rules/BinaryDist.hs @@ -194,18 +194,25 @@ bindistRules = do copyDirectory (rtsIncludeDir) bindistFilesDir when windowsHost $ createGhcii (bindistFilesDir -/- "bin") + -- Call ghc-pkg recache, after copying so the package.cache is + -- accurate, then it's on the distributor to use `cp -a` to install + -- a relocatable bindist. + -- + -- N.B. the ghc-pkg executable may be prefixed with a target triple + -- (c.f. #20267). + ghcPkgName <- programName (vanillaContext Stage1 ghcPkg) + cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"] + -- The settings file must be regenerated by the bindist installation -- logic to account for the environment discovered by the bindist -- configure script on the host. Not on Windows, however, where - -- we do not ship a configure script with the bindist. See #20253. + -- we do not ship a configure script with the bindist. See #20254. + -- + -- N.B. we must do this after ghc-pkg has been run as it will go + -- looking for the settings files. unless windowsHost $ removeFile (bindistFilesDir -/- "lib" -/- "settings") - -- Call ghc-pkg recache, after copying so the package.cache is - -- accurate, then it's on the distributor to use `cp -a` to install - -- a relocatable bindist. - cmd_ (bindistFilesDir -/- "bin" -/- "ghc-pkg") ["recache"] - unless cross $ need ["docs"] -- TODO: we should only embed the docs that have been generated |