Commit 835d8ddb authored by Moritz Angermann's avatar Moritz Angermann

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
parent 12a74444
......@@ -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
......
Subproject commit 357d49d826004c022f3b4871f16d753e1b932b54
Subproject commit 97c66f2c7698f0aea4277acb66b918b7341b3d01
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@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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment