Commit 02940703 authored by Duncan Coutts's avatar Duncan Coutts

Add a symlink-bindir field to the config file

and link it up with the symlink feature code.
parent 42b22d87
......@@ -77,7 +77,8 @@ data SavedConfig = SavedConfig {
configUploadPassword :: Flag Password,
configUserInstallDirs :: InstallDirs (Flag PathTemplate),
configGlobalInstallDirs :: InstallDirs (Flag PathTemplate),
configFlags :: ConfigFlags
configFlags :: ConfigFlags,
configSymlinkBinDir :: Flag FilePath
}
configUserInstall :: SavedConfig -> Flag Bool
......@@ -155,6 +156,7 @@ defaultSavedConfig =
, configRemoteRepos = [defaultRemoteRepo]
, configUploadUsername = mempty
, configUploadPassword = mempty
, configSymlinkBinDir = mempty
}
defaultRemoteRepo :: RemoteRepo
......@@ -220,6 +222,10 @@ configCabalInstallFieldDescrs =
(text . show . fromFlagOrDefault "" . fmap unPassword)
(fmap (fmap Password . emptyToNothing) parseTokenQ)
configUploadPassword (\d cfg -> cfg { configUploadPassword = d })
, simpleField "symlink-bindir"
(text . show . fromFlagOrDefault "")
(fmap emptyToNothing parseFilePathQ)
configSymlinkBinDir (\d cfg -> cfg { configSymlinkBinDir = d })
]
where emptyToNothing "" = mempty
emptyToNothing f = toFlag f
......
......@@ -205,7 +205,8 @@ data InstallFlags = InstallFlags {
installOnly :: Flag Bool,
installRootCmd :: Flag String,
installCabalVersion :: Flag Version,
installLogFile :: Flag FilePath
installLogFile :: Flag FilePath,
installSymlinkBinDir:: Flag FilePath
}
defaultInstallFlags :: InstallFlags
......@@ -214,7 +215,8 @@ defaultInstallFlags = InstallFlags {
installOnly = Flag False,
installRootCmd = mempty,
installCabalVersion = mempty,
installLogFile = mempty
installLogFile = mempty,
installSymlinkBinDir= mempty
}
installCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags)
......@@ -266,7 +268,8 @@ instance Monoid InstallFlags where
installOnly = combine installOnly,
installRootCmd = combine installRootCmd,
installCabalVersion = combine installCabalVersion,
installLogFile = combine installLogFile
installLogFile = combine installLogFile,
installSymlinkBinDir= combine installSymlinkBinDir
}
where combine field = field a `mappend` field b
......
......@@ -163,7 +163,9 @@ installAction (cflags,iflags) extraArgs = do
(comp, conf) <- configCompilerAux cflags'
install verbosity
(configPackageDB cflags') (configRepos config)
comp conf cflags' iflags
comp conf cflags' iflags {
installSymlinkBinDir = configSymlinkBinDir config
}
[ UnresolvedDependency pkg (Cabal.configConfigurationsFlags cflags')
| pkg <- pkgs ]
......@@ -202,7 +204,9 @@ upgradeAction (cflags,iflags) extraArgs = do
(comp, conf) <- configCompilerAux cflags'
upgrade verbosity
(configPackageDB cflags') (configRepos config)
comp conf cflags' iflags
comp conf cflags' iflags {
installSymlinkBinDir = configSymlinkBinDir config
}
[ UnresolvedDependency pkg (Cabal.configConfigurationsFlags cflags')
| pkg <- pkgs ]
......
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