Commit ff1a16a0 authored by ian@well-typed.com's avatar ian@well-typed.com

Simplify ghc-cabal

It now consistently takes directory and distDirectory as its first 2
arguments. Also, it only supports configuring 1 package at a time now
(we weren't using the ability to configure more than one at once).
parent b8447a93
......@@ -893,8 +893,8 @@ install_packages: rts/package.conf.install
$(foreach p, $(INSTALL_PACKAGES), \
$(call make-command, \
"$(ghc-cabal_INPLACE)" copy \
"$(STRIP_CMD)" \
$p $(INSTALL_DISTDIR_$p) \
"$(STRIP_CMD)" \
'$(DESTDIR)' \
'$(prefix)' \
'$(ghclibdir)' \
......@@ -903,10 +903,10 @@ install_packages: rts/package.conf.install
$(foreach p, $(INSTALL_PACKAGES), \
$(call make-command, \
"$(ghc-cabal_INPLACE)" register \
$p $(INSTALL_DISTDIR_$p) \
"$(INSTALLED_GHC_REAL)" \
"$(INSTALLED_GHC_PKG_REAL)" \
"$(DESTDIR)$(topdir)" \
$p $(INSTALL_DISTDIR_$p) \
'$(DESTDIR)' \
'$(prefix)' \
'$(ghclibdir)' \
......
......@@ -107,7 +107,7 @@ ifneq "$$($1_NO_CHECK)" "YES"
"$$(ghc-cabal_INPLACE)" check $1
endif
endif
"$$(ghc-cabal_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1
"$$(ghc-cabal_INPLACE)" configure $1 $2 --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS)
ifeq "$$($1_$2_PROG)" ""
ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
$$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config
......
......@@ -45,7 +45,7 @@ ifneq "$$(BINDIST)" "YES"
# so we don't want to expand it yet.
$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$$$(haddock_INPLACE) $$$$(ghc-cabal_INPLACE) $$($1_$2_HS_SRCS) $$$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/.
ifeq "$$(HSCOLOUR_SRCS)" "YES"
"$$(ghc-cabal_INPLACE)" hscolour $2 $1
"$$(ghc-cabal_INPLACE)" hscolour $1 $2
endif
"$$(TOP)/$$(INPLACE_BIN)/haddock" \
--odir="$1/$2/doc/html/$$($1_PACKAGE)" \
......
......@@ -34,26 +34,24 @@ main :: IO ()
main = do hSetBuffering stdout LineBuffering
args <- getArgs
case args of
"hscolour" : distDir : dir : args' ->
runHsColour distDir dir args'
"hscolour" : dir : distDir : args' ->
runHsColour dir distDir args'
"check" : dir : [] ->
doCheck dir
"copy" : strip : directory : distDir
: myDestDir : myPrefix : myLibdir : myDocdir
"copy" : dir : distDir
: strip : myDestDir : myPrefix : myLibdir : myDocdir
: args' ->
doCopy strip directory distDir
myDestDir myPrefix myLibdir myDocdir
doCopy dir distDir
strip myDestDir myPrefix myLibdir myDocdir
args'
"register" : ghc : ghcpkg : topdir : directory : distDir
"register" : dir : distDir : ghc : ghcpkg : topdir
: myDestDir : myPrefix : myLibdir : myDocdir
: relocatableBuild : args' ->
doRegister ghc ghcpkg topdir directory distDir
doRegister dir distDir ghc ghcpkg topdir
myDestDir myPrefix myLibdir myDocdir
relocatableBuild args'
"configure" : args' -> case break (== "--") args' of
(config_args, "--" : distdir : directories) ->
mapM_ (generate config_args distdir) directories
_ -> die syntax_error
"configure" : dir : distDir : config_args ->
generate dir distDir config_args
"sdist" : dir : distDir : [] ->
doSdist dir distDir
["--version"] ->
......@@ -124,7 +122,7 @@ doCheck directory
isFailure _ = True
runHsColour :: FilePath -> FilePath -> [String] -> IO ()
runHsColour distdir directory args
runHsColour directory distdir args
= withCurrentDirectory directory
$ defaultMainArgs ("hscolour" : "--builddir" : distdir : args)
......@@ -132,9 +130,9 @@ doCopy :: FilePath -> FilePath
-> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
-> [String]
-> IO ()
doCopy strip directory distDir
myDestDir myPrefix myLibdir myDocdir
args
doCopy directory distDir
strip myDestDir myPrefix myLibdir myDocdir
args
= withCurrentDirectory directory $ do
let copyArgs = ["copy", "--builddir", distDir]
++ (if null myDestDir
......@@ -182,7 +180,7 @@ doRegister :: FilePath -> FilePath -> FilePath -> FilePath
-> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
-> String -> [String]
-> IO ()
doRegister ghc ghcpkg topdir directory distDir
doRegister directory distDir ghc ghcpkg topdir
myDestDir myPrefix myLibdir myDocdir
relocatableBuildStr args
= withCurrentDirectory directory $ do
......@@ -300,8 +298,8 @@ mangleLbi "compiler" "stage2" lbi
_ -> False
mangleLbi _ _ lbi = lbi
generate :: [String] -> FilePath -> FilePath -> IO ()
generate config_args distdir directory
generate :: FilePath -> FilePath -> [String] -> IO ()
generate directory distdir config_args
= withCurrentDirectory directory
$ do let verbosity = normal
-- XXX We shouldn't just configure with the default flags
......
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