# Install packages in the right order, so that ghc-pkg doesn't complain.
# Also, install ghc-pkg first.
ifeq "$(Windows)" "NO"
+INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-stage2
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-pkg
else
+INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc-stage2.exe
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif
"$(INSTALLED_GHC_PKG_REAL)" --force --global-conf $(INSTALLED_PACKAGE_CONF) update rts/package.conf.install
$(foreach p, $(PACKAGES) $(PACKAGES_STAGE2),\
"$(GHC_CABAL_INPLACE)" install \
+ $(INSTALLED_GHC_REAL) \
$(INSTALLED_GHC_PKG_REAL) \
- $(INSTALLED_PACKAGE_CONF) \
+ $(DESTDIR)$(topdir) \
libraries/$p dist-install \
'$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries' &&) true
"$(GHC_CABAL_INPLACE)" install \
+ $(INSTALLED_GHC_REAL) \
$(INSTALLED_GHC_PKG_REAL) \
- $(INSTALLED_PACKAGE_CONF) \
+ $(DESTDIR)$(topdir) \
compiler stage2 \
'$(DESTDIR)' '$(prefix)' '$(ghclibdir)' '$(docdir)/html/libraries'
runHaddock distDir dir args'
"check" : dir : [] ->
doCheck dir
- "install" : ghcpkg : ghcpkgconfig : directory : distDir
+ "install" : ghc : ghcpkg : topdir : directory : distDir
: myDestDir : myPrefix : myLibdir : myDocdir : args' ->
- doInstall ghcpkg ghcpkgconfig directory distDir
+ doInstall ghc ghcpkg topdir directory distDir
myDestDir myPrefix myLibdir myDocdir args'
"configure" : args' -> case break (== "--") args' of
(config_args, "--" : distdir : directories) ->
= f pd lbi us flags
doInstall :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath
- -> FilePath -> FilePath -> FilePath -> [String] -> IO ()
-doInstall ghcpkg ghcpkgconf directory distDir myDestDir myPrefix myLibdir myDocdir args
+ -> FilePath -> FilePath -> FilePath -> FilePath -> [String]
+ -> IO ()
+doInstall ghc ghcpkg topdir directory distDir myDestDir myPrefix myLibdir myDocdir args
= withCurrentDirectory directory $ do
defaultMainWithHooksArgs hooks (["copy", "--builddir", distDir]
++ (if null myDestDir then []
docdir = toPathTemplate (myDocdir </> "$pkg"),
htmldir = toPathTemplate "$docdir" }
progs = withPrograms lbi
- prog = ConfiguredProgram {
- programId = programName ghcPkgProgram,
- programVersion = Nothing,
- programArgs = ["--global-conf", ghcpkgconf]
- ++ if not (null myDestDir)
- then ["--force"]
- else [],
- programLocation = UserSpecified ghcpkg
- }
- progs' = updateProgram prog progs
+ ghcProg = ConfiguredProgram {
+ programId = programName ghcProgram,
+ programVersion = Nothing,
+ programArgs = ["-B" ++ topdir],
+ programLocation = UserSpecified ghc
+ }
+ ghcpkgconf = topdir </> "package.conf"
+ ghcPkgProg = ConfiguredProgram {
+ programId = programName ghcPkgProgram,
+ programVersion = Nothing,
+ programArgs = ["--global-conf",
+ ghcpkgconf]
+ ++ if not (null myDestDir)
+ then ["--force"]
+ else [],
+ programLocation = UserSpecified ghcpkg
+ }
+ progs' = updateProgram ghcProg
+ $ updateProgram ghcPkgProg progs
lbi' = lbi {
installDirTemplates = idts',
withPrograms = progs'