[Git][ghc/ghc][wip/supersven/hadrian-cross-stage3] 9 commits: WIP bindist note
Sven Tennie pushed to branch wip/supersven/hadrian-cross-stage3 at Glasgow Haskell Compiler / GHC Commits: d4acb9e2 by GHC GitLab CI at 2026-07-18T09:24:50+02:00 WIP bindist note - - - - - c1947e80 by GHC GitLab CI at 2026-07-20T18:54:51+02:00 Improve Haddock - - - - - c327d249 by GHC GitLab CI at 2026-07-20T18:54:59+02:00 Imporve bindist - - - - - 7174bf40 by GHC GitLab CI at 2026-07-20T18:55:10+02:00 Fix Haddock - - - - - 63d1b2e0 by GHC GitLab CI at 2026-07-20T19:21:23+02:00 WIP - - - - - cf2d3ed7 by GHC GitLab CI at 2026-07-20T19:26:23+02:00 A - - - - - 4bb4b5a5 by GHC GitLab CI at 2026-07-20T19:34:26+02:00 Typos - - - - - 5aa97592 by GHC GitLab CI at 2026-07-20T20:00:35+02:00 Simplify - - - - - 6ec8857c by GHC GitLab CI at 2026-07-20T20:03:13+02:00 Formatting - - - - - 3 changed files: - hadrian/src/BindistConfig.hs - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/Generate.hs Changes: ===================================== hadrian/src/BindistConfig.hs ===================================== @@ -24,7 +24,7 @@ crossBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage1 targetBindist :: BindistConfig targetBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage2 } --- | Parent folder under build root ("bindist" or "bindist-stage3") +-- | Folder relative to build root ("bindist" or "bindist-stage3") bindistFolder :: BindistConfig -> FilePath bindistFolder conf | executable_stage conf == Stage2 = "bindist-stage3" bindistFolder _conf = "bindist" ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -19,66 +19,83 @@ import BindistConfig Note [Binary distributions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Hadrian produces binary distributions under: +Hadrian produces binary distributions that run on the build host architecture +(build == host, target == host || target /= host) under: <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz -For stage3 (target) bindists, a separate parent folder is used: +For stage3 (build /= host, host == target) bindists, a separate parent folder +is used: <build root>/bindist-stage3/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz -The stage2/cross bindist is generated by creating an archive from: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/ +While regular bindists are usual same-arch compilers or cross-compilers, stage3 +bindists are cross-compiled compilers. -The stage3/target bindist is generated by creating an archive from: - <build root>/bindist-stage3/ghc-<X>.<Y>.<Z>-<arch>-<os>/ +Bindists are generated by creating an archive from: + <build root>/<bindist|bindist-stage3>/ghc-<X>.<Y>.<Z>-<arch>-<os>/ -It does so by following the steps below. +Stage2 cross-compilers are a by-product of creating stage3 cross-compiled +compilers. The additional build dir (bindist-stage3) lets us keep both, such +that we can build them in one go on CI. +Configuration files (e.g. configure script and default.host.target) differ in +this case and keeping both targets separated also saves us some headache +dealing with stale files. -- make sure we have a complete stage 2 compiler + haddock +This table introduces variables to simplify the following step descriptions: + +| compiler kind | <bindist-dir> | <executable-stage-dir> | <library-stage-dir> | +|------------------|----------------|------------------------|---------------------| +| native | bindist | stage1/ | stage1/ | +| cross compiler | bindist | stage1/ | stage2/ | +| cross-compiled | bindist-stage3 | stage2/ | stage2/ | + +These are the steps to build a bindist: + +- make sure we have a complete compiler + libraries + haddock for the stage(s) + to bundle - copy the specific binaries which should be in the bindist to the bin folder and add the version suffix: - <build root>/stage1/bin/xxxx + <build root>/<executable-stage-dir>/bin/xxxx to - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER> + where the optional <target>- prefix is the cross triple for cross-compilers. - create symlink (or bash) wrapper from unversioned to versioned executable: - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx points to: - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/[<target>-]xxxx-<VER> - copy the lib directories of the compiler we built: - <build root>/stage1/lib + <build root>/<library-stage-dir>/lib to - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/lib - copy the generated docs (user guide, haddocks, etc): - <build root>/docs/ + <build root>/doc/ to - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/docs/ + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/doc/ -- use autoreconf to generate per-stage `configure` scripts from - aclocal.m4 and stage1/distrib/configure.ac (for cross/compiler bindists) or - stage2/distrib/configure.ac (for target-native bindists), that we move to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure - <build root>/bindist-stage3/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure +- use autoreconf to generate a staged `configure` script in + <build root>/<executable-stage>/distrib + that we move to: + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/configure - write a (fixed) Makefile capable of supporting 'make install' to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/Makefile - write some (fixed) supporting bash code for the wrapper scripts to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program> + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program> where <program> is the name of the executable that the bash file will help wrapping. -- copy supporting configure/make related files - (see @bindistInstallFiles@) to: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file> +- copy supporting configure/make related files (see @bindistInstallFiles@) to: + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/<file> - create a .tar.xz archive of the directory: - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/ + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>/ at - <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz + <build root>/<bindist-dir>/ghc-<X>.<Y>.<Z>-<arch>-<os>.tar.xz Note [Wrapper scripts and binary distributions] ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -567,7 +567,7 @@ generateSettings settingsFile includeLibDir rel_pkg_db compilerStage = do stage <- getStage -- The unit-id of the base package which is always linked against (#25382). - -- For stage2 cross compilers the target libraries live in the stage2 lib + -- For stage2 cross compilers the target libraries live in the stage3 lib -- dir, so the base unit-id must come from stage2; for native stage2 the -- libraries live in the stage1 lib dir. base_unit_id <- expr $ do View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/287b8a8c88a88036b20ea2e548273c8... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/287b8a8c88a88036b20ea2e548273c8... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Sven Tennie (@supersven)