diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index 7730f43f4ce3e935d18b8d4eb18894344b3259e1..5ddfddafb676b5e74d8c539d68582fa6857f79d1 100644 --- a/hadrian/src/Rules/BinaryDist.hs +++ b/hadrian/src/Rules/BinaryDist.hs @@ -35,10 +35,10 @@ It does so by following the steps below. to <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> -- create symlink (or bash) wrapper to from unversioned to versioned executable: - <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> - points to: +- create symlink (or bash) wrapper from unversioned to versioned executable: <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx + points to: + <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx-<VER> - copy the lib directories of the compiler we built: <build root>/stage1/lib @@ -293,6 +293,7 @@ wrapper "runghc" = runGhcWrapper wrapper _ = commonWrapper -- | Wrapper scripts for different programs. Common is default wrapper. +-- See Note [Two Types of Wrappers] ghcWrapper :: String ghcWrapper = "exec \"$executablename\" -B\"$libdir\" ${1+\"$@\"}\n" @@ -357,6 +358,7 @@ iservBins = do ] -- Version wrapper scripts +-- See Note [Two Types of Wrappers] -- | Create a wrapper script calls the executable given as first argument createVersionWrapper :: String -> FilePath -> Action () @@ -369,3 +371,25 @@ createVersionWrapper versioned_exe install_path = do , "-DEXE_PATH=\"" ++ versioned_exe ++ "\"" , version_wrapper] +{- +Note [Two Types of Wrappers] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are two different types of wrapper scripts. + +1. The wrapper scripts installed + <build root>/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/wrappers/<program> +2. The version wrapper scripts installed in + <build root/bindist/ghc-<X>.<Y>.<Z>-<arch>-<os>/bin/xxxx + +The purpose of the wrappers in (1) is to allow the executables to be installed +into a different @BINDIR@ which is not already adjacent to a libdir. Therefore +these wrappers pass the libdir and so on explicitliy to the executable so the +wrappers can be placed anywhere and still work. + +The purpose of the wrappers in (2) is to provide both versioned and unversioned +executables. On windows, these are actual wrapper scripts which just call the executable +but on linux these wrappers are symlinks. + +-} +