summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2017-08-01 11:05:18 -0400
committerBen Gamari <ben@smart-cactus.org>2017-08-01 16:04:54 -0400
commit36fe21aa3fe5abe1cef0104b20c296ac9385658d (patch)
treefccb49998e3e4c961e1f2c9e4d3000ae394bfd60 /rules
parentc13720c8c6047844f659ad4ce684946b80c99bee (diff)
downloadhaskell-36fe21aa3fe5abe1cef0104b20c296ac9385658d.tar.gz
Enable building Cabal with parsec
Cabal's parser has been rewritten in terms of Parsec (which is not enabled yet in Cabal-2.0 by default, but can be enabled by a cabal flag). The plan for Cabal is to drop support for the non-parsec parser, so we need to prepare GHC to cope with new situation. However, this means that lib:Cabal requires three new library dependency submodules, - parsec - text - mtl What complicates matters is that we need to build `ghc-cabal` early on during the bootstrap phase which currently needs to invoke `ghc --make` directly. So these additional dependencies need to be integrated into the monolithic `ghc --make` invocation which produces the `ghc-cabal` executable. Test Plan: `./validate --fast` passed Reviewers: austin, bgamari Subscribers: erikd, phadej, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3757
Diffstat (limited to 'rules')
-rw-r--r--rules/sdist-ghc-file.mk31
1 files changed, 31 insertions, 0 deletions
diff --git a/rules/sdist-ghc-file.mk b/rules/sdist-ghc-file.mk
index 9ea0b6521a..d6a70e10fb 100644
--- a/rules/sdist-ghc-file.mk
+++ b/rules/sdist-ghc-file.mk
@@ -44,3 +44,34 @@ sdist_$1_$2_$4 : $1/$2/build/$4.hs
# didn't generate all package-data.mk files.
$$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$3))
endef
+
+# -----------------------------------------------------------------------------
+# Variant of sdist-ghc-file whose `$3`-argument is interpreted
+# differently in a more appropriate way for cabal-packages
+
+define sdist-ghc-file2
+# $1 = dir
+# $2 = distdir
+# $3 = moduledir
+# $4 = filename
+# $5 = extension
+
+.PHONY: sdist_$1_$2_$4
+
+# We should do this before creating the `sdist-ghc` tarball, or when just
+# running `make sdist-ghc-prep`.
+sdist-ghc-prep : sdist_$1_$2_$4
+
+# But first create SRC_DIST_GHC_DIR.
+sdist_$1_$2_$4 : sdist-ghc-prep-tree
+
+# Generate the .hs files if they don't exist yet, then do actual copying and
+# moving.
+sdist_$1_$2_$4 : $1/$2/build/$3/$4.hs
+ "$(CP)" $1/$2/build/$3/$4.hs $(SRC_DIST_GHC_DIR)/$1/$3
+ mv $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5 $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5.source
+
+# And make sure the rules for generating the .hs files exist, even when we
+# didn't generate all package-data.mk files.
+$$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$3))
+endef