Commit 01299ca8 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

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. 7b45c46c).
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
parent 0054bcd4
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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)
......
......@@ -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.*
......
......@@ -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.
......
......@@ -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.*
-- 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: 0.0.0.0
version: @ProjectVersionMunged@
license: BSD3
license-file: LICENSE
category: GHC
......
-- 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: 0
version: @ProjectVersionMunged@
license: BSD3
license-file: LICENSE
category: GHC
......@@ -37,17 +40,17 @@ library
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,
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:
......@@ -58,7 +61,7 @@ library
containers == 0.5.*,
deepseq == 1.4.*,
filepath == 1.4.*,
ghc-boot == 0.0.*,
ghc-boot == @ProjectVersionMunged@,
template-haskell == 2.11.*,
transformers == 0.5.*
......
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
......@@ -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'])
......
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