From 7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6 Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Sun, 13 Jun 2021 16:02:06 +0530 Subject: 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 --- utils/genprimopcode/genprimopcode.cabal | 3 ++- utils/hp2ps/hp2ps.cabal | 5 ++++- utils/hpc/hpc-bin.cabal | 5 ++++- utils/runghc/Main.hs | 2 +- utils/runghc/ghc.mk | 1 - utils/runghc/runghc.cabal.in | 2 +- utils/touchy/touchy.cabal | 1 - utils/unlit/unlit.cabal | 3 ++- 8 files changed, 14 insertions(+), 8 deletions(-) (limited to 'utils') 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 -- cgit v1.2.1