[Git][ghc/ghc][master] 2 commits: `ghcversion.h`: No need to cope with undefined `ProjectPatchLevel*`
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Oct 18 23:42:29 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
b12df0bb by John Ericson at 2023-10-18T19:41:37-04:00
`ghcversion.h`: No need to cope with undefined `ProjectPatchLevel*`
Since 4e6c80197f1cc46dfdef0300de46847c7cfbdcb0, these are guaranteed to
be defined. (Guaranteed including a test in the testsuite.)
- - - - -
0295375a by John Ericson at 2023-10-18T19:41:37-04:00
Generate `ghcversion.h` from a `.in` file
Now that there are no conditional sections (see the previous commit), we
can just a do simple substitution rather than pasting it together line
by line.
Progress on #23966
- - - - -
5 changed files:
- configure.ac
- hadrian/src/Rules/Generate.hs
- hadrian/src/Settings/Builders/Cabal.hs
- − rts/ghcversion.h.top
- rts/ghcversion.h.bottom → rts/include/ghcversion.h.in
Changes:
=====================================
configure.ac
=====================================
@@ -68,23 +68,6 @@ FP_PROG_SORT
dnl ----------------------------------------------------------
FP_SETUP_PROJECT_VERSION
-dnl Don't use AC_DEFINE because it will make C-style comments invalid for
-dnl Haskell.
-
-> rts/include/ghcversion.h
-
-cat rts/ghcversion.h.top >> rts/include/ghcversion.h
-
-echo "#define __GLASGOW_HASKELL__ ${ProjectVersionInt}" >> rts/include/ghcversion.h
-echo "#define __GLASGOW_HASKELL_FULL_VERSION__ \"${ProjectVersion}\"" >> rts/include/ghcversion.h
-echo >> rts/include/ghcversion.h
-AS_IF([test x"${ProjectPatchLevel1}" != x],
- [echo "#define __GLASGOW_HASKELL_PATCHLEVEL1__ ${ProjectPatchLevel1}" >> rts/include/ghcversion.h])
-AS_IF([test x"${ProjectPatchLevel2}" != x],
- [echo "#define __GLASGOW_HASKELL_PATCHLEVEL2__ ${ProjectPatchLevel2}" >> rts/include/ghcversion.h])
-
-cat rts/ghcversion.h.bottom >> rts/include/ghcversion.h
-
# Hmmm, we fix the RPM release number to 1 here... Is this convenient?
AC_SUBST([release], [1])
@@ -105,8 +88,6 @@ AC_PREREQ([2.69])
AC_CONFIG_HEADER(mk/config.h)
# This one is manually maintained.
AC_CONFIG_HEADER(compiler/ghc-llvm-version.h)
-dnl manually outputted above, for reasons described there.
-dnl AC_CONFIG_HEADER(rts/include/ghcversion.h)
# No, semi-sadly, we don't do `--srcdir'...
if test x"$srcdir" != 'x.' ; then
=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -323,6 +323,12 @@ templateRules = do
templateRule "utils/ghc-pkg/ghc-pkg.cabal" $ projectVersion
templateRule "libraries/template-haskell/template-haskell.cabal" $ projectVersion
templateRule "libraries/prologue.txt" $ packageVersions
+ templateRule "rts/include/ghcversion.h" $ mconcat
+ [ interpolateSetting "ProjectVersionInt" ProjectVersionInt
+ , interpolateSetting "ProjectVersion" ProjectVersion
+ , interpolateSetting "ProjectPatchLevel1" ProjectPatchLevel1
+ , interpolateSetting "ProjectPatchLevel2" ProjectPatchLevel2
+ ]
templateRule "docs/index.html" $ packageVersions
templateRule "docs/users_guide/ghc_config.py" $ mconcat
[ projectVersion
=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -166,9 +166,14 @@ configureStageArgs = do
let cFlags = getStagedCCFlags
linkFlags = prgFlags . ccLinkProgram . tgtCCompilerLink <$> getStagedTarget
mconcat [ configureArgs cFlags linkFlags
- , notStage0 ? arg "--ghc-option=-ghcversion-file=rts/include/ghcversion.h"
+ , ghcVersionH
]
+ghcVersionH :: Args
+ghcVersionH = notStage0 ? do
+ let h = "rts/include/ghcversion.h"
+ expr $ need [h]
+ arg $ "--ghc-option=-ghcversion-file=" <> h
configureArgs :: Args -> Args -> Args
configureArgs cFlags' ldFlags' = do
@@ -199,7 +204,7 @@ configureArgs cFlags' ldFlags' = do
-- ROMES:TODO: how is the Host set to TargetPlatformFull? That would be the target
, conf "--host" $ arg =<< getSetting TargetPlatformFull
, conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage
- , notStage0 ? arg "--ghc-option=-ghcversion-file=rts/include/ghcversion.h"
+ , ghcVersionH
]
bootPackageConstraints :: Args
=====================================
rts/ghcversion.h.top deleted
=====================================
@@ -1,3 +0,0 @@
-#if !defined(__GHCVERSION_H__)
-#define __GHCVERSION_H__
-
=====================================
rts/ghcversion.h.bottom → rts/include/ghcversion.h.in
=====================================
@@ -1,3 +1,11 @@
+#if !defined(__GHCVERSION_H__)
+#define __GHCVERSION_H__
+
+#define __GLASGOW_HASKELL__ @ProjectVersionInt@
+#define __GLASGOW_HASKELL_FULL_VERSION__ "@ProjectVersion@"
+
+#define __GLASGOW_HASKELL_PATCHLEVEL1__ @ProjectPatchLevel1@
+#define __GLASGOW_HASKELL_PATCHLEVEL2__ @ProjectPatchLevel2@
#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) ( \
((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f9436990ac1304c8c13b4f1f3ec3e2c3206104e3...0295375a6a43284ed32e2fc39ee4d08c3ef0ab9a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f9436990ac1304c8c13b4f1f3ec3e2c3206104e3...0295375a6a43284ed32e2fc39ee4d08c3ef0ab9a
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/20231018/8cbee612/attachment-0001.html>
More information about the ghc-commits
mailing list