[Git][ghc/ghc][master] 3 commits: Generate settings by make/hadrian instead of configure

Marge Bot gitlab at gitlab.haskell.org
Wed May 1 00:35:32 UTC 2019



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d37d91e9 by John Ericson at 2019-05-01T00:29:31Z
Generate settings by make/hadrian instead of configure

This allows it to eventually become stage-specific

- - - - -
53d1cd96 by John Ericson at 2019-05-01T00:29:31Z
Remove settings.in

It is no longer needed

- - - - -
2988ef5e by John Ericson at 2019-05-01T00:29:31Z
Move cGHC_UNLIT_PGM to be "unlit command" in settings

The bulk of the work was done in #712, making settings be make/Hadrian
controlled. This commit then just moves the unlit command rules in
make/Hadrian from the `Config.hs` generator to the `settings` generator
in each build system.

I think this is a good change because the crucial benefit is *settings*
don't affect the build: ghc gets one baby step closer to being a regular
cabal executable, and make/Hadrian just maintains settings as part of
bootstrapping.

- - - - -


17 changed files:

- aclocal.m4
- compiler/ghc.mk
- compiler/main/SysTools.hs
- configure.ac
- distrib/configure.ac.in
- ghc.mk
- ghc/ghc.mk
- hadrian/cfg/system.config.in
- hadrian/doc/make.md
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/BinaryDist.hs
- hadrian/src/Rules/Configure.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/SourceDist.hs
- includes/ghc.mk
- mk/config.mk.in
- − settings.in


Changes:

=====================================
aclocal.m4
=====================================
@@ -497,16 +497,16 @@ AC_DEFUN([FP_SETTINGS],
 [
     if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"
     then
-        mingw_bin_prefix=mingw/bin/
-	SettingsCCompilerCommand="\$tooldir/${mingw_bin_prefix}gcc.exe"
-	SettingsHaskellCPPCommand="\$tooldir/${mingw_bin_prefix}gcc.exe"
+        mingw_bin_prefix='$$tooldir/mingw/bin/'
+        SettingsCCompilerCommand="${mingw_bin_prefix}gcc.exe"
+        SettingsHaskellCPPCommand="${mingw_bin_prefix}gcc.exe"
         SettingsHaskellCPPFlags="$HaskellCPPArgs"
-	SettingsLdCommand="\$tooldir/${mingw_bin_prefix}ld.exe"
-	SettingsArCommand="\$tooldir/${mingw_bin_prefix}ar.exe"
-	SettingsRanlibCommand="\$tooldir/${mingw_bin_prefix}ranlib.exe"
-	SettingsDllWrapCommand="\$tooldir/${mingw_bin_prefix}dllwrap.exe"
-	SettingsWindresCommand="\$tooldir/${mingw_bin_prefix}windres.exe"
-        SettingsTouchCommand='$topdir/bin/touchy.exe'
+        SettingsLdCommand="${mingw_bin_prefix}ld.exe"
+        SettingsArCommand="${mingw_bin_prefix}ar.exe"
+        SettingsRanlibCommand="${mingw_bin_prefix}ranlib.exe"
+        SettingsDllWrapCommand="${mingw_bin_prefix}dllwrap.exe"
+        SettingsWindresCommand="${mingw_bin_prefix}windres.exe"
+        SettingsTouchCommand='$$topdir/bin/touchy.exe'
     elif test "$EnableDistroToolchain" = "YES"
     then
         SettingsCCompilerCommand="$(basename $CC)"
@@ -517,7 +517,7 @@ AC_DEFUN([FP_SETTINGS],
         SettingsArCommand="$(basename $ArCmd)"
         SettingsDllWrapCommand="$(basename $DllWrapCmd)"
         SettingsWindresCommand="$(basename $WindresCmd)"
-        SettingsTouchCommand='$topdir/bin/touchy.exe'
+        SettingsTouchCommand='$$topdir/bin/touchy.exe'
     else
         SettingsCCompilerCommand="$CC"
         SettingsHaskellCPPCommand="$HaskellCPPCmd"


=====================================
compiler/ghc.mk
=====================================
@@ -110,8 +110,6 @@ endif
 	@echo 'cGhcEnableTablesNextToCode = "$(GhcEnableTablesNextToCode)"' >> $@
 	@echo 'cLeadingUnderscore    :: String'                             >> $@
 	@echo 'cLeadingUnderscore    = "$(LeadingUnderscore)"'              >> $@
-	@echo 'cGHC_UNLIT_PGM        :: String'                             >> $@
-	@echo 'cGHC_UNLIT_PGM        = "$(utils/unlit_dist_PROG)"'          >> $@
 	@echo 'cLibFFI               :: Bool'                               >> $@
 ifeq "$(UseLibFFIForAdjustors)" "YES"
 	@echo 'cLibFFI               = True'                                >> $@


=====================================
compiler/main/SysTools.hs
=====================================
@@ -211,9 +211,9 @@ initSysTools top_dir
            ghc_usage_msg_path  = installed "ghc-usage.txt"
            ghci_usage_msg_path = installed "ghci-usage.txt"
 
-             -- For all systems, unlit, split, mangle are GHC utilities
-             -- architecture-specific stuff is done when building Config.hs
-           unlit_path = libexec cGHC_UNLIT_PGM
+       -- For all systems, unlit, split, mangle are GHC utilities
+       -- architecture-specific stuff is done when building Config.hs
+       unlit_path <- getToolSetting "unlit command"
 
        windres_path <- getToolSetting "windres command"
        libtool_path <- getToolSetting "libtool command"


=====================================
configure.ac
=====================================
@@ -897,7 +897,7 @@ FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t)
 FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t)
 
 
-dnl for use in settings.in
+dnl for use in settings file
 TargetWordSize=$ac_cv_sizeof_void_p
 if test "x$TargetWordSize" == 8; then
   AC_SUBST([Cabal64bit],[True])
@@ -1292,7 +1292,7 @@ checkMake380() {
 checkMake380 make
 checkMake380 gmake
 
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/remote-iserv/remote-iserv.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal libraries/template-haskell/template-haskell.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/remote-iserv/remote-iserv.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal libraries/template-haskell/template-haskell.cabal docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
 AC_OUTPUT
 [
 if test "$print_make_warning" = "true"; then


=====================================
distrib/configure.ac.in
=====================================
@@ -159,7 +159,7 @@ dnl May need to use gcc to find platform details.
 dnl --------------------------------------------------------------
 FPTOOLS_SET_HASKELL_PLATFORM_VARS
 
-dnl TargetWordSize for settings.in
+dnl TargetWordSize for settings file
 AC_CHECK_SIZEOF(void *, 4)
 if test "x$ac_cv_sizeof_void_p" = "x0"; then
     AC_MSG_ERROR([Failed to determine machine word size. Does your toolchain actually work?])


=====================================
ghc.mk
=====================================
@@ -1010,7 +1010,6 @@ $(eval $(call bindist-list,.,\
     README \
     INSTALL \
     configure config.sub config.guess install-sh \
-    settings.in \
     llvm-targets \
     llvm-passes \
     packages \
@@ -1067,7 +1066,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
 unix-binary-dist-prep:
 	$(call removeTrees,bindistprep/)
 	"$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
-	set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
+	set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
 	echo "HADDOCK_DOCS       = $(HADDOCK_DOCS)"       >> $(BIN_DIST_MK)
 	echo "BUILD_SPHINX_HTML  = $(BUILD_SPHINX_HTML)"  >> $(BIN_DIST_MK)
 	echo "BUILD_SPHINX_PDF   = $(BUILD_SPHINX_PDF)"   >> $(BIN_DIST_MK)
@@ -1165,7 +1164,7 @@ SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \
 SRC_DIST_GHC_FILES += \
     configure.ac config.guess config.sub configure \
     aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
-    install-sh settings.in llvm-targets llvm-passes VERSION GIT_COMMIT_ID \
+    install-sh llvm-targets llvm-passes VERSION GIT_COMMIT_ID \
     boot packages ghc.mk MAKEHELP.md
 
 .PHONY: VERSION


=====================================
ghc/ghc.mk
=====================================
@@ -129,6 +129,9 @@ all_ghc_stage1 : $(GHC_STAGE1)
 all_ghc_stage2 : $(GHC_STAGE2)
 all_ghc_stage3 : $(GHC_STAGE3)
 
+settings : $(includes_SETTINGS)
+	"$(CP)" $< $@
+
 $(INPLACE_LIB)/settings : settings
 	"$(CP)" $< $@
 


=====================================
hadrian/cfg/system.config.in
=====================================
@@ -108,6 +108,46 @@ conf-ld-linker-args-stage1  = @CONF_LD_LINKER_OPTS_STAGE1@
 conf-ld-linker-args-stage2  = @CONF_LD_LINKER_OPTS_STAGE2@
 conf-ld-linker-args-stage3  = @CONF_LD_LINKER_OPTS_STAGE3@
 
+# Settings:
+#==========
+
+# We are in the process of moving the settings file from being entirely
+# generated by configure, to generated being by the build system. Many of these
+# might become redundant.
+
+gcc-extra-via-c-opts = @GccExtraViaCOpts@
+ld-has-no-compact-unwind = @LdHasNoCompactUnwind@
+ld-has-build-id = @LdHasBuildId@
+ld-has-filelist = @LdHasFilelist@
+ld-is-gnu-ld = @LdIsGNULd@
+ar-args = @ArArgs@
+
+settings-c-compiler-command = @SettingsCCompilerCommand@
+settings-haskell-cpp-command = @SettingsHaskellCPPCommand@
+settings-haskell-cpp-flags = @SettingsHaskellCPPFlags@
+settings-c-compiler-flags = @SettingsCCompilerFlags@
+settings-c-compiler-link-flags = @SettingsCCompilerLinkFlags@
+settings-c-compiler-supports-no-pie = @SettingsCCompilerSupportsNoPie@
+settings-ld-command = @SettingsLdCommand@
+settings-ld-flags = @SettingsLdFlags@
+settings-ar-command = @SettingsArCommand@
+settings-ranlib-command = @SettingsRanlibCommand@
+settings-dll-wrap-command = @SettingsDllWrapCommand@
+settings-windres-command = @SettingsWindresCommand@
+settings-libtool-command = @SettingsLibtoolCommand@
+settings-touch-command = @SettingsTouchCommand@
+settings-clang-command = @SettingsClangCommand@
+settings-llc-command = @SettingsLlcCommand@
+settings-opt-command = @SettingsOptCommand@
+
+haskell-target-os = @HaskellTargetOs@
+haskell-target-arch = @HaskellTargetArch@
+target-word-size = @TargetWordSize@
+haskell-have-gnu-nonexec-stack = @HaskellHaveGnuNonexecStack@
+haskell-have-ident-directive = @HaskellHaveIdentDirective@
+haskell-have-subsections-via-symbols = @HaskellHaveSubsectionsViaSymbols@
+haskell-have-rts-linker = @HaskellHaveRTSLinker@
+
 # Include and library directories:
 #=================================
 


=====================================
hadrian/doc/make.md
=====================================
@@ -163,6 +163,17 @@ time you fire up a build. This is not possible with the Make build system.
   build _build/stage1/lib/platformConstants
   ```
 
+- Generate the `settings` file to be used for stage 1/2 GHC
+
+  ``` sh
+  # Make
+  make inplace/lib/settings
+
+  # Hadrian
+  build _build/stage0/lib/settings
+  build _build/stage1/lib/settings
+  ```
+
 - Build a static library for base with the stage 1 compiler
 
   ``` sh


=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -3,7 +3,9 @@ module Oracles.Setting (
     getSettingList,  anyTargetPlatform, anyTargetOs, anyTargetArch, anyHostOs,
     ghcWithInterpreter, ghcEnableTablesNextToCode, useLibFFIForAdjustors,
     ghcCanonVersion, cmdLineLengthLimit, iosHost, osxHost, windowsHost,
-    hostSupportsRPaths, topDirectory, libsuf, ghcVersionStage
+    hostSupportsRPaths, topDirectory, libsuf, ghcVersionStage,
+    SettingsFileSetting (..),
+    settingsFileSetting
     ) where
 
 import Hadrian.Expression
@@ -75,6 +77,31 @@ data SettingList = ConfCcArgs Stage
                  | ConfLdLinkerArgs Stage
                  | HsCppArgs
 
+-- TODO compute solely in Hadrian, removing these variables' definitions
+-- from aclocal.m4 whenever they can be calculated from other variables
+-- already fed into Hadrian.
+
+-- | Each 'SettingsFileSetting' is defined by 'FP_SETTINGS' in aclocal.m4.
+-- Eventually much of that local can probably be computed just in Hadrian.
+data SettingsFileSetting
+    = SettingsFileSetting_CCompilerCommand
+    | SettingsFileSetting_HaskellCPPCommand
+    | SettingsFileSetting_HaskellCPPFlags
+    | SettingsFileSetting_CCompilerFlags
+    | SettingsFileSetting_CCompilerLinkFlags
+    | SettingsFileSetting_CCompilerSupportsNoPie
+    | SettingsFileSetting_LdCommand
+    | SettingsFileSetting_LdFlags
+    | SettingsFileSetting_ArCommand
+    | SettingsFileSetting_RanlibCommand
+    | SettingsFileSetting_DllWrapCommand
+    | SettingsFileSetting_WindresCommand
+    | SettingsFileSetting_LibtoolCommand
+    | SettingsFileSetting_TouchCommand
+    | SettingsFileSetting_ClangCommand
+    | SettingsFileSetting_LlcCommand
+    | SettingsFileSetting_OptCommand
+
 -- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the
 -- result.
 setting :: Setting -> Action String
@@ -127,6 +154,28 @@ settingList key = fmap words $ lookupValueOrError configFile $ case key of
     ConfLdLinkerArgs  stage -> "conf-ld-linker-args-"  ++ stageString stage
     HsCppArgs               -> "hs-cpp-args"
 
+-- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the
+-- result.
+settingsFileSetting :: SettingsFileSetting -> Action String
+settingsFileSetting key = lookupValueOrError configFile $ case key of
+    SettingsFileSetting_CCompilerCommand -> "settings-c-compiler-command"
+    SettingsFileSetting_HaskellCPPCommand -> "settings-haskell-cpp-command"
+    SettingsFileSetting_HaskellCPPFlags -> "settings-haskell-cpp-flags"
+    SettingsFileSetting_CCompilerFlags -> "settings-c-compiler-flags"
+    SettingsFileSetting_CCompilerLinkFlags -> "settings-c-compiler-link-flags"
+    SettingsFileSetting_CCompilerSupportsNoPie -> "settings-c-compiler-supports-no-pie"
+    SettingsFileSetting_LdCommand -> "settings-ld-command"
+    SettingsFileSetting_LdFlags -> "settings-ld-flags"
+    SettingsFileSetting_ArCommand -> "settings-ar-command"
+    SettingsFileSetting_RanlibCommand -> "settings-ranlib-command"
+    SettingsFileSetting_DllWrapCommand -> "settings-dll-wrap-command"
+    SettingsFileSetting_WindresCommand -> "settings-windres-command"
+    SettingsFileSetting_LibtoolCommand -> "settings-libtool-command"
+    SettingsFileSetting_TouchCommand -> "settings-touch-command"
+    SettingsFileSetting_ClangCommand -> "settings-clang-command"
+    SettingsFileSetting_LlcCommand -> "settings-llc-command"
+    SettingsFileSetting_OptCommand -> "settings-opt-command"
+
 -- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
 -- tracking the result.
 getSetting :: Setting -> Expr c b String


=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -204,7 +204,7 @@ bindistRules = do
 bindistInstallFiles :: [FilePath]
 bindistInstallFiles =
     [ "config.sub", "config.guess", "install-sh", "mk" -/- "config.mk.in"
-    , "mk" -/- "install.mk.in", "mk" -/- "project.mk", "settings.in", "README"
+    , "mk" -/- "install.mk.in", "mk" -/- "project.mk", "README"
     , "INSTALL" ]
 
 -- | This auxiliary function gives us a top-level 'Filepath' that we can 'need'


=====================================
hadrian/src/Rules/Configure.hs
=====================================
@@ -14,7 +14,7 @@ import qualified System.Info.Extra as System
 -- | Files generated by running the @configure@ script.
 configureResults :: [FilePath]
 configureResults =
-    [ configFile, "settings", configH, "compiler/ghc.cabal", "rts/rts.cabal"]
+    [ configFile, configH, "compiler/ghc.cabal", "rts/rts.cabal"]
 
 configureRules :: Rules ()
 configureRules = do


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -7,6 +7,7 @@ module Rules.Generate (
 import Base
 import Expression
 import Flavour
+import Hadrian.Oracles.TextFile (lookupValueOrError)
 import Oracles.Flag
 import Oracles.ModuleFiles
 import Oracles.Setting
@@ -161,7 +162,7 @@ copyRules = do
         prefix -/- "llvm-targets"      <~ return "."
         prefix -/- "llvm-passes"       <~ return "."
         prefix -/- "platformConstants" <~ (buildRoot <&> (-/- generatedDir))
-        prefix -/- "settings"          <~ return "."
+        prefix -/- "settings"          <~ (buildRoot <&> (-/- generatedDir))
         prefix -/- "template-hsc.h"    <~ return (pkgPath hsc2hs)
 
         prefix -/- "html//*"           <~ return "utils/haddock/haddock-api/resources"
@@ -177,6 +178,7 @@ generateRules = do
     priority 2.0 $ (root -/- generatedDir -/- "ghcautoconf.h") <~ generateGhcAutoconfH
     priority 2.0 $ (root -/- generatedDir -/- "ghcplatform.h") <~ generateGhcPlatformH
     priority 2.0 $ (root -/- generatedDir -/-  "ghcversion.h") <~ generateGhcVersionH
+    priority 2.0 $ (root -/- generatedDir -/-      "settings") <~ generateSettings
 
     -- TODO: simplify, get rid of fake rts context
     root -/- generatedDir ++ "//*" %> \file -> do
@@ -261,6 +263,56 @@ generateGhcPlatformH = do
         ++
         [ "\n#endif /* __GHCPLATFORM_H__ */" ]
 
+generateSettings :: Expr String
+generateSettings = do
+    let flag' = flag >=> \case
+            True  -> pure "YES"
+            False -> pure "NO"
+    settings <- (traverse . traverse) expr $
+        [ ("GCC extra via C opts", lookupValueOrError configFile "gcc-extra-via-c-opts")
+        , ("C compiler command", settingsFileSetting SettingsFileSetting_CCompilerCommand)
+        , ("C compiler flags", settingsFileSetting SettingsFileSetting_CCompilerFlags)
+        , ("C compiler link flags", settingsFileSetting SettingsFileSetting_CCompilerLinkFlags)
+        , ("C compiler supports -no-pie", settingsFileSetting SettingsFileSetting_CCompilerSupportsNoPie)
+        , ("Haskell CPP command", settingsFileSetting SettingsFileSetting_HaskellCPPCommand)
+        , ("Haskell CPP flags", settingsFileSetting SettingsFileSetting_HaskellCPPFlags)
+        , ("ld command", settingsFileSetting SettingsFileSetting_LdCommand)
+        , ("ld flags", settingsFileSetting SettingsFileSetting_LdFlags)
+        , ("ld supports compact unwind", lookupValueOrError configFile "ld-has-no-compact-unwind")
+        , ("ld supports build-id", lookupValueOrError configFile "ld-has-build-id")
+        , ("ld supports filelist", lookupValueOrError configFile "ld-has-filelist")
+        , ("ld is GNU ld", lookupValueOrError configFile "ld-is-gnu-ld")
+        , ("ar command", settingsFileSetting SettingsFileSetting_ArCommand)
+        , ("ar flags", lookupValueOrError configFile "ar-args")
+        , ("ar supports at file", flag' ArSupportsAtFile)
+        , ("ranlib command", settingsFileSetting SettingsFileSetting_RanlibCommand)
+        , ("touch command", settingsFileSetting SettingsFileSetting_TouchCommand)
+        , ("dllwrap command", settingsFileSetting SettingsFileSetting_DllWrapCommand)
+        , ("windres command", settingsFileSetting SettingsFileSetting_WindresCommand)
+        , ("libtool command", settingsFileSetting SettingsFileSetting_LibtoolCommand)
+        , ("unlit command", ("$topdir/bin/" <>) . takeFileName <$> builderPath Unlit)
+        , ("cross compiling", flag' CrossCompiling)
+        , ("target os", lookupValueOrError configFile "haskell-target-os")
+        , ("target arch", lookupValueOrError configFile "haskell-target-arch")
+        , ("target word size", lookupValueOrError configFile "target-word-size")
+        , ("target has GNU nonexec stack", lookupValueOrError configFile "haskell-have-gnu-nonexec-stack")
+        , ("target has .ident directive", lookupValueOrError configFile "haskell-have-ident-directive")
+        , ("target has subsections via symbols", lookupValueOrError configFile "haskell-have-subsections-via-symbols")
+        , ("target has RTS linker", lookupValueOrError configFile "haskell-have-rts-linker")
+        , ("Unregisterised", flag' GhcUnregisterised)
+        , ("LLVM llc command", settingsFileSetting SettingsFileSetting_LlcCommand)
+        , ("LLVM opt command", settingsFileSetting SettingsFileSetting_OptCommand)
+        , ("LLVM clang command", settingsFileSetting SettingsFileSetting_ClangCommand)
+        ]
+    let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")"
+    pure $ case settings of
+        [] -> "[]"
+        s : ss -> unlines $
+            ("[" ++ showTuple s)
+            : ((\s' -> "," ++ showTuple s') <$> ss)
+            ++ ["]"]
+
+
 -- | Generate @Config.hs@ files.
 generateConfigHs :: Expr String
 generateConfigHs = do
@@ -284,7 +336,6 @@ generateConfigHs = do
     cGhcWithSMP                <- expr $ yesNo <$> ghcWithSMP
     cGhcEnableTablesNextToCode <- expr $ yesNo <$> ghcEnableTablesNextToCode
     cLeadingUnderscore         <- expr $ yesNo <$> flag LeadingUnderscore
-    cGHC_UNLIT_PGM             <- fmap takeFileName $ getBuilderPath Unlit
     cLibFFI                    <- expr useLibFFIForAdjustors
     rtsWays                    <- getRtsWays
     cGhcRtsWithLibdw           <- getFlag WithLibdw
@@ -342,8 +393,6 @@ generateConfigHs = do
         , "cGhcEnableTablesNextToCode = " ++ show cGhcEnableTablesNextToCode
         , "cLeadingUnderscore    :: String"
         , "cLeadingUnderscore    = " ++ show cLeadingUnderscore
-        , "cGHC_UNLIT_PGM        :: String"
-        , "cGHC_UNLIT_PGM        = " ++ show cGHC_UNLIT_PGM
         , "cLibFFI               :: Bool"
         , "cLibFFI               = " ++ show cLibFFI
         , "cGhcThreaded :: Bool"


=====================================
hadrian/src/Rules/SourceDist.hs
=====================================
@@ -110,4 +110,4 @@ prepareTree dest = do
         , "ghc.mk"
         , "install-sh"
         , "packages"
-        , "settings.in" ]
+        ]


=====================================
includes/ghc.mk
=====================================
@@ -166,6 +166,53 @@ endif
 
 endif
 
+# -----------------------------------------------------------------------------
+# Settings
+
+# These settings are read by GHC at runtime, so as to not cause spurious
+# rebuilds.
+
+includes_SETTINGS = includes/dist/build/settings
+
+$(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
+	$(call removeFiles,$@)
+	@echo '[("GCC extra via C opts", "$(GccExtraViaCOpts)")' >> $@
+	@echo ',("C compiler command", "$(SettingsCCompilerCommand)")' >> $@
+	@echo ',("C compiler flags", "$(SettingsCCompilerFlags)")' >> $@
+	@echo ',("C compiler link flags", "$(SettingsCCompilerLinkFlags)")' >> $@
+	@echo ',("C compiler supports -no-pie", "$(SettingsCCompilerSupportsNoPie)")' >> $@
+	@echo ',("Haskell CPP command", "$(SettingsHaskellCPPCommand)")' >> $@
+	@echo ',("Haskell CPP flags", "$(SettingsHaskellCPPFlags)")' >> $@
+	@echo ',("ld command", "$(SettingsLdCommand)")' >> $@
+	@echo ',("ld flags", "$(SettingsLdFlags)")' >> $@
+	@echo ',("ld supports compact unwind", "$(LdHasNoCompactUnwind)")' >> $@
+	@echo ',("ld supports build-id", "$(LdHasBuildId)")' >> $@
+	@echo ',("ld supports filelist", "$(LdHasFilelist)")' >> $@
+	@echo ',("ld is GNU ld", "$(LdIsGNULd)")' >> $@
+	@echo ',("ar command", "$(SettingsArCommand)")' >> $@
+	@echo ',("ar flags", "$(ArArgs)")' >> $@
+	@echo ',("ar supports at file", "$(ArSupportsAtFile)")' >> $@
+	@echo ',("ranlib command", "$(SettingsRanlibCommand)")' >> $@
+	@echo ',("touch command", "$(SettingsTouchCommand)")' >> $@
+	@echo ',("dllwrap command", "$(SettingsDllWrapCommand)")' >> $@
+	@echo ',("windres command", "$(SettingsWindresCommand)")' >> $@
+	@echo ',("libtool command", "$(SettingsLibtoolCommand)")' >> $@
+	@echo ',("unlit command", "$$topdir/bin/$(utils/unlit_dist_PROG)")' >> $@
+	@echo ',("cross compiling", "$(CrossCompiling)")' >> $@
+	@echo ',("target os", "$(HaskellTargetOs)")' >> $@
+	@echo ',("target arch", "$(HaskellTargetArch)")' >> $@
+	@echo ',("target word size", "$(TargetWordSize)")' >> $@
+	@echo ',("target has GNU nonexec stack", "$(HaskellHaveGnuNonexecStack)")' >> $@
+	@echo ',("target has .ident directive", "$(HaskellHaveIdentDirective)")' >> $@
+	@echo ',("target has subsections via symbols", "$(HaskellHaveSubsectionsViaSymbols)")' >> $@
+	@echo ',("target has RTS linker", "$(HaskellHaveRTSLinker)")' >> $@
+	@echo ',("Unregisterised", "$(Unregisterised)")' >> $@
+	@echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@
+	@echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@
+	@echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@
+	@echo ']' >> $@
+
+
 # ---------------------------------------------------------------------------
 # Make DerivedConstants.h for the compiler
 


=====================================
mk/config.mk.in
=====================================
@@ -487,6 +487,43 @@ endif
 
 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
 
+#-----------------------------------------------------------------------------
+# Settings
+
+# We are in the process of moving the settings file from being entirely
+# generated by configure, to generated being by the build system. Many of these
+# might become redundant.
+
+GccExtraViaCOpts = @GccExtraViaCOpts@
+LdHasFilelist = @LdHasFilelist@
+ArArgs = @ArArgs@
+HaskellTargetOs = @HaskellTargetOs@
+HaskellTargetArch = @HaskellTargetArch@
+TargetWordSize = @TargetWordSize@
+HaskellHaveGnuNonexecStack = @HaskellHaveGnuNonexecStack@
+HaskellHaveIdentDirective = @HaskellHaveIdentDirective@
+HaskellHaveSubsectionsViaSymbols = @HaskellHaveSubsectionsViaSymbols@
+HaskellHaveRTSLinker = @HaskellHaveRTSLinker@
+Unregisterised = @Unregisterised@
+
+SettingsCCompilerCommand = @SettingsCCompilerCommand@
+SettingsHaskellCPPCommand = @SettingsHaskellCPPCommand@
+SettingsHaskellCPPFlags = @SettingsHaskellCPPFlags@
+SettingsCCompilerFlags = @SettingsCCompilerFlags@
+SettingsCCompilerLinkFlags = @SettingsCCompilerLinkFlags@
+SettingsCCompilerSupportsNoPie = @SettingsCCompilerSupportsNoPie@
+SettingsLdCommand = @SettingsLdCommand@
+SettingsLdFlags = @SettingsLdFlags@
+SettingsArCommand = @SettingsArCommand@
+SettingsRanlibCommand = @SettingsRanlibCommand@
+SettingsDllWrapCommand = @SettingsDllWrapCommand@
+SettingsWindresCommand = @SettingsWindresCommand@
+SettingsLibtoolCommand = @SettingsLibtoolCommand@
+SettingsTouchCommand = @SettingsTouchCommand@
+SettingsClangCommand = @SettingsClangCommand@
+SettingsLlcCommand = @SettingsLlcCommand@
+SettingsOptCommand = @SettingsOptCommand@
+
 #-----------------------------------------------------------------------------
 # C compiler
 #


=====================================
settings.in deleted
=====================================
@@ -1,34 +0,0 @@
-[("GCC extra via C opts", "@GccExtraViaCOpts@")
-,("C compiler command", "@SettingsCCompilerCommand@")
-,("C compiler flags", "@SettingsCCompilerFlags@")
-,("C compiler link flags", "@SettingsCCompilerLinkFlags@")
-,("C compiler supports -no-pie", "@SettingsCCompilerSupportsNoPie@")
-,("Haskell CPP command", "@SettingsHaskellCPPCommand@")
-,("Haskell CPP flags", "@SettingsHaskellCPPFlags@")
-,("ld command", "@SettingsLdCommand@")
-,("ld flags", "@SettingsLdFlags@")
-,("ld supports compact unwind", "@LdHasNoCompactUnwind@")
-,("ld supports build-id", "@LdHasBuildId@")
-,("ld supports filelist", "@LdHasFilelist@")
-,("ld is GNU ld", "@LdIsGNULd@")
-,("ar command", "@SettingsArCommand@")
-,("ar flags", "@ArArgs@")
-,("ar supports at file", "@ArSupportsAtFile@")
-,("ranlib command", "@SettingsRanlibCommand@")
-,("touch command", "@SettingsTouchCommand@")
-,("dllwrap command", "@SettingsDllWrapCommand@")
-,("windres command", "@SettingsWindresCommand@")
-,("libtool command", "@SettingsLibtoolCommand@")
-,("cross compiling", "@CrossCompiling@")
-,("target os", "@HaskellTargetOs@")
-,("target arch", "@HaskellTargetArch@")
-,("target word size", "@TargetWordSize@")
-,("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@")
-,("target has .ident directive", "@HaskellHaveIdentDirective@")
-,("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@")
-,("target has RTS linker", "@HaskellHaveRTSLinker@")
-,("Unregisterised", "@Unregisterised@")
-,("LLVM llc command", "@SettingsLlcCommand@")
-,("LLVM opt command", "@SettingsOptCommand@")
-,("LLVM clang command", "@SettingsClangCommand@")
-]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/014ed644eea9037427c1ebeaac16189b00f9dbc7...2988ef5e0334f9841bf23d905b0363a3b8a1a660

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/014ed644eea9037427c1ebeaac16189b00f9dbc7...2988ef5e0334f9841bf23d905b0363a3b8a1a660
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190430/22f496b4/attachment-0001.html>


More information about the ghc-commits mailing list