summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-02-11 09:56:43 +0100
committerBen Gamari <ben@smart-cactus.org>2020-06-17 16:22:03 -0400
commitaa9e7b7196f03f84579e3b4a09068c668cbe6ffb (patch)
treec4bf6673ea4298a4675b21c8b5dcbc205bfbb86f
parent0f67e3447e5a0089b5348940d404ed876fddddfc (diff)
downloadhaskell-aa9e7b7196f03f84579e3b4a09068c668cbe6ffb.tar.gz
Update `make` based build system
* replace integer-* package selection with ghc-bignum backend selection
-rw-r--r--ghc.mk35
-rw-r--r--includes/ghc.mk2
-rw-r--r--libraries/ghc-bignum/gmp/ghc.mk5
-rw-r--r--mk/build.mk.sample4
-rw-r--r--mk/config.mk.in4
-rw-r--r--mk/flavours/bench-cross-ncg.mk2
-rw-r--r--mk/flavours/bench-cross.mk2
-rw-r--r--mk/flavours/perf-cross-ncg.mk2
-rw-r--r--mk/flavours/perf-cross.mk2
-rw-r--r--mk/flavours/quick-cross-ncg.mk2
-rw-r--r--mk/flavours/quick-cross.mk2
-rw-r--r--rules/build-package-data.mk5
-rw-r--r--rules/foreachLibrary.mk4
13 files changed, 34 insertions, 37 deletions
diff --git a/ghc.mk b/ghc.mk
index 92ec715623..02e3b79a2d 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -420,7 +420,7 @@ PACKAGES_STAGE0 += terminfo
endif
PACKAGES_STAGE1 += ghc-prim
-PACKAGES_STAGE1 += $(INTEGER_LIBRARY)
+PACKAGES_STAGE1 += ghc-bignum
PACKAGES_STAGE1 += base
PACKAGES_STAGE1 += filepath
PACKAGES_STAGE1 += array
@@ -451,6 +451,7 @@ PACKAGES_STAGE1 += parsec
PACKAGES_STAGE1 += Cabal/Cabal
PACKAGES_STAGE1 += ghc-compact
PACKAGES_STAGE1 += ghc-heap
+PACKAGES_STAGE1 += integer-gmp # compat library
ifeq "$(HADDOCK_DOCS)" "YES"
PACKAGES_STAGE1 += xhtml
@@ -466,6 +467,15 @@ endif
# and executables. This flag disables the latter.
libraries/haskeline_CONFIGURE_OPTS += --flags=-examples
+libraries/ghc-bignum_CONFIGURE_OPTS += -f $(BIGNUM_BACKEND)
+
+ifeq "$(BIGNUM_BACKEND)" "gmp"
+GMP_ENABLED = YES
+libraries/ghc-bignum_CONFIGURE_OPTS += --configure-option="--with-gmp"
+else
+GMP_ENABLED = NO
+endif
+
PACKAGES_STAGE1 += stm
PACKAGES_STAGE1 += exceptions
PACKAGES_STAGE1 += haskeline
@@ -605,21 +615,6 @@ libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $$(genprimopcode_I
# Required so that Haddock documents the primops.
libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs
-# ----------------------------------------
-# Special magic for the integer package
-
-ifneq "$(CLEANING)" "YES"
-ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
-libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-gmp
-compiler_stage2_CONFIGURE_OPTS += --flags=integer-gmp
-else ifeq "$(INTEGER_LIBRARY)" "integer-simple"
-libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple
-compiler_stage2_CONFIGURE_OPTS += --flags=integer-simple
-else
-$(error Unknown integer library: $(INTEGER_LIBRARY))
-endif
-endif
-
# -----------------------------------------------------------------------------
# Include build instructions from all subdirs
BUILD_DIRS += utils/mkdirhier
@@ -656,7 +651,7 @@ BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
BUILD_DIRS += $(patsubst %, libraries/%, $(filter-out $(PACKAGES_STAGE1),$(PACKAGES_STAGE0)))
endif
-BUILD_DIRS += libraries/integer-gmp/gmp
+BUILD_DIRS += libraries/ghc-bignum/gmp
BUILD_DIRS += utils/haddock
BUILD_DIRS += utils/haddock/doc
BUILD_DIRS += compiler
@@ -702,9 +697,6 @@ ifeq "$(GhcWithInterpreter)" "NO"
# runghc is just GHCi in disguise
BUILD_DIRS := $(filter-out utils/runghc,$(BUILD_DIRS))
endif
-ifneq "$(INTEGER_LIBRARY)" "integer-gmp"
-BUILD_DIRS := $(filter-out libraries/integer-gmp/gmp,$(BUILD_DIRS))
-endif
ifneq "$(CrossCompiling) $(Stage1Only)" "NO NO"
# See Note [No stage2 packages when CrossCompiling or Stage1Only].
# See Note [Stage1Only vs stage=1] in mk/config.mk.in.
@@ -1301,7 +1293,8 @@ sdist_%:
.PHONY: clean
-CLEAN_FILES += libraries/integer-gmp/include/HsIntegerGmp.h
+CLEAN_FILES += libraries/ghc-bignum/include/ghc-gmp.h
+CLEAN_FILES += libraries/ghc-bignum/include/HsIntegerGmp.h
CLEAN_FILES += libraries/base/include/EventConfig.h
CLEAN_FILES += mk/config.mk.old
CLEAN_FILES += mk/project.mk.old
diff --git a/includes/ghc.mk b/includes/ghc.mk
index 737e66cdea..c8180548d3 100644
--- a/includes/ghc.mk
+++ b/includes/ghc.mk
@@ -247,7 +247,7 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
@echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@
@echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@
@echo
- @echo ',("integer library", "$(INTEGER_LIBRARY)")' >> $@
+ @echo ',("bignum backend", "$(BIGNUM_BACKEND)")' >> $@
@echo ',("Use interpreter", "$(GhcWithInterpreter)")' >> $@
@echo ',("Use native code generator", "$(GhcWithNativeCodeGen)")' >> $@
@echo ',("Support SMP", "$(GhcWithSMP)")' >> $@
diff --git a/libraries/ghc-bignum/gmp/ghc.mk b/libraries/ghc-bignum/gmp/ghc.mk
index fd2798770e..fe8ba7c171 100644
--- a/libraries/ghc-bignum/gmp/ghc.mk
+++ b/libraries/ghc-bignum/gmp/ghc.mk
@@ -83,11 +83,10 @@ UseIntreeGmp = YES
endif
endif
-# wrappers.c includes "ghc-gmp.h"
-libraries/integer-gmp/cbits/wrappers.c: libraries/integer-gmp/include/ghc-gmp.h
+# gmp_wrappers.c includes "ghc-gmp.h"
+libraries/ghc-bignum/cbits/gmp_wrappers.c: libraries/ghc-bignum/include/ghc-gmp.h
ifeq "$(UseIntreeGmp)" "YES"
-
# Copy header from in-tree build (gmp.h => ghc-gmp.h)
libraries/ghc-bignum/include/ghc-gmp.h: libraries/ghc-bignum/gmp/gmp.h
$(CP) $< $@
diff --git a/mk/build.mk.sample b/mk/build.mk.sample
index 80457b6a47..e3417a2765 100644
--- a/mk/build.mk.sample
+++ b/mk/build.mk.sample
@@ -99,9 +99,9 @@ endif
# https://gitlab.haskell.org/ghc/ghc/wikis/building/running-tests/running#additional-packages
#BUILD_EXTRA_PKGS=YES
-# Uncomment the following to force `integer-gmp` to use the in-tree GMP 6.1.2
+# Uncomment the following to force `ghc-bignum` to use the in-tree GMP 6.1.2
# (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`)
-#libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
+#libraries/ghc-bignum_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
# Enable pretty hyperlinked sources
#HADDOCK_DOCS = YES
diff --git a/mk/config.mk.in b/mk/config.mk.in
index ef2ee685ab..406e72ba1b 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -244,8 +244,8 @@ ExtraMakefileSanityChecks = NO
#------------------------------------------------------------------------------
# Options for Libraries
-# Which directory (in libraries/) contains the integer library?
-INTEGER_LIBRARY=integer-gmp
+# Backend to use in ghc-bignum (gmp, native, etc.)
+BIGNUM_BACKEND=gmp
# We build the libraries at least the "vanilla" way (way "v")
# Technically we don't need the v way if DYNAMIC_GHC_PROGRAMS is YES,
diff --git a/mk/flavours/bench-cross-ncg.mk b/mk/flavours/bench-cross-ncg.mk
index 1fc7b245a0..727f9301ae 100644
--- a/mk/flavours/bench-cross-ncg.mk
+++ b/mk/flavours/bench-cross-ncg.mk
@@ -10,7 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/mk/flavours/bench-cross.mk b/mk/flavours/bench-cross.mk
index 7d1d4c4260..fa332fe9f6 100644
--- a/mk/flavours/bench-cross.mk
+++ b/mk/flavours/bench-cross.mk
@@ -10,7 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/mk/flavours/perf-cross-ncg.mk b/mk/flavours/perf-cross-ncg.mk
index 56ecc79b13..fefff049d3 100644
--- a/mk/flavours/perf-cross-ncg.mk
+++ b/mk/flavours/perf-cross-ncg.mk
@@ -9,7 +9,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/mk/flavours/perf-cross.mk b/mk/flavours/perf-cross.mk
index 9e48ce9605..36d33b68b5 100644
--- a/mk/flavours/perf-cross.mk
+++ b/mk/flavours/perf-cross.mk
@@ -9,7 +9,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/mk/flavours/quick-cross-ncg.mk b/mk/flavours/quick-cross-ncg.mk
index 471b37dc6b..55e62f6b0f 100644
--- a/mk/flavours/quick-cross-ncg.mk
+++ b/mk/flavours/quick-cross-ncg.mk
@@ -10,7 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/mk/flavours/quick-cross.mk b/mk/flavours/quick-cross.mk
index 98defa700c..07ed5f06ff 100644
--- a/mk/flavours/quick-cross.mk
+++ b/mk/flavours/quick-cross.mk
@@ -10,7 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
-INTEGER_LIBRARY = integer-simple
+BIGNUM_BACKEND = native
Stage1Only = YES
DYNAMIC_BY_DEFAULT = NO
DYNAMIC_GHC_PROGRAMS = NO
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 1c5987e63d..e2a98082d2 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -100,6 +100,11 @@ ifeq "$$(GMP_FORCE_INTREE)" "YES"
$1_$2_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
endif
+ifeq "$$(GMP_ENABLED)" "YES"
+$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp
+endif
+
+
ifneq "$$(CURSES_LIB_DIRS)" ""
$1_$2_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="$$(CURSES_LIB_DIRS)"
endif
diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk
index dddd61a899..60dd0d3a82 100644
--- a/rules/foreachLibrary.mk
+++ b/rules/foreachLibrary.mk
@@ -32,7 +32,7 @@
# - ghc-boot-th
# - ghc-prim
# - integer-gmp
-# - integer-simple
+# - ghc-bignum
# - template-haskell
define foreachLibrary
@@ -44,7 +44,7 @@ $$(foreach hashline,libraries/ghc-boot-th#-#no-remote-repo#no-vcs \
libraries/base#-#no-remote-repo#no-vcs \
libraries/ghc-prim#-#no-remote-repo#no-vcs \
libraries/integer-gmp#-#no-remote-repo#no-vcs \
- libraries/integer-simple#-#no-remote-repo#no-vcs \
+ libraries/ghc-bignum#-#no-remote-repo#no-vcs \
libraries/template-haskell#-#no-remote-repo#no-vcs \
$$(shell grep '^libraries/' packages | sed 's/ */#/g'),\
$$(eval FEL_line := $$(subst #,$$(space),$$(hashline))) \