diff options
| author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-08-18 16:26:00 +0100 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-08-23 13:34:16 -0400 |
| commit | 7dde84ad04e556bfdab7cc03bcde21f08d61cb55 (patch) | |
| tree | 2b3541f8309ea6d451cc64366e55b328197b23e6 /hadrian/src/Rules | |
| parent | 27c27f7d8fed00d435f6bcad17fa47e85a442235 (diff) | |
| download | haskell-7dde84ad04e556bfdab7cc03bcde21f08d61cb55.tar.gz | |
hadrian: Write version wrappers in C rather than Haskell
This reduces the resulting binary size on windows where the executables
were statically linked.
Diffstat (limited to 'hadrian/src/Rules')
| -rw-r--r-- | hadrian/src/Rules/BinaryDist.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index 6d812cefad..8cd7923547 100644 --- a/hadrian/src/Rules/BinaryDist.hs +++ b/hadrian/src/Rules/BinaryDist.hs @@ -419,13 +419,14 @@ iservBins = do -- | Create a wrapper script calls the executable given as first argument createVersionWrapper :: String -> FilePath -> Action () createVersionWrapper versioned_exe install_path = do - ghcPath <- builderPath (Ghc CompileHs Stage2) + ccPath <- builderPath (Cc CompileC Stage2) top <- topDirectory - let version_wrapper = top -/- "hadrian" -/- "bindist" -/- "version-wrapper.hs" - cmd ghcPath ["-o", install_path, "-no-keep-hi-files" - , "-no-keep-o-files", "-rtsopts=ignore" + let version_wrapper_dir = top -/- "hadrian" -/- "bindist" -/- "cwrappers" + wrapper_files = [ version_wrapper_dir -/- file | file <- ["version-wrapper.c", "getLocation.c", "cwrapper.c"]] + + cmd ccPath (["-o", install_path, "-I", version_wrapper_dir , "-DEXE_PATH=\"" ++ versioned_exe ++ "\"" - , version_wrapper] + ] ++ wrapper_files) {- Note [Two Types of Wrappers] |
