[Git][ghc/ghc][wip/toolchain-selection] Rename target files to hadrian/cfg (not on bindist)

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jul 17 10:18:26 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
4372c1fa by Rodrigo Mesquita at 2023-07-17T11:18:12+01:00
Rename target files to hadrian/cfg (not on bindist)

- - - - -


8 changed files:

- configure.ac
- distrib/configure.ac.in
- hadrian/.gitignore
- default.host.target.in → hadrian/cfg/default.host.target.in
- default.target.in → hadrian/cfg/default.target.in
- hadrian/src/Base.hs
- hadrian/src/Rules/BinaryDist.hs
- m4/ghc_toolchain.m4


Changes:

=====================================
configure.ac
=====================================
@@ -1177,7 +1177,7 @@ checkMake380 gmake
 
 # Toolchain target files
 PREP_TARGET_FILE
-FIND_GHC_TOOLCHAIN
+FIND_GHC_TOOLCHAIN([hadrian/cfg])
 
 AC_CONFIG_FILES(
 [ mk/project.mk
@@ -1187,8 +1187,8 @@ AC_CONFIG_FILES(
   hadrian/ghci-stack
   docs/users_guide/ghc_config.py
   distrib/configure.ac
-  default.host.target
-  default.target
+  hadrian/cfg/default.host.target
+  hadrian/cfg/default.target
 ])
 
 dnl Create the VERSION file, satisfying #22322.
@@ -1313,5 +1313,5 @@ For more information on how to configure your GHC build, see
 #
 # VALIDATE_GHC_TOOLCHAIN([default.host.target],[default.host.target.ghc-toolchain])
 
-VALIDATE_GHC_TOOLCHAIN([default.target],[default.target.ghc-toolchain])
+VALIDATE_GHC_TOOLCHAIN([hadrian/cfg/default.target],[hadrian/cfg/default.target.ghc-toolchain])
 


=====================================
distrib/configure.ac.in
=====================================
@@ -312,7 +312,7 @@ checkMake380 gmake
 
 # Toolchain target files
 PREP_TARGET_FILE
-FIND_GHC_TOOLCHAIN
+FIND_GHC_TOOLCHAIN([.])
 
 VALIDATE_GHC_TOOLCHAIN([default.target],[default.target.ghc-toolchain])
 


=====================================
hadrian/.gitignore
=====================================
@@ -1,5 +1,9 @@
 # generated by the configure script
 cfg/system.config
+cfg/default.host.target
+cfg/default.host.target.ghc-toolchain
+cfg/default.target
+cfg/default.target.ghc-toolchain
 /ghci-stack
 /ghci-multi-cabal
 /ghci-cabal


=====================================
default.host.target.in → hadrian/cfg/default.host.target.in
=====================================


=====================================
default.target.in → hadrian/cfg/default.target.in
=====================================


=====================================
hadrian/src/Base.hs
=====================================
@@ -83,17 +83,20 @@ configFile = configPath -/- "system.config"
 -- | The target configuration file generated by ghc-toolchain for the
 -- compilation build platform
 buildTargetFile :: FilePath
-buildTargetFile = "default.host.target" -- ROMES:TODO: Not hardcode this value?
+buildTargetFile = configPath -/- "default.host.target"
 
 -- | The target configuration file generated by ghc-toolchain for the
 -- compilation host platform
+--
+-- Currently, GHC requires that BUILD=HOST, so, for now, the host target file
+-- is really just the build target file.
 hostTargetFile :: FilePath
-hostTargetFile = "default.host.target" -- ROMES:TODO: Not hardcode this value?
+hostTargetFile = buildTargetFile
 
 -- | The target configuration file generated by ghc-toolchain for the
 -- compilation target platform
 targetTargetFile :: FilePath
-targetTargetFile = "default.target" -- ROMES:TODO: Not hardcode this value, depends on target
+targetTargetFile = configPath -/- "default.target"
 
 -- | Path to source files of the build system, e.g. this file is located at
 -- @sourcePath -/- "Base.hs"@. We use this to track some of the source files.


=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -258,8 +258,8 @@ bindistRules = do
           need $ map (bindistFilesDir -/-)
                     (["configure", "Makefile"] ++ bindistInstallFiles)
           copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in")
-          copyFile ("default.target.in") (bindistFilesDir -/- "default.target.in")
-          copyFile ("default.host.target.in") (bindistFilesDir -/- "default.host.target.in")
+          copyFile ("hadrian" -/- "cfg" -/- "default.target.in") (bindistFilesDir -/- "default.target.in")
+          copyFile ("hadrian" -/- "cfg" -/- "default.host.target.in") (bindistFilesDir -/- "default.host.target.in")
           forM_ bin_targets $ \(pkg, _) -> do
             needed_wrappers <- pkgToWrappers pkg
             forM_ needed_wrappers $ \wrapper_name -> do


=====================================
m4/ghc_toolchain.m4
=====================================
@@ -40,6 +40,7 @@ AC_DEFUN([INVOKE_GHC_TOOLCHAIN],
     ) <acargs || exit 1
 ])
 
+dnl $1 is the path to the directory where to put the configured default.host.target.ghc-toolchain and default.target.ghc-toolchain
 AC_DEFUN([FIND_GHC_TOOLCHAIN],
 [
     "$GHC" -v0 \
@@ -51,7 +52,7 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN],
     # (1) Configure a toolchain for the build and host platform (we require that BUILD=HOST, so one toolchain suffices)
     rm -f acargs
     echo "--triple=$HostPlatform" >> acargs
-    echo "--output=default.host.target.ghc-toolchain" >> acargs
+    echo "--output=$1/default.host.target.ghc-toolchain" >> acargs
     echo "--cc=$CC_STAGE0" >> acargs
     echo "--cc-link=$CC_STAGE0" >> acargs
     echo "--ar=$AR_STAGE0" >> acargs
@@ -77,7 +78,7 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN],
     # calling it through configure.
     rm -f acargs
     echo "--triple=$target" >> acargs
-    echo "--output=default.target.ghc-toolchain" >> acargs
+    echo "--output=$1/default.target.ghc-toolchain" >> acargs
     echo "--llvm-triple=$LlvmTarget" >> acargs
     echo "--cc=$CC" >> acargs
     echo "--cxx=$CXX" >> acargs
@@ -131,9 +132,4 @@ AC_DEFUN([VALIDATE_GHC_TOOLCHAIN],[
                 https://www.haskell.org/ghc/reportabug
       ])
     fi
-
-dnl     echo "$1:"
-dnl     cat $1
-dnl     echo "$2:"
-dnl     cat $2
 ])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4372c1faf41ba958e71f01fe24b9248e1809e000

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4372c1faf41ba958e71f01fe24b9248e1809e000
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/20230717/bf5b6ec6/attachment-0001.html>


More information about the ghc-commits mailing list