Commit eb787d6d authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add --enable/disable-executable-stripping option

The default is enabled
parent 35b34c15
......@@ -88,7 +88,7 @@ import Distribution.Simple.Setup
( ConfigFlags(..), CopyDest(..), fromFlag, fromFlagOrDefault, flagToMaybe )
import Distribution.Simple.InstallDirs
( InstallDirs(..), defaultInstallDirs, combineInstallDirs )
import Distribution.Simple.LocalBuildInfo as LBI
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), absoluteInstallDirs
, prefixRelativeInstallDirs )
import Distribution.Simple.BuildPaths
......@@ -416,6 +416,7 @@ configure (pkg_descr0, pbi) cfg
withOptimization = fromFlag $ configOptimization cfg,
withGHCiLib = fromFlag $ configGHCiLib cfg,
splitObjs = split_objs,
stripExes = fromFlag $ configStripExes cfg,
withPackageDB = packageDb,
progPrefix = fromFlag $ configProgPrefix cfg,
progSuffix = fromFlag $ configProgSuffix cfg
......
......@@ -702,7 +702,7 @@ installExe verbosity lbi pref buildPref (progprefix, progsuffix) pkg_descr
stripExe verbosity lbi exeFileName (pref </> fixedExeFileName)
stripExe :: Verbosity -> LocalBuildInfo -> FilePath -> FilePath -> IO ()
stripExe verbosity lbi name path =
stripExe verbosity lbi name path = when (stripExes lbi) $
case lookupProgram stripProgram (withPrograms lbi) of
Just strip -> rawSystemProgram verbosity strip [path]
Nothing -> warn verbosity $ "Unable to strip executable '" ++ name
......
......@@ -100,6 +100,7 @@ data LocalBuildInfo = LocalBuildInfo {
withOptimization :: OptimisationLevel, -- ^Whether to build with optimization (if available).
withGHCiLib :: Bool, -- ^Whether to build libs suitable for use with GHCi.
splitObjs :: Bool, -- ^Use -split-objs with GHC, if available
stripExes :: Bool, -- ^Whether to strip executables during install
progPrefix :: PathTemplate, -- ^Prefix to be prepended to installed executables
progSuffix :: PathTemplate -- ^Suffix to be appended to installed executables
......
......@@ -246,6 +246,7 @@ data ConfigFlags = ConfigFlags {
configPackageDB :: Flag PackageDB, -- ^Which package DB to use
configGHCiLib :: Flag Bool, -- ^Enable compiling library for GHCi
configSplitObjs :: Flag Bool, -- ^Enable -split-objs with GHC
configStripExes :: Flag Bool, -- ^Enable executable stripping
configConfigurationsFlags :: [(String, Bool)]
}
deriving Show
......@@ -264,7 +265,8 @@ defaultConfigFlags progConf = emptyConfigFlags {
configVerbose = Flag normal,
configUserInstall = Flag False, --TODO: reverse this
configGHCiLib = Flag True,
configSplitObjs = Flag False -- takes longer, so turn off by default
configSplitObjs = Flag False, -- takes longer, so turn off by default
configStripExes = Flag True
}
configureCommand :: ProgramConfiguration -> CommandUI ConfigFlags
......@@ -417,6 +419,11 @@ configureOptions showOrParseArgs =
configSplitObjs (\v flags -> flags { configSplitObjs = v })
(boolOpt [] [])
,option "" ["executable-stripping"]
"strip executables upon installation to reduce binary sizes"
configStripExes (\v flags -> flags { configStripExes = v })
(boolOpt [] [])
,option "" ["configure-option"]
"Extra option for configure"
configConfigureArgs (\v flags -> flags { configConfigureArgs = v })
......@@ -494,6 +501,7 @@ instance Monoid ConfigFlags where
configPackageDB = mempty,
configGHCiLib = mempty,
configSplitObjs = mempty,
configStripExes = mempty,
configExtraLibDirs = mempty,
configExtraIncludeDirs = mempty,
configConfigurationsFlags = mempty
......@@ -520,6 +528,7 @@ instance Monoid ConfigFlags where
configPackageDB = combine configPackageDB,
configGHCiLib = combine configGHCiLib,
configSplitObjs = combine configSplitObjs,
configStripExes = combine configSplitObjs,
configExtraLibDirs = combine configExtraLibDirs,
configExtraIncludeDirs = combine configExtraIncludeDirs,
configConfigurationsFlags = combine configConfigurationsFlags
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment