Commit b1932c34 authored by ijones's avatar ijones
Browse files

install-prefix and friends

* enumerated some imports
* used --install-prefix flag
* implemented conditional register at install time
** breaks install for two reasons:
1) install will try to register
2) register is broken
* Register is broken for three reasons:
1) --user and --system aren't implemented
2) install doesn't put the files in the right place (prefix/lib/package-version)
3) install doesn't put the .hi and .o files in the right place.

But you can still use install-prefix to test.
parent d95f264a
......@@ -47,10 +47,8 @@ module Distribution.Simple (
defaultMain,
) where
-- Base
import System(getArgs)
import Distribution.Package
-- local
import Distribution.Package --must not specify imports, since we're exporting moule.
import Distribution.Setup(parseArgs, Action(..), optionHelpString)
import Distribution.Simple.Build ( build )
......@@ -64,8 +62,13 @@ import Distribution.Simple.Utils (die)
import Distribution.Misc (License(..))
import Distribution.Version (Version(..))
import System.IO
-- Base
import System(getArgs)
import Control.Monad(when)
import Data.Maybe(isNothing)
import Data.List ( intersperse )
import System.IO (hPutStr, stderr)
-- |Reads local build info, executes function
doBuildInstall :: (PackageDescription -> LocalBuildInfo -> IO ()) -- ^function to apply
......@@ -91,10 +94,11 @@ defaultMain pkg_descr
localbuildinfo <- getPersistBuildConfig
build pkg_descr localbuildinfo
Right (InstallCmd _, extra_flags) -> do
Right (InstallCmd install_prefixM, extra_flags) -> do
no_extra_flags extra_flags
localbuildinfo <- getPersistBuildConfig
install pkg_descr localbuildinfo
install pkg_descr localbuildinfo install_prefixM
when (isNothing install_prefixM) (register pkg_descr localbuildinfo)
Right (SDistCmd, extra_flags) -> do
no_extra_flags extra_flags
......
......@@ -17,9 +17,9 @@ module Distribution.Simple.GHCPackageConfig (
showGHCPackageConfig
) where
import Distribution.Package
import Distribution.Simple.Configure
import Distribution.Simple.Install
import Distribution.Package (PackageDescription(..), showPackageId)
import Distribution.Simple.Configure (LocalBuildInfo(..))
import Distribution.Simple.Install (mkImportDir)
import Text.PrettyPrint.HughesPJ
......
......@@ -47,7 +47,7 @@ module Distribution.Simple.Install (
mkImportDir,
) where
import Distribution.Package
import Distribution.Package (PackageDescription(..), showPackageId)
import Distribution.Simple.Configure(LocalBuildInfo(..))
import Distribution.Simple.Utils(setupMessage, moveSources)
......@@ -58,10 +58,14 @@ import System.Exit
-- |FIX: for now, only works with hugs or sdist-style
-- installation... must implement for .hi files and such... how do we
-- know which files to expect?
install :: PackageDescription -> LocalBuildInfo -> IO ()
install pkg_descr lbi = do
install :: PackageDescription -> LocalBuildInfo
-> Maybe FilePath -- ^install-prefix
-> IO ()
install pkg_descr lbi install_prefixM = do
let pref = maybe (prefix lbi) id install_prefixM
setupMessage "Installing" pkg_descr
moveSources (prefix lbi) (allModules pkg_descr) (mainModules pkg_descr)
moveSources pref (allModules pkg_descr) (mainModules pkg_descr)
-- installation step should be performed by caller.
-- -----------------------------------------------------------------------------
-- Installation policies
......
......@@ -14,11 +14,16 @@
** grep for "FIX".
** Get function from hmake that creates a directory based on arch.
** register
** generate InstalledPackageInfo
** read & write config-droppings
** configure: check for presence of build dependencies
** ./Setup test
- this may be something that's easy to break off and give to someone else.
* later todo
** writePersistBuildConfig robustify + diagnostics
** elaborate command-line help text
......
......@@ -3,8 +3,11 @@ all:
clean:
rm *.o setup *.hi
check: all
./setup configure --prefix=/tmp/foo
./setup configure --user --prefix=/tmp/foo
./setup install --install-prefix=/tmp/bar
ls /tmp/bar*
# install w/ register!
./setup install
ls /tmp/foo*
# ls /tmp/foo*
./setup sdist
ls dist
Supports Markdown
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