packages feed

Cabal 1.2.1 → 1.2.2.0

raw patch · 14 files changed

+327/−142 lines, 14 files

Files

Cabal.cabal view
@@ -1,5 +1,5 @@ Name: Cabal-Version: 1.2.1+Version: 1.2.2.0 Copyright: 2003-2006, Isaac Jones License: BSD3 License-File: LICENSE@@ -17,7 +17,7 @@         and tools. Category: Distribution Build-Type: Custom--- Even though we do use the default Setup.lhs it's vital to bootstraping+-- Even though we do use the default Setup.lhs it's vital to bootstrapping -- that we build Setup.lhs using our own local Cabal source code.  Extra-Source-Files:@@ -28,15 +28,16 @@  Library   if flag(small_base)-    Build-Depends: base, filepath, pretty, directory, old-time, process, containers+    Build-Depends: base >= 3, pretty, directory, old-time, process, containers   else-    Build-Depends: base, filepath+    Build-Depends: base < 3+  Build-Depends: filepath    if impl(ghc < 6.3)     Build-Depends: unix    GHC-Options: -Wall-  CPP-Options: "-DCABAL_VERSION=1,2,1"+  CPP-Options: "-DCABAL_VERSION=1,2,2,0"   nhc98-Options: -K4M    Exposed-Modules:
Distribution/Simple.hs view
@@ -84,7 +84,9 @@                                           removeRegScripts                                         ) -import Distribution.Simple.Configure(getPersistBuildConfig, maybeGetPersistBuildConfig,+import Distribution.Simple.Configure(getPersistBuildConfig, +                                     maybeGetPersistBuildConfig,+                                     checkPersistBuildConfig,                                      configure, writePersistBuildConfig)  import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), distPref, srcPref)@@ -305,7 +307,7 @@ 			parseConfigureArgs prog_conf flags all_args [scratchDirOpt]                 pbi <- preConf hooks args flags' -                pkg_descr0 <- maybe (confPkgDescr flags') (return . Right) mdescr+                (mb_pd_file, pkg_descr0) <- confPkgDescr flags'                  --    get_pkg_descr (configVerbose flags')                 --let pkg_descr = updatePackageDescription pbi pkg_descr0@@ -314,26 +316,33 @@                 --(warns, ers) <- sanityCheckPackage pkg_descr                 --errorOut (configVerbose flags') warns ers -		localbuildinfo <- confHook hooks epkg_descr flags'+		localbuildinfo0 <- confHook hooks epkg_descr flags' +                -- remember the .cabal filename if we know it+                let localbuildinfo = localbuildinfo0{ pkgDescrFile = mb_pd_file }                 writePersistBuildConfig (foldr id localbuildinfo optFns)                  		let pkg_descr = localPkgDescr localbuildinfo                 postConf hooks args flags' pkg_descr localbuildinfo               where-                confPkgDescr :: ConfigFlags -> IO (Either GenericPackageDescription-                                                          PackageDescription)-                confPkgDescr cfgflags = do-                  mdescr' <- readDesc hooks-                  case mdescr' of-                    Just descr -> return $ Right descr-                    Nothing -> do-                      pdfile <- defaultPackageDesc (configVerbose cfgflags)-                      ppd <- readPackageDescription (configVerbose cfgflags) pdfile-                      return (Left ppd)+                confPkgDescr :: ConfigFlags+                             -> IO (Maybe FilePath,+                                    Either GenericPackageDescription+                                           PackageDescription)+                confPkgDescr cfgflags =+                   case mdescr of+                     Just ppd -> return (Nothing, Right ppd)+                     Nothing  -> do+                       mdescr' <- readDesc hooks+                       case mdescr' of+                         Just descr -> return (Nothing, Right descr)+                         Nothing -> do+                           pdfile <- defaultPackageDesc (configVerbose cfgflags)+                           ppd <- readPackageDescription (configVerbose cfgflags) pdfile+                           return (Just pdfile, Left ppd)              BuildCmd -> do-                lbi <- getPersistBuildConfig+                lbi <- getBuildConfigIfUpToDate                 res@(flags, _, _) <-                   parseBuildArgs prog_conf                                  (emptyBuildFlags (withPrograms lbi)) all_args []@@ -344,22 +353,22 @@             MakefileCmd ->                 command (parseMakefileArgs emptyMakefileFlags) makefileVerbose                         preMakefile makefileHook postMakefile-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              HscolourCmd ->                 command (parseHscolourArgs emptyHscolourFlags) hscolourVerbose                         preHscolour hscolourHook postHscolour-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate                      HaddockCmd ->                  command (parseHaddockArgs emptyHaddockFlags) haddockVerbose                         preHaddock haddockHook postHaddock-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              ProgramaticaCmd -> do                 command parseProgramaticaArgs pfeVerbose                         prePFE pfeHook postPFE-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              CleanCmd -> do                 (flags, _, args) <- parseCleanArgs emptyCleanFlags all_args []@@ -378,12 +387,12 @@             CopyCmd mprefix -> do                 command (parseCopyArgs (emptyCopyFlags mprefix)) copyVerbose                         preCopy copyHook postCopy-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              InstallCmd -> do                 command (parseInstallArgs emptyInstallFlags) installVerbose                         preInst instHook postInst-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              SDistCmd -> do                 (flags, _, args) <- parseSDistArgs all_args []@@ -401,19 +410,19 @@              TestCmd -> do                 (_verbosity,_, args) <- parseTestArgs all_args []-                localbuildinfo <- getPersistBuildConfig+                localbuildinfo <- getBuildConfigIfUpToDate                 let pkg_descr = localPkgDescr localbuildinfo                 runTests hooks args False pkg_descr localbuildinfo              RegisterCmd  -> do                 command (parseRegisterArgs emptyRegisterFlags) regVerbose                         preReg regHook postReg-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              UnregisterCmd -> do                 command (parseUnregisterArgs emptyRegisterFlags) regVerbose                         preUnreg unregHook postUnreg-                        getPersistBuildConfig+                        getBuildConfigIfUpToDate              HelpCmd -> return () -- this is handled elsewhere         where@@ -437,6 +446,14 @@ getModulePaths lbi bi =    fmap concat .       mapM (flip (moduleToFilePath (buildDir lbi : hsSourceDirs bi)) ["hs", "lhs"])++getBuildConfigIfUpToDate :: IO LocalBuildInfo+getBuildConfigIfUpToDate = do+   lbi <- getPersistBuildConfig+   case pkgDescrFile lbi of+     Nothing -> return ()+     Just pkg_descr_file -> checkPersistBuildConfig pkg_descr_file+   return lbi  -- -------------------------------------------------------------------------- -- Programmatica support
Distribution/Simple/Configure.hs view
@@ -44,6 +44,7 @@ module Distribution.Simple.Configure (configure,                                       writePersistBuildConfig,                                       getPersistBuildConfig,+                                      checkPersistBuildConfig,                                       maybeGetPersistBuildConfig, --                                      getConfiguredPkgDescr,                                       localBuildInfoFile,@@ -92,7 +93,7 @@     ( LocalBuildInfo(..), distPref, absoluteInstallDirs     , prefixRelativeInstallDirs ) import Distribution.Simple.Utils-    ( die, warn, info )+    ( die, warn, info, createDirectoryIfMissingVerbose ) import Distribution.Simple.Register     ( removeInstalledConfig ) import Distribution.System@@ -119,7 +120,7 @@ import Data.Maybe     ( fromMaybe, isNothing ) import System.Directory-    ( doesFileExist )+    ( doesFileExist, getModificationTime ) import System.Environment     ( getProgName ) import System.Exit@@ -154,7 +155,9 @@ tryGetPersistBuildConfig :: IO (Either String LocalBuildInfo) tryGetPersistBuildConfig = tryGetConfigStateFile localBuildInfoFile --- |Read the 'localBuildInfoFile'.  Error if it doesn't exist.+-- |Read the 'localBuildInfoFile'.  Error if it doesn't exist.  Also+-- fail if the file containing LocalBuildInfo is older than the .cabal+-- file, indicating that a re-configure is required. getPersistBuildConfig :: IO LocalBuildInfo getPersistBuildConfig = do   lbi <- tryGetPersistBuildConfig@@ -173,11 +176,19 @@   createDirectoryIfMissing False distPref   writeFile localBuildInfoFile (show lbi) +-- |Check that localBuildInfoFile is up-to-date with respect to the+-- .cabal file.+checkPersistBuildConfig :: FilePath -> IO ()+checkPersistBuildConfig pkg_descr_file = do+  t0 <- getModificationTime pkg_descr_file+  t1 <- getModificationTime localBuildInfoFile+  when (t0 > t1) $+    die (pkg_descr_file ++ " has been changed, please re-configure.")+ -- |@dist\/setup-config@ localBuildInfoFile :: FilePath localBuildInfoFile = distPref </> "setup-config" - -- ----------------------------------------------------------------------------- -- * Configuration -- -----------------------------------------------------------------------------@@ -194,6 +205,8 @@ 	setupMessage verbosity "Configuring"                      (either packageDescription id pkg_descr0) +	createDirectoryIfMissingVerbose (lessVerbose verbosity) True distPref+ 	-- detect compiler 	(comp, programsConfig) <- configCompilerAux cfg'         let version = compilerVersion comp@@ -289,6 +302,7 @@ 		    buildDir            = distPref </> "build", 		    scratchDir          = distPref </> "scratch", 		    packageDeps         = dep_pkgs,+                    pkgDescrFile        = Nothing, 		    localPkgDescr       = pkg_descr', 		    withPrograms        = programsConfig'', 		    withVanillaLib      = configVanillaLib cfg,
Distribution/Simple/GHC.hs view
@@ -56,16 +56,17 @@ 				  Executable(..), withExe, Library(..), 				  libModules, hcOptions ) import Distribution.Simple.LocalBuildInfo-				( LocalBuildInfo(..), autogenModulesDir )+				( LocalBuildInfo(..), autogenModulesDir, distPref ) import Distribution.Simple.Utils import Distribution.Package  	( PackageIdentifier(..), showPackageId,                                   parsePackageId ) import Distribution.Simple.Program ( rawSystemProgram, rawSystemProgramConf, 				  rawSystemProgramStdoutConf,+                                  rawSystemProgramStdout, 				  Program(..), ConfiguredProgram(..),                                   ProgramConfiguration, addKnownProgram,                                   userMaybeSpecifyPath, requireProgram,-                                  programPath, lookupProgram,+                                  programPath, lookupProgram, updateProgram,                                   ghcProgram, ghcPkgProgram,                                   arProgram, ranlibProgram, ldProgram ) import Distribution.Simple.Compiler@@ -88,6 +89,7 @@ import System.FilePath          ( (</>), (<.>), takeExtension,                                   takeDirectory, replaceExtension, splitExtension ) import System.IO+import Control.Exception as Exception (catch)  -- System.IO used to export a different try, so we can't use try unqualified #ifndef __NHC__@@ -134,6 +136,25 @@                 } conf''         _ -> conf'' +  -- we need to find out if ld supports the -x flag+  (ldProg, conf'''') <- requireProgram verbosity ldProgram AnyVersion conf'''+  let testfile   = distPref </> "Conftest"+      testfile'  = testfile ++ "2"+  writeFile (testfile <.> "c") "int foo() {}\n"+  rawSystemProgram          verbosity ghcProg ["-c", testfile <.> "c"]+  ldx <-+    (rawSystemProgramStdout verbosity ldProg  ["-x", "-r", testfile  <.> "o",+                                                     "-o", testfile' <.> "o"]+    >> return True) `Exception.catch` \_ -> return False+  mapM_ (try . removeFile) [testfile <.> "c", testfile  <.> "o"+                                            , testfile' <.> "o"]+  let conf''''' = updateProgram ldProg {+                  programArgs = if ldx then ["-x"] else []+		} conf''''+  -- Yeah yeah, so obviously conf''''' is totally rediculious and the program+  -- configuration needs to be in a state monad. That is exactly the plan+  -- (along with some other stuff to give Cabal a better DSL).+   let isSep c = isSpace c || (c == ',')   languageExtensions <-     if ghcVersion >= Version [6,7] []@@ -149,7 +170,7 @@         compilerId             = PackageIdentifier "ghc" ghcVersion,         compilerExtensions     = languageExtensions       }-  return (comp, conf''')+  return (comp, conf''''')  -- | Given something like /usr/local/bin/ghc-6.6.1(.exe) we try and find a -- corresponding ghc-pkg, we try looking for both a versioned and unversioned@@ -259,6 +280,7 @@       runGhcProg = rawSystemProgramConf verbosity ghcProgram (withPrograms lbi)       ifVanillaLib forceVanilla = when (forceVanilla || withVanillaLib lbi)       ifProfLib = when (withProfLib lbi)+      ifSharedLib = when (withSharedLib lbi)       ifGHCiLib = when (withGHCiLib lbi)    -- GHC versions prior to 6.4 didn't have the user package database,@@ -299,9 +321,16 @@                   "-osuf", "p_o"                  ]               ++ ghcProfOptions libBi+          ghcArgsShared = ghcArgs+              ++ ["-dynamic",+                  "-hisuf", "dyn_hi",+                  "-osuf", "dyn_o", "-fPIC"+                 ]+              ++ ghcSharedOptions libBi       unless (null (libModules pkg_descr)) $         do ifVanillaLib forceVanillaLib (runGhcProg ghcArgs)            ifProfLib (runGhcProg ghcArgsProf)+           ifSharedLib (runGhcProg ghcArgsShared)        -- build any C sources       unless (null (cSources libBi)) $ do@@ -310,31 +339,42 @@                                                             filename verbosity                        createDirectoryIfMissingVerbose verbosity True odir                        runGhcProg args+                       ifSharedLib (runGhcProg (args ++ ["-fPIC", "-osuf dyn_o"]))                    | filename <- cSources libBi]        -- link:       info verbosity "Linking..."       let cObjs = map (`replaceExtension` objExtension) (cSources libBi)-          libName  = mkLibName pref (showPackageId (package pkg_descr))-          profLibName  = mkProfLibName pref (showPackageId (package pkg_descr))+	  cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi)+	  libName  = mkLibName pref (showPackageId (package pkg_descr))+	  profLibName  = mkProfLibName pref (showPackageId (package pkg_descr))+	  sharedLibName  = mkSharedLibName pref (showPackageId (package pkg_descr)) (compilerId (compiler lbi)) 	  ghciLibName = mkGHCiLibName pref (showPackageId (package pkg_descr))        stubObjs <- sequence [moduleToFilePath [libTargetDir] (x ++"_stub") [objExtension]                            |  x <- libModules pkg_descr ]  >>= return . concat       stubProfObjs <- sequence [moduleToFilePath [libTargetDir] (x ++"_stub") ["p_" ++ objExtension]                            |  x <- libModules pkg_descr ]  >>= return . concat+      stubSharedObjs <- sequence [moduleToFilePath [libTargetDir] (x ++"_stub") ["dyn_" ++ objExtension]+                           |  x <- libModules pkg_descr ]  >>= return . concat        hObjs     <- getHaskellObjects pkg_descr libBi lbi-			pref objExtension+			pref objExtension True       hProfObjs <-  	if (withProfLib lbi) 		then getHaskellObjects pkg_descr libBi lbi-			pref ("p_" ++ objExtension)+			pref ("p_" ++ objExtension) True 		else return []+      hSharedObjs <-+	if (withSharedLib lbi)+		then getHaskellObjects pkg_descr libBi lbi+			pref ("dyn_" ++ objExtension) False+		else return []        unless (null hObjs && null cObjs && null stubObjs) $ do         Try.try (removeFile libName) -- first remove library if it exists         Try.try (removeFile profLibName) -- first remove library if it exists+        Try.try (removeFile sharedLibName) -- first remove library if it exists 	Try.try (removeFile ghciLibName) -- first remove library if it exists          let arVerbosity | verbosity >= deafening = "v"@@ -353,25 +393,43 @@                 ++ map (pref </>) cObjs                 ++ stubProfObjs 	    ldArgs = ["-r"]-                ++ ["-x"] -- FIXME: only some systems's ld support the "-x" flag 	        ++ ["-o", ghciLibName <.> "tmp"]             ldObjArgs = 		   hObjs                 ++ map (pref </>) cObjs 		++ stubObjs+            ghcSharedObjArgs =+		   hSharedObjs+                ++ map (pref </>) cSharedObjs+		++ stubSharedObjs+	    -- After the relocation lib is created we invoke ghc -shared+	    -- with the dependencies spelled out as -package arguments+	    -- and ghc invokes the linker with the proper library paths+	    ghcSharedLinkArgs =+		[ "-shared",+		  "-dynamic",+		  "-o", sharedLibName ]+		++ ghcSharedObjArgs+		++ ["-package-name", packageId ]+		++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ])+	        ++ ["-l"++extraLib | extraLib <- extraLibs libBi]+	        ++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi] -            runLd args = do-              exists <- doesFileExist ghciLibName-                -- SDM: we always remove ghciLibName above, so isn't this-                -- always False?  What is this stuff for anyway?+            runLd ldLibName args = do+              exists <- doesFileExist ldLibName+	        -- This method is called iteratively by xargs. The+	        -- output goes to <ldLibName>.tmp, and any existing file+	        -- named <ldLibName> is included when linking. The+	        -- output is renamed to <libName>.               rawSystemProgramConf verbosity ldProgram (withPrograms lbi)-                (args ++ if exists then [ghciLibName] else [])-              renameFile (ghciLibName <.> "tmp") ghciLibName+                (args ++ if exists then [ldLibName] else [])+              renameFile (ldLibName <.> "tmp") ldLibName              runAr = rawSystemProgramConf verbosity arProgram (withPrograms lbi)               --TODO: discover this at configure time on unix-            maxCommandLineSize = 30 * 1024+            -- used to be 30k, but Solaris needs 2k (see GHC bug #1785)+            maxCommandLineSize = 2048          ifVanillaLib False $ xargs maxCommandLineSize           runAr arArgs arObjArgs@@ -380,8 +438,10 @@           runAr arProfArgs arProfObjArgs          ifGHCiLib $ xargs maxCommandLineSize-          runLd ldArgs ldObjArgs+          (runLd ghciLibName) ldArgs ldObjArgs +        ifSharedLib $ runGhcProg ghcSharedLinkArgs+   -- build any executables   withExe pkg_descr $ \ (Executable exeName' modPath exeBi) -> do                  info verbosity $ "Building executable: " ++ exeName' ++ "..."@@ -443,9 +503,9 @@ -- when using -split-objs, we need to search for object files in the -- Module_split directory for each module. getHaskellObjects :: PackageDescription -> BuildInfo -> LocalBuildInfo- 	-> FilePath -> String -> IO [FilePath]-getHaskellObjects pkg_descr _ lbi pref wanted_obj_ext-  | splitObjs lbi = do+ 	-> FilePath -> String -> Bool -> IO [FilePath]+getHaskellObjects pkg_descr _ lbi pref wanted_obj_ext allow_split_objs+  | splitObjs lbi && allow_split_objs = do 	let dirs = [ pref </> (dotToSep x ++ "_split")  		   | x <- libModules pkg_descr ] 	objss <- mapM getDirectoryContents dirs@@ -557,7 +617,8 @@   let decls = [         ("modules", unwords (exposedModules lib ++ otherModules bi)),         ("GHC", programPath ghcProg),-        ("WAYS", if withProfLib lbi then "p" else ""),+        ("GHC_VERSION", (showVersion (compilerVersion (compiler lbi)))),+        ("WAYS", (if withProfLib lbi then "p " else "") ++ (if withSharedLib lbi then "dyn" else "")),         ("odir", builddir),         ("srcdir", case hsSourceDirs bi of                         [one] -> one@@ -570,8 +631,13 @@         ("C_SRCS", unwords (cSources bi)),         ("GHC_CC_OPTS", unwords (ghcCcOptions lbi bi (buildDir lbi))),         ("GHCI_LIB", mkGHCiLibName builddir (showPackageId (package pkg_descr))),+        ("soext", dllExtension),+        ("LIB_LD_OPTS", unwords (["-package-name", packageId]+				 ++ concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ]+				 ++ ["-l"++libName | libName <- extraLibs bi]+				 ++ ["-L"++libDir | libDir <- extraLibDirs bi])),         ("AR", programPath arProg),-        ("LD", programPath ldProg)+        ("LD", programPath ldProg ++ concat [" " ++ arg | arg <- programArgs ldProg ])         ]   hPutStrLn h "# DO NOT EDIT!  Automatically generated by Cabal\n"   hPutStrLn h (unlines (map (\(a,b)-> a ++ " = " ++ munge b) decls))@@ -601,24 +667,25 @@  -- |Install for ghc, .hi, .a and, if --with-ghci given, .o installLib    :: Verbosity -- ^verbosity-              -> ProgramConfiguration-              -> Bool      -- ^has vanilla library-              -> Bool      -- ^has profiling library-              -> Bool      -- ^has GHCi libs+              -> LocalBuildInfo               -> FilePath  -- ^install location+              -> FilePath  -- ^install location for dynamic librarys               -> FilePath  -- ^Build location               -> PackageDescription -> IO ()-installLib verbosity programConf hasVanilla hasProf hasGHCi pref buildPref+installLib verbosity lbi pref dynPref buildPref               pd@PackageDescription{library=Just _,                                     package=p}-    = do ifVanilla $ smartCopySources verbosity [buildPref] pref (libModules pd) ["hi"] True False+    = do let programConf = withPrograms lbi+         ifVanilla $ smartCopySources verbosity [buildPref] pref (libModules pd) ["hi"] True False          ifProf $ smartCopySources verbosity [buildPref] pref (libModules pd) ["p_hi"] True False          let libTargetLoc = mkLibName pref (showPackageId p)              profLibTargetLoc = mkProfLibName pref (showPackageId p) 	     libGHCiTargetLoc = mkGHCiLibName pref (showPackageId p)+	     sharedLibTargetLoc = mkSharedLibName dynPref (showPackageId p) (compilerId (compiler lbi))          ifVanilla $ copyFileVerbose verbosity (mkLibName buildPref (showPackageId p)) libTargetLoc          ifProf $ copyFileVerbose verbosity (mkProfLibName buildPref (showPackageId p)) profLibTargetLoc 	 ifGHCi $ copyFileVerbose verbosity (mkGHCiLibName buildPref (showPackageId p)) libGHCiTargetLoc+	 ifShared $ copyFileVerbose verbosity (mkSharedLibName buildPref (showPackageId p) (compilerId (compiler lbi))) sharedLibTargetLoc           -- use ranlib or ar -s to build an index. this is necessary          -- on some systems like MacOS X.  If we can't find those,@@ -632,8 +699,10 @@                                          ifProf $ rawSystemProgram verbosity ar ["-s", profLibTargetLoc]                           Nothing -> setupMessage verbosity "Warning: Unable to generate index for library (missing ranlib and ar)" pd          return ()-    where ifVanilla action = when hasVanilla (action >> return ())-          ifProf action = when hasProf (action >> return ())-	  ifGHCi action = when hasGHCi (action >> return ())-installLib _ _ _ _ _ _ _ PackageDescription{library=Nothing}+    where ifVanilla action = when (withVanillaLib lbi) (action >> return ())+          ifProf action = when (withProfLib lbi) (action >> return ())+          ifGHCi action = when (withGHCiLib lbi) (action >> return ())+          ifShared action = when (withSharedLib lbi) (action >> return ())++installLib _ _ _ _ _ PackageDescription{library=Nothing}     = die $ "Internal Error. installLibGHC called with no library."
Distribution/Simple/GHC/Makefile.hs view
@@ -1,5 +1,5 @@ -- DO NOT EDIT: change Makefile.in, and run ../../../mkGHCMakefile.sh module Distribution.Simple.GHC.Makefile where { makefileTemplate :: String; makefileTemplate=unlines-["# -----------------------------------------------------------------------------","# Makefile template starts here.","","GHC_OPTS += -i$(odir)","","# For adding options on the command-line","GHC_OPTS += $(EXTRA_HC_OPTS)","","WAY_p_OPTS = -prof","","ifneq \"$(way)\" \"\"","way_ := $(way)_","_way := _$(way)","GHC_OPTS += $(WAY_$(way)_OPTS)","GHC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(osuf)","endif","osuf  = $(way_)o","hisuf = $(way_)hi","","HS_OBJS = $(patsubst %,$(odir)/%.$(osuf),$(subst .,/,$(modules)))","HS_IFS  = $(patsubst %,$(odir)/%.$(hisuf),$(subst .,/,$(modules)))","C_OBJS  = $(patsubst %.c,$(odir)/%.$(osuf),$(C_SRCS))","","LIB = $(odir)/libHS$(package)$(_way).a","","RM = rm -f","","# Optionally include local customizations:","-include Makefile.local","","# Rules follow:","","MKSTUBOBJS = find $(odir) -name \"*_stub.$(osuf)\" -print","# HACK ^^^ we tried to use $(wildcard), but apparently it fails due to ","# make using cached directory contents, or something.","","all :: .depend $(LIB)","",".depend : $(MAKEFILE)","\t$(GHC) -M -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(filter-out -split-objs, $(GHC_OPTS)) $(modules)","\tfor dir in $(sort $(foreach mod,$(HS_OBJS) $(C_OBJS),$(dir $(mod)))); do \\","\t\tif test ! -d $$dir; then mkdir -p $$dir; fi \\","\tdone","","include .depend","","ifneq \"$(filter -split-objs, $(GHC_OPTS))\" \"\"","$(LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\t(echo $(C_OBJS) `$(MKSTUBOBJS)`; find $(patsubst %.$(osuf),%_split,$(HS_OBJS)) -name '*.$(way_)o' -print) | xargs -s 30000 $(AR) q $(EXTRA_AR_ARGS) $@ ","else","$(LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\techo $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` | xargs -s 30000 $(AR) q $(EXTRA_AR_ARGS) $@ ","endif","","ifneq \"$(GHCI_LIB)\" \"\"","ifeq \"$(way)\" \"\"","all ::  $(GHCI_LIB)","","$(GHCI_LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\t$(LD) -r -x -o $@ $(EXTRA_LD_OPTS) $(HS_OBJS) `$(MKSTUBOBJS)` $(C_OBJS)","endif","endif","","# suffix rules","","ifneq \"$(odir)\" \"\"","odir_ = $(odir)/","else","odir_ =","endif","","$(odir_)%.$(osuf) : $(srcdir)/%.hs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(srcdir)/%.lhs\t ","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","# The .hs files might be in $(odir) if they were preprocessed","$(odir_)%.$(osuf) : $(odir_)%.hs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(odir_)%.lhs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(srcdir)/%.c","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(osuf) : $(srcdir)/%.$(way_)s","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(osuf) : $(srcdir)/%.S","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(way_)s : $(srcdir)/%.c","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -S $< -o $@","","$(odir_)%.$(osuf)-boot : $(srcdir)/%.hs-boot","\t$(GHC) $(GHC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot","","$(odir_)%.$(osuf)-boot : $(srcdir)/%.lhs-boot","\t$(GHC) $(GHC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot","","%.$(hisuf) : %.$(osuf)","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","%.$(way_)hi-boot : %.$(osuf)-boot","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","$(odir_)%.$(hisuf) : %.$(way_)hc","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","show:","\t@echo '$(VALUE)=\"$($(VALUE))\"'","","clean ::","\t$(RM) $(HS_OBJS) $(C_OBJS) $(LIB) $(GHCI_LIB) $(HS_IFS) .depend","\t$(RM) -rf $(wildcard $(patsubst %.$(osuf), %_split, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %.o-boot, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %.hi-boot, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %_stub.o, $(HS_OBJS)))","","ifneq \"$(strip $(WAYS))\" \"\"","ifeq \"$(way)\" \"\"","all clean ::","# Don't rely on -e working, instead we check exit return codes from sub-makes.","\t@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \\","\tfor i in $(WAYS) ; do \\","\t  echo \"== $(MAKE) way=$$i -f $(MAKEFILE) $@;\"; \\","\t  $(MAKE) way=$$i -f $(MAKEFILE) --no-print-directory $(MFLAGS) $@ ; \\","\t  if [ $$? -eq 0 ] ; then true; else exit $$x_on_err; fi; \\","\tdone","\t@echo \"== Finished recursively making \\`$@' for ways: $(WAYS) ...\"","endif","endif",""]+["# -----------------------------------------------------------------------------","# Makefile template starts here.","","GHC_OPTS += -i$(odir)","","# For adding options on the command-line","GHC_OPTS += $(EXTRA_HC_OPTS)","","WAY_p_OPTS = -prof","WAY_dyn_OPTS = -fPIC -dynamic","WAY_dyn_CC_OPTS = -fPIC","","ifneq \"$(way)\" \"\"","way_ := $(way)_","_way := _$(way)","GHC_OPTS += $(WAY_$(way)_OPTS)","GHC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(osuf)","GHC_CC_OPTS += $(WAY_$(way)_CC_OPTS)","endif","osuf  = $(way_)o","hisuf = $(way_)hi","","HS_OBJS = $(patsubst %,$(odir)/%.$(osuf),$(subst .,/,$(modules)))","HS_IFS  = $(patsubst %,$(odir)/%.$(hisuf),$(subst .,/,$(modules)))","C_OBJS  = $(patsubst %.c,$(odir)/%.$(osuf),$(C_SRCS))","","ifeq \"$(way:%dyn=YES)\" \"YES\"","LIB = $(odir)/libHS$(package)$(_way:%_dyn=%)-ghc$(GHC_VERSION)$(soext)","else","LIB = $(odir)/libHS$(package)$(_way).a","endif","","RM = rm -f","","# Optionally include local customizations:","-include Makefile.local","","# Rules follow:","","MKSTUBOBJS = find $(odir) -name \"*_stub.$(osuf)\" -print","# HACK ^^^ we tried to use $(wildcard), but apparently it fails due to ","# make using cached directory contents, or something.","","all :: $(odir)/.depend $(LIB)","","$(odir)/.depend : $(MAKEFILE)","\t$(GHC) -M -optdep-f -optdep$(odir)/.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(filter-out -split-objs, $(GHC_OPTS)) $(modules)","\tfor dir in $(sort $(foreach mod,$(HS_OBJS) $(C_OBJS),$(dir $(mod)))); do \\","\t\tif test ! -d $$dir; then mkdir -p $$dir; fi \\","\tdone","","include $(odir)/.depend","","ifeq \"$(way:%dyn=YES)\" \"YES\"","$(LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\t$(GHC) -shared -dynamic -o $@ $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` $(LIB_LD_OPTS)","else","ifneq \"$(filter -split-objs, $(GHC_OPTS))\" \"\"","$(LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\t(echo $(C_OBJS) `$(MKSTUBOBJS)`; find $(patsubst %.$(osuf),%_split,$(HS_OBJS)) -name '*.$(way_)o' -print) | xargs $(AR) q $(EXTRA_AR_ARGS) $@ ","else","$(LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\techo $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` | xargs $(AR) q $(EXTRA_AR_ARGS) $@","endif","endif","","ifneq \"$(GHCI_LIB)\" \"\"","ifeq \"$(way)\" \"\"","all ::  $(GHCI_LIB)","","$(GHCI_LIB) : $(HS_OBJS) $(C_OBJS)","\t@$(RM) $@","\t$(LD) -r -o $@ $(EXTRA_LD_OPTS) $(HS_OBJS) `$(MKSTUBOBJS)` $(C_OBJS)","endif","endif","","# suffix rules","","ifneq \"$(odir)\" \"\"","odir_ = $(odir)/","else","odir_ =","endif","","$(odir_)%.$(osuf) : $(srcdir)/%.hs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(srcdir)/%.lhs\t ","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","# The .hs files might be in $(odir) if they were preprocessed","$(odir_)%.$(osuf) : $(odir_)%.hs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(odir_)%.lhs","\t$(GHC) $(GHC_OPTS) -c $< -o $@  -ohi $(basename $@).$(hisuf)","","$(odir_)%.$(osuf) : $(srcdir)/%.c","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(osuf) : $(srcdir)/%.$(way_)s","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(osuf) : $(srcdir)/%.S","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -c $< -o $@","","$(odir_)%.$(way_)s : $(srcdir)/%.c","\t@$(RM) $@","\t$(GHC) $(GHC_CC_OPTS) -S $< -o $@","","$(odir_)%.$(osuf)-boot : $(srcdir)/%.hs-boot","\t$(GHC) $(GHC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot","","$(odir_)%.$(osuf)-boot : $(srcdir)/%.lhs-boot","\t$(GHC) $(GHC_OPTS) -c $< -o $@ -ohi $(basename $@).$(way_)hi-boot","","%.$(hisuf) : %.$(osuf)","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","%.$(way_)hi-boot : %.$(osuf)-boot","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","$(odir_)%.$(hisuf) : %.$(way_)hc","\t@if [ ! -f $@ ] ; then \\","\t    echo Panic! $< exists, but $@ does not.; \\","\t    exit 1; \\","\telse exit 0 ; \\","\tfi","","show:","\t@echo '$(VALUE)=\"$($(VALUE))\"'","","clean ::","\t$(RM) $(HS_OBJS) $(C_OBJS) $(LIB) $(GHCI_LIB) $(HS_IFS) .depend","\t$(RM) -rf $(wildcard $(patsubst %.$(osuf), %_split, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %.o-boot, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %.hi-boot, $(HS_OBJS)))","\t$(RM) $(wildcard $(patsubst %.$(osuf), %_stub.o, $(HS_OBJS)))","","ifneq \"$(strip $(WAYS))\" \"\"","ifeq \"$(way)\" \"\"","all clean ::","# Don't rely on -e working, instead we check exit return codes from sub-makes.","\t@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \\","\tfor i in $(WAYS) ; do \\","\t  echo \"== $(MAKE) way=$$i -f $(MAKEFILE) $@;\"; \\","\t  $(MAKE) way=$$i -f $(MAKEFILE) --no-print-directory $(MFLAGS) $@ ; \\","\t  if [ $$? -eq 0 ] ; then true; else exit $$x_on_err; fi; \\","\tdone","\t@echo \"== Finished recursively making \\`$@' for ways: $(WAYS) ...\"","endif","endif",""] }
Distribution/Simple/GHC/Makefile.in view
@@ -7,12 +7,15 @@ GHC_OPTS += $(EXTRA_HC_OPTS)  WAY_p_OPTS = -prof+WAY_dyn_OPTS = -fPIC -dynamic+WAY_dyn_CC_OPTS = -fPIC  ifneq "$(way)" "" way_ := $(way)_ _way := _$(way) GHC_OPTS += $(WAY_$(way)_OPTS) GHC_OPTS += -hisuf $(way_)hi -hcsuf $(way_)hc -osuf $(osuf)+GHC_CC_OPTS += $(WAY_$(way)_CC_OPTS) endif osuf  = $(way_)o hisuf = $(way_)hi@@ -21,7 +24,11 @@ HS_IFS  = $(patsubst %,$(odir)/%.$(hisuf),$(subst .,/,$(modules))) C_OBJS  = $(patsubst %.c,$(odir)/%.$(osuf),$(C_SRCS)) +ifeq "$(way:%dyn=YES)" "YES"+LIB = $(odir)/libHS$(package)$(_way:%_dyn=%)-ghc$(GHC_VERSION)$(soext)+else LIB = $(odir)/libHS$(package)$(_way).a+endif  RM = rm -f @@ -44,15 +51,21 @@  include $(odir)/.depend +ifeq "$(way:%dyn=YES)" "YES"+$(LIB) : $(HS_OBJS) $(C_OBJS)+	@$(RM) $@+	$(GHC) -shared -dynamic -o $@ $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` $(LIB_LD_OPTS)+else ifneq "$(filter -split-objs, $(GHC_OPTS))" "" $(LIB) : $(HS_OBJS) $(C_OBJS) 	@$(RM) $@-	(echo $(C_OBJS) `$(MKSTUBOBJS)`; find $(patsubst %.$(osuf),%_split,$(HS_OBJS)) -name '*.$(way_)o' -print) | xargs -s 30000 $(AR) q $(EXTRA_AR_ARGS) $@ +	(echo $(C_OBJS) `$(MKSTUBOBJS)`; find $(patsubst %.$(osuf),%_split,$(HS_OBJS)) -name '*.$(way_)o' -print) | xargs $(AR) q $(EXTRA_AR_ARGS) $@  else $(LIB) : $(HS_OBJS) $(C_OBJS) 	@$(RM) $@-	echo $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` | xargs -s 30000 $(AR) q $(EXTRA_AR_ARGS) $@ +	echo $(C_OBJS) $(HS_OBJS) `$(MKSTUBOBJS)` | xargs $(AR) q $(EXTRA_AR_ARGS) $@ endif+endif  ifneq "$(GHCI_LIB)" "" ifeq "$(way)" ""@@ -60,7 +73,7 @@  $(GHCI_LIB) : $(HS_OBJS) $(C_OBJS) 	@$(RM) $@-	$(LD) -r -x -o $@ $(EXTRA_LD_OPTS) $(HS_OBJS) `$(MKSTUBOBJS)` $(C_OBJS)+	$(LD) -r -o $@ $(EXTRA_LD_OPTS) $(HS_OBJS) `$(MKSTUBOBJS)` $(C_OBJS) endif endif 
Distribution/Simple/Haddock.hs view
@@ -53,7 +53,8 @@ import Distribution.ParseUtils(Field(..), readFields, parseCommaList, parseFilePathQ) import Distribution.Simple.Program(ConfiguredProgram(..), requireProgram,                              lookupProgram, programPath, ghcPkgProgram,-			    hscolourProgram, haddockProgram, rawSystemProgram)+			    hscolourProgram, haddockProgram, rawSystemProgram, rawSystemProgramStdoutConf,+          ghcProgram) import Distribution.Simple.PreProcess (ppCpp', ppUnlit, preprocessSources,                                 PPSuffixHandler, runSimplePreProcessor) import Distribution.Simple.Setup@@ -63,7 +64,7 @@                                         substPathTemplate,                                         initialPathTemplateEnv) import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..), hscolourPref,-                                            haddockPref, distPref )+                                            haddockPref, distPref, autogenModulesDir ) import Distribution.Simple.Utils (die, warn, notice, createDirectoryIfMissingVerbose,                                   moduleToFilePath, findFile) @@ -74,12 +75,15 @@ import System.Directory(removeFile, doesFileExist)  import Control.Monad (liftM, when, join)-import Data.Maybe    ( isJust, catMaybes )+import Data.Maybe    ( isJust, catMaybes, fromJust )+import Data.List     (nub)+import Data.Char     (isSpace)  import Distribution.Compat.Directory(removeDirectoryRecursive, copyFile) import System.FilePath((</>), (<.>), splitFileName, splitExtension,                        replaceExtension) import Distribution.Version+import Distribution.Simple.Compiler (compilerVersion, extensionsToFlags)  -- -------------------------------------------------------------------------- -- Haddock support@@ -118,8 +122,9 @@                      then "--hoogle"                      else "--html"     let Just version = programVersion confHaddock-    let have_src_hyperlink_flags = version >= Version [0,8] []-        have_new_flags           = version >  Version [0,8] []+    let have_src_hyperlink_flags = version >= Version [0,8] [] && version < Version [2,0] []+        have_new_flags           = version >  Version [0,8] [] && version < Version [2,0] []+        isVersion2               = version >= Version [2,0] []     let comp = compiler lbi         Just pkgTool = lookupProgram ghcPkgProgram (withPrograms lbi)     let ghcpkgFlags = if have_new_flags@@ -174,6 +179,24 @@      packageFlags <- liftM catMaybes $ mapM makeReadInterface (packageDeps lbi) +    when isVersion2 $ do+      strHadGhcVers <- rawSystemProgramStdoutConf verbosity haddockProgram (withPrograms lbi) ["--ghc-version"]+      let mHadGhcVers = readVersion strHadGhcVers+      when (mHadGhcVers == Nothing) $ die "Could not get GHC version from Haddock"+      when (fromJust mHadGhcVers /= compilerVersion comp) $+        die "Haddock's internal GHC version must match the configured GHC version"++    ghcLibDir0 <- rawSystemProgramStdoutConf verbosity ghcProgram (withPrograms lbi) ["--print-libdir"]+    let ghcLibDir = reverse $ dropWhile isSpace $ reverse ghcLibDir0++    let packageName = if isVersion2+          then ["--optghc=-package-name", "--optghc=" ++ showPkg]+          else ["--package=" ++ showPkg]++    let haddock2options bi = if isVersion2+          then ("-B" ++ ghcLibDir) : map ("--optghc=" ++) (ghcSimpleOptions lbi bi)+          else []+     withLib pkg_descr () $ \lib -> do         let bi = libBuildInfo lib         inFiles <- getModulePaths lbi bi (exposedModules lib ++ otherModules bi)@@ -191,9 +214,9 @@                 ([outputFlag,                   "--odir=" ++ haddockPref pkg_descr,                   "--title=" ++ showPkg ++ subtitle,-                  "--package=" ++ showPkg,                   "--dump-interface=" ++ haddockFile,                   "--prologue=" ++ prologName]+                 ++ packageName                  ++ ghcpkgFlags                  ++ allowMissingHtmlFlags 		 ++ cssFileFlag@@ -201,8 +224,9 @@                  ++ packageFlags                  ++ programArgs confHaddock                  ++ verboseFlags-                 ++ outFiles                  ++ map ("--hide=" ++) (otherModules bi)+                 ++ haddock2options bi+                 ++ outFiles                 )         removeFile prologName         notice verbosity $ "Documentation created: "@@ -232,6 +256,7 @@                  ++ packageFlags                  ++ programArgs confHaddock                  ++ verboseFlags+                 ++ haddock2options bi                  ++ outFiles                 )         removeFile prologName@@ -256,6 +281,18 @@                        return ()         needsCpp :: BuildInfo -> Bool         needsCpp bi = CPP `elem` extensions bi+++ghcSimpleOptions :: LocalBuildInfo -> BuildInfo -> [String]+ghcSimpleOptions lbi bi+  =  ["-hide-all-packages"]+  ++ ["-i" ++ autogenModulesDir lbi]+  ++ ["-i" ++ l | l <- nub (hsSourceDirs bi)]+  ++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ])+  ++ hcOptions GHC (options bi)+  ++ extensionsToFlags c (extensions bi)+  where c = compiler lbi+  -- -------------------------------------------------------------------------- -- hscolour support
Distribution/Simple/Install.hs view
@@ -67,7 +67,7 @@ import Distribution.Package (PackageIdentifier(..)) import Distribution.PackageDescription ( 	PackageDescription(..), BuildInfo(..), Library(..),-	hasLibs, withLib, hasExes, withExe )+	hasLibs, withLib, hasExes, withExe, haddockName ) import Distribution.Simple.LocalBuildInfo (         LocalBuildInfo(..), InstallDirs(..), absoluteInstallDirs, haddockPref) import Distribution.Simple.Utils (createDirectoryIfMissingVerbose,@@ -107,6 +107,7 @@          progdir    = progPref,          docdir     = docPref,          htmldir    = htmlPref,+         interfacedir = interfacePref,          includedir = incPref       } = absoluteInstallDirs pkg_descr lbi copydest   docExists <- doesDirectoryExist $ haddockPref pkg_descr@@ -120,6 +121,14 @@       createDirectoryIfMissingVerbose verbosity True htmlPref       copyDirectoryRecursiveVerbose verbosity (haddockPref pkg_descr) htmlPref       -- setPermissionsRecursive [Read] htmlPref+      -- The haddock interface file actually already got installed+      -- in the recursive copy, but now we install it where we actually+      -- want it to be (normally the same place). We could remove the+      -- copy in htmlPref first.+      createDirectoryIfMissingVerbose verbosity True interfacePref+      copyFileVerbose verbosity+                      (haddockPref pkg_descr </> haddockName pkg_descr)+                      (interfacePref </> haddockName pkg_descr)    let lfile = licenseFile pkg_descr   unless (null lfile) $ do@@ -138,9 +147,7 @@    case compilerFlavor (compiler lbi) of      GHC  -> do withLib pkg_descr () $ \_ ->-                  GHC.installLib verbosity (withPrograms lbi)-                       (withVanillaLib lbi) (withProfLib lbi)-                       (withGHCiLib lbi) libPref buildPref pkg_descr+                  GHC.installLib verbosity lbi libPref dynlibPref buildPref pkg_descr                 withExe pkg_descr $ \_ -> 		  GHC.installExe verbosity binPref buildPref pkg_descr      JHC  -> do withLib pkg_descr () $ JHC.installLib verbosity libPref buildPref pkg_descr
Distribution/Simple/InstallDirs.hs view
@@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}  module Distribution.Simple.InstallDirs (-	InstallDirs(..), haddockdir,+        InstallDirs(..), haddockdir, haddockinterfacedir,         InstallDirTemplates(..),         defaultInstallDirs,         absoluteInstallDirs,@@ -99,16 +99,17 @@ -- unix style systems. -- data InstallDirs dir = InstallDirs {-        prefix     :: dir,-        bindir     :: dir,-        libdir     :: dir,-        dynlibdir  :: dir,-        libexecdir :: dir,-        progdir    :: dir,-        includedir :: dir,-        datadir    :: dir,-        docdir     :: dir,-        htmldir    :: dir+        prefix       :: dir,+        bindir       :: dir,+        libdir       :: dir,+        dynlibdir    :: dir,+        libexecdir   :: dir,+        progdir      :: dir,+        includedir   :: dir,+        datadir      :: dir,+        docdir       :: dir,+        htmldir      :: dir,+        interfacedir :: dir     } deriving (Read, Show)  -- | The installation dirctories in terms of 'PathTemplate's that contain@@ -134,17 +135,18 @@ -- systems which support such things, like Windows. -- data InstallDirTemplates = InstallDirTemplates {-        prefixDirTemplate  :: PathTemplate,-        binDirTemplate     :: PathTemplate,-        libDirTemplate     :: PathTemplate,-        libSubdirTemplate  :: PathTemplate,-        libexecDirTemplate :: PathTemplate,-        progDirTemplate    :: PathTemplate,-        includeDirTemplate :: PathTemplate,-        dataDirTemplate    :: PathTemplate,-        dataSubdirTemplate :: PathTemplate,-        docDirTemplate     :: PathTemplate,-        htmlDirTemplate    :: PathTemplate+        prefixDirTemplate    :: PathTemplate,+        binDirTemplate       :: PathTemplate,+        libDirTemplate       :: PathTemplate,+        libSubdirTemplate    :: PathTemplate,+        libexecDirTemplate   :: PathTemplate,+        progDirTemplate      :: PathTemplate,+        includeDirTemplate   :: PathTemplate,+        dataDirTemplate      :: PathTemplate,+        dataSubdirTemplate   :: PathTemplate,+        docDirTemplate       :: PathTemplate,+        htmlDirTemplate      :: PathTemplate,+        interfaceDirTemplate :: PathTemplate     } deriving (Read, Show)  -- ---------------------------------------------------------------------------@@ -178,24 +180,30 @@         Windows _ -> "$prefix"  </> "doc" </> "$pkgid" 	_other    -> "$datadir" </> "doc" </> "$pkgid"       htmlDir      = "$docdir"  </> "html"+      interfaceDir = "$docdir"  </> "html"   return InstallDirTemplates {-      prefixDirTemplate  = toPathTemplate prefixDir,-      binDirTemplate     = toPathTemplate binDir,-      libDirTemplate     = toPathTemplate libDir,-      libSubdirTemplate  = toPathTemplate libSubdir,-      libexecDirTemplate = toPathTemplate libexecDir,-      progDirTemplate    = toPathTemplate progDir,-      includeDirTemplate = toPathTemplate includeDir,-      dataDirTemplate    = toPathTemplate dataDir,-      dataSubdirTemplate = toPathTemplate dataSubdir,-      docDirTemplate     = toPathTemplate docDir,-      htmlDirTemplate    = toPathTemplate htmlDir+      prefixDirTemplate    = toPathTemplate prefixDir,+      binDirTemplate       = toPathTemplate binDir,+      libDirTemplate       = toPathTemplate libDir,+      libSubdirTemplate    = toPathTemplate libSubdir,+      libexecDirTemplate   = toPathTemplate libexecDir,+      progDirTemplate      = toPathTemplate progDir,+      includeDirTemplate   = toPathTemplate includeDir,+      dataDirTemplate      = toPathTemplate dataDir,+      dataSubdirTemplate   = toPathTemplate dataSubdir,+      docDirTemplate       = toPathTemplate docDir,+      htmlDirTemplate      = toPathTemplate htmlDir,+      interfaceDirTemplate = toPathTemplate interfaceDir     }  haddockdir :: InstallDirs FilePath -> PackageDescription -> FilePath haddockdir installDirs pkg_descr =   htmldir installDirs +haddockinterfacedir :: InstallDirs FilePath -> PackageDescription -> FilePath+haddockinterfacedir installDirs pkg_descr =+  interfacedir installDirs+ -- --------------------------------------------------------------------------- -- Converting directories, absolute or prefix-relative @@ -229,6 +237,8 @@       docDirTemplate     = subst docDirTemplate   $ prefixBinLibVars                              ++ [dataDirVar, dataSubdirVar],       htmlDirTemplate    = subst htmlDirTemplate  $ prefixBinLibVars+                             ++ [dataDirVar, dataSubdirVar, docDirVar],+      interfaceDirTemplate = subst interfaceDirTemplate  $ prefixBinLibVars                              ++ [dataDirVar, dataSubdirVar, docDirVar]     }     -- The initial environment has all the static stuff but no paths@@ -251,16 +261,17 @@                     -> InstallDirTemplates -> InstallDirs FilePath absoluteInstallDirs pkgId compilerId copydest dirs =   InstallDirs {-    prefix     = copy $ path prefixDirTemplate,-    bindir     = copy $ path binDirTemplate,-    libdir     = copy $ path libDirTemplate </> path libSubdirTemplate,-    dynlibdir  = copy $ path libDirTemplate,-    libexecdir = copy $ path libexecDirTemplate,-    progdir    = copy $ path progDirTemplate,-    includedir = copy $ path includeDirTemplate,-    datadir    = copy $ path dataDirTemplate </> path dataSubdirTemplate,-    docdir     = copy $ path docDirTemplate,-    htmldir    = copy $ path htmlDirTemplate+    prefix       = copy $ path prefixDirTemplate,+    bindir       = copy $ path binDirTemplate,+    libdir       = copy $ path libDirTemplate </> path libSubdirTemplate,+    dynlibdir    = copy $ path libDirTemplate,+    libexecdir   = copy $ path libexecDirTemplate,+    progdir      = copy $ path progDirTemplate,+    includedir   = copy $ path includeDirTemplate,+    datadir      = copy $ path dataDirTemplate </> path dataSubdirTemplate,+    docdir       = copy $ path docDirTemplate,+    htmldir      = copy $ path htmlDirTemplate,+    interfacedir = copy $ path interfaceDirTemplate   }   where     dirs' = substituteTemplates pkgId compilerId dirs {@@ -286,16 +297,17 @@                           -> InstallDirs (Maybe FilePath) prefixRelativeInstallDirs pkgId compilerId dirs =   InstallDirs {-    prefix     = relative prefixDirTemplate,-    bindir     = relative binDirTemplate,-    libdir     = (flip fmap) (relative libDirTemplate) (</> path libSubdirTemplate),-    dynlibdir  = (relative libDirTemplate),-    libexecdir = relative libexecDirTemplate,-    progdir    = relative progDirTemplate,-    includedir = relative includeDirTemplate,-    datadir    = (flip fmap) (relative dataDirTemplate) (</> path dataSubdirTemplate),-    docdir     = relative docDirTemplate,-    htmldir    = relative htmlDirTemplate+    prefix       = relative prefixDirTemplate,+    bindir       = relative binDirTemplate,+    libdir       = (flip fmap) (relative libDirTemplate) (</> path libSubdirTemplate),+    dynlibdir    = (relative libDirTemplate),+    libexecdir   = relative libexecDirTemplate,+    progdir      = relative progDirTemplate,+    includedir   = relative includeDirTemplate,+    datadir      = (flip fmap) (relative dataDirTemplate) (</> path dataSubdirTemplate),+    docdir       = relative docDirTemplate,+    htmldir      = relative htmlDirTemplate,+    interfacedir = relative interfaceDirTemplate   }   where     -- substitute the path template into each other, except that we map
Distribution/Simple/LocalBuildInfo.hs view
@@ -87,6 +87,8 @@ 		-- that must be satisfied in terms of version ranges.  This 		-- field fixes those dependencies to the specific versions 		-- available on this machine for this compiler.+        pkgDescrFile  :: Maybe FilePath,+                -- ^ the filename containing the .cabal file, if available         localPkgDescr :: PackageDescription,                 -- ^ The resolved package description, that does not contain                 -- any conditionals.
Distribution/Simple/PreProcess.hs view
@@ -308,7 +308,7 @@     GHC -> ppGhcCpp (cppArgs ++ extraArgs) bi lbi     _   -> ppCpphs  (cppArgs ++ extraArgs) bi lbi -  where cppArgs = sysDefines ++ getCppOptions bi lbi+  where cppArgs = sysDefines ++ cppOptions bi ++ getCppOptions bi lbi         sysDefines =                 ["-D" ++ os ++ "_" ++ loc ++ "_OS" | loc <- locations] ++                 ["-D" ++ arch ++ "_" ++ loc ++ "_ARCH" | loc <- locations]
Distribution/Simple/Program.hs view
@@ -562,7 +562,7 @@       case maybeVersion of         Nothing -> return Nothing 	Just version ->-          withTempFile "." "hsc" $ \hsc -> do+          withTempFile "dist" "hsc" $ \hsc -> do 	    writeFile hsc "" 	    (str, _) <- rawSystemStdout' verbosity path [hsc, "--cflag=--version"] 	    try $ removeFile (dropExtension hsc ++ "_hsc_make.c")
Distribution/Simple/Register.hs view
@@ -62,7 +62,8 @@ #endif  import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), distPref,-                                           InstallDirs(..), haddockdir,+                                           InstallDirs(..),+                                           haddockinterfacedir, haddockdir,                                            InstallDirTemplates(..), 					   absoluteInstallDirs, toPathTemplate) import Distribution.Simple.Compiler (CompilerFlavor(..), Compiler(..),@@ -273,13 +274,18 @@                           htmlDirTemplate    = toPathTemplate (pwd </> distPref </> "doc" </> "html" </> pkgName (package pkg_descr))                         }                       } NoCopyDest-	(absinc,relinc) = partition isAbsolute (includeDirs bi)-	installIncludeDir | null (installIncludes bi) = []-	                  | otherwise = [includedir installDirs]-        haddockDir  | inplace   = haddockdir inplaceDirs pkg_descr-                    | otherwise = haddockdir installDirs pkg_descr-        libraryDir  | inplace   = build_dir-                    | otherwise = libdir installDirs+        (absinc,relinc) = partition isAbsolute (includeDirs bi)+        installIncludeDir | null (installIncludes bi) = []+                          | otherwise = [includedir installDirs]+        haddockInterfaceDir+         | inplace   = haddockinterfacedir inplaceDirs pkg_descr+         | otherwise = haddockinterfacedir installDirs pkg_descr+        haddockDir+         | inplace   = haddockdir inplaceDirs pkg_descr+         | otherwise = haddockdir installDirs pkg_descr+        libraryDir+         | inplace   = build_dir+         | otherwise = libdir installDirs     in     return emptyInstalledPackageInfo{         IPI.package           = package pkg_descr,@@ -309,7 +315,7 @@         IPI.ldOptions         = ldOptions bi,         IPI.frameworkDirs     = [],         IPI.frameworks        = frameworks bi,-	IPI.haddockInterfaces = [haddockDir </> haddockName pkg_descr],+	IPI.haddockInterfaces = [haddockInterfaceDir </> haddockName pkg_descr], 	IPI.haddockHTMLs      = [haddockDir]         } 
Distribution/Simple/Setup.hs view
@@ -141,6 +141,8 @@ 		-- ^installation dir for documentation 	configHtmlDir   :: Maybe FilePath, 		-- ^installation dir for HTML documentation+	configInterfaceDir :: Maybe FilePath,+		-- ^installation dir for haddock interfaces          configVerbose  :: Verbosity,      -- ^verbosity level 	configPackageDB:: PackageDB,	  -- ^ the --user flag?@@ -173,6 +175,7 @@ 	configDataSubDir = Nothing, 	configDocDir = Nothing, 	configHtmlDir = Nothing,+	configInterfaceDir = Nothing,         configVerbose  = normal, 	configPackageDB = GlobalPackageDB, 	configGHCiLib  = True,@@ -302,6 +305,7 @@ 	  | DataSubDir FilePath 	  | DocDir FilePath 	  | HtmlDir FilePath+	  | InterfaceDir FilePath           | ConfigurationsFlags [(String, Bool)]            | ProgramArgs String String   -- program name, arguments@@ -495,6 +499,8 @@ 		"installation directory for documentation", 	   Option "" ["htmldir"] (reqDirArg HtmlDir) 		"installation directory for HTML documentation",+	   Option "" ["interfacedir"] (reqDirArg InterfaceDir)+		"installation directory for haddock interfaces",            Option "" ["enable-library-vanilla"] (NoArg WithVanillaLib)                "Enable vanilla libraries",            Option "" ["disable-library-vanilla"] (NoArg WithoutVanillaLib)@@ -631,6 +637,7 @@         updateCfg t (DataSubDir path)    = t { configDataSubDir = Just path }         updateCfg t (DocDir path)        = t { configDocDir  = Just path }         updateCfg t (HtmlDir path)       = t { configHtmlDir  = Just path }+        updateCfg t (InterfaceDir path)  = t { configInterfaceDir  = Just path }         updateCfg t (Verbose n)          = t { configVerbose  = n }         updateCfg t UserFlag             = t { configPackageDB = UserPackageDB }         updateCfg t GlobalFlag           = t { configPackageDB = GlobalPackageDB }