Commit 66ec09b7 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Merge branch 'master' of http://darcs.haskell.org/ghc

parents b6acaf08 edb53036
......@@ -1794,7 +1794,7 @@ AC_MSG_NOTICE(Building in-tree ghc-pwd)
])
AC_DEFUN([FP_BINDIST_GHC_PWD],[
GHC_PWD=utils/ghc-pwd/dist-install/build/tmp/ghc-pwd
GHC_PWD=utils/ghc-pwd/dist-install/build/tmp/ghc-pwd-bindist
])
AC_DEFUN([FP_FIND_ROOT],[
......
......@@ -365,23 +365,32 @@ tryToInline dflags live node assigs = go usages node [] assigs
go _usages node _skipped [] = (node, [])
go usages node skipped (a@(l,rhs,_) : rest)
| can_inline = inline_and_discard
| isTrivial rhs = inline_and_keep
| cannot_inline = dont_inline
| occurs_once = inline_and_discard
| isTrivial rhs = inline_and_keep
| otherwise = dont_inline
where
inline_and_discard = go usages' node' skipped rest
inline_and_discard = go usages' inl_node skipped rest
where usages' = foldRegsUsed addUsage usages rhs
inline_and_keep = (node'', a : rest')
where (node'',rest') = go usages' node' (l:skipped) rest
dont_inline = keep node -- don't inline the assignment, keep it
inline_and_keep = keep inl_node -- inline the assignment, keep it
can_inline =
not (l `elemRegSet` live)
&& not (skipped `regsUsedIn` rhs) -- Note [dependent assignments]
&& okToInline dflags rhs node
&& lookupUFM usages l == Just 1
keep node' = (final_node, a : rest')
where (final_node, rest') = go usages' node' (l:skipped) rest
usages' = foldRegsUsed (\m r -> addToUFM m r 2) usages rhs
-- we must not inline anything that is mentioned in the RHS
-- of a binding that we have already skipped, so we set the
-- usages of the regs on the RHS to 2.
usages' = foldRegsUsed addUsage usages rhs
cannot_inline = skipped `regsUsedIn` rhs -- Note [dependent assignments]
|| l `elem` skipped
|| not (okToInline dflags rhs node)
node' = mapExpDeep inline node
occurs_once = not (l `elemRegSet` live)
&& lookupUFM usages l == Just 1
inl_node = mapExpDeep inline node
where inline (CmmReg (CmmLocal l')) | l == l' = rhs
inline (CmmRegOff (CmmLocal l') off) | l == l'
= cmmOffset dflags rhs off
......@@ -389,14 +398,6 @@ tryToInline dflags live node assigs = go usages node [] assigs
inline (CmmMachOp op args) = cmmMachOpFold dflags op args
inline other = other
go usages node skipped (assig@(l,rhs,_) : rest)
= (node', assig : rest')
where (node', rest') = go usages' node (l:skipped) rest
usages' = foldRegsUsed (\m r -> addToUFM m r 2) usages rhs
-- we must not inline anything that is mentioned in the RHS
-- of a binding that we have already skipped, so we set the
-- usages of the regs on the RHS to 2.
-- Note [dependent assignments]
--
-- If our assignment list looks like
......@@ -415,6 +416,15 @@ tryToInline dflags live node assigs = go usages node [] assigs
--
-- For now we do nothing, because this would require putting
-- everything inside UniqSM.
--
-- One more variant of this (#7366):
--
-- [ y = e, y = z ]
--
-- If we don't want to inline y = e, because y is used many times, we
-- might still be tempted to inline y = z (because we always inline
-- trivial rhs's). But of course we can't, because y is equal to e,
-- not z.
addUsage :: UniqFM Int -> LocalReg -> UniqFM Int
addUsage m r = addToUFM_C (+) m r 1
......
......@@ -66,6 +66,7 @@ module DynFlags (
-- ** Manipulating DynFlags
defaultDynFlags, -- Settings -> DynFlags
defaultWays,
initDynFlags, -- DynFlags -> IO DynFlags
defaultFatalMessager,
defaultLogAction,
......@@ -1181,9 +1182,9 @@ defaultDynFlags mySettings =
packageFlags = [],
pkgDatabase = Nothing,
pkgState = panic "no package state yet: call GHC.setSessionDynFlags",
ways = [],
buildTag = mkBuildTag [],
rtsBuildTag = mkBuildTag [],
ways = defaultWays mySettings,
buildTag = mkBuildTag (defaultWays mySettings),
rtsBuildTag = mkBuildTag (defaultWays mySettings),
splitInfo = Nothing,
settings = mySettings,
-- ghc -M values
......@@ -1238,6 +1239,11 @@ defaultDynFlags mySettings =
interactivePrint = Nothing
}
defaultWays :: Settings -> [Way]
defaultWays settings = if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then [WayDyn]
else []
--------------------------------------------------------------------------
type FatalMessager = String -> IO ()
......
......@@ -1260,7 +1260,7 @@ showRichTokenStream ts = go startLoc ts ""
. (str ++)
. go tokEnd ts
| otherwise -> ((replicate (tokLine - locLine) '\n') ++)
. ((replicate tokCol ' ') ++)
. ((replicate (tokCol - 1) ' ') ++)
. (str ++)
. go tokEnd ts
where (locLine, locCol) = (srcLocLine loc, srcLocCol loc)
......
......@@ -9516,7 +9516,7 @@ Sometimes, however, this approach is over-cautious, and we <emphasis>do</emphasi
rule to fire, even though doing so would duplicate redex. There is no way that GHC can work out
when this is a good idea, so we provide the CONLIKE pragma to declare it, thus:
<programlisting>
{-# INLINE[1] CONLIKE f #-}
{-# INLINE CONLIKE [1] f #-}
f x = <replaceable>blah</replaceable>
</programlisting>
CONLIKE is a modifier to an INLINE or NOINLINE pragma. It specifies that an application
......
......@@ -143,6 +143,7 @@ endif
include rules/prof.mk
include rules/trace.mk
include rules/library-path.mk
include rules/make-command.mk
include rules/pretty_commands.mk
......@@ -186,8 +187,10 @@ $(foreach way,$(ALL_WAYS),\
ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
GHCI_WAY = dyn
HADDOCK_WAY = dyn
else
GHCI_WAY = v
HADDOCK_WAY = v
endif
# -----------------------------------------------------------------------------
......@@ -480,6 +483,7 @@ utils/ghc-pkg/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/compare_sizes/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/runghc/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/mkUserGuidePart/dist/package-data.mk: compiler/stage2/package-data.mk
# add the final package.conf dependency: ghc-prim depends on RTS
libraries/ghc-prim/dist-install/package-data.mk : rts/package.conf.inplace
......@@ -820,7 +824,7 @@ define installLibsTo
case $$i in \
*.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
$(RANLIB) $2/`basename $$i` ;; \
*.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(STRIP_CMD) $2/$$i ;; \
......@@ -1027,7 +1031,7 @@ unix-binary-dist-prep:
echo "BUILD_DOCBOOK_PS = $(BUILD_DOCBOOK_PS)" >> $(BIN_DIST_MK)
echo "BUILD_DOCBOOK_PDF = $(BUILD_DOCBOOK_PDF)" >> $(BIN_DIST_MK)
echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK)
echo "GHC_CABAL_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal" >> $(BIN_DIST_MK)
echo "GHC_CABAL_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK)
cd $(BIN_DIST_PREP_DIR) && autoreconf
$(call removeFiles,$(BIN_DIST_PREP_TAR))
# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
......@@ -1303,6 +1307,30 @@ bootstrapping-files: $(libffi_HEADERS)
.DELETE_ON_ERROR:
# -----------------------------------------------------------------------------
ifeq "$(HADDOCK_DOCS)" "YES"
BINDIST_HADDOCK_FLAG = --with-haddock="$(BINDIST_PREFIX)/bin/haddock"
endif
ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
BINDIST_LIBRARY_FLAGS = --enable-shared --disable-library-vanilla
else
BINDIST_LIBRARY_FLAGS = --enable-library-vanilla --disable-shared
endif
BINDIST_LIBRARY_FLAGS += --disable-library-prof
.PHONY: validate_build_transformers
validate_build_transformers:
cd libraries/transformers && "$(BINDIST_PREFIX)/bin/ghc" --make Setup
cd libraries/transformers && ./Setup configure --with-ghc="$(BINDIST_PREFIX)/bin/ghc" $(BINDIST_HADDOCK_FLAG) $(BINDIST_LIBRARY_FLAGS) --global --builddir=dist-bindist --prefix="$(BINDIST_PREFIX)"
cd libraries/transformers && ./Setup build --builddir=dist-bindist
ifeq "$(HADDOCK_DOCS)" "YES"
cd libraries/transformers && ./Setup haddock --builddir=dist-bindist
endif
cd libraries/transformers && ./Setup install --builddir=dist-bindist
cd libraries/transformers && ./Setup clean --builddir=dist-bindist
cd libraries/transformers && rm -f Setup Setup.exe Setup.hi Setup.o
# -----------------------------------------------------------------------------
# Numbered phase targets
......
......@@ -292,7 +292,7 @@ checkOptions mode dflags srcs objs = do
hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
-- -prof and --interactive are not a good combination
when (notNull (filter (not . wayRTSOnly) (ways dflags))
when ((filter (not . wayRTSOnly) (ways dflags) /= defaultWays (settings dflags))
&& isInterpretiveMode mode) $
do ghcError (UsageError
"--interactive can't be used with -prof or -unreg.")
......
......@@ -261,6 +261,7 @@ RTS_RET(stg_ret_f);
RTS_RET(stg_ret_d);
RTS_RET(stg_ret_l);
RTS_FUN_DECL(stg_gc_prim);
RTS_FUN_DECL(stg_gc_prim_p);
RTS_FUN_DECL(stg_gc_prim_pp);
RTS_FUN_DECL(stg_gc_prim_n);
......@@ -392,6 +393,7 @@ RTS_FUN_DECL(stg_deRefStablePtrzh);
RTS_FUN_DECL(stg_forkzh);
RTS_FUN_DECL(stg_forkOnzh);
RTS_FUN_DECL(stg_yieldzh);
RTS_FUN_DECL(stg_killMyself);
RTS_FUN_DECL(stg_killThreadzh);
RTS_FUN_DECL(stg_getMaskingStatezh);
RTS_FUN_DECL(stg_maskAsyncExceptionszh);
......
......@@ -30,8 +30,7 @@
# A development build, working on the stage 2 compiler:
#BuildFlavour = devel2
GhcLibWays = v
DYNAMIC_BY_DEFAULT = NO
GhcLibWays = $(if $(filter $(DYNAMIC_BY_DEFAULT),YES),dyn,v)
# Uncomment this to get prettier build output.
# Please use V = 1 when reporting GHC bugs.
......
......@@ -29,7 +29,7 @@ GhcLibHcOpts += -O -dcore-lint
# We define DefaultFastGhcLibWays in this style so that the value is
# correct even if the user alters DYNAMIC_BY_DEFAULT
DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_BY_DEFAULT),YES),v dyn,v)
DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_BY_DEFAULT),YES),dyn,v)
ifeq "$(ValidateSpeed)" "FAST"
GhcLibWays = $(DefaultFastGhcLibWays)
......
......@@ -842,7 +842,7 @@ tryGrabCapability (Capability *cap, Task *task)
* allow the workers to stop.
*
* This function should be called when interrupted and
* shutting_down_scheduler = rtsTrue, thus any worker that wakes up
* sched_state = SCHED_SHUTTING_DOWN, thus any worker that wakes up
* will exit the scheduler and call taskStop(), and any bound thread
* that wakes up will return to its caller. Runnable threads are
* killed.
......
......@@ -1067,7 +1067,7 @@ fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso)
{
char *desc;
StgInfoTable *info;
info = get_itbl(exception);
info = get_itbl(UNTAG_CLOSURE(exception));
switch (info->type) {
case CONSTR:
case CONSTR_1_0:
......
......@@ -97,13 +97,6 @@ volatile StgWord sched_state = SCHED_RUNNING;
*/
StgTSO dummy_tso;
/*
* Set to TRUE when entering a shutdown state (via shutdownHaskellAndExit()) --
* in an MT setting, needed to signal that a worker thread shouldn't hang around
* in the scheduler when it is out of work.
*/
rtsBool shutting_down_scheduler = rtsFalse;
/*
* This mutex protects most of the global scheduler data in
* the THREADED_RTS runtime.
......@@ -180,28 +173,6 @@ static void deleteThread_(Capability *cap, StgTSO *tso);
* thread ends
* stack overflow
GRAN version:
In a GranSim setup this loop iterates over the global event queue.
This revolves around the global event queue, which determines what
to do next. Therefore, it's more complicated than either the
concurrent or the parallel (GUM) setup.
This version has been entirely removed (JB 2008/08).
GUM version:
GUM iterates over incoming messages.
It starts with nothing to do (thus CurrentTSO == END_TSO_QUEUE),
and sends out a fish whenever it has nothing to do; in-between
doing the actual reductions (shared code below) it processes the
incoming messages and deals with delayed operations
(see PendingFetches).
This is not the ugliest code you could imagine, but it's bloody close.
(JB 2008/08) This version was formerly indicated by a PP-Flag PAR,
now by PP-flag PARALLEL_HASKELL. The Eden RTS (in GHC-6.x) uses it,
as well as future GUM versions. This file has been refurbished to
only contain valid code, which is however incomplete, refers to
invalid includes etc.
------------------------------------------------------------------------ */
static Capability *
......
......@@ -37,15 +37,6 @@ ifneq "$$($1_$2_HS_SRCS)" ""
"$$($1_$2_HC_MK_DEPEND)" -M $$($1_$2_MKDEPENDHS_FLAGS) \
$$(filter-out -split-objs, $$($1_$2_$$(firstword $$($1_$2_WAYS))_ALL_HC_OPTS)) \
$$($1_$2_HS_SRCS)
endif
# We use the GHCI_WAY object files when doing TH for all ways. We
# therefore need the GHCI_WAY object files available when compiling
# the other ways, in case we're compiling something that uses TH.
ifneq "$$(filter $$(GHCI_WAY),$$($1_$2_WAYS))" ""
$$(foreach w,$$(filter-out $$(GHCI_WAY),$$($1_$2_WAYS)),\
$$(foreach o,$$($1_$2_$$w_HS_OBJS),\
$$(call make-command,\
echo "$$o: $$(basename $$o).$$($$(GHCI_WAY)_osuf)" >> $$@.tmp)))
endif
echo "$1_$2_depfile_haskell_EXISTS = YES" >> $$@.tmp
ifneq "$$($1_$2_SLASH_MODS)" ""
......
......@@ -18,12 +18,22 @@ $(call profStart, build-package-data($1,$2,$3))
# $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler)
ifeq "$$(filter v,$$($1_$2_WAYS))" "v"
$1_$2_CONFIGURE_OPTS += --enable-library-vanilla
else
$1_$2_CONFIGURE_OPTS += --disable-library-vanilla
endif
ifeq "$$(filter p,$$($1_$2_WAYS))" "p"
$1_$2_CONFIGURE_OPTS += --enable-library-profiling
else
$1_$2_CONFIGURE_OPTS += --disable-library-profiling
endif
ifeq "$$(filter dyn,$$($1_$2_WAYS))" "dyn"
$1_$2_CONFIGURE_OPTS += --enable-shared
else
$1_$2_CONFIGURE_OPTS += --disable-shared
endif
$1_$2_CONFIGURE_OPTS += --disable-library-for-ghci
......
......@@ -33,7 +33,7 @@ endif
.PHONY: html_$1
html_$1 : $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)
$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEPS),$$($$n_HADDOCK_FILE) $$($$n_dist-install_v_LIB))
$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEPS),$$($$n_HADDOCK_FILE) $$($$n_dist-install_$$(HADDOCK_WAY)_LIB))
ifeq "$$(HSCOLOUR_SRCS)" "YES"
$1_$2_HADDOCK_FLAGS += --source-module=src/%{MODULE/./-}.html --source-entity=src/%{MODULE/./-}.html\#%{NAME}
......@@ -54,7 +54,7 @@ endif
--prologue="$1/$2/haddock-prologue.txt" \
$$(foreach mod,$$($1_$2_HIDDEN_MODULES),--hide=$$(mod)) \
$$(foreach pkg,$$($1_$2_DEPS),$$(if $$($$(pkg)_HADDOCK_FILE),--read-interface=../$$(pkg)$$(comma)../$$(pkg)/src/%{MODULE/./-}.html\#%{NAME}$$(comma)$$($$(pkg)_HADDOCK_FILE))) \
$$(foreach opt,$$($1_$2_v_ALL_HC_OPTS),--optghc=$$(opt)) \
$$(foreach opt,$$($1_$2_$$(HADDOCK_WAY)_ALL_HC_OPTS),--optghc=$$(opt)) \
$$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS) \
$$($1_$2_HS_SRCS) \
$$($1_$2_EXTRA_HADDOCK_SRCS) \
......@@ -68,7 +68,7 @@ endif
# Make the haddocking depend on the library .a file, to ensure
# that we wait until the library is fully built before we haddock it
$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$($1_$2_v_LIB)
$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$($1_$2_$$(HADDOCK_WAY)_LIB)
endif
endif
......
# -----------------------------------------------------------------------------
#
# (c) 2010 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
# $1 = paths to prepend
ifeq "$(TargetOS_CPP)" "linux"
prependLibraryPath = export LD_LIBRARY_PATH="$1:$$LD_LIBRARY_PATH"
else ifeq "$(TargetOS_CPP)" "darwin"
prependLibraryPath = export DYLD_LIBRARY_PATH="$1:$$DYLD_LIBRARY_PATH"
else
prependLibraryPath = $(error Do not know how to prependLibraryPath on $(TargetOS_CPP))
endif
......@@ -35,28 +35,24 @@ ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
endif
$$(INPLACE_WRAPPER): $$($1_$2_INPLACE)
$$(call removeFiles, $$@)
echo '#!$$(SHELL)' >> $$@
echo 'executablename="$$(TOP)/$$<"' >> $$@
echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
$$(call removeFiles, $$@)
echo '#!$$(SHELL)' >> $$@
echo 'executablename="$$(TOP)/$$<"' >> $$@
echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
$$($1_$2_SHELL_WRAPPER_EXTRA)
$$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
ifeq "$$(TargetOS_CPP)" "linux"
echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH):$$$$LD_LIBRARY_PATH"' >> $$@
else ifeq "$$(TargetOS_CPP)" "darwin"
echo 'export DYLD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH):$$$$DYLD_LIBRARY_PATH"' >> $$@
endif
echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_DIRS_SEARCHPATH))' >> $$@
endif
ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
else
echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@
echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@
endif
$$(EXECUTABLE_FILE) $$@
$$(EXECUTABLE_FILE) $$@
endif
......@@ -92,5 +88,24 @@ install_$1_$2_wrapper:
endif
ifeq "$$($1_$2_WANT_BINDIST_WRAPPER)" "YES"
$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROG)-bindist
all_$1_$2 : $$($1_$2_BINDIST_WRAPPER)
BINDIST_EXTRAS += $$($1_$2_BINDIST_WRAPPER)
$$($1_$2_BINDIST_WRAPPER): $1/$2/build/tmp/$$($1_$2_PROG)
$$(call removeFiles, $$@)
echo '#!$$(SHELL)' >> $$@
ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_REL_DIRS_SEARCHPATH))' >> $$@
endif
echo 'exec "$$<" $$$${1+"$$$$@"}' >> $$@
$$(EXECUTABLE_FILE) $$@
endif
$(call profEnd, shell-wrapper($1,$2))
endef
......@@ -366,10 +366,22 @@ generate config_args distdir directory
-- the RTS's library-dirs here.
_ -> error "No (or multiple) ghc rts package is registered!!"
dep_ids = map snd (externalPackageDeps lbi)
dep_ids = map snd (externalPackageDeps lbi)
deps = map display dep_ids
depNames = map (display . packageName) dep_ids
let libraryDirs = forDeps Installed.libraryDirs
transitive_dep_ids = map Installed.sourcePackageId dep_pkgs
transitiveDeps = map display transitive_dep_ids
transitiveDepNames = map (display . packageName) transitive_dep_ids
libraryDirs = forDeps Installed.libraryDirs
-- The mkLibraryRelDir function is a bit of a hack.
-- Ideally it should be handled in the makefiles instead.
mkLibraryRelDir "rts" = "rts/dist/build"
mkLibraryRelDir "ghc" = "compiler/stage2/build"
mkLibraryRelDir "Cabal" = "libraries/Cabal/Cabal/dist-install/build"
mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build"
libraryRelDirs = map mkLibraryRelDir transitiveDepNames
wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs
wrappedLibraryDirs <- wrap libraryDirs
......@@ -379,10 +391,10 @@ generate config_args distdir directory
variablePrefix ++ "_HIDDEN_MODULES = " ++ unwords (map display (otherModules bi)),
variablePrefix ++ "_SYNOPSIS =" ++ synopsis pd,
variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi),
variablePrefix ++ "_DEPS = " ++ unwords (map display dep_ids),
variablePrefix ++ "_DEP_NAMES = " ++ unwords (map (display . packageName) dep_ids),
variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords (map display transitive_dep_ids),
variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords (map (display . packageName) transitive_dep_ids),
variablePrefix ++ "_DEPS = " ++ unwords deps,
variablePrefix ++ "_DEP_NAMES = " ++ unwords depNames,
variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords transitiveDeps,
variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames,
variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi),
variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi),
variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi),
......@@ -406,6 +418,7 @@ generate config_args distdir directory
variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions),
variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs,
variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs,
variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs,
variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries),
variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions),
variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi),
......
......@@ -54,8 +54,8 @@ $(GHC_CABAL_DIR)_USES_CABAL = YES
$(GHC_CABAL_DIR)_PACKAGE = ghc-cabal
$(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext)
$(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO
$(GHC_CABAL_DIR)_dist-install_WANT_BINDIST_WRAPPER = YES
$(GHC_CABAL_DIR)_dist-install_MODULES = Main
$(GHC_CABAL_DIR)_dist-install_MORE_HC_OPTS = -static
$(eval $(call build-prog,utils/ghc-cabal,dist-install,1))
......@@ -49,7 +49,7 @@ import qualified Data.Binary as Bin
import qualified Data.Binary.Get as Bin
#if defined(mingw32_HOST_OS)
-- mingw32 needs these for getExecDir, GHC <6.12 needs them for openNewFile
-- mingw32 needs these for getExecDir
import Foreign
import Foreign.C
#endif
......@@ -1471,32 +1471,38 @@ checkDuplicateDepends deps
checkHSLib :: Verbosity -> [String] -> Bool -> String -> Validate ()
checkHSLib verbosity dirs auto_ghci_libs lib = do
let batch_lib_file = "lib" ++ lib ++ ".a"
m <- liftIO $ doesFileExistOnPath batch_lib_file dirs
filenames = ["lib" ++ lib ++ ".a",
"lib" ++ lib ++ ".p_a",
"lib" ++ lib ++ "-ghc" ++ Version.version ++ ".so",
"lib" ++ lib ++ "-ghc" ++ Version.version ++ ".dylib",
lib ++ "-ghc" ++ Version.version ++ ".dll"]
m <- liftIO $ doesFileExistOnPath filenames dirs
case m of
Nothing -> verror ForceFiles ("cannot find " ++ batch_lib_file ++
" on library path")
Nothing -> verror ForceFiles ("cannot find any of " ++ show filenames ++
" on library path")
Just dir -> liftIO $ checkGHCiLib verbosity dir batch_lib_file lib auto_ghci_libs
doesFileExistOnPath :: String -> [FilePath] -> IO (Maybe FilePath)
doesFileExistOnPath file path = go path
where go [] = return Nothing
go (p:ps) = do b <- doesFileExistIn file p
if b then return (Just p) else go ps
doesFileExistIn :: String -> String -> IO Bool
doesFileExistIn lib d = doesFileExist (d </> lib)
doesFileExistOnPath :: [FilePath] -> [FilePath] -> IO (Maybe FilePath)
doesFileExistOnPath filenames paths = go fullFilenames
where fullFilenames = [ (path, path </> filename)
| filename <- filenames
, path <- paths ]
go [] = return Nothing
go ((p, fp) : xs) = do b <- doesFileExist fp
if b then return (Just p) else go xs
checkModules :: InstalledPackageInfo -> Validate ()
checkModules pkg = do
mapM_ findModule (exposedModules pkg ++ hiddenModules pkg)
where
findModule modl = do
-- there's no .hi file for GHC.Prim
if modl == fromString "GHC.Prim" then return () else do
let file = toFilePath modl <.> "hi"
m <- liftIO $ doesFileExistOnPath file (importDirs pkg)
findModule modl =
-- there's no interface file for GHC.Prim
unless (modl == fromString "GHC.Prim") $ do
let files = [ toFilePath modl <.> extension
| extension <- ["hi", "p_hi", "dyn_hi" ] ]
m <- liftIO $ doesFileExistOnPath files (importDirs pkg)
when (isNothing m) $
verror ForceFiles ("file " ++ file ++ " is missing")
verror ForceFiles ("cannot find any of " ++ show files)
checkGHCiLib :: Verbosity -> String -> String -> String -> Bool -> IO ()
checkGHCiLib verbosity batch_lib_dir batch_lib_file lib auto_build
......
......@@ -2,8 +2,8 @@
utils/ghc-pwd_USES_CABAL = YES
utils/ghc-pwd_PACKAGE = ghc-pwd
utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES
utils/ghc-pwd_dist-install_WANT_BINDIST_WRAPPER = YES
utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext)
utils/ghc-pwd_dist-install_MORE_HC_OPTS += -static