diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2021-06-13 16:02:06 +0530 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-21 11:18:58 +0000 |
commit | 7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6 (patch) | |
tree | 9e6ff5ac7982e9d22987f551a531d0f034ec942c | |
parent | 2f0ceecc42789558c648c6dcff431d3c8ac3aa46 (diff) | |
download | haskell-7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6.tar.gz |
Reinstallable GHC
This patch allows ghc and its dependencies to be built using a normal
invocation of cabal-install. Each componenent which relied on generated
files or additional configuration now has a Setup.hs file.
There are also various fixes to the cabal files to satisfy
cabal-install.
There is a new hadrian command which will build a stage2 compiler and
then a stage3 compiler by using cabal.
```
./hadrian/build build-cabal
```
There is also a new CI job which tests running this command.
For the 9.4 release we will upload all the dependent executables to
hackage and then end users will be free to build GHC and GHC executables
via cabal.
There are still some unresolved questions about how to ensure soundness
when loading plugins into a reinstalled GHC (#20742) which will be
tighted up in due course.
Fixes #19896
33 files changed, 691 insertions, 69 deletions
diff --git a/.gitignore b/.gitignore index f0121e6936..7f0ff4081b 100644 --- a/.gitignore +++ b/.gitignore @@ -242,3 +242,4 @@ ghc.nix/ # clangd .clangd +dist-newstyle/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1d2f3ac7d0..0a2d34db8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -956,6 +956,22 @@ nightly-x86_64-linux-deb10-llvm: BUILD_FLAVOUR: perf-llvm TEST_ENV: "x86_64-linux-deb10-llvm" +#################################### +# Testing reinstallable ghc codepath +#################################### + +test-cabal-reinstall-x86_64-linux-deb10: + extends: .validate-linux-hadrian + stage: full-build + before_script: + - ./boot + - ./configure + - "cabal update --index=$HACKAGE_INDEX_STATE --project-file=cabal.project-reinstall" + variables: + REINSTALL_GHC: "yes" + BUILD_FLAVOUR: validate + TEST_ENV: "x86_64-linux-deb10-cabal-install" + ################################# # x86_64-linux-deb11 ################################# diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index f727da77be..74cba5ea36 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -90,6 +90,8 @@ Environment variables determining build configuration of Make system: Environment variables determining build configuration of Hadrian system: BUILD_FLAVOUR Which flavour to build. + REINSTALL_GHC Build and test a reinstalled "stage3" ghc built using cabal-install + This tests the "reinstall" configuration Environment variables determining bootstrap toolchain (Linux): @@ -348,6 +350,7 @@ function setup_toolchain() { --with-compiler=$GHC \ --index-state=$HACKAGE_INDEX_STATE \ --installdir=$toolchain/bin \ + --ignore-project \ --overwrite-policy=always" # Avoid symlinks on Windows @@ -487,9 +490,14 @@ function build_hadrian() { # N.B. First build Hadrian, unsetting MACOSX_DEPLOYMENT_TARGET which may warn # if the bootstrap libraries were built with a different version expectation. MACOSX_DEPLOYMENT_TARGET="" run_hadrian stage1:exe:ghc-bin - run_hadrian binary-dist -V - mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" + if [[ -n "${REINSTALL_GHC:-}" ]]; then + run_hadrian build-cabal -V + else + run_hadrian binary-dist -V + mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" + fi + } function test_hadrian() { @@ -514,32 +522,50 @@ function test_hadrian() { fi fi - cd _build/bindist/ghc-*/ - case "$(uname)" in - MSYS_*|MINGW*) - mkdir -p "$TOP"/_build/install - cp -a * "$TOP"/_build/install - ;; - *) - read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}" - run ./configure --prefix="$TOP"/_build/install "${args[@]}" - run "$MAKE" install - ;; - esac - cd ../../../ - - run_hadrian \ - test \ - --test-root-dirs=testsuite/tests/stage1 \ - --test-compiler=stage1 \ - "runtest.opts+=${RUNTEST_ARGS:-}" - - run_hadrian \ - test \ - --summary-junit=./junit.xml \ - --test-have-intree-files \ - --test-compiler="$TOP/_build/install/bin/ghc$exe" \ - "runtest.opts+=${RUNTEST_ARGS:-}" + + if [[ -n "${REINSTALL_GHC:-}" ]]; then + run_hadrian \ + test \ + --test-root-dirs=testsuite/tests/stage1 \ + --test-compiler=stage-cabal \ + --test-root-dirs=testsuite/tests/perf \ + --test-root-dirs=testsuite/tests/typecheck \ + "runtest.opts+=${RUNTEST_ARGS:-}" + else + cd _build/bindist/ghc-*/ + case "$(uname)" in + MSYS_*|MINGW*) + mkdir -p "$TOP"/_build/install + cp -a * "$TOP"/_build/install + ;; + *) + read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}" + run ./configure --prefix="$TOP"/_build/install "${args[@]}" + run "$MAKE" install + ;; + esac + cd ../../../ + test_compiler="$TOP/_build/install/bin/ghc$exe" + + + run_hadrian \ + test \ + --test-root-dirs=testsuite/tests/stage1 \ + --test-compiler=stage1 \ + "runtest.opts+=${RUNTEST_ARGS:-}" + + shell ls + shell ls _build/stage-cabal/bin + + run_hadrian \ + test \ + --summary-junit=./junit.xml \ + --test-have-intree-files \ + --test-compiler="${test_compiler}" \ + "runtest.opts+=${RUNTEST_ARGS:-}" \ + + fi + } function cabal_test() { diff --git a/cabal.project-reinstall b/cabal.project-reinstall new file mode 100644 index 0000000000..e026e70a5d --- /dev/null +++ b/cabal.project-reinstall @@ -0,0 +1,79 @@ +packages: ./compiler + ./utils/genprimopcode/ + ./utils/deriveConstants/ + ./ghc/ + -- ./libraries/array + -- ./libraries/base + ./libraries/binary + ./libraries/bytestring + ./libraries/Cabal/Cabal + ./libraries/Cabal/Cabal-syntax + ./libraries/containers/containers/ + -- ./libraries/deepseq/ + ./libraries/directory/ + ./libraries/exceptions/ + -- ./libraries/filepath/ + -- ./libraries/ghc-bignum/ + ./libraries/ghc-boot/ + -- ./libraries/ghc-boot-th/ + ./libraries/ghc-compact + ./libraries/ghc-heap + ./libraries/ghci + -- ./libraries/ghc-prim + ./libraries/haskeline + ./libraries/directory + ./libraries/hpc + -- ./libraries/integer-gmp + ./libraries/libiserv/ + ./libraries/mtl/ + ./libraries/parsec/ + -- ./libraries/pretty/ + ./libraries/process/ + ./libraries/stm + -- ./libraries/template-haskell/ + ./libraries/terminfo/ + ./libraries/text + ./libraries/time + ./libraries/transformers/ + ./libraries/unix/ + ./libraries/Win32/ + ./libraries/xhtml/ + ./utils/ghc-pkg + ./utils/haddock + ./utils/hp2ps + ./utils/hpc + ./utils/hsc2hs + ./utils/runghc + ./utils/unlit + ./utils/iserv + +constraints: ghc +internal-interpreter +dynamic-system-linke +terminfo, + ghc-bin +internal-interpreter +threaded, + ghci +internal-interpreter, + haddock +in-ghc-tree, + any.array installed, + any.base installed, + any.deepseq installed, + any.filepath installed, + any.ghc-bignum installed, + any.ghc-boot-th installed, + any.integer-gmp installed, + any.pretty installed, + any.template-haskell installed + +allow-newer: + ghc-paths:Cabal, + *:base, + *:ghc-prim, + tree-diff:time + +benchmarks: False +tests: False +allow-boot-library-installs: False + +-- Workaround for https://github.com/haskell/cabal/issues/7297 +package * + library-vanilla: True + shared: True + executable-profiling: False + executable-dynamic: True diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 91bf2adf39..34d34815ce 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -4429,6 +4429,7 @@ parseEnvFile envfile = mapM_ parseEntry . lines where envdir = takeDirectory envfile db = drop 11 str ["clear-package-db"] -> clearPkgDb + ["hide-package", pkg] -> hidePackage pkg ["global-package-db"] -> addPkgDbRef GlobalPkgDb ["user-package-db"] -> addPkgDbRef UserPkgDb ["package-id", pkgid] -> exposePackageId pkgid @@ -4622,6 +4623,10 @@ compilerInfo dflags (rawSettings dflags) ++ [("Project version", projectVersion dflags), ("Project Git commit id", cProjectGitCommitId), + ("Project Version Int", cProjectVersionInt), + ("Project Patch Level", cProjectPatchLevel), + ("Project Patch Level1", cProjectPatchLevel1), + ("Project Patch Level2", cProjectPatchLevel2), ("Booter version", cBooterVersion), ("Stage", cStage), ("Build platform", cBuildPlatformString), diff --git a/compiler/Setup.hs b/compiler/Setup.hs new file mode 100644 index 0000000000..e6d3d09d18 --- /dev/null +++ b/compiler/Setup.hs @@ -0,0 +1,138 @@ +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE LambdaCase #-} +module Main where + +import Distribution.Simple +import Distribution.Simple.BuildPaths +import Distribution.Types.LocalBuildInfo +import Distribution.Verbosity +import Distribution.Simple.Program +import Distribution.Simple.Utils +import Distribution.Simple.Setup + +import System.IO +import System.Process +import System.Directory +import System.FilePath +import Control.Monad +import Data.Char +import GHC.ResponseFile +import System.Environment + +main :: IO () +main = defaultMainWithHooks ghcHooks + where + ghcHooks = simpleUserHooks + { postConf = \args cfg pd lbi -> do + let verbosity = fromFlagOrDefault minBound (configVerbosity cfg) + ghcAutogen verbosity lbi + postConf simpleUserHooks args cfg pd lbi + } + +-- Mapping from primop-*.hs-incl file to command +primopIncls :: [(String,String)] +primopIncls = + [ ("primop-data-decl.hs-incl" , "--data-decl") + , ("primop-tag.hs-incl" , "--primop-tag") + , ("primop-list.hs-incl" , "--primop-list") + , ("primop-has-side-effects.hs-incl" , "--has-side-effects") + , ("primop-out-of-line.hs-incl" , "--out-of-line") + , ("primop-commutable.hs-incl" , "--commutable") + , ("primop-code-size.hs-incl" , "--code-size") + , ("primop-can-fail.hs-incl" , "--can-fail") + , ("primop-strictness.hs-incl" , "--strictness") + , ("primop-fixity.hs-incl" , "--fixity") + , ("primop-primop-info.hs-incl" , "--primop-primop-info") + , ("primop-vector-uniques.hs-incl" , "--primop-vector-uniques") + , ("primop-vector-tys.hs-incl" , "--primop-vector-tys") + , ("primop-vector-tys-exports.hs-incl", "--primop-vector-tys-exports") + , ("primop-vector-tycons.hs-incl" , "--primop-vector-tycons") + , ("primop-docs.hs-incl" , "--wired-in-docs") + ] + +ghcAutogen :: Verbosity -> LocalBuildInfo -> IO () +ghcAutogen verbosity lbi@LocalBuildInfo{..} = do + -- Get compiler/ root directory from the cabal file + let Just compilerRoot = takeDirectory <$> pkgDescrFile + + -- Require the necessary programs + (gcc ,withPrograms) <- requireProgram normal gccProgram withPrograms + (ghc ,withPrograms) <- requireProgram normal ghcProgram withPrograms + + settings <- read <$> getProgramOutput normal ghc ["--info"] + -- We are reinstalling GHC + -- Write primop-*.hs-incl + let hsCppOpts = case lookup "Haskell CPP flags" settings of + Just fs -> unescapeArgs fs + Nothing -> [] + primopsTxtPP = compilerRoot </> "GHC/Builtin/primops.txt.pp" + cppOpts = hsCppOpts ++ ["-P","-x","c"] + cppIncludes = map ("-I"++) [compilerRoot] + -- Preprocess primops.txt.pp + primopsStr <- getProgramOutput normal gcc (cppOpts ++ cppIncludes ++ [primopsTxtPP]) + -- Call genprimopcode to generate *.hs-incl + forM_ primopIncls $ \(file,command) -> do + contents <- readProcess "genprimopcode" [command] primopsStr + rewriteFileEx verbosity (buildDir </> file) contents + + -- Write GHC.Platform.Constants + let platformConstantsPath = autogenPackageModulesDir lbi </> "GHC/Platform/Constants.hs" + targetOS = case lookup "target os" settings of + Nothing -> error "no target os in settings" + Just os -> os + createDirectoryIfMissingVerbose verbosity True (takeDirectory platformConstantsPath) + withTempFile (takeDirectory platformConstantsPath) "Constants_tmp.hs" $ \tmp h -> do + hClose h + callProcess "deriveConstants" ["--gen-haskell-type","-o",tmp,"--target-os",targetOS] + renameFile tmp platformConstantsPath + + -- Write GHC.Settings.Config + let configHsPath = autogenPackageModulesDir lbi </> "GHC/Settings/Config.hs" + configHs = generateConfigHs settings + createDirectoryIfMissingVerbose verbosity True (takeDirectory configHsPath) + rewriteFileEx verbosity configHsPath configHs + +getSetting :: [(String,String)] -> String -> String -> Either String String +getSetting settings kh kr = go settings kr + where + go settings k = case lookup k settings of + Nothing -> Left (show k ++ " not found in settings: " ++ show settings) + Just v -> Right v + +generateConfigHs :: [(String,String)] -> String +generateConfigHs settings = either error id $ do + let getSetting' = getSetting $ (("cStage","2"):) settings + buildPlatform <- getSetting' "cBuildPlatformString" "Host platform" + hostPlatform <- getSetting' "cHostPlatformString" "Target platform" + cProjectName <- getSetting' "cProjectName" "Project name" + cBooterVersion <- getSetting' "cBooterVersion" "Project version" + cStage <- getSetting' "cStage" "cStage" + return $ unlines + [ "module GHC.Settings.Config" + , " ( module GHC.Version" + , " , cBuildPlatformString" + , " , cHostPlatformString" + , " , cProjectName" + , " , cBooterVersion" + , " , cStage" + , " ) where" + , "" + , "import GHC.Prelude" + , "" + , "import GHC.Version" + , "" + , "cBuildPlatformString :: String" + , "cBuildPlatformString = " ++ show buildPlatform + , "" + , "cHostPlatformString :: String" + , "cHostPlatformString = " ++ show hostPlatform + , "" + , "cProjectName :: String" + , "cProjectName = " ++ show cProjectName + , "" + , "cBooterVersion :: String" + , "cBooterVersion = " ++ show cBooterVersion + , "" + , "cStage :: String" + , "cStage = show ("++ cStage ++ " :: Int)" + ] diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 6bc23a69a8..4ff65c4e61 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -1,10 +1,10 @@ +Cabal-Version: 2.2 -- WARNING: ghc.cabal is automatically generated from ghc.cabal.in by -- ./configure. Make sure you are editing ghc.cabal.in, not ghc.cabal. -Cabal-Version: 1.22 Name: ghc Version: @ProjectVersionMunged@ -License: BSD3 +License: BSD-3-Clause License-File: LICENSE Author: The GHC Team Maintainer: glasgow-haskell-users@haskell.org @@ -21,9 +21,11 @@ Description: See <https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler> for more information. Category: Development -Build-Type: Simple +Build-Type: Custom extra-source-files: + GHC/Builtin/primops.txt.pp + GHC/Builtin/bytearray-ops.txt.pp Unique.h CodeGen.Platform.h -- Shared with rts via hard-link at configure time. This is safer @@ -33,6 +35,11 @@ extra-source-files: ClosureTypes.h FunTypes.h MachRegs.h + ghc-llvm-version.h + + +custom-setup + setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.8, directory, process, filepath Flag internal-interpreter Description: Build with internal interpreter support. @@ -60,6 +67,8 @@ Library FunTypes.h ghc-llvm-version.h + build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0, genprimopcode:genprimopcode, deriveConstants:deriveConstants + Build-Depends: base >= 4.11 && < 4.17, deepseq >= 1.4 && < 1.5, directory >= 1 && < 1.4, @@ -765,6 +774,9 @@ Library Language.Haskell.Syntax.Pat Language.Haskell.Syntax.Type + autogen-modules: GHC.Platform.Constants + GHC.Settings.Config + reexported-modules: GHC.Platform.ArchOS , GHC.Platform.Host diff --git a/configure.ac b/configure.ac index cf3d586590..e8a95726a3 100644 --- a/configure.ac +++ b/configure.ac @@ -936,6 +936,10 @@ AC_PATH_PROG(GIT,git) dnl ** check for makeinfo AC_PATH_PROG(MAKEINFO,makeinfo) +dnl ** check for cabal +AC_PATH_PROG(CABAL,cabal) + + dnl ** check for Python for testsuite driver FIND_PYTHON @@ -1409,6 +1413,7 @@ echo "\ xelatex : $XELATEX makeinfo : $MAKEINFO git : $GIT + cabal-install : $CABAL Using LLVM tools clang : $ClangCmd diff --git a/driver/ghci/ghci-wrapper.cabal.in b/driver/ghci/ghci-wrapper.cabal.in index 2616223ada..5a422aab9b 100644 --- a/driver/ghci/ghci-wrapper.cabal.in +++ b/driver/ghci/ghci-wrapper.cabal.in @@ -24,6 +24,5 @@ Executable ghci buildable: False Include-Dirs: ../utils C-Sources: - ghci.c -- the following get copied from ../utils by hadrian getLocation.c isMinTTY.c cwrapper.c diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 139ef0196b..8a9178a183 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -14,8 +14,6 @@ Description: This package contains the @ghc@ executable, the user facing front-end to the Glasgow Haskell Compiler. Category: Development -Data-Dir: .. -Data-Files: settings Build-Type: Simple Cabal-Version: >=1.10 @@ -46,8 +44,8 @@ Executable ghc filepath >= 1 && < 1.5, containers >= 0.5 && < 0.7, transformers == 0.5.*, - ghc-boot == @ProjectVersionMunged@, - ghc == @ProjectVersionMunged@ + ghc-boot == @ProjectVersionMunged@, + ghc == @ProjectVersionMunged@ if os(windows) Build-Depends: Win32 >= 2.3 && < 2.13 diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index 2f8ebe6713..f8669c7315 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -30,6 +30,7 @@ makeindex = @MAKEINDEX@ makeinfo = @MAKEINFO@ bourne-shell = @SH@ git = @GIT@ +cabal = @CABAL@ # Python 3 is required to run test driver. # See: https://github.com/ghc/ghc/blob/master/testsuite/mk/boilerplate.mk#L220 diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal index 13ac5d1362..560402f1a0 100644 --- a/hadrian/hadrian.cabal +++ b/hadrian/hadrian.cabal @@ -67,6 +67,7 @@ executable hadrian , Packages , Rules , Rules.BinaryDist + , Rules.CabalReinstall , Rules.Clean , Rules.Compile , Rules.Dependencies @@ -155,6 +156,7 @@ executable hadrian -Wredundant-constraints -fno-warn-name-shadowing -rtsopts + -fno-ignore-asserts if flag(threaded) ghc-options: diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index 6da009bda1..0ff400288d 100644 --- a/hadrian/src/Builder.hs +++ b/hadrian/src/Builder.hs @@ -89,7 +89,11 @@ instance NFData GhcMode -- This instructs package configuration functions (such as 'configurePackage') -- to enable the @profiling@ Cabal flag when processing @rts.cabal@ and -- building RTS with profiling information. -data ConfigurationInfo = Setup | Flags deriving (Eq, Generic, Show) +data ConfigurationInfo + = Setup + | Flags + | Install + deriving (Eq, Generic, Show) instance Binary ConfigurationInfo instance Hashable ConfigurationInfo @@ -426,6 +430,7 @@ systemBuilderPath builder = case builder of Xelatex -> fromKey "xelatex" Makeindex -> fromKey "makeindex" Win32Tarballs _ -> fromKey "python" + Cabal _ _ -> fromKey "cabal" _ -> error $ "No entry for " ++ show builder ++ inCfg where inCfg = " in " ++ quote configFile ++ " file." diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs index 4e3bd5be17..8fe518349d 100644 --- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE MultiWayIf #-} ----------------------------------------------------------------------------- -- | -- Module : Hadrian.Haskell.Cabal.Parse @@ -51,7 +52,10 @@ import Hadrian.Haskell.Cabal import Hadrian.Haskell.Cabal.Type import Hadrian.Oracles.Cabal import Hadrian.Oracles.ArgsHash +import Settings.Builders.Common (packageDatabaseArgs ) import Hadrian.Target +import Oracles.Setting (setting, Setting(..)) +import Rules.Generate import Base import Builder diff --git a/hadrian/src/Oracles/TestSettings.hs b/hadrian/src/Oracles/TestSettings.hs index 42aea11a5b..dec7097d25 100644 --- a/hadrian/src/Oracles/TestSettings.hs +++ b/hadrian/src/Oracles/TestSettings.hs @@ -90,6 +90,10 @@ getBinaryDirectory "stage0" = takeDirectory <$> setting SystemGhc getBinaryDirectory "stage1" = liftM2 (-/-) absoluteBuildRoot (pure "stage1-test/bin/") getBinaryDirectory "stage2" = liftM2 (-/-) topDirectory (stageBinPath Stage1) getBinaryDirectory "stage3" = liftM2 (-/-) topDirectory (stageBinPath Stage2) +getBinaryDirectory "stage-cabal" = do + top <- topDirectory + root <- buildRoot + pure (top -/- root -/- "stage-cabal" -/- "bin") getBinaryDirectory compiler = pure $ takeDirectory compiler -- | Get the path to the given @--test-compiler@. @@ -98,6 +102,10 @@ getCompilerPath "stage0" = setting SystemGhc getCompilerPath "stage1" = liftM2 (-/-) absoluteBuildRoot (pure ("stage1-test/bin/ghc" <.> exe)) getCompilerPath "stage2" = liftM2 (-/-) topDirectory (fullPath Stage1 ghc) getCompilerPath "stage3" = liftM2 (-/-) topDirectory (fullPath Stage2 ghc) +getCompilerPath "stage-cabal" = do + top <- topDirectory + root <- buildRoot + pure (top -/- root -/- "stage-cabal" -/- "bin" -/- "ghc") getCompilerPath compiler = pure compiler isInTreeCompiler :: String -> Bool diff --git a/hadrian/src/Rules.hs b/hadrian/src/Rules.hs index 67646a8689..fc85d1d698 100644 --- a/hadrian/src/Rules.hs +++ b/hadrian/src/Rules.hs @@ -12,6 +12,7 @@ import qualified Oracles.Flavour import qualified Oracles.ModuleFiles import Packages import qualified Rules.BinaryDist +import qualified Rules.CabalReinstall import qualified Rules.Compile import qualified Rules.Dependencies import qualified Rules.Documentation @@ -136,6 +137,7 @@ buildRules = do Rules.Library.libraryRules Rules.Rts.rtsRules packageRules + Rules.CabalReinstall.cabalBuildRules oracleRules :: Rules () oracleRules = do diff --git a/hadrian/src/Rules/CabalReinstall.hs b/hadrian/src/Rules/CabalReinstall.hs new file mode 100644 index 0000000000..c34362171a --- /dev/null +++ b/hadrian/src/Rules/CabalReinstall.hs @@ -0,0 +1,112 @@ +module Rules.CabalReinstall where + +import Context +import Expression +import Oracles.Flag +import Packages +import Settings +import Target +import Utilities +import qualified System.Directory.Extra as IO +import Data.Either +import Rules.BinaryDist +import Hadrian.Haskell.Cabal (pkgIdentifier) + +{- +Note [Testing reinstallable GHC] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +To test the reinstallable GHC configuration, we install a GHC to <build root>/stage-cabal/bin +along with appropriate wrapper scripts. + +The libdir of the reinstalled GHC points to the libdir of the stage 2 compiler (in <build root>/stage1) +-} + + +-- | We don't support reinstalling these +cabalExcludedPackages :: [Package] +cabalExcludedPackages = [array, base, deepseq, filepath, ghcBignum, ghcBootTh, ghcPrim, integerGmp, integerSimple, pretty, templateHaskell] + +findCabalPackageDb :: String -> FilePath +findCabalPackageDb env = go $ map (\l -> (words l, l)) (lines env) + where + go [] = error $ "Couldn't find installed package db in " ++ show env + go (("package-db":_, l):_) = drop 11 l + go (_:xs) = go xs + + +cabalBuildRules :: Rules () +cabalBuildRules = do + root <- buildRootRules + root -/- "stage-cabal" -/- "cabal-packages" %> \_ -> do + -- Always rerun to pass onto cabal's own recompilation logic + alwaysRerun + all_pkgs <- stagePackages Stage1 + forM_ (filter (not . (`elem` cabalExcludedPackages)) all_pkgs) $ \pkg -> do + withVerbosity Diagnostic $ + buildWithCmdOptions [] $ + target (vanillaContext Stage2 pkg) (Cabal Install Stage2) [] [] + + phony "build-cabal" $ need [root -/- "stage-cabal" -/- "bin" -/- ".stamp"] + + root -/- "stage-cabal" -/- "bin" -/- "*" %> \_ -> need [root -/- "stage-cabal" -/- "bin" -/- ".stamp"] + + priority 2.0 $ root -/- "stage-cabal" -/- "bin" -/- ".stamp" %> \stamp -> do + -- We 'need' all binaries and libraries + all_pkgs <- stagePackages Stage1 + (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs + cross <- flag CrossCompiling + iserv_targets <- if cross then pure [] else iservBins + need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets))) + + distDir <- Context.distDir Stage1 + rtsDir <- pkgIdentifier rts + + let ghcBuildDir = root -/- stageString Stage1 + rtsIncludeDir = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir + -/- "include" + + libdir <- liftIO . IO.makeAbsolute =<< stageLibPath Stage1 + work_dir <- liftIO $ IO.makeAbsolute $ root -/- "stage-cabal" + let outputDir = work_dir -/- "bin" + includeDir <- liftIO $ IO.makeAbsolute rtsIncludeDir + + createDirectory outputDir + + need [root -/- "stage-cabal" -/- "cabal-packages"] + env <- liftIO $ readFile $ root -/- "stage-cabal" -/- "cabal-packages" + let cabal_package_db = findCabalPackageDb env + + forM_ (filter ((/= iserv) . fst) bin_targets) $ \(bin_pkg,_bin_path) -> do + let pgmName pkg + | pkg == ghc = "ghc" + | pkg == hpcBin = "hpc" + | otherwise = pkgName pkg + let cabal_bin_out = work_dir -/- "cabal-bin" -/- (pgmName bin_pkg) + needed_wrappers <- pkgToWrappers bin_pkg + forM_ needed_wrappers $ \wrapper_name -> do + let wrapper_prefix = unlines + ["#!/usr/bin/env sh" + ,"executablename="++show cabal_bin_out + ,"libdir="++show libdir + ,"bindir="++show outputDir + ,"exedir="++show outputDir + ,"includedir="++show includeDir + ,"export GHC_PACKAGE_PATH="++show cabal_package_db++":" + ] + output_file = outputDir -/- wrapper_name + wrapper_content <- wrapper wrapper_name + writeFile' output_file (wrapper_prefix ++ wrapper_content) + makeExecutable output_file + pure () + + -- Just symlink these for now + -- TODO: build these with cabal as well + forM_ iserv_targets $ \(_bin_pkg,bin_path') -> do + bin_path <- liftIO $ IO.makeAbsolute bin_path' + let orig_filename = takeFileName bin_path + output_file = outputDir -/- orig_filename + liftIO $ do + IO.removeFile output_file <|> pure () + IO.createFileLink bin_path output_file + pure () + writeFile' stamp "OK" diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 32a9248eff..e19d058425 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -78,6 +78,7 @@ compilerDependencies = do , "primop-vector-uniques.hs-incl" , "primop-docs.hs-incl" , "GHC/Platform/Constants.hs" + , "GHC/Settings/Config.hs" ] generatedDependencies :: Expr [FilePath] diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs index fea8a8f7b6..fe0aba04cc 100644 --- a/hadrian/src/Rules/Test.hs +++ b/hadrian/src/Rules/Test.hs @@ -153,7 +153,9 @@ testRules = do let testGhc = testCompiler args ghcPath <- getCompilerPath testGhc whenJust (stageOf testGhc) $ \stg -> - need . (:[]) =<< programPath (Context stg ghc vanilla) + need . (:[]) =<< programPath (Context stg ghc vanilla) + cwd <- liftIO $ IO.getCurrentDirectory + need [makeRelative cwd ghcPath] need [root -/- ghcConfigProgPath] cmd [FileStdout $ root -/- ghcConfigPath] (root -/- ghcConfigProgPath) [ghcPath] diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs index 19bc8c315e..1ef20147ae 100644 --- a/hadrian/src/Settings/Builders/Cabal.hs +++ b/hadrian/src/Settings/Builders/Cabal.hs @@ -9,31 +9,92 @@ import Flavour import Packages import Settings.Builders.Common import qualified Settings.Builders.Common as S +import Control.Exception (assert) +import System.Directory +import Settings.Program (programContext) cabalBuilderArgs :: Args -cabalBuilderArgs = builder (Cabal Setup) ? do - verbosity <- expr getVerbosity +cabalBuilderArgs = cabalSetupArgs <> cabalInstallArgs + +cabalInstallArgs :: Args +cabalInstallArgs = builder (Cabal Install) ? do + pkg <- getPackage + root <- exprIO . makeAbsolute =<< getBuildRoot + let pgmName + | pkg == ghc = "ghc" + | pkg == hpcBin = "hpc" + | otherwise = pkgName pkg + assertNoBuildRootLeak $ + mconcat [ arg $ "--store-dir=" ++ (root -/- "stage-cabal" -/- "cabal-store") + , arg "install" + , if isProgram pkg then arg $ "exe:" ++ pgmName else mconcat [arg "--lib", arg $ pkgName pkg] + , commonReinstallCabalArgs + ] + +-- | Checks that _build/stageN/lib/* doesn't leak into the arguments for +-- reinstallable GHC. If this assert fails, then GHC probably isn't +-- properly reinstallable. +-- We allow "package.conf.d" however since we do need to read the package environment +-- of the stage 2 compiler +assertNoBuildRootLeak :: Args -> Args +assertNoBuildRootLeak args = do + libPaths <- expr $ mapM stageLibPath [Stage0 ..] + xs <- args + pure $ assert (not $ any (\arg -> or [libPath `isInfixOf` arg && not ("package.conf.d" `isSuffixOf` arg) + | libPath <- libPaths]) xs) + xs + +commonReinstallCabalArgs :: Args +commonReinstallCabalArgs = do top <- expr topDirectory - pkg <- getPackage - path <- getContextPath - stage <- getStage - let prefix = "${pkgroot}" ++ (if windowsHost then "" else "/..") - mconcat [ arg "configure" - -- Don't strip libraries when cross compiling. + root <- getBuildRoot + threads <- shakeThreads <$> expr getShakeOptions + _pkg <- getPackage + compiler <- expr $ programPath =<< programContext Stage1 ghc + mconcat [ arg "--project-file" + , arg $ top -/- "cabal.project-reinstall" + , arg "--distdir" + , arg $ root -/- "stage-cabal" -/- "dist-newstyle" + , arg ("--ghc-option=-j" ++ show threads) + , arg $ "--install-method=copy" + , arg $ "--overwrite-policy=always" + , arg $ "--with-compiler=" ++ top -/- compiler + , arg $ "--installdir=" ++ (root -/- "stage-cabal" -/- "cabal-bin") + , arg $ "--package-env=" ++ (root -/- "stage-cabal" -/- "cabal-packages") + , arg "--enable-executable-dynamic" + , arg "--enable-library-vanilla" + ] + +cabalSetupArgs :: Args +cabalSetupArgs = builder (Cabal Setup) ? do + top <- expr topDirectory + stage <- getStage + path <- getContextPath + mconcat [ arg "configure" + , arg "--distdir" + , arg $ top -/- path + , commonCabalArgs stage + , configureStageArgs + ] + +commonCabalArgs :: Stage -> Args +commonCabalArgs stage = do + verbosity <- expr getVerbosity + pkg <- getPackage + let prefix = "${pkgroot}" ++ (if windowsHost then "" else "/..") + mconcat [ -- Don't strip libraries when cross compiling. -- TODO: We need to set @--with-strip=(stripCmdPath :: Action FilePath)@, -- and if it's @:@ disable stripping as well. As it is now, I believe -- we might have issues with stripping on Windows, as I can't see a -- consumer of 'stripCmdPath'. -- TODO: See https://github.com/snowleopard/hadrian/issues/549. - , flag CrossCompiling ? pure [ "--disable-executable-stripping" + flag CrossCompiling ? pure [ "--disable-executable-stripping" , "--disable-library-stripping" ] -- We don't want to strip the debug RTS , S.package rts ? pure [ "--disable-executable-stripping" , "--disable-library-stripping" ] , arg "--cabal-file" , arg $ pkgCabalFile pkg - , arg "--distdir" - , arg $ top -/- path , arg "--ipid" , arg "$pkg-$version" , arg "--prefix" @@ -55,7 +116,6 @@ cabalBuilderArgs = builder (Cabal Setup) ? do , withBuilderArgs (GhcPkg Update stage) , bootPackageDatabaseArgs , libraryArgs - , configureArgs , bootPackageConstraints , withStaged $ Cc CompileC , notStage0 ? with (Ld stage) @@ -97,9 +157,20 @@ libraryArgs = do then "--enable-shared" else "--disable-shared" ] +-- | Configure args with stage/lib specific include directories and settings +configureStageArgs :: Args +configureStageArgs = do + let cFlags = getStagedSettingList ConfCcArgs + ldFlags = getStagedSettingList ConfGccLinkerArgs + mconcat [ configureArgs cFlags ldFlags + , notStage0 ? arg "--ghc-option=-ghcversion-file=rts/include/ghcversion.h" + ] + + -- TODO: LD_OPTS? -configureArgs :: Args -configureArgs = do +configureArgs :: Args -> Args -> Args +configureArgs cFlags' ldFlags' = do + top <- expr topDirectory pkg <- getPackage let conf key expr = do @@ -110,8 +181,11 @@ configureArgs = do , getStagedSettingList ConfCcArgs -- See https://github.com/snowleopard/hadrian/issues/523 , arg $ "-iquote" - , arg $ top -/- pkgPath pkg ] - ldFlags = ldArgs <> (getStagedSettingList ConfGccLinkerArgs) + + , arg $ top -/- pkgPath pkg + , cFlags' + ] + ldFlags = ldArgs <> ldFlags' cldFlags <- unwords <$> (cFlags <> ldFlags) mconcat [ conf "CFLAGS" cFlags diff --git a/hadrian/src/Settings/Builders/Common.hs b/hadrian/src/Settings/Builders/Common.hs index ad6f5c048a..54f4105529 100644 --- a/hadrian/src/Settings/Builders/Common.hs +++ b/hadrian/src/Settings/Builders/Common.hs @@ -5,7 +5,7 @@ module Settings.Builders.Common ( module Oracles.Setting, module Settings, module UserSettings, - cIncludeArgs, ldArgs, cArgs, cWarnings, + cIncludeArgs, ldArgs, cArgs, cppArgs, cWarnings, packageDatabaseArgs, bootPackageDatabaseArgs ) where @@ -50,6 +50,9 @@ ldArgs = mempty cArgs :: Args cArgs = mempty +cppArgs :: Args +cppArgs = mempty + -- TODO: should be in a different file cWarnings :: Args cWarnings = mconcat diff --git a/libraries/ghc-boot/Setup.hs b/libraries/ghc-boot/Setup.hs new file mode 100644 index 0000000000..0995ee3f8f --- /dev/null +++ b/libraries/ghc-boot/Setup.hs @@ -0,0 +1,120 @@ +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE LambdaCase #-} +module Main where + +import Distribution.Simple +import Distribution.Simple.BuildPaths +import Distribution.Types.LocalBuildInfo +import Distribution.Verbosity +import Distribution.Simple.Program +import Distribution.Simple.Utils +import Distribution.Simple.Setup + +import System.IO +import System.Directory +import System.FilePath +import System.Environment +import Control.Monad +import Data.Char +import GHC.ResponseFile + +main :: IO () +main = defaultMainWithHooks ghcHooks + where + ghcHooks = simpleUserHooks + { postConf = \args cfg pd lbi -> do + let verbosity = fromFlagOrDefault minBound (configVerbosity cfg) + ghcAutogen verbosity lbi + postConf simpleUserHooks args cfg pd lbi + } + +ghcAutogen :: Verbosity -> LocalBuildInfo -> IO () +ghcAutogen verbosity lbi@LocalBuildInfo{..} = do + -- Get compiler/ root directory from the cabal file + let Just compilerRoot = takeDirectory <$> pkgDescrFile + + let platformHostFile = "GHC/Platform/Host.hs" + platformHostPath = autogenPackageModulesDir lbi </> platformHostFile + ghcVersionFile = "GHC/Version.hs" + ghcVersionPath = autogenPackageModulesDir lbi </> ghcVersionFile + + -- Get compiler settings + settings <- lookupEnv "HADRIAN_SETTINGS" >>= \case + Just settings -> pure $ Left $ read settings + Nothing -> do + (ghc,withPrograms) <- requireProgram normal ghcProgram withPrograms + Right . read <$> getProgramOutput normal ghc ["--info"] + + -- Write GHC.Platform.Host + createDirectoryIfMissingVerbose verbosity True (takeDirectory platformHostPath) + rewriteFileEx verbosity platformHostPath (generatePlatformHostHs settings) + + -- Write GHC.Version + createDirectoryIfMissingVerbose verbosity True (takeDirectory ghcVersionPath) + rewriteFileEx verbosity ghcVersionPath (generateVersionHs settings) + +-- | Takes either a list of hadrian generated settings, or a list of settings from ghc --info, +-- and keys in both lists, and looks up the value in the appropriate list +getSetting :: Either [(String,String)] [(String,String)] -> String -> String -> Either String String +getSetting settings kh kr = case settings of + Left settings -> go settings kh + Right settings -> go settings kr + where + go settings k = case lookup k settings of + Nothing -> Left (show k ++ " not found in settings: " ++ show settings) + Just v -> Right v + +generatePlatformHostHs :: Either [(String,String)] [(String,String)] -> String +generatePlatformHostHs settings = either error id $ do + let getSetting' = getSetting settings + cHostPlatformArch <- getSetting' "hostPlatformArch" "target arch" + cHostPlatformOS <- getSetting' "hostPlatformOS" "target os" + return $ unlines + [ "module GHC.Platform.Host where" + , "" + , "import GHC.Platform.ArchOS" + , "" + , "hostPlatformArch :: Arch" + , "hostPlatformArch = " ++ cHostPlatformArch + , "" + , "hostPlatformOS :: OS" + , "hostPlatformOS = " ++ cHostPlatformOS + , "" + , "hostPlatformArchOS :: ArchOS" + , "hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS" + ] + +generateVersionHs :: Either [(String,String)] [(String,String)] -> String +generateVersionHs settings = either error id $ do + let getSetting' = getSetting settings + cProjectGitCommitId <- getSetting' "cProjectGitCommitId" "Project Git commit id" + cProjectVersion <- getSetting' "cProjectVersion" "Project version" + cProjectVersionInt <- getSetting' "cProjectVersionInt" "Project Version Int" + + cProjectPatchLevel <- getSetting' "cProjectPatchLevel" "Project Patch Level" + cProjectPatchLevel1 <- getSetting' "cProjectPatchLevel1" "Project Patch Level1" + cProjectPatchLevel2 <- getSetting' "cProjectPatchLevel2" "Project Patch Level2" + return $ unlines + [ "module GHC.Version where" + , "" + , "import Prelude -- See Note [Why do we import Prelude here?]" + , "" + , "cProjectGitCommitId :: String" + , "cProjectGitCommitId = " ++ show cProjectGitCommitId + , "" + , "cProjectVersion :: String" + , "cProjectVersion = " ++ show cProjectVersion + , "" + , "cProjectVersionInt :: String" + , "cProjectVersionInt = " ++ show cProjectVersionInt + , "" + , "cProjectPatchLevel :: String" + , "cProjectPatchLevel = " ++ show cProjectPatchLevel + , "" + , "cProjectPatchLevel1 :: String" + , "cProjectPatchLevel1 = " ++ show cProjectPatchLevel1 + , "" + , "cProjectPatchLevel2 :: String" + , "cProjectPatchLevel2 = " ++ show cProjectPatchLevel2 + ] diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in index fa86241b62..efac404501 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -24,9 +24,12 @@ description: This library is shared between GHC, ghc-pkg, and other boot The package database format and this library are constructed in such a way that while ghc-pkg depends on Cabal, the GHC library and program do not have to depend on Cabal. -build-type: Simple +build-type: Custom extra-source-files: changelog.md +custom-setup + setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.8, directory, filepath + source-repository head type: git location: https://gitlab.haskell.org/ghc/ghc.git @@ -62,9 +65,9 @@ Library , GHC.Lexeme -- but done by Hadrian - -- autogen-modules: - -- GHC.Version - -- GHC.Platform.Host + autogen-modules: + GHC.Version + GHC.Platform.Host build-depends: base >= 4.7 && < 4.17, binary == 0.8.*, diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal index 1a0abfe262..dbe5d18667 100644 --- a/libraries/ghc-prim/ghc-prim.cabal +++ b/libraries/ghc-prim/ghc-prim.cabal @@ -20,7 +20,7 @@ source-repository head subdir: libraries/ghc-prim custom-setup - setup-depends: base >= 4 && < 5, Cabal >= 1.23 && < 3.8 + setup-depends: base >= 4 && < 5, process, filepath, directory, Cabal >= 1.23 && < 3.8 Library default-language: Haskell2010 diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 8e286d32f8..bec08a490c 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -877,7 +877,7 @@ def normalise_win32_io_errors(name, opts): def normalise_version_( *pkgs ): def normalise_version__( str ): - return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+', + return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-f]+)?', '\\1-<VERSION>', str) return normalise_version__ diff --git a/utils/genprimopcode/genprimopcode.cabal b/utils/genprimopcode/genprimopcode.cabal index d6dc8b58ec..2dc581dc49 100644 --- a/utils/genprimopcode/genprimopcode.cabal +++ b/utils/genprimopcode/genprimopcode.cabal @@ -15,7 +15,7 @@ Description: * an LaTeX document describing the primitive operations. Category: Development build-type: Simple -cabal-version: >=1.10 +cabal-version: 2.0 Executable genprimopcode Default-Language: Haskell2010 @@ -26,3 +26,4 @@ Executable genprimopcode Syntax Build-Depends: base >= 4 && < 5, array + build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0 diff --git a/utils/hp2ps/hp2ps.cabal b/utils/hp2ps/hp2ps.cabal index 1b48694564..482ea772b9 100644 --- a/utils/hp2ps/hp2ps.cabal +++ b/utils/hp2ps/hp2ps.cabal @@ -9,13 +9,16 @@ Synopsis: Heap Profile to PostScript converter Description: XXX Category: Development build-type: Simple +extra-source-files: AreaBelow.h AuxFile.h Axes.h Curves.h Defines.h Deviation.h + Dimensions.h Error.h HpFile.h Key.h Main.h Marks.h PsFile.h Reorder.h Scale.h + Shade.h TopTwenty.h TraceElement.h Utilities.h Executable hp2ps Default-Language: Haskell2010 Main-Is: Main.c extra-libraries: m C-Sources: - AreaBelow.c Curves.c Error.c Main.c + AreaBelow.c Curves.c Error.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 diff --git a/utils/hpc/hpc-bin.cabal b/utils/hpc/hpc-bin.cabal index 28cc2af49b..6e344de856 100644 --- a/utils/hpc/hpc-bin.cabal +++ b/utils/hpc/hpc-bin.cabal @@ -10,7 +10,7 @@ Synopsis: XXX Description: XXX Category: Development build-type: Simple -cabal-version: >=1.10 +cabal-version: 2.0 Executable hpc Default-Language: Haskell2010 @@ -27,6 +27,8 @@ Executable hpc HpcUtils Paths_hpc_bin + autogen-modules: Paths_hpc_bin + Build-Depends: base >= 4 && < 5, directory >= 1 && < 1.4, filepath >= 1 && < 1.5, @@ -34,3 +36,4 @@ Executable hpc array >= 0.1 && < 0.6, hpc >= 0.6.1 && < 0.7 + build-tool-depends: happy:happy >= 1.20.0 diff --git a/utils/runghc/Main.hs b/utils/runghc/Main.hs index 9ed650410d..5e447ed99f 100644 --- a/utils/runghc/Main.hs +++ b/utils/runghc/Main.hs @@ -110,7 +110,7 @@ parseRunGhcFlags = f mempty printVersion :: IO () printVersion = do - putStrLn ("runghc " ++ VERSION) + putStrLn ("runghc " ++ CURRENT_PACKAGE_VERSION ) printUsage :: IO () printUsage = do diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk index 65a3ca88d6..76272d9d80 100644 --- a/utils/runghc/ghc.mk +++ b/utils/runghc/ghc.mk @@ -17,7 +17,6 @@ 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)\"" # Be explicit about which version of ghc to call (#9054). define utils/runghc_dist-install_INPLACE_SHELL_WRAPPER_EXTRA diff --git a/utils/runghc/runghc.cabal.in b/utils/runghc/runghc.cabal.in index ffe75756f7..3afeb425ee 100644 --- a/utils/runghc/runghc.cabal.in +++ b/utils/runghc/runghc.cabal.in @@ -32,4 +32,4 @@ Executable runghc filepath if !os(windows) - build-depends: unix
\ No newline at end of file + build-depends: unix diff --git a/utils/touchy/touchy.cabal b/utils/touchy/touchy.cabal index 21a774b1fa..5c28c664fc 100644 --- a/utils/touchy/touchy.cabal +++ b/utils/touchy/touchy.cabal @@ -13,4 +13,3 @@ build-type: Simple Executable touchy Default-Language: Haskell2010 Main-Is: touchy.c - C-Sources: touchy.c diff --git a/utils/unlit/unlit.cabal b/utils/unlit/unlit.cabal index e49fd8558b..0707d5d95a 100644 --- a/utils/unlit/unlit.cabal +++ b/utils/unlit/unlit.cabal @@ -9,9 +9,10 @@ Synopsis: Literate program filter Description: XXX Category: Development build-type: Simple +extra-source-files: fs.h Executable unlit Default-Language: Haskell2010 Main-Is: unlit.c - C-Sources: unlit.c, fs.c + C-Sources: fs.c Includes: fs.h |