diff options
author | Ian Lynagh <igloo@earth.li> | 2008-07-11 21:16:15 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-07-11 21:16:15 +0000 |
commit | e7d5df5d11379fb95ffd980b56a97ee143720d6a (patch) | |
tree | 3c976d04688110de82852a6ebafa0fe28de58512 /libraries | |
parent | 2a150d4b7d9b6cb7cca96b10749f406128ca57b6 (diff) | |
download | haskell-e7d5df5d11379fb95ffd980b56a97ee143720d6a.tar.gz |
Move installPackage out into its own cabal package under utils/
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/Makefile | 21 | ||||
-rw-r--r-- | libraries/installPackage.hs | 134 |
2 files changed, 4 insertions, 151 deletions
diff --git a/libraries/Makefile b/libraries/Makefile index d5d1e82b3e..1fe8bc09a3 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -185,14 +185,6 @@ bootstrapping.conf: cabal-bin cd hpc && $(CABAL) install --distpref=dist-bootstrapping --inplace mv $@.tmp $@ -installPackage/installPackage: installPackage.hs - -$(RM) -rf installPackage - mkdir installPackage - $(CP) installPackage.hs installPackage/ - cd installPackage && $(FPTOOLS_TOP_ABS)/compiler/stage1/ghc-inplace \ - --make installPackage -o installPackage \ - $(DEPLOYMENT_OPTS) - ifBuildable/ifBuildable: ifBuildable.hs -$(RM) -rf ifBuildable mkdir ifBuildable @@ -223,8 +215,7 @@ remake.library.%: clean.library.% make.library.% # NB. we're depending on make chasing dependencies from left to right here. # This bit goes wrong with 'make -j'. -build: $(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)) \ - installPackage/installPackage +build: $(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)) configure: $(foreach SUBDIR,$(SUBDIRS), \ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).$(SUBDIR)) @@ -330,7 +321,6 @@ clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR)) $(RM) -f bootstrapping.conf.tmp bootstrapping.conf.tmp.old $(RM) -f cabal-bin cabal-bin.exe $(RM) -rf ifBuildable - $(RM) -rf installPackage $(RM) -f libraries.txt index.html doc-index.html doc-index*.html $(RM) -f haddock* *.gif @@ -375,20 +365,17 @@ install-docs: # overridden when installing a bindist. $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \ -install.library.%: installPackage/installPackage ifBuildable/ifBuildable +install.library.%: ifBuildable/ifBuildable if $(IFBUILDABLE) $*; then \ cd $* && \ - $(FPTOOLS_TOP_ABS)/libraries/installPackage/installPackage install '$(GHC_PKG_PROG)' '$(DESTDIR)$(libdir)/package.conf' '$(DESTDIR)' '$(prefix)' '$(iprefix)' '$(ibindir)' '$(ilibdir)' '$(ilibexecdir)' '$(idynlibdir)' '$(idatadir)' '$(idocdir)' '$(ihtmldir)' '$(ihaddockdir)' ; \ + $(FPTOOLS_TOP_ABS)/utils/installPackage/install-inplace/bin/installPackage install '$(GHC_PKG_PROG)' '$(DESTDIR)$(libdir)/package.conf' '$(DESTDIR)' '$(prefix)' '$(iprefix)' '$(ibindir)' '$(ilibdir)' '$(ilibexecdir)' '$(idynlibdir)' '$(idatadir)' '$(idocdir)' '$(ihtmldir)' '$(ihaddockdir)' ; \ fi .PHONY: binary-dist binary-dist.library.% BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries -binary-dist: $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR)) \ - installPackage/installPackage - mkdir $(BIN_DIST_LIBDIR)/installPackage - cp installPackage/installPackage $(BIN_DIST_LIBDIR)/installPackage +binary-dist: $(foreach SUBDIR,$(SUBDIRS),binary-dist.library.$(SUBDIR)) mkdir $(BIN_DIST_LIBDIR)/ifBuildable cp ifBuildable/ifBuildable $(BIN_DIST_LIBDIR)/ifBuildable cp Makefile $(BIN_DIST_LIBDIR) diff --git a/libraries/installPackage.hs b/libraries/installPackage.hs deleted file mode 100644 index 65eab5664b..0000000000 --- a/libraries/installPackage.hs +++ /dev/null @@ -1,134 +0,0 @@ - -import Data.Maybe -import Distribution.PackageDescription -import Distribution.PackageDescription.Parse -import Distribution.ReadE -import Distribution.Simple -import Distribution.Simple.Configure -import Distribution.Simple.LocalBuildInfo -import Distribution.Simple.Program -import Distribution.Simple.Setup -import Distribution.Simple.Utils -import Distribution.Text -import Distribution.Verbosity -import System.Environment - --- XXX This will need to be changed -distPref :: FilePath -distPref = defaultDistPref - -main :: IO () -main - = do args <- getArgs - case args of - "install" : ghcpkg : ghcpkgconf : destdir : topdir : - iprefix : ibindir : ilibdir : ilibexecdir : idynlibdir : - idatadir : idocdir : ihtmldir : ihaddockdir : - args' -> - let verbosity = mkVerbosity args' - in doInstall verbosity ghcpkg ghcpkgconf destdir topdir - iprefix ibindir ilibdir ilibexecdir idynlibdir idatadir - idocdir ihtmldir ihaddockdir - _ -> - error ("Bad arguments: " ++ show args) - -mkVerbosity :: [String] -> Verbosity -mkVerbosity [] = normal -mkVerbosity ['-':'v':v] = readEOrFail flagToVerbosity v -mkVerbosity args = error ("Bad arguments: " ++ show args) - -doInstall :: Verbosity -> FilePath -> FilePath -> FilePath -> FilePath - -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> FilePath -> FilePath -> FilePath -> FilePath - -> IO () -doInstall verbosity ghcpkg ghcpkgconf destdir topdir - iprefix ibindir ilibdir ilibexecdir idynlibdir idatadir - idocdir ihtmldir ihaddockdir = - do let userHooks = simpleUserHooks - copyto = if null destdir then NoCopyDest else CopyTo destdir - copyFlags = defaultCopyFlags { - copyDest = toFlag copyto, - copyVerbosity = toFlag verbosity - } - registerFlags = defaultRegisterFlags { - regPackageDB = toFlag GlobalPackageDB, - regVerbosity = toFlag verbosity, - regGenScript = toFlag $ False, - regInPlace = toFlag $ False - } - lbi <- getConfig verbosity - let pd = localPkgDescr lbi - i = installDirTemplates lbi - -- This is an almighty hack. We need to register - -- ghc-prim:GHC.Prim, but it doesn't exist, get built, get - -- haddocked, get copied, etc. - pd_reg = if packageName pd == PackageName "ghc-prim" - then case library pd of - Just lib -> - let ems = fromJust (simpleParse "GHC.Prim") - : exposedModules lib - lib' = lib { exposedModules = ems } - in pd { library = Just lib' } - Nothing -> - error "Expected a library, but none found" - else pd - -- When coying, we need to actually give a concrete - -- directory to copy to rather than "$topdir" - toPathTemplate' = toPathTemplate . replaceTopdir topdir - i_copy = i { prefix = toPathTemplate' iprefix, - bindir = toPathTemplate' ibindir, - libdir = toPathTemplate' ilibdir, - dynlibdir = toPathTemplate' idynlibdir, - libexecdir = toPathTemplate' ilibexecdir, - datadir = toPathTemplate' idatadir, - docdir = toPathTemplate' idocdir, - htmldir = toPathTemplate' ihtmldir, - haddockdir = toPathTemplate' ihaddockdir - } - lbi_copy = lbi { installDirTemplates = i_copy } - -- When we run GHC we give it a $topdir that includes the - -- $compiler/lib/ part of libsubdir, so we only want the - -- $pkgid part in the package.conf file. This is a bit of - -- a hack, really. - progs = withPrograms lbi - prog = ConfiguredProgram { - programId = programName ghcPkgProgram, - programVersion = Nothing, - programArgs = ["--force", "--global-conf", ghcpkgconf], - programLocation = UserSpecified ghcpkg - } - progs' = updateProgram prog progs - i_reg = i { prefix = toPathTemplate iprefix, - bindir = toPathTemplate ibindir, - libdir = toPathTemplate ilibdir, - dynlibdir = toPathTemplate idynlibdir, - libexecdir = toPathTemplate ilibexecdir, - datadir = toPathTemplate idatadir, - docdir = toPathTemplate idocdir, - htmldir = toPathTemplate ihtmldir, - haddockdir = toPathTemplate ihaddockdir - } - lbi_reg = lbi { installDirTemplates = i_reg, - withPrograms = progs' } - (copyHook simpleUserHooks) pd lbi_copy userHooks copyFlags - (regHook simpleUserHooks) pd_reg lbi_reg userHooks registerFlags - return () - -replaceTopdir :: FilePath -> FilePath -> FilePath -replaceTopdir topdir ('$':'t':'o':'p':'d':'i':'r':p) = topdir ++ p -replaceTopdir topdir ('$':'h':'t':'t':'p':'t':'o':'p':'d':'i':'r':p) - = topdir ++ p -replaceTopdir _ p = p - --- Get the build info, merging the setup-config and buildinfo files. -getConfig :: Verbosity -> IO LocalBuildInfo -getConfig verbosity = do - lbi <- getPersistBuildConfig distPref - maybe_infoFile <- defaultHookedPackageDesc - case maybe_infoFile of - Nothing -> return lbi - Just infoFile -> do - hbi <- readHookedBuildInfo verbosity infoFile - return lbi { localPkgDescr = updatePackageDescription hbi (localPkgDescr lbi)} - - |