[commit: ghc] master: GHC.Prim use virtual-modules (835d8dd)
git at git.haskell.org
git at git.haskell.org
Sat Nov 18 03:08:35 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/835d8ddbbfb11796ea8a03d1806b7cee38ba17a6/ghc
>---------------------------------------------------------------
commit 835d8ddbbfb11796ea8a03d1806b7cee38ba17a6
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Thu Nov 16 22:54:11 2017 +0800
GHC.Prim use virtual-modules
Stop the GHC.Prim madness with `virtual-module` support from cabal.
Needs https://github.com/haskell/cabal/pull/4875.
Bumps submodule libraries/Cabal to include the necessary logic for `virtual-module`.
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4179
>---------------------------------------------------------------
835d8ddbbfb11796ea8a03d1806b7cee38ba17a6
ghc.mk | 10 ++--------
libraries/Cabal | 2 +-
libraries/ghc-prim/ghc-prim.cabal | 12 ++++--------
utils/ghc-cabal/Main.hs | 16 +---------------
4 files changed, 8 insertions(+), 32 deletions(-)
diff --git a/ghc.mk b/ghc.mk
index 8918441..e653aae 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -598,15 +598,9 @@ libraries/ghci_dist-install_CONFIGURE_OPTS += --flags=ghci
# We want the ghc-prim package to include the GHC.Prim module when it
# is registered, but not when it is built, because GHC.Prim is not a
-# real source module, it is built-in to GHC. The old build system did
-# this using Setup.hs, but we can't do that here, so we have a flag to
-# enable GHC.Prim in the .cabal file (so that the ghc-prim package
-# remains compatible with the old build system for the time being).
-# GHC.Prim module in the ghc-prim package with a flag:
-#
-libraries/ghc-prim_CONFIGURE_OPTS += --flag=include-ghc-prim
+# real source module, it is built-in to GHC.
-# And then we strip it out again before building the package:
+# Strip it out again before building the package:
define libraries/ghc-prim_PACKAGE_MAGIC
libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim,$$(libraries/ghc-prim_dist-install_MODULES))
endef
diff --git a/libraries/Cabal b/libraries/Cabal
index 357d49d..97c66f2 160000
--- a/libraries/Cabal
+++ b/libraries/Cabal
@@ -1 +1 @@
-Subproject commit 357d49d826004c022f3b4871f16d753e1b932b54
+Subproject commit 97c66f2c7698f0aea4277acb66b918b7341b3d01
diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal
index ca50808..9b8c1ac 100644
--- a/libraries/ghc-prim/ghc-prim.cabal
+++ b/libraries/ghc-prim/ghc-prim.cabal
@@ -1,3 +1,4 @@
+cabal-version: 2.1
name: ghc-prim
version: 0.5.2.0
-- NOTE: Don't forget to update ./changelog.md
@@ -7,7 +8,6 @@ category: GHC
maintainer: libraries at haskell.org
bug-reports: http://ghc.haskell.org/trac/ghc/newticket?component=libraries%20%28other%29&keywords=ghc-prim
synopsis: GHC primitives
-cabal-version: >=1.10
build-type: Custom
description:
This package contains the primitive types and operations supplied by GHC.
@@ -19,10 +19,6 @@ source-repository head
location: http://git.haskell.org/ghc.git
subdir: libraries/ghc-prim
-flag include-ghc-prim
- Description: Include GHC.Prim in exposed-modules
- default: False
-
custom-setup
setup-depends: base >= 4 && < 5, Cabal >= 1.23
@@ -53,6 +49,9 @@ Library
GHC.Tuple
GHC.Types
+ virtual-modules:
+ GHC.Prim
+
-- OS Specific
if os(windows)
-- Windows requires some extra libraries for linking because the RTS
@@ -67,9 +66,6 @@ Library
-- on Windows. Required because of mingw32.
extra-libraries: user32, mingw32, mingwex
- if flag(include-ghc-prim)
- exposed-modules: GHC.Prim
-
c-sources:
cbits/atomic.c
cbits/bswap.c
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 9d0ffcf..440ab0b 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -145,26 +145,12 @@ doCopy directory distDir
else ["--destdir", myDestDir])
++ args
copyHooks = userHooks {
- copyHook = noGhcPrimHook
- $ modHook False
+ copyHook = modHook False
$ copyHook userHooks
}
defaultMainWithHooksArgs copyHooks copyArgs
where
- noGhcPrimHook f pd lbi us flags
- = let pd'
- | packageName pd == mkPackageName "ghc-prim" =
- case library pd of
- Just lib ->
- let ghcPrim = fromJust (simpleParse "GHC.Prim")
- ems = filter (ghcPrim /=) (exposedModules lib)
- lib' = lib { exposedModules = ems }
- in pd { library = Just lib' }
- Nothing ->
- error "Expected a library, but none found"
- | otherwise = pd
- in f pd' lbi us flags
modHook relocatableBuild f pd lbi us flags
= do let verbosity = normal
idts = updateInstallDirTemplates relocatableBuild
More information about the ghc-commits
mailing list