Commit babef8d0 authored by ijones's avatar ijones
Browse files

respects --user flag

** made register command respect --user flag
** changed install to put the sources in the place that register
   expects it, though I'm not sure if it's exactly right.
parent 01c060d0
......@@ -49,7 +49,7 @@ module Distribution.Simple.Install (
import Distribution.Package (PackageDescription(..), showPackageId)
import Distribution.Simple.Configure(LocalBuildInfo(..))
import Distribution.Simple.Utils(setupMessage, moveSources)
import Distribution.Simple.Utils(setupMessage, moveSources, pathSeperatorStr)
import System.Cmd(system)
import System.Directory(doesDirectoryExist, createDirectory, doesFileExist)
......@@ -62,7 +62,8 @@ install :: PackageDescription -> LocalBuildInfo
-> Maybe FilePath -- ^install-prefix
-> IO ()
install pkg_descr lbi install_prefixM = do
let pref = maybe (prefix lbi) id install_prefixM
let pref = (maybe (prefix lbi) id install_prefixM) ++
pathSeperatorStr ++ "lib" ++ pathSeperatorStr ++ (showPackageId $ package pkg_descr)
setupMessage "Installing" pkg_descr
moveSources pref (allModules pkg_descr) (mainModules pkg_descr)
-- installation step should be performed by caller.
......
......@@ -52,6 +52,8 @@ import Distribution.Package (PackageDescription, package, showPackageId)
import Distribution.Simple.Utils (setupMessage, rawSystemExit, die)
import Distribution.Simple.GHCPackageConfig (mkGHCPackageConfig, showGHCPackageConfig)
import System(getEnv)
import Control.Monad (when)
-- -----------------------------------------------------------------------------
......@@ -62,13 +64,14 @@ register :: PackageDescription -> LocalBuildInfo
-> IO ()
register pkg_descr lbi userInst = do
setupMessage "Registering" pkg_descr
when userInst (putStrLn "Would install for --user, but not implemented")
case compilerFlavor (compiler lbi) of
GHC -> do let pkg_config = mkGHCPackageConfig pkg_descr lbi
writeFile installedPkgConfigFile (showGHCPackageConfig pkg_config)
home <- getEnv "HOME"
rawSystemExit (compilerPkgTool (compiler lbi))
["--add-package", "--input-file="++installedPkgConfigFile]
(["--add-package", "--input-file="++installedPkgConfigFile]
++ (if userInst then ["--config-file=" ++ home ++ "/.ghc-packages"] else []))
_ -> die ("only registering with GHC is implemented")
installedPkgConfigFile :: String
......
* Code
** Write top-level Setup test cases (like "make check" under the test directory)
** Extensions -> flags interface
** parse pkg.desc
** parse Setup.description
** build (for NHC and Hugs)
** install (for GHC and NHC) - look for .o and .hi, register, etc
......@@ -20,8 +22,8 @@
** clean up Setup parsing code.
** register
** generate InstalledPackageInfo
** read & write config-droppings
*** for hugs & nhc
** configure: check for presence of build dependencies
** ./Setup test
......
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