Commit 096e9b85 authored by Clemens Fruhwirth's avatar Clemens Fruhwirth
Browse files

Add --enable-shared as configure argument, and ghc-shared-options as .cabal field

parent 04f45faa
......@@ -572,7 +572,8 @@ data BuildInfo = BuildInfo {
includes :: [FilePath], -- ^ The .h files to be found in includeDirs
installIncludes :: [FilePath], -- ^ .h files to install with the package
options :: [(CompilerFlavor,[String])],
ghcProfOptions :: [String]
ghcProfOptions :: [String],
ghcSharedOptions :: [String]
}
deriving (Show,Read,Eq)
......@@ -592,7 +593,8 @@ nullBuildInfo = BuildInfo {
includes = [],
installIncludes = [],
options = [],
ghcProfOptions = []
ghcProfOptions = [],
ghcSharedOptions = []
}
-- | Modify all the 'BuildInfo's in a package description.
......@@ -664,6 +666,9 @@ binfoFieldDescrs =
, listField "ghc-prof-options"
text parseTokenQ
ghcProfOptions (\val binfo -> binfo{ghcProfOptions=val})
, listField "ghc-shared-options"
text parseTokenQ
ghcProfOptions (\val binfo -> binfo{ghcSharedOptions=val})
, optsField "ghc-options" GHC
options (\path binfo -> binfo{options=path})
, optsField "hugs-options" Hugs
......
......@@ -120,6 +120,7 @@ data ConfigFlags = ConfigFlags {
configHcPkg :: Maybe FilePath, -- ^given hc-pkg location
configVanillaLib :: Bool, -- ^Enable vanilla library
configProfLib :: Bool, -- ^Enable profiling in the library
configSharedLib :: Bool, -- ^Enable profiling in the library
configProfExe :: Bool, -- ^Enable profiling in the executables.
configConfigureArgs :: [String], -- ^Extra arguments to @configure@
configOptimization :: Bool, -- ^Enable optimization.
......@@ -158,6 +159,7 @@ emptyConfigFlags progConf = ConfigFlags {
configHcPkg = Nothing,
configVanillaLib = True,
configProfLib = False,
configSharedLib = False,
configProfExe = False,
configConfigureArgs = [],
configOptimization = True,
......@@ -296,6 +298,7 @@ data Flag a = GhcFlag | NhcFlag | HugsFlag | JhcFlag
| WithCompiler FilePath | WithHcPkg FilePath
| WithVanillaLib | WithoutVanillaLib
| WithProfLib | WithoutProfLib
| WithSharedLib | WithoutSharedLib
| WithProfExe | WithoutProfExe
| WithOptimization | WithoutOptimization
| WithGHCiLib | WithoutGHCiLib
......@@ -528,6 +531,10 @@ configureCmd progConf = Cmd {
"Enable library profiling",
Option "" ["disable-library-profiling"] (NoArg WithoutProfLib)
"Disable library profiling",
Option "" ["enable-shared"] (NoArg WithSharedLib)
"Enable shared library",
Option "" ["disable-shared"] (NoArg WithoutSharedLib)
"Disable shared library",
Option "" ["enable-executable-profiling"] (NoArg WithProfExe)
"Enable executable profiling",
Option "" ["disable-executable-profiling"] (NoArg WithoutProfExe)
......@@ -627,6 +634,8 @@ parseConfigureArgs progConf = parseArgs (configureCmd progConf) updateCfg
configGHCiLib = False }
updateCfg t WithProfLib = t { configProfLib = True }
updateCfg t WithoutProfLib = t { configProfLib = False }
updateCfg t WithSharedLib = t { configSharedLib = True }
updateCfg t WithoutSharedLib = t { configSharedLib = False }
updateCfg t WithProfExe = t { configProfExe = True }
updateCfg t WithoutProfExe = t { configProfExe = False }
updateCfg t WithOptimization = t { configOptimization = True }
......
......@@ -287,20 +287,21 @@ configure (pkg_descr0, pbi) cfg
return False
let lbi = LocalBuildInfo{
installDirTemplates = installDirs,
compiler = comp,
installDirTemplates = installDirs,
compiler = comp,
buildDir = distPref </> "build",
scratchDir = distPref </> "scratch",
packageDeps = dep_pkgs,
localPkgDescr = pkg_descr,
withPrograms = programsConfig',
withVanillaLib = configVanillaLib cfg,
withProfLib = configProfLib cfg,
withProfExe = configProfExe cfg,
withOptimization = configOptimization cfg,
packageDeps = dep_pkgs,
localPkgDescr = pkg_descr,
withPrograms = programsConfig',
withVanillaLib = configVanillaLib cfg,
withProfLib = configProfLib cfg,
withSharedLib = configSharedLib cfg,
withProfExe = configProfExe cfg,
withOptimization = configOptimization cfg,
withGHCiLib = configGHCiLib cfg,
splitObjs = split_objs,
userConf = configUser cfg
userConf = configUser cfg
}
let dirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
......
......@@ -94,6 +94,7 @@ data LocalBuildInfo = LocalBuildInfo {
userConf :: Bool, -- ^Was this package configured with --user?
withVanillaLib:: Bool, -- ^Whether to build normal libs.
withProfLib :: Bool, -- ^Whether to build profiling versions of libs.
withSharedLib :: Bool, -- ^Whether to build shared versions of libs.
withProfExe :: Bool, -- ^Whether to build executables for profiling.
withOptimization :: Bool, -- ^Whether to build with optimization (if available).
withGHCiLib :: Bool, -- ^Whether to build libs suitable for use with GHCi.
......
......@@ -817,6 +817,18 @@ Executable program2 {
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>ghc-shared-options:</literal>
<replaceable>token list</replaceable>
</term>
<listitem>
<para>Additional options for GHC when the package is
built as shared library.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>hugs-options:</literal>
......@@ -2260,6 +2272,24 @@ runhaskell Setup.hs unregister --gen-script</screen>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--enable-shared</option></term>
<listitem>
<para>Build shared library. This implies a seperate
compiler run to generate position independent code as
required on most platforms.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--disable-shared</option></term>
<listitem>
<para>(default) Do not build shared library.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--configure-option</option>=<replaceable>str</replaceable></term>
<listitem>
......
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