diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 93ec21c5b9f..2a53fd03385 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -33,4 +33,4 @@ md5CheckGenericPackageDescription proxy = md5Check proxy md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy - 0x78979713e08179ab070d6ab10cd5ef6c + 0x481d5ad67f456246ab2ac06b3aab554f diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 79ab53f364a..b47100a0629 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -903,6 +903,8 @@ buildOptionsFromConfigFlags verbosity cfg comp = do , exeCoverage = False , libCoverage = False , relocatable = fromFlagOrDefault False $ configRelocatable cfg + , programPrefix = flagToMaybe $ configProgPrefix cfg + , programSuffix = flagToMaybe $ configProgSuffix cfg } -- | Adjust 'LBC.BuildOptions' to be compatible with the given 'Compiler' and diff --git a/Cabal/src/Distribution/Types/LocalBuildConfig.hs b/Cabal/src/Distribution/Types/LocalBuildConfig.hs index f79d470dcf3..7a7ae976982 100644 --- a/Cabal/src/Distribution/Types/LocalBuildConfig.hs +++ b/Cabal/src/Distribution/Types/LocalBuildConfig.hs @@ -188,6 +188,10 @@ data BuildOptions = BuildOptions -- ^ Whether to enable library program coverage , relocatable :: Bool -- ^ Whether to build a relocatable package + , programPrefix :: Maybe PathTemplate + -- ^ Installed executable prefix + , programSuffix :: Maybe PathTemplate + -- ^ Installed executable suffix } deriving (Eq, Generic, Read, Show) @@ -229,4 +233,6 @@ buildOptionsConfigFlags (BuildOptions{..}) = , configStripExes = toFlag stripExes , configStripLibs = toFlag stripLibs , configDebugInfo = toFlag withDebugInfo + , configProgPrefix = maybeToFlag programPrefix + , configProgSuffix = maybeToFlag programSuffix } diff --git a/Cabal/src/Distribution/Types/LocalBuildInfo.hs b/Cabal/src/Distribution/Types/LocalBuildInfo.hs index f525d397aba..e34763e80a3 100644 --- a/Cabal/src/Distribution/Types/LocalBuildInfo.hs +++ b/Cabal/src/Distribution/Types/LocalBuildInfo.hs @@ -47,6 +47,8 @@ module Distribution.Types.LocalBuildInfo , libCoverage , extraCoverageFor , relocatable + , programPrefix + , programSuffix , .. ) @@ -188,6 +190,8 @@ pattern LocalBuildInfo -> Bool -> [UnitId] -> Bool + -> Maybe PathTemplate + -> Maybe PathTemplate -> LocalBuildInfo pattern LocalBuildInfo { configFlags @@ -227,6 +231,8 @@ pattern LocalBuildInfo , libCoverage , extraCoverageFor , relocatable + , programPrefix + , programSuffix } = NewLocalBuildInfo { localBuildDescr = @@ -279,6 +285,8 @@ pattern LocalBuildInfo , exeCoverage , libCoverage , relocatable + , programPrefix + , programSuffix } } } diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 5ec48a249aa..852a1f3ad8f 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -2361,6 +2361,8 @@ elaborateInstallPlan , relocatable = perPkgOptionFlag pkgid False packageConfigRelocatable , withProfLibDetail = elabProfExeDetail , withProfExeDetail = elabProfLibDetail + , programPrefix = elabProgPrefix + , programSuffix = elabProgSuffix } okProfDyn = profilingDynamicSupportedOrUnknown compiler profExe = perPkgOptionFlag pkgid False packageConfigProf diff --git a/changelog.d/hooks-prefix.md b/changelog.d/hooks-prefix.md new file mode 100644 index 00000000000..f1216a3dce8 --- /dev/null +++ b/changelog.d/hooks-prefix.md @@ -0,0 +1,10 @@ +--- +synopsis: Add program prefix and suffix to `BuildOptions` +packages: [Cabal, Cabal-hooks] +prs: 11787 +issues: 11168 +--- + +Two new fields of `BuildOptions`, `programPrefix` and `programSuffix`, have +been added. This allows the installed executable program prefix and suffix to +be set by `SetupHooks` for packages with `build-type: Hooks`.