From 01299ca83996710ec1572c952917157b1c2d139e Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sun, 27 Dec 2015 09:03:44 +0100 Subject: Synchronise ghci-package version with ghc-package In order to simplify the task, the version munging logic has been radically simplified: Previously, in cases where the version contained dates as version components, the build-system would munge the version of the stage1 ghc package before registering the `ghc` package. However, this hack was already questionable at the time of its introduction (c.f. 7b45c46cbabe1288ea87bd9b94c57e010ed17e60). Simplifying the build-systems by avoiding such hacks may also help the shaking-up-ghc effort. So now we simply munge directly via the `.cabal` files, which gives a simpler picture, as now every stage is munged the same. Munging is only active when the first patch-level version component is a date. So stable snapshots and release candidates are unaffacted (as those have the date in the second patch-level version component) Reviewers: simonmar, bgamari, austin, thomie, ezyang Reviewed By: bgamari, thomie, ezyang Differential Revision: https://phabricator.haskell.org/D1673 --- .gitignore | 2 + aclocal.m4 | 16 +++++- boot | 6 +- compiler/ghc.cabal.in | 18 +++--- compiler/ghc.mk | 53 ----------------- configure.ac | 2 +- ghc.mk | 1 + ghc/ghc-bin.cabal.in | 8 +-- ghc/ghc.mk | 9 --- iserv/iserv-bin.cabal | 2 +- libraries/ghc-boot/ghc-boot.cabal | 45 --------------- libraries/ghc-boot/ghc-boot.cabal.in | 49 ++++++++++++++++ libraries/ghci/ghci.cabal | 66 ---------------------- libraries/ghci/ghci.cabal.in | 69 +++++++++++++++++++++++ libraries/template-haskell/template-haskell.cabal | 2 +- rules/build-package-data.mk | 2 - rules/foreachLibrary.mk | 1 + testsuite/tests/th/all.T | 5 +- 18 files changed, 161 insertions(+), 195 deletions(-) delete mode 100644 libraries/ghc-boot/ghc-boot.cabal create mode 100644 libraries/ghc-boot/ghc-boot.cabal.in delete mode 100644 libraries/ghci/ghci.cabal create mode 100644 libraries/ghci/ghci.cabal.in diff --git a/.gitignore b/.gitignore index bb69e916f4..0455251c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -125,7 +125,9 @@ _darcs/ /libraries/doc-index*.html /libraries/frames.html /libraries/ghc-boot/GNUmakefile +/libraries/ghc-boot/ghc-boot.cabal /libraries/ghc-boot/ghc.mk +/libraries/ghci/ghci.cabal /libraries/ghci/ghc.mk /libraries/haddock-util.js /libraries/hslogo-16.png diff --git a/aclocal.m4 b/aclocal.m4 index 45c94f784b..e823f34fcc 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1532,8 +1532,22 @@ AC_SUBST([ProjectPatchLevel2]) ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'` AC_SUBST([ProjectPatchLevel]) -])# FP_SETUP_PROJECT_VERSION +# The version of the GHC package changes every day, since the +# patchlevel is the current date. We don't want to force +# recompilation of the entire compiler when this happens, so for +# GHC HEAD we omit the patchlevel from the package version number. +# +# The ProjectPatchLevel1 > 20000000 iff GHC HEAD. If it's for a stable +# release like 7.10.1 or for a release candidate such as 7.10.1.20141224 +# then we don't omit the patchlevel components. + +ProjectVersionMunged="$ProjectVersion" +if test "$ProjectPatchLevel1" -gt 20000000; then + ProjectVersionMunged="${VERSION_MAJOR}.${VERSION_MINOR}" +fi +AC_SUBST([ProjectVersionMunged]) +])# FP_SETUP_PROJECT_VERSION # Check for a working timer_create(). We need a pretty detailed check # here, because there exist partially-working implementations of diff --git a/boot b/boot index 2ce7acbb06..18d43aabda 100755 --- a/boot +++ b/boot @@ -144,7 +144,10 @@ sub boot_pkgs { for $package (@library_dirs) { my $dir = &basename($package); - my @cabals = glob("$package/*.cabal"); + my @cabals = glob("$package/*.cabal.in"); + if ($#cabals < 0) { + @cabals = glob("$package/*.cabal"); + } if ($#cabals > 0) { die "Too many .cabal file in $package\n"; } @@ -155,6 +158,7 @@ sub boot_pkgs { if (-f $cabal) { $pkg = $cabal; $pkg =~ s#.*/##; + $pkg =~ s/\.cabal.in$//; $pkg =~ s/\.cabal$//; $top = $package; $top =~ s#[^/]+#..#g; diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index da8fce2109..4264b667e7 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -2,7 +2,7 @@ -- ./configure. Make sure you are editing ghc.cabal.in, not ghc.cabal. Name: ghc -Version: @ProjectVersion@ +Version: @ProjectVersionMunged@ License: BSD3 License-File: ../LICENSE Author: The GHC Team @@ -53,19 +53,19 @@ Library containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, - template-haskell, - hpc, - transformers, - ghc-boot, - hoopl + template-haskell == 2.11.*, + hpc == 0.6.*, + transformers == 0.5.*, + ghc-boot == @ProjectVersionMunged@, + hoopl >= 3.10.2 && < 3.11 if os(windows) - Build-Depends: Win32 + Build-Depends: Win32 == 2.3.* else - Build-Depends: unix + Build-Depends: unix == 2.7.* if flag(ghci) - Build-Depends: ghci + Build-Depends: ghci == @ProjectVersionMunged@ GHC-Options: -Wall -fno-warn-name-shadowing diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 9148c79030..49c6971dd0 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -437,42 +437,6 @@ compiler/stage3/package-data.mk : compiler/ghc.mk compiler_PACKAGE = ghc -# Note [fiddle-stage1-version] -# The version of the GHC package changes every day, since the -# patchlevel is the current date. We don't want to force -# recompilation of the entire compiler when this happens, so for stage -# 1 we omit the patchlevel from the version number. For stage 2 we -# have to include the patchlevel since this is the package we install, -# however. -# -# Note: we also have to tweak the version number of the package itself -# when it gets registered; see Note [munge-stage1-package-config] -# below. -# The ProjectPatchLevel > 20000000 iff it's a date. If it's e.g. 6.12.1 -# then we don't want to remove it -ifneq "$(CLEANING)" "YES" -ifeq "$(shell [ $(ProjectPatchLevel) -gt 20000000 ] && echo YES)" "YES" -compiler_stage1_VERSION_MUNGED = YES -endif -endif - -ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES" -compiler_stage1_MUNGED_VERSION = $(subst .$(ProjectPatchLevel),,$(ProjectVersion)) -define compiler_PACKAGE_MAGIC -compiler_stage1_VERSION = $(compiler_stage1_MUNGED_VERSION) -compiler_stage1_COMPONENT_ID = $(subst .$(ProjectPatchLevel),,$(compiler_stage1_COMPONENT_ID)) -endef - -# NB: the COMPONENT_ID munging has no effect for new-style unit ids -# (which indeed, have nothing version like in them, but are important for -# old-style unit ids which do.) The subst operation is idempotent, so -# as long as we do it at least once we should be good. - -# Don't register the non-munged package -compiler_stage1_REGISTER_PACKAGE = NO - -endif - # Don't do splitting for the GHC package, it takes too long and # there's not much benefit. compiler_stage1_SplitObjs = NO @@ -708,21 +672,4 @@ ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" compiler/utils/Util_HC_OPTS += -DDYNAMIC_GHC_PROGRAMS endif -# Note [munge-stage1-package-config] -# Strip the date/patchlevel from the version of stage1. See Note -# [fiddle-stage1-version] above. -# NB: The sed expression for hs-libraries is a bit weird to be POSIX-compliant. -ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES" -compiler/stage1/inplace-pkg-config-munged: compiler/stage1/inplace-pkg-config - sed -e 's/^\(version: .*\)\.$(ProjectPatchLevel)$$/\1/' \ - -e 's/^\(id: .*\)\.$(ProjectPatchLevel)$$/\1/' \ - -e 's/^\(hs-libraries: HSghc-.*\)\.$(ProjectPatchLevel)\(-[A-Za-z0-9][A-Za-z0-9]*\)*$$/\1\2/' \ - < $< > $@ - "$(compiler_stage1_GHC_PKG)" update --force $(compiler_stage1_GHC_PKG_OPTS) $@ - -# We need to make sure the munged config is in the database before we -# try to configure ghc-bin -ghc/stage1/package-data.mk : compiler/stage1/inplace-pkg-config-munged -endif - endif diff --git a/configure.ac b/configure.ac index 69cdd2b7e4..f5d624db26 100644 --- a/configure.ac +++ b/configure.ac @@ -1103,7 +1103,7 @@ if test -e shake-build/cfg/system.config.in; then AC_CONFIG_FILES([shake-build/cfg/system.config]) fi -AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac]) +AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghci/ghci.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac]) AC_OUTPUT # We got caught by diff --git a/ghc.mk b/ghc.mk index 1bd54154bd..ba708a1f59 100644 --- a/ghc.mk +++ b/ghc.mk @@ -1349,6 +1349,7 @@ distclean : clean $(call removeFiles,mk/project.mk) $(call removeFiles,compiler/ghc.cabal) $(call removeFiles,ghc/ghc-bin.cabal) + $(call removeFiles,libraries/ghci/ghci.cabal) $(call removeFiles,utils/runghc/runghc.cabal) $(call removeFiles,settings) $(call removeFiles,docs/users_guide/ug-book.xml) diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index adf81b3890..afb3939fc9 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -27,14 +27,14 @@ Executable ghc Default-Language: Haskell2010 Main-Is: Main.hs - Build-Depends: base >= 3 && < 5, + Build-Depends: base >= 4 && < 5, array >= 0.1 && < 0.6, bytestring >= 0.9 && < 0.11, directory >= 1 && < 1.3, process >= 1 && < 1.5, filepath >= 1 && < 1.5, - ghc-boot == 0.0.*, - ghc + ghc-boot == @ProjectVersionMunged@, + ghc == @ProjectVersionMunged@ if os(windows) Build-Depends: Win32 == 2.3.* @@ -49,7 +49,7 @@ Executable ghc Build-depends: containers == 0.5.*, deepseq == 1.4.*, - ghci, + ghci == @ProjectVersionMunged@, haskeline == 0.7.*, time == 1.6.*, transformers == 0.5.* diff --git a/ghc/ghc.mk b/ghc/ghc.mk index f8c6b09e3f..c0c78bdef6 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -22,15 +22,6 @@ ghc_stage2_CONFIGURE_OPTS += --flags=ghci ghc_stage3_CONFIGURE_OPTS += --flags=ghci endif -ifeq "$(compiler_stage1_VERSION_MUNGED)" "YES" -# If we munge the stage1 version, and we're using a devel snapshot for -# stage0, then stage1 may actually have an earlier version than stage0 -# (e.g. boot with ghc-7.5.20120316, building ghc-7.5). We therefore -# need to tell Cabal to use version 7.5 of the ghc package when building -# in ghc/stage1 -ghc_stage1_CONFIGURE_OPTS += --constraint "ghc == $(compiler_stage1_MUNGED_VERSION)" -endif - # This package doesn't pass the Cabal checks because data-dir # points outside the source directory. This isn't a real problem, so # we just skip the check. diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index 9dac158ebf..d4f0eed263 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -23,4 +23,4 @@ Executable iserv bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci + ghci == 7.11.* diff --git a/libraries/ghc-boot/ghc-boot.cabal b/libraries/ghc-boot/ghc-boot.cabal deleted file mode 100644 index f9516b6060..0000000000 --- a/libraries/ghc-boot/ghc-boot.cabal +++ /dev/null @@ -1,45 +0,0 @@ -name: ghc-boot -version: 0.0.0.0 -license: BSD3 -license-file: LICENSE -category: GHC -maintainer: ghc-devs@haskell.org -bug-reports: https://ghc.haskell.org/trac/ghc/newticket -synopsis: Shared functionality between GHC and its boot libraries -description: This library is shared between GHC, ghc-pkg, and other boot - libraries. - . - A note about "GHC.PackageDb": it only deals with the subset of - the package database that the compiler cares about: modules - paths etc and not package metadata like description, authors - etc. It is thus not a library interface to ghc-pkg and is *not* - suitable for modifying GHC package databases. - . - The package database format and this library are constructed in - such a way that while ghc-pkg depends on Cabal, the GHC library - and program do not have to depend on Cabal. -cabal-version: >=1.10 -build-type: Simple -extra-source-files: changelog.md - -source-repository head - type: git - location: http://git.haskell.org/ghc.git - subdir: libraries/ghc-boot - -Library - default-language: Haskell2010 - other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables - - exposed-modules: - GHC.Lexeme - GHC.PackageDb - GHC.LanguageExtensions - GHC.Serialized - - build-depends: base >= 4.7 && < 4.10, - binary == 0.8.*, - bytestring == 0.10.*, - directory == 1.2.*, - filepath >= 1.3 && < 1.5 - diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in new file mode 100644 index 0000000000..b7d3955190 --- /dev/null +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -0,0 +1,49 @@ +-- WARNING: ghc-boot.cabal is automatically generated from ghc-boot.cabal.in by +-- ../../configure. Make sure you are editing ghc-boot.cabal.in, not +-- ghc-boot.cabal. + +name: ghc-boot +version: @ProjectVersionMunged@ +license: BSD3 +license-file: LICENSE +category: GHC +maintainer: ghc-devs@haskell.org +bug-reports: https://ghc.haskell.org/trac/ghc/newticket +synopsis: Shared functionality between GHC and its boot libraries +description: This library is shared between GHC, ghc-pkg, and other boot + libraries. + . + A note about "GHC.PackageDb": it only deals with the subset of + the package database that the compiler cares about: modules + paths etc and not package metadata like description, authors + etc. It is thus not a library interface to ghc-pkg and is *not* + suitable for modifying GHC package databases. + . + The package database format and this library are constructed in + such a way that while ghc-pkg depends on Cabal, the GHC library + and program do not have to depend on Cabal. +cabal-version: >=1.10 +build-type: Simple +extra-source-files: changelog.md + +source-repository head + type: git + location: http://git.haskell.org/ghc.git + subdir: libraries/ghc-boot + +Library + default-language: Haskell2010 + other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables + + exposed-modules: + GHC.Lexeme + GHC.PackageDb + GHC.LanguageExtensions + GHC.Serialized + + build-depends: base >= 4.7 && < 4.10, + binary == 0.8.*, + bytestring == 0.10.*, + directory == 1.2.*, + filepath >= 1.3 && < 1.5 + diff --git a/libraries/ghci/ghci.cabal b/libraries/ghci/ghci.cabal deleted file mode 100644 index 39eb7dacf9..0000000000 --- a/libraries/ghci/ghci.cabal +++ /dev/null @@ -1,66 +0,0 @@ -name: ghci -version: 0 -license: BSD3 -license-file: LICENSE -category: GHC -maintainer: ghc-devs@haskell.org -bug-reports: https://ghc.haskell.org/trac/ghc/newticket -synopsis: XXX -description: - XXX -cabal-version: >=1.10 -build-type: Simple -extra-source-files: changelog.md - -source-repository head - type: git - location: http://git.haskell.org/ghc.git - subdir: libraries/ghci - -library - default-language: Haskell2010 - other-extensions: - BangPatterns - CPP - DeriveGeneric - ExistentialQuantification - FlexibleInstances - GADTs - GeneralizedNewtypeDeriving - InstanceSigs - MagicHash - MultiParamTypeClasses - RecordWildCards - ScopedTypeVariables - StandaloneDeriving - TupleSections - UnboxedTuples - - exposed-modules: - GHCi.Message, - GHCi.ResolvedBCO, - GHCi.RemoteTypes, - GHCi.ObjLink, - GHCi.CreateBCO, - GHCi.FFI, - GHCi.InfoTable, - GHCi.Run, - GHCi.Signals, - GHCi.TH, - GHCi.TH.Binary, - SizedSeq - - Build-Depends: - array == 0.5.*, - base == 4.9.*, - binary == 0.8.*, - bytestring == 0.10.*, - containers == 0.5.*, - deepseq == 1.4.*, - filepath == 1.4.*, - ghc-boot == 0.0.*, - template-haskell == 2.11.*, - transformers == 0.5.* - - if !os(windows) - Build-Depends: unix == 2.7.* diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in new file mode 100644 index 0000000000..e9ceb46608 --- /dev/null +++ b/libraries/ghci/ghci.cabal.in @@ -0,0 +1,69 @@ +-- WARNING: ghci.cabal is automatically generated from ghci.cabal.in by +-- ../../configure. Make sure you are editing ghci.cabal.in, not ghci.cabal. + +name: ghci +version: @ProjectVersionMunged@ +license: BSD3 +license-file: LICENSE +category: GHC +maintainer: ghc-devs@haskell.org +bug-reports: https://ghc.haskell.org/trac/ghc/newticket +synopsis: XXX +description: + XXX +cabal-version: >=1.10 +build-type: Simple +extra-source-files: changelog.md + +source-repository head + type: git + location: http://git.haskell.org/ghc.git + subdir: libraries/ghci + +library + default-language: Haskell2010 + other-extensions: + BangPatterns + CPP + DeriveGeneric + ExistentialQuantification + FlexibleInstances + GADTs + GeneralizedNewtypeDeriving + InstanceSigs + MagicHash + MultiParamTypeClasses + RecordWildCards + ScopedTypeVariables + StandaloneDeriving + TupleSections + UnboxedTuples + + exposed-modules: + GHCi.Message + GHCi.ResolvedBCO + GHCi.RemoteTypes + GHCi.ObjLink + GHCi.CreateBCO + GHCi.FFI + GHCi.InfoTable + GHCi.Run + GHCi.Signals + GHCi.TH + GHCi.TH.Binary + SizedSeq + + Build-Depends: + array == 0.5.*, + base == 4.9.*, + binary == 0.8.*, + bytestring == 0.10.*, + containers == 0.5.*, + deepseq == 1.4.*, + filepath == 1.4.*, + ghc-boot == @ProjectVersionMunged@, + template-haskell == 2.11.*, + transformers == 0.5.* + + if !os(windows) + Build-Depends: unix == 2.7.* diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index ad51144d68..ff9fe05367 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -48,7 +48,7 @@ Library build-depends: base >= 4.6 && < 4.10, - ghc-boot, + ghc-boot >= 7.11 && < 8.1, pretty == 1.1.* -- We need to set the unit ID to template-haskell (without a diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index 17b87e021e..e46ecd6d61 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -134,10 +134,8 @@ endif endif "$$(ghc-cabal_INPLACE)" configure $1 $2 "$$($1_$2_dll0_MODULES)" --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) ifeq "$$($1_$2_PROG)" "" -ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO" $$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config endif -endif endif # NO_GENERATED_MAKEFILE_RULES endif # BINDIST diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk index 1a91cd9d77..1f44c9ec5f 100644 --- a/rules/foreachLibrary.mk +++ b/rules/foreachLibrary.mk @@ -38,6 +38,7 @@ define foreachLibrary # $1 = function to call for each library # We will give it the package path and the tag as arguments $$(foreach hashline,libraries/ghc-boot#-#no-remote-repo#no-vcs \ + libraries/ghci#-#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 \ diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index fb429bcbd5..549737b826 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -284,8 +284,9 @@ test('T8028', ['T8028', '-v0 ' + config.ghc_th_way_flags]) test('TH_Roles1', normal, compile_fail, ['-v0']) -test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', - 'integer-gmp', 'pretty', 'template-haskell' +test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', 'ghc-boot', + 'integer-gmp', 'pretty', 'template-haskell', + 'binary', 'bytestring', 'containers' ), compile, ['-v0 -ddump-tc']) test('TH_Roles3', normal, compile, ['-v0 -dsuppress-uniques']) test('TH_Roles4', normal, compile, ['-v0']) -- cgit v1.2.1