summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-08-05 11:15:50 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2011-08-05 11:15:50 +0100
commit7c39ab0209fa6cc8447c9ab28563d0046dae0b7a (patch)
tree848b839988b48381251952e2b4bdbab423f5255a
parent1ae5e77cbdd51912ef96ff6e3d554f27354ff982 (diff)
parent59534b8022acf97e9f475cde14b85cd0d74088ac (diff)
downloadhaskell-7c39ab0209fa6cc8447c9ab28563d0046dae0b7a.tar.gz
Merge branch 'master' of http://darcs.haskell.org/ghc
-rw-r--r--aclocal.m43
-rwxr-xr-xboot4
-rw-r--r--compiler/cmm/CmmLex.x17
-rw-r--r--compiler/parser/Lexer.x15
-rw-r--r--docs/users_guide/extending_ghc.xml12
-rw-r--r--docs/users_guide/safe_haskell.xml2
-rw-r--r--ghc.mk96
-rw-r--r--ghc/ghc.mk2
-rw-r--r--mk/build.mk.sample9
-rw-r--r--mk/config.mk.in7
-rw-r--r--rts/Capability.c12
11 files changed, 115 insertions, 64 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index d798eb5063..68d36006e1 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -517,9 +517,12 @@ if test ! -f compiler/cmm/CmmLex.hs || test ! -f compiler/parser/Lexer.hs
then
FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[2.1.0],
[AC_MSG_ERROR([Alex version 2.1.0 or later is required to compile GHC.])])[]
+ FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-ge],[3.0],
+ [Alex3=YES],[Alex3=NO])
fi
AlexVersion=$fptools_cv_alex_version;
AC_SUBST(AlexVersion)
+AC_SUBST(Alex3)
])
diff --git a/boot b/boot
index b98eff4f5c..5d0973d1b9 100755
--- a/boot
+++ b/boot
@@ -174,8 +174,8 @@ sub boot_pkgs {
or die "Opening $package/ghc.mk failed: $!";
print GHCMK "${package}_PACKAGE = ${pkg}\n";
print GHCMK "${package}_dist-install_GROUP = libraries\n";
- print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
- print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(STAGE2_PACKAGES)),2,1)))\n";
+ print GHCMK "\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
+ print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE2)),2,1)))\n";
close GHCMK
or die "Closing $package/ghc.mk failed: $!";
diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x
index 9a7b43da6c..cbadaa85e4 100644
--- a/compiler/cmm/CmmLex.x
+++ b/compiler/cmm/CmmLex.x
@@ -33,6 +33,9 @@ import FastString
import Ctype
import Util
--import TRACE
+
+import Data.Word
+import Data.Char
}
$whitechar = [\ \t\n\r\f\v\xa0] -- \xa0 is Unicode no-break space
@@ -320,11 +323,19 @@ type AlexInput = (RealSrcLoc,StringBuffer)
alexInputPrevChar :: AlexInput -> Char
alexInputPrevChar (_,s) = prevChar s '\n'
+-- backwards compatibility for Alex 2.x
alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
-alexGetChar (loc,s)
+alexGetChar inp = case alexGetByte inp of
+ Nothing -> Nothing
+ Just (b,i) -> c `seq` Just (c,i)
+ where c = chr $ fromIntegral b
+
+alexGetByte :: AlexInput -> Maybe (Word8,AlexInput)
+alexGetByte (loc,s)
| atEnd s = Nothing
- | otherwise = c `seq` loc' `seq` s' `seq` Just (c, (loc', s'))
- where c = currentChar s
+ | otherwise = b `seq` loc' `seq` s' `seq` Just (b, (loc', s'))
+ where c = currentChar s
+ b = fromIntegral $ ord $ c
loc' = advanceSrcLoc loc c
s' = stepOn s
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 3f762aa5de..1570af32bc 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -80,6 +80,7 @@ import Data.Maybe
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Ratio
+import Data.Word
}
$unispace = \x05 -- Trick Alex into handling Unicode. See alexGetChar.
@@ -1576,14 +1577,22 @@ data AlexInput = AI RealSrcLoc StringBuffer
alexInputPrevChar :: AlexInput -> Char
alexInputPrevChar (AI _ buf) = prevChar buf '\n'
+-- backwards compatibility for Alex 2.x
alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
-alexGetChar (AI loc s)
+alexGetChar inp = case alexGetByte inp of
+ Nothing -> Nothing
+ Just (b,i) -> c `seq` Just (c,i)
+ where c = chr $ fromIntegral b
+
+alexGetByte :: AlexInput -> Maybe (Word8,AlexInput)
+alexGetByte (AI loc s)
| atEnd s = Nothing
- | otherwise = adj_c `seq` loc' `seq` s' `seq`
+ | otherwise = byte `seq` loc' `seq` s' `seq`
--trace (show (ord c)) $
- Just (adj_c, (AI loc' s'))
+ Just (byte, (AI loc' s'))
where (c,s') = nextChar s
loc' = advanceSrcLoc loc c
+ byte = fromIntegral $ ord adj_c
non_graphic = '\x0'
upper = '\x1'
diff --git a/docs/users_guide/extending_ghc.xml b/docs/users_guide/extending_ghc.xml
index 11cd75d898..1bce3fa7b4 100644
--- a/docs/users_guide/extending_ghc.xml
+++ b/docs/users_guide/extending_ghc.xml
@@ -173,12 +173,16 @@ plugin = defaultPlugin {
install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
install _ todo = do
+ reinitializeGlobals
putMsgS "Hello!"
return todo
</programlisting>
<para>Provided you compiled this plugin and registered it in a package (with cabal for instance,) you can then use it by just specifying <literal>-fplugin=DoNothing.Plugin</literal> on the command line, and during the compilation you should see GHC say 'Hello'.</para>
+ <para>Note carefully the <literal>reinitializeGlobals</literal> call at the beginning of the installation function. Due to bugs in the windows linker dealing with <literal>libghc</literal>, this call is necessary to properly ensure compiler plugins have the same global state as GHC at the time of invocation. Without <literal>reinitializeGlobals</literal>, compiler plugins can crash at runtime because they may require state that hasn't otherwise been initialized.</para>
+
+ <para>In the future, when the linking bugs are fixed, <literal>reinitializeGlobals</literal> will be deprecated with a warning, and changed to do nothing.</para>
<sect3 id="coretodo-in-more-detail">
<title><literal>CoreToDo</literal> in more detail</title>
@@ -217,7 +221,9 @@ plugin = defaultPlugin {
}
install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
-install _ todo = return (CoreDoPluginPass "Say name" pass : todo)
+install _ todo = do
+ reinitializeGlobals
+ return (CoreDoPluginPass "Say name" pass : todo)
pass :: ModGuts -> CoreM ModGuts
pass = bindsOnlyPass (mapM printBind)
@@ -252,7 +258,9 @@ plugin = defaultPlugin {
}
install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
-install _ todo = return (CoreDoPluginPass "Say name" pass : todo)
+install _ todo = do
+ reinitializeGlobals
+ return (CoreDoPluginPass "Say name" pass : todo)
pass :: ModGuts -> CoreM ModGuts
pass g = mapM_ (printAnn g) (mg_binds g) >> return g
diff --git a/docs/users_guide/safe_haskell.xml b/docs/users_guide/safe_haskell.xml
index abca32a71f..5c9bc67365 100644
--- a/docs/users_guide/safe_haskell.xml
+++ b/docs/users_guide/safe_haskell.xml
@@ -51,7 +51,7 @@
Haskell code easier to analyze and reason about. It also codifies an
existing culture in the Haskell community of trying to avoid using such
unsafe functions unless absolutely necessary. As such using the safe
- language (through the <option>-XSafe</option> flag) can be though of as a
+ language (through the <option>-XSafe</option> flag) can be thought of as a
way of enforcing good style, similar to the function of
<option>-Wall</option>.
</sect3>
diff --git a/ghc.mk b/ghc.mk
index b359ecca7a..bae8d91273 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -33,7 +33,7 @@
# then we don't have to use -osuf/-hisuf. We would have to install
# them in different places too, so we'd need ghc-pkg support for packages
# of different ways.
-# * make PACKAGES generated by './configure' or './boot'?
+# * make PACKAGES_STAGE1 generated by './configure' or './boot'?
# * we should use a directory of package.conf files rather than a single
# file for the inplace package database, so that we can express
# dependencies more accurately. Otherwise it's possible to get into
@@ -284,28 +284,28 @@ include rules/bindist.mk
%/. : | $(MKDIRHIER)
"$(MKDIRHIER)" $@
-# -----------------------------------------------------------------------------
-# Packages
-# --------------------------------
+# -----------------------------------------------------------------------------
# Properties of packages
+
# These lists say "if this package is built, here's a property it has"
# They do not say "this package will be built"; see $(PACKAGES_xx) for that
# Packages that are built but not installed
-INTREE_ONLY_PACKAGES := haskeline mtl terminfo utf8-string xhtml
+PKGS_THAT_ARE_INTREE_ONLY := haskeline mtl terminfo utf8-string xhtml
-DPH_PACKAGES := dph/dph-base dph/dph-prim-interface dph/dph-prim-seq \
+PKGS_THAT_ARE_DPH := dph/dph-base dph/dph-prim-interface dph/dph-prim-seq \
dph/dph-common dph/dph-prim-par dph/dph-par dph/dph-seq \
vector primitive random
# Packages that, if present, must be built by the stage2 compiler,
# because they use TH and/or annotations, or depend on other stage2
# packages:
-STAGE2_PACKAGES := $(DPH_PACKAGES) haskell98 haskell2010
+PKGS_THAT_BUILD_WITH_STAGE2 := $(PKGS_THAT_ARE_DPH) haskell98 haskell2010
+
# Packages that we shouldn't build if we don't have TH (e.g. because
# we're building a profiled compiler):
-TH_PACKAGES := $(DPH_PACKAGES)
+PKGS_THAT_USE_TH := $(PKGS_THAT_ARE_DPH)
# Packages that are built by stage0, in addition to stage1. These
# packages are dependencies of GHC, that we do not assume the stage0
@@ -313,11 +313,11 @@ TH_PACKAGES := $(DPH_PACKAGES)
#
# We assume that the stage0 compiler has a suitable bytestring package,
# so we don't have to include it below.
-PACKAGES_STAGE0 = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
+PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
# These packages are installed, but are installed hidden
# Why install them at all? Because the 'ghc' package depends on them
-HIDDEN_PACKAGES = binary
+PKGS_THAT_ARE_HIDDEN = binary
# $(EXTRA_PACKAGES) is another classification, of packages built but
# not installed
@@ -326,19 +326,24 @@ HIDDEN_PACKAGES = binary
# this ghc.mk
-# --------------------------------
+
+# ----------------------------------------------------------------------------
# Packages to build
# The lists of packages that we *actually* going to build in each stage:
#
-# $(PACKAGES_STAGE0) does double duty; it really is the list of packages
-# we build the bootstrap compiler in stage 0
-#
-# $(PACKAGES) A list of directories relative to libraries/ containing
-# packages that will be built by stage1, in dependency
-# order.
-#
-# $(PACKAGES_STAGE2) Ditto, for stage2.
+# $(PACKAGES_STAGE0)
+# $(PACKAGES_STAGE1)
+# $(PACKAGES_STAGE2)
#
+# These are automatically derived from
+# (a) the set of packages in this source tree
+# (b) the predicates above, e.g. $(PKGS_THAT_BUILD_WITH_STAGE2)
+# (c) which platform we're on, and a few other things
+
+
+# no processing to do on this one: it really is the list of packages
+# to build with stage 0.
+PACKAGES_STAGE0 = $(PKGS_THAT_BUILD_WITH_STAGE0)
define addPackageGeneral
# args: $1 = PACKAGES variable, $2 = package, $3 = condition
@@ -356,11 +361,11 @@ define addPackageGeneral
endef
define addPackage # args: $1 = package, $2 = condition
-ifneq "$(filter $1,$(TH_PACKAGES)) $(GhcProfiled)" "$1 YES"
-ifeq "$(filter $1,$(STAGE2_PACKAGES))" "$1"
+ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES"
+ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1"
$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
else
-$(call addPackageGeneral,PACKAGES,$1,$2)
+$(call addPackageGeneral,PACKAGES_STAGE1,$1,$2)
endif
endif
endef
@@ -411,7 +416,7 @@ $(eval $(call extra-packages))
# configured and registered all of its dependencies. So the following
# hack forces all the configure steps to happen in exactly the following order:
#
-# $(PACKAGES) ghc(stage2) $(PACKAGES_STAGE2)
+# $(PACKAGES_STAGE1) ghc(stage2) $(PACKAGES_STAGE2)
#
# Ideally we should use the correct dependencies here to allow more
# parallelism, but we don't know the dependencies until we've
@@ -423,7 +428,7 @@ endef
ifneq "$(BINDIST)" "YES"
fixed_pkg_prev=
-$(foreach pkg,$(PACKAGES),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
+$(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
# the GHC package doesn't live in libraries/, so we add its dependency manually:
compiler/stage2/package-data.mk: $(fixed_pkg_prev)
@@ -461,9 +466,9 @@ BOOT_PKG_CONSTRAINTS := \
--constraint "$p == $(shell grep -i "^Version:" libraries/$d/$p.cabal | sed "s/[^0-9.]//g")"))
# The actual .a and .so/.dll files: needed for dependencies.
-ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB))
+ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_v_LIB))
ifeq "$(BuildSharedLibs)" "YES"
-ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_dyn_LIB))
+ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_dyn_LIB))
endif
BOOT_LIBS = $(foreach lib,$(PACKAGES_STAGE0),$(libraries/$(lib)_dist-boot_v_LIB))
@@ -572,7 +577,7 @@ endif
ifneq "$(CLEANING)" "YES"
BUILD_DIRS += \
- $(patsubst %, libraries/%, $(PACKAGES))
+ $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
endif
ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
@@ -636,7 +641,7 @@ stage1_libs : $(ALL_STAGE1_LIBS)
# libraries/<pkg>_dist-install_HC_OPTS += -Wwarn
# Add $(GhcLibHcOpts) to all package builds
-$(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
+$(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
# Add $(GhcBootLibHcOpts) to all stage0 package builds
$(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts)))
@@ -645,7 +650,7 @@ $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$
# Haddock-related bits
# Don't run Haddock for the package that will not be installed
-$(foreach p,$(INTREE_ONLY_PACKAGES),$(eval libraries/$p_dist-install_DO_HADDOCK = NO))
+$(foreach p,$(PKGS_THAT_ARE_INTREE_ONLY),$(eval libraries/$p_dist-install_DO_HADDOCK = NO))
# We don't haddock the bootstrapping libraries
$(foreach p,$(PACKAGES_STAGE0),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
@@ -691,7 +696,7 @@ ifneq "$(BINDIST)" "YES"
# ghc-stage2. DPH includes a bit of Template Haskell which needs the
# GHCI libs, and we don't have a better way to express that dependency.
#
-GHCI_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
+GHCI_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
$(compiler_stage2_GHCI_LIB)
ifeq "$(UseArchivesForGhci)" "NO"
@@ -848,14 +853,14 @@ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif
-INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES)) \
+INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1)) \
compiler \
$(addprefix libraries/,$(PACKAGES_STAGE2))
ifeq "$(InstallExtraPackages)" "NO"
INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(EXTRA_PACKAGES)),\
$(INSTALLED_PKG_DIRS))
endif
-INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(INTREE_ONLY_PACKAGES)),\
+INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(PKGS_THAT_ARE_INTREE_ONLY)),\
$(INSTALLED_PKG_DIRS))
# Set the INSTALL_DISTDIR_p for each package; compiler is special
@@ -884,7 +889,7 @@ install_packages: libffi/package.conf.install rts/package.conf.install
'$(ghclibdir)' \
'$(docdir)/html/libraries' \
$(RelocatableBuild)))
- $(foreach p, $(HIDDEN_PACKAGES), \
+ $(foreach p, $(PKGS_THAT_ARE_HIDDEN), \
$(call make-command, \
"$(INSTALLED_GHC_PKG_REAL)" \
--global-conf "$(INSTALLED_PACKAGE_CONF)" hide $p))
@@ -919,10 +924,7 @@ $(eval $(call bindist,.,\
$(BINDIST_LIBS) \
$(BINDIST_HI) \
$(BINDIST_EXTRAS) \
- $(includes_H_CONFIG) \
- $(includes_H_PLATFORM) \
$(includes_H_FILES) \
- includes/ghcconfig.h \
$(INSTALL_HEADERS) \
$(INSTALL_LIBEXECS) \
$(INSTALL_LIBEXEC_SCRIPTS) \
@@ -1138,19 +1140,19 @@ clean_files :
"$(RM)" $(RM_OPTS) $(CLEAN_FILES)
.PHONY: clean_libraries
-clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES) $(PACKAGES_STAGE2))
+clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(PACKAGES_STAGE0))
clean_libraries:
- "$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/dist, $(PACKAGES) $(PACKAGES_STAGE2))
- "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
# We have to define a clean target for each library manually, because the
# libraries/*/ghc.mk files are not included when we're cleaning.
ifeq "$(CLEANING)" "YES"
$(foreach lib,$(PACKAGES_STAGE0),\
$(eval $(call clean-target,libraries/$(lib),dist-boot,libraries/$(lib)/dist-boot)))
-$(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),\
+$(foreach lib,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),\
$(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install)))
endif
@@ -1174,20 +1176,20 @@ distclean : clean
"$(RM)" $(RM_OPTS_REC) utils/ghc-pwd/dist
"$(RM)" $(RM_OPTS_REC) inplace
- "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2))
- "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2))
- "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES) $(PACKAGES_STAGE2))
- "$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
maintainer-clean : distclean
"$(RM)" $(RM_OPTS) configure mk/config.h.in
"$(RM)" $(RM_OPTS_REC) autom4te.cache libraries/*/autom4te.cache
"$(RM)" $(RM_OPTS) ghc.spec
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/GNUmakefile, \
- $(PACKAGES) $(PACKAGES_STAGE2))
- "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES) $(PACKAGES_STAGE2))
+ $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+ "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/configure, \
- $(PACKAGES) $(PACKAGES_STAGE2))
+ $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h.in
"$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h.in
"$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h.in
diff --git a/ghc/ghc.mk b/ghc/ghc.mk
index d270a7ad9d..4c16e25c63 100644
--- a/ghc/ghc.mk
+++ b/ghc/ghc.mk
@@ -97,7 +97,7 @@ ifneq "$(BINDIST)" "YES"
ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(BOOT_LIBS)
ifeq "$(GhcProfiled)" "YES"
ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_p_LIB)
-ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_p_LIB))
+ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_p_LIB))
endif
# Modules here import HsVersions.h, so we need ghc_boot_platform.h
diff --git a/mk/build.mk.sample b/mk/build.mk.sample
index 0d10ae8121..5196a65fa4 100644
--- a/mk/build.mk.sample
+++ b/mk/build.mk.sample
@@ -134,6 +134,15 @@ BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS = NO
BUILD_DOCBOOK_PDF = NO
+# After stage 1 and the libraries have been built, you can uncomment this line:
+
+# stage=2
+
+# Then stage 1 will not be touched by the build system, until
+# you uncomment the line again. This is a useful trick for when you're
+# working on stage 2 and want to freeze stage 1 and the libraries for
+# a while.
+
endif
# -------- A Unregisterised build) -------------------------------------------
diff --git a/mk/config.mk.in b/mk/config.mk.in
index e39c5c7381..0adaf69222 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -760,10 +760,17 @@ SRC_HAPPY_OPTS = -agc --strict
#
ALEX = @AlexCmd@
ALEX_VERSION = @AlexVersion@
+Alex3 = @Alex3@
#
# Options to pass to Happy when we're going to compile the output with GHC
#
+ifeq "$(Alex3)" "YES"
+# We aren't using the Unicode support in Alex 3.0 yet, in fact we do our own
+# Unicode handling, so diable Alex's.
+SRC_ALEX_OPTS = -g --latin1
+else
SRC_ALEX_OPTS = -g
+endif
# Should we build haddock docs?
HADDOCK_DOCS = YES
diff --git a/rts/Capability.c b/rts/Capability.c
index 91c5e2d98e..57c75e6875 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -366,11 +366,13 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
cap->no, task->incall->tso ? "bound task" : "worker",
(void *)task->id);
ACQUIRE_LOCK(&task->lock);
- task->wakeup = rtsTrue;
- // the wakeup flag is needed because signalCondition() doesn't
- // flag the condition if the thread is already runniing, but we want
- // it to be sticky.
- signalCondition(&task->cond);
+ if (task->wakeup == rtsFalse) {
+ task->wakeup = rtsTrue;
+ // the wakeup flag is needed because signalCondition() doesn't
+ // flag the condition if the thread is already runniing, but we want
+ // it to be sticky.
+ signalCondition(&task->cond);
+ }
RELEASE_LOCK(&task->lock);
}
#endif