diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/compare_sizes/ghc.mk | 1 | ||||
-rw-r--r-- | utils/genapply/ghc.mk | 1 | ||||
-rw-r--r-- | utils/genprimopcode/ghc.mk | 1 | ||||
-rw-r--r-- | utils/ghc-cabal/Main.hs | 134 | ||||
-rw-r--r-- | utils/ghc-cabal/ghc.mk | 1 | ||||
-rw-r--r-- | utils/ghc-pwd/ghc.mk | 2 | ||||
-rw-r--r-- | utils/ghctags/ghc.mk | 9 | ||||
-rw-r--r-- | utils/hp2ps/ghc.mk | 15 | ||||
-rw-r--r-- | utils/hpc/ghc.mk | 7 | ||||
-rw-r--r-- | utils/mkUserGuidePart/ghc.mk | 9 | ||||
-rw-r--r-- | utils/runghc/ghc.mk | 1 | ||||
-rw-r--r-- | utils/unlit/ghc.mk | 1 |
12 files changed, 119 insertions, 63 deletions
diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk index 5e48299646..7a7142c19b 100644 --- a/utils/compare_sizes/ghc.mk +++ b/utils/compare_sizes/ghc.mk @@ -3,6 +3,7 @@ utils/compare_sizes_USES_CABAL = YES utils/compare_sizes_PACKAGE = compareSizes utils/compare_sizes_MODULES = Main utils/compare_sizes_dist-install_PROG = compareSizes$(exeext) +utils/compare_sizes_dist-install_INSTALL_INPLACE = NO $(eval $(call build-prog,utils/compare_sizes,dist-install,1)) diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk index 4f78bc9600..805fd6f697 100644 --- a/utils/genapply/ghc.mk +++ b/utils/genapply/ghc.mk @@ -12,6 +12,7 @@ utils/genapply_dist_MODULES = GenApply utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM) +utils/genapply_dist_INSTALL_INPLACE = YES utils/genapply_HC_OPTS += -package pretty diff --git a/utils/genprimopcode/ghc.mk b/utils/genprimopcode/ghc.mk index 5cbf82e831..d119d8dfb3 100644 --- a/utils/genprimopcode/ghc.mk +++ b/utils/genprimopcode/ghc.mk @@ -13,5 +13,6 @@ utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM) utils/genprimopcode_dist_HC_OPTS = -package array +utils/genprimopcode_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/genprimopcode,dist,0)) diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 3e43800a78..58ab921c45 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -37,12 +37,18 @@ main = do hSetBuffering stdout LineBuffering runHsColour distDir dir args' "check" : dir : [] -> doCheck dir - "install" : ghc : ghcpkg : strip : topdir : directory : distDir - : myDestDir : myPrefix : myLibdir : myDocdir - : relocatableBuild : args' -> - doInstall ghc ghcpkg strip topdir directory distDir - myDestDir myPrefix myLibdir myDocdir - relocatableBuild args' + "copy" : strip : directory : distDir + : myDestDir : myPrefix : myLibdir : myDocdir + : args' -> + doCopy strip directory distDir + myDestDir myPrefix myLibdir myDocdir + args' + "register" : ghc : ghcpkg : topdir : directory : distDir + : myDestDir : myPrefix : myLibdir : myDocdir + : relocatableBuild : args' -> + doRegister ghc ghcpkg topdir directory distDir + myDestDir myPrefix myLibdir myDocdir + relocatableBuild args' "configure" : args' -> case break (== "--") args' of (config_args, "--" : distdir : directories) -> mapM_ (generate config_args distdir) directories @@ -121,37 +127,26 @@ runHsColour distdir directory args = withCurrentDirectory directory $ defaultMainArgs ("hscolour" : "--builddir" : distdir : args) -doInstall :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> String -> [String] - -> IO () -doInstall ghc ghcpkg strip topdir directory distDir +doCopy :: FilePath -> FilePath + -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath + -> [String] + -> IO () +doCopy strip directory distDir myDestDir myPrefix myLibdir myDocdir - relocatableBuildStr args + args = withCurrentDirectory directory $ do - relocatableBuild <- case relocatableBuildStr of - "YES" -> return True - "NO" -> return False - _ -> die ["Bad relocatableBuildStr: " ++ - show relocatableBuildStr] let copyArgs = ["copy", "--builddir", distDir] ++ (if null myDestDir then [] else ["--destdir", myDestDir]) ++ args - regArgs = "register" : "--builddir" : distDir : args copyHooks = userHooks { copyHook = noGhcPrimHook $ modHook False $ copyHook userHooks } - regHooks = userHooks { - regHook = modHook relocatableBuild - $ regHook userHooks - } defaultMainWithHooksArgs copyHooks copyArgs - defaultMainWithHooksArgs regHooks regArgs where noGhcPrimHook f pd lbi us flags = let pd' @@ -168,23 +163,46 @@ doInstall ghc ghcpkg strip topdir directory distDir in f pd' lbi us flags modHook relocatableBuild f pd lbi us flags = do let verbosity = normal - idts = installDirTemplates lbi - idts' = idts { - prefix = toPathTemplate $ - if relocatableBuild - then "$topdir" - else myPrefix, - libdir = toPathTemplate $ - if relocatableBuild - then "$topdir" - else myLibdir, - libsubdir = toPathTemplate "$pkgid", - docdir = toPathTemplate $ - if relocatableBuild - then "$topdir/../doc/html/libraries/$pkgid" - else (myDocdir </> "$pkgid"), - htmldir = toPathTemplate "$docdir" - } + idts = updateInstallDirTemplates relocatableBuild + myPrefix myLibdir myDocdir + (installDirTemplates lbi) + progs = withPrograms lbi + stripProgram' = stripProgram { + programFindLocation = \_ -> return (Just strip) } + + progs' <- configureProgram verbosity stripProgram' progs + let lbi' = lbi { + withPrograms = progs', + installDirTemplates = idts + } + f pd lbi' us flags + +doRegister :: FilePath -> FilePath -> FilePath -> FilePath + -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath + -> String -> [String] + -> IO () +doRegister ghc ghcpkg topdir directory distDir + myDestDir myPrefix myLibdir myDocdir + relocatableBuildStr args + = withCurrentDirectory directory $ do + relocatableBuild <- case relocatableBuildStr of + "YES" -> return True + "NO" -> return False + _ -> die ["Bad relocatableBuildStr: " ++ + show relocatableBuildStr] + let regArgs = "register" : "--builddir" : distDir : args + regHooks = userHooks { + regHook = modHook relocatableBuild + $ regHook userHooks + } + + defaultMainWithHooksArgs regHooks regArgs + where + modHook relocatableBuild f pd lbi us flags + = do let verbosity = normal + idts = updateInstallDirTemplates relocatableBuild + myPrefix myLibdir myDocdir + (installDirTemplates lbi) progs = withPrograms lbi ghcpkgconf = topdir </> "package.conf.d" ghcProgram' = ghcProgram { @@ -194,11 +212,9 @@ doInstall ghc ghcpkg strip topdir directory distDir programPostConf = \_ _ -> return $ ["--global-package-db", ghcpkgconf] ++ ["--force" | not (null myDestDir) ], programFindLocation = \_ -> return (Just ghcpkg) } - stripProgram' = stripProgram { - programFindLocation = \_ -> return (Just strip) } configurePrograms ps conf = foldM (flip (configureProgram verbosity)) conf ps - progs' <- configurePrograms [ghcProgram', ghcPkgProgram', stripProgram'] progs + progs' <- configurePrograms [ghcProgram', ghcPkgProgram'] progs let Just ghcPkgProg = lookupProgram ghcPkgProgram' progs' instInfos <- dump verbosity ghcPkgProg GlobalPackageDB let installedPkgs' = PackageIndex.fromList instInfos @@ -215,11 +231,32 @@ doInstall ghc ghcpkg strip topdir directory distDir lbi' = lbi { libraryConfig = mlc', installedPkgs = installedPkgs', - installDirTemplates = idts', + installDirTemplates = idts, withPrograms = progs' } f pd lbi' us flags +updateInstallDirTemplates :: Bool -> FilePath -> FilePath -> FilePath + -> InstallDirTemplates + -> InstallDirTemplates +updateInstallDirTemplates relocatableBuild myPrefix myLibdir myDocdir idts + = idts { + prefix = toPathTemplate $ + if relocatableBuild + then "$topdir" + else myPrefix, + libdir = toPathTemplate $ + if relocatableBuild + then "$topdir" + else myLibdir, + libsubdir = toPathTemplate "$pkgid", + docdir = toPathTemplate $ + if relocatableBuild + then "$topdir/../doc/html/libraries/$pkgid" + else (myDocdir </> "$pkgid"), + htmldir = toPathTemplate "$docdir" + } + -- The packages are built with the package ID ending in "-inplace", but -- when they're installed they get the package hash appended. We need to -- fix up the package deps so that they use the hash package IDs, not @@ -331,8 +368,12 @@ generate config_args distdir directory dep_ids = map snd (externalPackageDeps lbi) + let libraryDirs = forDeps Installed.libraryDirs wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs - wrappedLibraryDirs <- wrap $ forDeps Installed.libraryDirs + wrappedLibraryDirs <- wrap libraryDirs + let depDynlibDirName d = display (Installed.sourcePackageId d) + rpaths = map (\d -> "'$$ORIGIN/../" ++ depDynlibDirName d ++ "'") + dep_pkgs let variablePrefix = directory ++ '_':distdir let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), @@ -342,6 +383,7 @@ generate config_args distdir directory variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi), variablePrefix ++ "_DEPS = " ++ unwords (map display dep_ids), variablePrefix ++ "_DEP_NAMES = " ++ unwords (map (display . packageName) dep_ids), + variablePrefix ++ "_RPATHS = " ++ unwords rpaths, variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi), variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi), variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi), @@ -364,6 +406,7 @@ generate config_args distdir directory variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, + variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), @@ -388,5 +431,6 @@ generate config_args distdir directory | head s == ' ' = die ["Leading space in value to be wrapped:", s] | last s == ' ' = die ["Trailing space in value to be wrapped:", s] | otherwise = return ("\'" ++ s ++ "\'") + mkSearchPath = intercalate [searchPathSeparator] boolToYesNo True = "YES" boolToYesNo False = "NO" diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 0a3e920e7a..ae1a213122 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -55,6 +55,7 @@ $(GHC_CABAL_DIR)_PACKAGE = ghc-cabal $(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext) $(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO $(GHC_CABAL_DIR)_dist-install_MODULES = Main +$(GHC_CABAL_DIR)_dist-install_MORE_HC_OPTS = -static $(eval $(call build-prog,utils/ghc-cabal,dist-install,1)) diff --git a/utils/ghc-pwd/ghc.mk b/utils/ghc-pwd/ghc.mk index 5efe3b8fdf..f2feef4f52 100644 --- a/utils/ghc-pwd/ghc.mk +++ b/utils/ghc-pwd/ghc.mk @@ -1,7 +1,9 @@ utils/ghc-pwd_USES_CABAL = YES utils/ghc-pwd_PACKAGE = ghc-pwd +utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext) +utils/ghc-pwd_dist-install_MORE_HC_OPTS += -static $(eval $(call build-prog,utils/ghc-pwd,dist-install,1)) diff --git a/utils/ghctags/ghc.mk b/utils/ghctags/ghc.mk index 73a520157c..b167a3c069 100644 --- a/utils/ghctags/ghc.mk +++ b/utils/ghctags/ghc.mk @@ -10,8 +10,9 @@ # # ----------------------------------------------------------------------------- -utils/ghctags_dist-install_MODULES = Main -utils/ghctags_dist-install_HC_OPTS = -package ghc -utils/ghctags_dist-install_INSTALL = NO -utils/ghctags_dist-install_PROG = ghctags$(exeext) +utils/ghctags_dist-install_MODULES = Main +utils/ghctags_dist-install_HC_OPTS = -package ghc +utils/ghctags_dist-install_INSTALL = NO +utils/ghctags_dist-install_INSTALL_INPLACE = YES +utils/ghctags_dist-install_PROG = ghctags$(exeext) $(eval $(call build-prog,utils/ghctags,dist-install,2)) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index 30a9d05658..59791c840d 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -10,14 +10,15 @@ # # ----------------------------------------------------------------------------- -utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ - Reorder.c TopTwenty.c AuxFile.c Deviation.c \ - HpFile.c Marks.c Scale.c TraceElement.c \ - Axes.c Dimensions.c Key.c PsFile.c Shade.c \ - Utilities.c +utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ + Reorder.c TopTwenty.c AuxFile.c Deviation.c \ + HpFile.c Marks.c Scale.c TraceElement.c \ + Axes.c Dimensions.c Key.c PsFile.c Shade.c \ + Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROG = hp2ps$(exeext) -utils/hp2ps_dist_INSTALL = YES +utils/hp2ps_dist_PROG = hp2ps$(exeext) +utils/hp2ps_dist_INSTALL = YES +utils/hp2ps_dist_INSTALL_INPLACE = YES utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) diff --git a/utils/hpc/ghc.mk b/utils/hpc/ghc.mk index 9a8f8ad54e..2485e1639d 100644 --- a/utils/hpc/ghc.mk +++ b/utils/hpc/ghc.mk @@ -13,7 +13,8 @@ utils/hpc_dist-install_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer \ HpcMarkup HpcOverlay HpcParser HpcReport \ HpcShowTix HpcUtils -utils/hpc_dist-install_HC_OPTS = -cpp -package hpc -utils/hpc_dist-install_INSTALL = YES -utils/hpc_dist-install_PROG = hpc$(exeext) +utils/hpc_dist-install_HC_OPTS = -cpp -package hpc +utils/hpc_dist-install_INSTALL = YES +utils/hpc_dist-install_INSTALL_INPLACE = YES +utils/hpc_dist-install_PROG = hpc$(exeext) $(eval $(call build-prog,utils/hpc,dist-install,1)) diff --git a/utils/mkUserGuidePart/ghc.mk b/utils/mkUserGuidePart/ghc.mk index fa96769249..ff917848a1 100644 --- a/utils/mkUserGuidePart/ghc.mk +++ b/utils/mkUserGuidePart/ghc.mk @@ -10,10 +10,11 @@ # # ----------------------------------------------------------------------------- -utils/mkUserGuidePart_dist_MODULES = Main -utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) -utils/mkUserGuidePart_HC_OPTS = -package ghc +utils/mkUserGuidePart_dist_MODULES = Main +utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) +utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES +utils/mkUserGuidePart_HC_OPTS = -package ghc -static -utils/mkUserGuidePart/dist/build/Main.o: $(ALL_STAGE1_LIBS) $(compiler_stage2_v_LIB) +utils/mkUserGuidePart/dist/build/Main.o: $(ALL_STAGE1_LIBS) $(compiler_stage2_PROGRAM_DEP_LIB) $(eval $(call build-prog,utils/mkUserGuidePart,dist,1)) diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk index 6ff84f0c62..0c045b4e2b 100644 --- a/utils/runghc/ghc.mk +++ b/utils/runghc/ghc.mk @@ -15,6 +15,7 @@ utils/runghc_dist-install_USES_CABAL = YES utils/runghc_dist-install_PROG = runghc$(exeext) utils/runghc_dist-install_SHELL_WRAPPER = YES utils/runghc_dist-install_INSTALL = YES +utils/runghc_dist-install_INSTALL_INPLACE = YES utils/runghc_dist-install_INSTALL_SHELL_WRAPPER_NAME = runghc-$(ProjectVersion) utils/runghc_dist-install_EXTRA_HC_OPTS = -cpp -DVERSION="\"$(ProjectVersion)\"" diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk index f46c3b32ad..1bdf4a07b6 100644 --- a/utils/unlit/ghc.mk +++ b/utils/unlit/ghc.mk @@ -14,6 +14,7 @@ utils/unlit_dist_C_SRCS = unlit.c utils/unlit_dist_PROG = $(GHC_UNLIT_PGM) utils/unlit_dist_TOPDIR = YES utils/unlit_dist_INSTALL = YES +utils/unlit_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/unlit,dist,0)) |