[Git][ghc/ghc][wip/toolchain-selection] 2 commits: Split ghc-toolchain executable to new packge
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Wed Jul 19 15:43:24 UTC 2023
Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC
Commits:
c2340c86 by Rodrigo Mesquita at 2023-07-19T16:43:06+01:00
Split ghc-toolchain executable to new packge
In light of #23690, we split the ghc-toolchain executable out of the
library package to be able to ship it in the bindist using Hadrian.
Ideally, we eventually revert this commit.
- - - - -
72ff798c by Rodrigo Mesquita at 2023-07-19T16:43:08+01:00
Ship ghc-toolchain in the bindist
Add the ghc-toolchain binary to the binary distribution we ship to
users, and teach the bindist configure to use the existing ghc-toolchain.
- - - - -
8 changed files:
- configure.ac
- distrib/configure.ac.in
- hadrian/src/Packages.hs
- hadrian/src/Settings/Default.hs
- m4/ghc_toolchain.m4
- utils/ghc-toolchain/Main.hs → utils/ghc-toolchain/exe/Main.hs
- + utils/ghc-toolchain/exe/ghc-toolchain-bin.cabal
- utils/ghc-toolchain/ghc-toolchain.cabal
Changes:
=====================================
configure.ac
=====================================
@@ -1177,7 +1177,7 @@ checkMake380 gmake
# Toolchain target files
PREP_TARGET_FILE
-FIND_GHC_TOOLCHAIN([hadrian/cfg])
+FIND_GHC_TOOLCHAIN([hadrian/cfg],[NO])
AC_CONFIG_FILES(
[ mk/project.mk
=====================================
distrib/configure.ac.in
=====================================
@@ -312,7 +312,7 @@ checkMake380 gmake
# Toolchain target files
PREP_TARGET_FILE
-FIND_GHC_TOOLCHAIN([.])
+FIND_GHC_TOOLCHAIN([.],[YES])
VALIDATE_GHC_TOOLCHAIN([default.target],[default.target.ghc-toolchain])
=====================================
hadrian/src/Packages.hs
=====================================
@@ -5,7 +5,8 @@ module Packages (
checkExact, countDeps,
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform,
- ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline,
+ ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, ghcToolchain, ghcToolchainBin,
+ haddock, haskeline,
hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy,
libffi, mtl, parsec, pretty, primitive, process, remoteIserv, rts,
runGhc, semaphoreCompat, stm, templateHaskell, terminfo, text, time, timeout, touchy,
@@ -37,7 +38,8 @@ ghcPackages =
[ array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, countDeps
, compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls
, exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform
- , ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline, hsc2hs
+ , ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, ghcToolchain, ghcToolchainBin
+ , haddock, haskeline, hsc2hs
, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, libffi, mtl
, parsec, pretty, process, rts, runGhc, stm, semaphoreCompat, templateHaskell
, terminfo, text, time, touchy, transformers, unlit, unix, win32, xhtml
@@ -53,7 +55,8 @@ isGhcPackage = (`elem` ghcPackages)
array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, countDeps,
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcPlatform,
- ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, haddock, haskeline, hsc2hs,
+ ghcCompact, ghcConfig, ghcHeap, ghci, ghciWrapper, ghcPkg, ghcPrim, ghcToolchain,
+ haddock, haskeline, hsc2hs,
hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy, remoteIserv, libffi, mtl,
parsec, pretty, primitive, process, rts, runGhc, semaphoreCompat, stm, templateHaskell,
terminfo, text, time, touchy, transformers, unlit, unix, win32, xhtml,
@@ -93,6 +96,8 @@ ghciWrapper = prg "ghci-wrapper" `setPath` "driver/ghci"
-- See Note [Hadrian's ghci-wrapper package]
ghcPkg = util "ghc-pkg"
ghcPrim = lib "ghc-prim"
+ghcToolchain = lib "ghc-toolchain" `setPath` "utils/ghc-toolchain"
+ghcToolchainBin = prg "ghc-toolchain-bin" `setPath` "utils/ghc-toolchain/exe" -- workaround for #23690
haddock = util "haddock"
haskeline = lib "haskeline"
hsc2hs = util "hsc2hs"
=====================================
hadrian/src/Settings/Default.hs
=====================================
@@ -87,6 +87,7 @@ stage0Packages = do
, ghcBootTh
, ghcPlatform
, ghcHeap
+ , ghcToolchain
, ghci
, ghcPkg
, haddock
@@ -154,6 +155,7 @@ stage1Packages = do
, hpcBin
, iserv
, runGhc
+ , ghcToolchainBin
]
, when (winTarget && not cross)
[ touchy
=====================================
m4/ghc_toolchain.m4
=====================================
@@ -33,21 +33,38 @@ AC_DEFUN([INVOKE_GHC_TOOLCHAIN],
while read -r arg; do
set -- "[$]@" "$arg"
done
- # For now, we don't exit even if ghc-toolchain fails. We don't want to
+ # For now, we don't 'exit' even if ghc-toolchain fails. We don't want to
# fail configure due to it, since the target file is still being generated by configure.
- ./acghc-toolchain -v2 "[$]@" # || exit 1
- python3 -c 'import sys; print(sys.argv)' "[$]@"
- ) <acargs || exit 1
+ "$GHC_TOOLCHAIN_BIN" -v2 "[$]@"
+ ) <acargs
])
dnl $1 is the path to the directory where to put the configured default.host.target.ghc-toolchain and default.target.ghc-toolchain
+dnl $2 is YES or NO,
+dnl * YES means we're calling GHC_TOOLCHAIN from the bindist configure script,
+dnl and that ghc-toolchain is already an available binary
+dnl * NO means we're calling GHC_TOOLCHAIN from the source tree configure script,
+dnl and that we must compile ghc-toolchain before invoking it
AC_DEFUN([FIND_GHC_TOOLCHAIN],
[
- "$GHC" -v0 \
- -ilibraries/ghc-platform/src -iutils/ghc-toolchain/src \
- -XNoImplicitPrelude \
- -odir actmp-ghc-toolchain -hidir actmp-ghc-toolchain \
- utils/ghc-toolchain/Main.hs -o acghc-toolchain
+ case "$2" in
+ YES)
+ # We're configuring the bindist, and the binary is already available
+ GHC_TOOLCHAIN_BIN="bin/ghc-toolchain-bin"
+ ;;
+ NO)
+ # We're in the source tree, so compile ghc-toolchain
+ "$GHC" -v0 \
+ -ilibraries/ghc-platform/src -iutils/ghc-toolchain/src \
+ -XNoImplicitPrelude \
+ -odir actmp-ghc-toolchain -hidir actmp-ghc-toolchain \
+ utils/ghc-toolchain/exe/Main.hs -o acghc-toolchain
+ GHC_TOOLCHAIN_BIN="./acghc-toolchain"
+ ;;
+ *)
+ AC_MSG_ERROR([In m4/ghc_toolchain.m4, expecting $2 to be either YES or NO.])
+ ;;
+ esac
# (1) Configure a toolchain for the build and host platform (we require that BUILD=HOST, so one toolchain suffices)
rm -f acargs
=====================================
utils/ghc-toolchain/Main.hs → utils/ghc-toolchain/exe/Main.hs
=====================================
=====================================
utils/ghc-toolchain/exe/ghc-toolchain-bin.cabal
=====================================
@@ -0,0 +1,22 @@
+cabal-version: 2.4
+name: ghc-toolchain-bin
+version: 0.1.0.0
+synopsis: Utility for managing GHC target toolchains
+description:
+bug-reports: https://gitlab.haskell.org/ghc/ghc/-/issues
+author: Ben Gamari
+maintainer: ben at well-typed.com
+copyright: (c) The GHC Developers
+
+executable ghc-toolchain-bin
+ main-is: Main.hs
+ ghc-options: -Wall
+ default-extensions: NoImplicitPrelude
+ build-depends: base,
+ directory,
+ filepath,
+ process,
+ transformers,
+ ghc-platform,
+ ghc-toolchain
+ default-language: Haskell2010
=====================================
utils/ghc-toolchain/ghc-toolchain.cabal
=====================================
@@ -40,16 +40,3 @@ library
ghc-platform
hs-source-dirs: src
default-language: Haskell2010
-
-executable ghc-toolchain
- main-is: Main.hs
- ghc-options: -Wall
- default-extensions: NoImplicitPrelude
- build-depends: base,
- directory,
- filepath,
- process,
- transformers,
- ghc-platform,
- ghc-toolchain
- default-language: Haskell2010
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/10e2f0fe251970d8444e67790714fc0248fbb7cb...72ff798c8c2825294ff405d876063254b8d85392
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/10e2f0fe251970d8444e67790714fc0248fbb7cb...72ff798c8c2825294ff405d876063254b8d85392
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/20230719/bb92d214/attachment-0001.html>
More information about the ghc-commits
mailing list