diff options
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Base.hs | 8 | ||||
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 23 | ||||
-rw-r--r-- | hadrian/src/Rules/Lint.hs | 8 | ||||
-rw-r--r-- | hadrian/src/Rules/Register.hs | 6 | ||||
-rw-r--r-- | hadrian/src/Rules/SourceDist.hs | 4 |
5 files changed, 12 insertions, 37 deletions
diff --git a/hadrian/src/Base.hs b/hadrian/src/Base.hs index 72baba6aaa..623a5bae8b 100644 --- a/hadrian/src/Base.hs +++ b/hadrian/src/Base.hs @@ -28,9 +28,6 @@ module Base ( module Stage, module Way, - -- * Files - configH, - -- * Paths hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, stageBinPath, stageLibPath, templateHscPath, @@ -87,11 +84,6 @@ configFile = configPath -/- "system.config" sourcePath :: FilePath sourcePath = hadrianPath -/- "src" --- TODO: Change @mk/config.h@ to @shake-build/cfg/config.h@. --- | Path to the generated @mk/config.h@ file. -configH :: FilePath -configH = "mk/config.h" - -- | The directory in 'buildRoot' containing the Shake database and other -- auxiliary files generated by Hadrian. shakeFilesDir :: FilePath diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 2c02407d31..b156c9dfdf 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -147,7 +147,8 @@ generatePackageCode context@(Context stage pkg _ _) = do root -/- "**" -/- dir -/- "cmm/AutoApply.cmm" %> \file -> build $ target context GenApply [] [file] let go gen file = generate file (semiEmptyTarget stage) gen - root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> go generateGhcAutoconfH + root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> \_ -> + need . pure =<< pkgSetupConfigFile context root -/- "**" -/- dir -/- "include/ghcplatform.h" %> go generateGhcPlatformH root -/- "**" -/- dir -/- "include/DerivedConstants.h" %> genPlatformConstantsHeader context root -/- "**" -/- dir -/- "include/rts/EventLogConstants.h" %> genEventTypes "--event-types-defines" @@ -486,26 +487,6 @@ generateConfigHs = do stageString (Stage0 GlobalLibs) = error "stageString: StageBoot" --- | Generate @ghcautoconf.h@ header. -generateGhcAutoconfH :: Expr String -generateGhcAutoconfH = do - trackGenerateHs - configHContents <- expr $ mapMaybe undefinePackage <$> readFileLines configH - return . unlines $ - [ "#if !defined(__GHCAUTOCONF_H__)" - , "#define __GHCAUTOCONF_H__" ] - ++ configHContents ++ - [ "#endif /* __GHCAUTOCONF_H__ */" ] - where - undefinePackage s - | "#define PACKAGE_" `isPrefixOf` s - = Just $ "/* #undef " ++ takeWhile (/=' ') (drop 8 s) ++ " */" - | "#define __GLASGOW_HASKELL" `isPrefixOf` s - = Nothing - | "/* REMOVE ME */" == s - = Nothing - | otherwise = Just s - -- | Generate @Version.hs@ files. generateVersionHs :: Expr String generateVersionHs = do diff --git a/hadrian/src/Rules/Lint.hs b/hadrian/src/Rules/Lint.hs index fa279fa836..0928ec02eb 100644 --- a/hadrian/src/Rules/Lint.hs +++ b/hadrian/src/Rules/Lint.hs @@ -11,13 +11,15 @@ lintRules :: Rules () lintRules = do "lint:base" ~> lint base "lint:compiler" ~> lint compiler + + -- Ensure that autoconf scripts, which are usually run by Cabal, are run to + -- avoid depending upon Cabal from the stage0 compiler.. "libraries" -/- "base" -/- "include" -/- "HsBaseConfig.h" %> \_ -> -- ./configure is called here manually because we need to generate -- HsBaseConfig.h, which is created from HsBaseConfig.h.in. ./configure - -- is usually run by Cabal which generates this file but if we do that - -- then hadrian thinks it needs to build the stage0 compiler before - -- attempting to configure. Therefore we just run it directly here. cmd_ (Cwd "libraries/base") "./configure" + "rts" -/- "include" -/- "ghcautoconf.h" %> \_ -> + cmd_ (Cwd "rts") "./configure" lint :: Action () -> Action () lint lintAction = do diff --git a/hadrian/src/Rules/Register.hs b/hadrian/src/Rules/Register.hs index bfd8538cb0..8543576215 100644 --- a/hadrian/src/Rules/Register.hs +++ b/hadrian/src/Rules/Register.hs @@ -48,11 +48,9 @@ configurePackageRules = do when (pkg == rts) $ do -- Rts.h is a header listed in the cabal file, and configuring -- therefore wants to ensure that the header "works" post-configure. - -- But it (transitively) includes these, so we must ensure they exist + -- But it (transitively) includes this, so we must ensure it exists -- for that check to work. - need [ buildP -/- "include/ghcautoconf.h" - , buildP -/- "include/ghcplatform.h" - ] + need [buildP -/- "include/ghcplatform.h"] Cabal.configurePackage ctx root -/- "**/autogen/cabal_macros.h" %> \out -> do diff --git a/hadrian/src/Rules/SourceDist.hs b/hadrian/src/Rules/SourceDist.hs index 598b6fdcc9..640b06a47d 100644 --- a/hadrian/src/Rules/SourceDist.hs +++ b/hadrian/src/Rules/SourceDist.hs @@ -142,7 +142,9 @@ prepareTree dest = do moveFile (dest -/- "boot") (dest -/- "boot.source") bootFiles = - [ pkgPath process -/- "include" -/- "HsProcessConfig.h.in" + [ pkgPath rts -/- "configure" + , pkgPath rts -/- "ghcautoconf.h.autoconf.in" + , pkgPath process -/- "include" -/- "HsProcessConfig.h.in" , pkgPath process -/- "configure" , pkgPath ghcBignum -/- "configure" , pkgPath base -/- "configure" |