summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-07-08 00:27:17 +0000
committerIan Lynagh <igloo@earth.li>2008-07-08 00:27:17 +0000
commit2002bc3d77b9e601287cd0499c0f815ebc992ea0 (patch)
tree609aaf2ef554f672d81e63409af0a9346702fe83
parent69adcec2c70afb3e940fae0a5c64589cfa09ad56 (diff)
downloadhaskell-2002bc3d77b9e601287cd0499c0f815ebc992ea0.tar.gz
Get rid of compat/
Compat.Unicode is not utils/Unicode in the compiler. We build the hpc package with the stage1 compiler. Nothing else in the compat package was still used.
-rw-r--r--Makefile8
-rw-r--r--compat/Makefile99
-rw-r--r--compat/README32
-rw-r--r--compat/Trace/Hpc/Mix.hs3
-rw-r--r--compat/Trace/Hpc/Tix.hs3
-rw-r--r--compat/Trace/Hpc/Util.hs3
-rw-r--r--compat/cbits/directory.c96
-rw-r--r--compat/cbits/rawSystem.c140
-rw-r--r--compat/compat.mk50
-rw-r--r--compat/include/directory.h13
-rw-r--r--compiler/Makefile20
-rw-r--r--compiler/cbits/unicode.c (renamed from compat/cbits/unicode.c)0
-rw-r--r--compiler/parser/Lexer.x6
-rw-r--r--compiler/utils/Unicode.hs (renamed from compat/Compat/Unicode.hs)5
-rw-r--r--libraries/Makefile7
-rw-r--r--utils/ghc-pkg/Makefile8
-rw-r--r--utils/hpc/Makefile3
17 files changed, 21 insertions, 475 deletions
diff --git a/Makefile b/Makefile
index f65f2bddee..9e3319e6db 100644
--- a/Makefile
+++ b/Makefile
@@ -67,12 +67,12 @@ include $(TOP)/mk/boilerplate.mk
# We can't 'make boot' in libraries until stage1 is built
ifeq "$(BootingFromHc)" "YES"
-SUBDIRS_BUILD = includes rts compat compiler docs utils driver
+SUBDIRS_BUILD = includes rts compiler docs utils driver
else
-SUBDIRS_BUILD = includes compat utils driver docs compiler rts libraries/Cabal/doc
+SUBDIRS_BUILD = includes utils driver docs compiler rts libraries/Cabal/doc
endif
-SUBDIRS = gmp libffi includes compat utils driver docs rts libraries compiler libraries/Cabal/doc
+SUBDIRS = gmp libffi includes utils driver docs rts libraries compiler libraries/Cabal/doc
# Sanity check that all the boot libraries are in the tree, to catch
# failure to run darcs-all.
@@ -312,7 +312,6 @@ binary-dist-pre::
echo 'include $$(TOP)/mk/package.mk' > $(BIN_DIST_DIR)/mk/target.mk
echo 'include $$(TOP)/mk/install.mk' >> $(BIN_DIST_DIR)/mk/target.mk
echo 'include $$(TOP)/mk/recurse.mk' >> $(BIN_DIST_DIR)/mk/target.mk
- echo '' > $(BIN_DIST_DIR)/mk/compat.mk
cp mk/package.mk $(BIN_DIST_DIR)/mk/
cp mk/install.mk $(BIN_DIST_DIR)/mk/
cp mk/recurse.mk $(BIN_DIST_DIR)/mk/
@@ -533,7 +532,6 @@ hc-file-bundle :
$(LN_S) . ghc-$(ProjectVersion)
$(FIND) ghc-$(ProjectVersion)/compiler \
ghc-$(ProjectVersion)/utils \
- ghc-$(ProjectVersion)/compat \
ghc-$(ProjectVersion)/libraries -follow \
\( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \) -print > hc-files-to-go
for f in `$(FIND) ghc-$(ProjectVersion)/compiler ghc-$(ProjectVersion)/utils ghc-$(ProjectVersion)/libraries -name "*.hsc" -follow -print` ""; do \
diff --git a/compat/Makefile b/compat/Makefile
deleted file mode 100644
index fb28e2c495..0000000000
--- a/compat/Makefile
+++ /dev/null
@@ -1,99 +0,0 @@
-TOP=..
-include $(TOP)/mk/boilerplate.mk
-
-ALL_DIRS = \
- Data \
- Compat \
- Trace/Hpc \
- cbits
-
-SplitObjs=NO
-LIBRARY = libghccompat.a
-
-# We don't want this installed
-NO_INSTALL_LIBRARY = YES
-
-# Avoid building the GHCi lib, since we don't need it
-GhcWithInterpreter = NO
-
-# There are lots of warnings in here due to things like modules being
-# imported that, in some versions of GHC, aren't used. Thus we don't
-# give any warnings in here, and therefore validating with -Werror won't
-# make the build fail.
-SRC_HC_OPTS += -w
-
-# Needed so that the libraries can #include relative to this directory.
-INCLUDE_DIRS=-I. -Iinclude
-
-SRC_HC_OPTS += $(INCLUDE_DIRS)
-SRC_CC_OPTS += $(INCLUDE_DIRS)
-MKDEPENDC_OPTS += $(INCLUDE_DIRS)
-
-# Just to silence warnings
-MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
-
-UseGhcForCc = YES
-
-# This library is linked to the compiler, at least in stage1, so we
-# better make sure it is built the same "way".
-#
-# BUT, if GhcHcOpts includes -DDEBUG we *don't* want to compile
-# lib/compat with -DDEBUG, because the preprocessor symbols used
-# by the compiler may be understood differently by library code.
-# In this particular case, it turned out that -DDEBUG made Cabal
-# import HUnit, which might not be installed for the compiler we are
-# compiling with (e.g. 6.2.1). Hence the filter-out.
-SRC_HC_OPTS += $(filter-out -D%, $(GhcHcOpts) $(GhcStage1HcOpts))
-
-# GHC 6.4 didn't have WCsubst.c, but 6.4.1 did, and we need to know
-# this in cbits/unicode.c The patchlevel isn't normally exposed as a
-# CPP symbol, so we have to do it by hand:
-SRC_CC_OPTS += -D__GHC_PATCHLEVEL__=$(GhcPatchLevel)
-
-# This module shouldn't be compiled itself, only #included into other files
-EXCLUDED_SRCS += System/FilePath/Internal.hs
-
-ifeq "$(ghc_ge_607)" "YES"
-SRC_HC_OPTS += -package directory
-SRC_HC_OPTS += -package pretty
-endif
-
-# Some explicit dependencies, needed because ghc -M can't discover the
-# true dependencies of these stub files.
-System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/directory/System/Directory/Internals.hs
-Trace/Hpc/Mix.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Mix.hs
-Trace/Hpc/Util.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Util.hs
-Trace/Hpc/Tix.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Tix.hs
-
-cbits/unicode.o : $(FPTOOLS_TOP)/libraries/base/cbits/WCsubst.c $(FPTOOLS_TOP)/libraries/base/include/WCsubst.h
-
-SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/base/include
-
-# Make the #includes in the stubs independent of the current location
-SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
-
-SRC_HC_OPTS += -fglasgow-exts
-
-ifeq "$(ghc_ge_609)" "YES"
-SRC_HC_OPTS += -fforce-recomp
-else
-SRC_HC_OPTS += -no-recomp
-endif
-
-ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
-Compat/Directory_HC_OPTS += -\#include shlobj.h
-endif
-
-# libghccompat is needed to build ghc-pkg, which is built during 'make boot',
-# so we must build this library during 'make boot' too.
-# Do a recursive 'make all' after generating dependencies, because this
-# will work with 'make -j'.
-ifneq "$(BootingFromHc)" "YES"
-boot :: depend
- $(MAKE) all
-endif
-
-# We don't ever want to build libghccompat as a shared library.
-GhcBuildDylibs=NO
-
-include $(TOP)/mk/target.mk
diff --git a/compat/README b/compat/README
deleted file mode 100644
index 8d0697beb4..0000000000
--- a/compat/README
+++ /dev/null
@@ -1,32 +0,0 @@
-GHC compatibiliy library: libghccompat.a
-----------------------------------------
-
-This library contains interfaces that are available in recent versions
-of GHC, but may or may not be available in older versions. The idea
-is to provide an abstraction layer and reduce the amount of #ifdefery
-and code duplication in GHC and its tools. Furthermore, we can add
-modules to the main library and start using them right away in GHC, by
-adding a stub to this compat library.
-
-There are two types of modules in here:
-
-(a) a module with the same name as a module in the main library
- (eg. Distribution.Package). If the module is available in
- the main library, then we don't include it in libghccompat.
- Otherwise, we have a stub module here that just #includes
- the source from the real location under libraries/. Go look
- at Distribution/Package.hs for example.
-
-(b) a module that doesn't exist in another library. For example,
- Compat.RawSystem. These modules are used to provide functions
- that are available in newer versions of the main libraries.
-
-BIG NOTE: when building stage 2 of GHC, libghccompat is not used,
-because we would have to build another version of it. Instead, we
-just use the appropriate libraries directly. For (a)-type modules,
-just import the module directly. For (b)-type modules, a single
-#ifdef will be required to choose between the Compat version and
-the real version.
-
-In stage 1 of GHC, and tools (eg. ghc-pkg, runghc), libghccompat.a
-is linked in, so all its libraries will be accessible.
diff --git a/compat/Trace/Hpc/Mix.hs b/compat/Trace/Hpc/Mix.hs
deleted file mode 100644
index 49110a5c38..0000000000
--- a/compat/Trace/Hpc/Mix.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-{-# OPTIONS -cpp #-}
-#include "hpc/Trace/Hpc/Mix.hs"
--- dummy comment
diff --git a/compat/Trace/Hpc/Tix.hs b/compat/Trace/Hpc/Tix.hs
deleted file mode 100644
index 9bba7d0e0a..0000000000
--- a/compat/Trace/Hpc/Tix.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-{-# OPTIONS -cpp #-}
-#include "hpc/Trace/Hpc/Tix.hs"
--- dummy comment
diff --git a/compat/Trace/Hpc/Util.hs b/compat/Trace/Hpc/Util.hs
deleted file mode 100644
index 9be55097c6..0000000000
--- a/compat/Trace/Hpc/Util.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-{-# OPTIONS -cpp #-}
-#include "hpc/Trace/Hpc/Util.hs"
--- dummy comment
diff --git a/compat/cbits/directory.c b/compat/cbits/directory.c
deleted file mode 100644
index 51df480546..0000000000
--- a/compat/cbits/directory.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "HsFFI.h"
-
-#include "../../../includes/ghcconfig.h"
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#if HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-#include "directory.h"
-
-#define INLINE /* nothing */
-
-/*
- * Following code copied from libraries/base/includes/HsBase.h
- */
-
-#ifdef PATH_MAX
-/* A size that will contain many path names, but not necessarily all
- * (PATH_MAX is not defined on systems with unlimited path length,
- * e.g. the Hurd).
- */
-INLINE int __compat_long_path_size() { return PATH_MAX; }
-#else
-INLINE int __compat_long_path_size() { return 4096; }
-#endif
-
-#if defined(mingw32_HOST_OS)
-#if __GLASGOW_HASKELL__ < 604
-
-/* Make sure we've got the reqd CSIDL_ constants in scope;
- * w32api header files are lagging a bit in defining the full set.
- */
-#if !defined(CSIDL_APPDATA)
-#define CSIDL_APPDATA 0x001a
-#endif
-#if !defined(CSIDL_PERSONAL)
-#define CSIDL_PERSONAL 0x0005
-#endif
-#if !defined(CSIDL_PROFILE)
-#define CSIDL_PROFILE 0x0028
-#endif
-#if !defined(CSIDL_WINDOWS)
-#define CSIDL_WINDOWS 0x0024
-#endif
-
-INLINE int __hscore_CSIDL_PROFILE() { return CSIDL_PROFILE; }
-INLINE int __hscore_CSIDL_APPDATA() { return CSIDL_APPDATA; }
-INLINE int __hscore_CSIDL_WINDOWS() { return CSIDL_WINDOWS; }
-INLINE int __hscore_CSIDL_PERSONAL() { return CSIDL_PERSONAL; }
-
-/*
- * Function: __hscore_getFolderPath()
- *
- * Late-bound version of SHGetFolderPath(), coping with OS versions
- * that have shell32's lacking that particular API.
- *
- */
-typedef HRESULT (*HSCORE_GETAPPFOLDERFUNTY)(HWND,int,HANDLE,DWORD,char*);
-int
-__hscore_getFolderPath(HWND hwndOwner,
- int nFolder,
- HANDLE hToken,
- DWORD dwFlags,
- char* pszPath)
-{
- static int loaded_dll = 0;
- static HMODULE hMod = (HMODULE)NULL;
- static HSCORE_GETAPPFOLDERFUNTY funcPtr = NULL;
- /* The DLLs to try loading entry point from */
- char* dlls[] = { "shell32.dll", "shfolder.dll" };
-
- if (loaded_dll < 0) {
- return (-1);
- } else if (loaded_dll == 0) {
- int i;
- for(i=0;i < sizeof(dlls); i++) {
- hMod = LoadLibrary(dlls[i]);
- if ( hMod != NULL &&
- (funcPtr = (HSCORE_GETAPPFOLDERFUNTY)GetProcAddress(hMod, "SHGetFolderPathA")) ) {
- loaded_dll = 1;
- break;
- }
- }
- if (loaded_dll == 0) {
- loaded_dll = (-1);
- return (-1);
- }
- }
- /* OK, if we got this far the function has been bound */
- return (int)funcPtr(hwndOwner,nFolder,hToken,dwFlags,pszPath);
- /* ToDo: unload the DLL on shutdown? */
-}
-#endif /* __GLASGOW_HASKELL__ < 604 */
-#endif /* mingw32_HOST_OS */
diff --git a/compat/cbits/rawSystem.c b/compat/cbits/rawSystem.c
deleted file mode 100644
index 917594fd2e..0000000000
--- a/compat/cbits/rawSystem.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * (c) The University of Glasgow 1994-2004
- *
- * WARNING: this file is here for backwards compatibility only. It is
- * not included as part of the base package, but is #included into the
- * compiler and the runghc utility when building either of these with
- * an old version of GHC.
- *
- * shell-less system Runtime Support (see System.Cmd.rawSystem).
- */
-
-/* The itimer stuff in this module is non-posix */
-/* #include "PosixSource.h" */
-
-#include "../../../includes/ghcconfig.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-# ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-# else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
-
-#include "HsFFI.h"
-
-#if defined(mingw32_HOST_OS)
-#include <windows.h>
-#endif
-
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-
-#ifdef HAVE_VFORK
-#define fork vfork
-#endif
-
-#if defined(mingw32_HOST_OS)
-/* -------------------- WINDOWS VERSION --------------------- */
-
-HsInt
-rawSystem(char *cmd)
-{
- STARTUPINFO sInfo;
- PROCESS_INFORMATION pInfo;
- DWORD retCode;
-
- ZeroMemory(&sInfo, sizeof(sInfo));
- sInfo.cb = sizeof(sInfo);
-
- if (!CreateProcess(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &sInfo, &pInfo)) {
- /* The 'TRUE' says that the created process should share
- handles with the current process. This is vital to ensure
- that error messages sent to stderr actually appear on the screen.
- Since we are going to wait for the process to terminate anyway,
- there is no problem with such sharing. */
-
- errno = EINVAL; // ToDo: wrong, caller should use GetLastError()
- return -1;
- }
- WaitForSingleObject(pInfo.hProcess, INFINITE);
- if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) {
- errno = EINVAL; // ToDo: wrong, caller should use GetLastError()
- return -1;
- }
-
- CloseHandle(pInfo.hProcess);
- CloseHandle(pInfo.hThread);
- return retCode;
-}
-
-#else
-/* -------------------- UNIX VERSION --------------------- */
-
-HsInt
-rawSystem(char *cmd, char **args)
-{
- int pid;
- int wstat;
-
- switch(pid = fork()) {
- case -1:
- {
- return -1;
- }
- case 0:
- {
-#ifdef HAVE_SETITIMER
- /* Reset the itimers in the child, so it doesn't get plagued
- * by SIGVTALRM interrupts.
- */
- struct timeval tv_null = { 0, 0 };
- struct itimerval itv;
- itv.it_interval = tv_null;
- itv.it_value = tv_null;
- setitimer(ITIMER_REAL, &itv, NULL);
- setitimer(ITIMER_VIRTUAL, &itv, NULL);
- setitimer(ITIMER_PROF, &itv, NULL);
-#endif
-
- /* the child */
- execvp(cmd, args);
- _exit(127);
- }
- }
-
- while (waitpid(pid, &wstat, 0) < 0) {
- if (errno != EINTR) {
- return -1;
- }
- }
-
- if (WIFEXITED(wstat))
- return WEXITSTATUS(wstat);
- else if (WIFSIGNALED(wstat)) {
- errno = EINTR;
- }
- else {
- /* This should never happen */
- }
- return -1;
-}
-#endif
diff --git a/compat/compat.mk b/compat/compat.mk
deleted file mode 100644
index 00a3c9f4c5..0000000000
--- a/compat/compat.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# Settings for using the libghccompat.a library elsewhere in the build
-# tree: this file is just included into Makefiles, see
-# utils/ghc-pkg/Makefile for example.
-#
-# This is a poor-mans package, but simpler because we don't
-# have to deal with variations in the package support of different
-# versions of GHC.
-
-ifneq "$(UseStage1)" "YES"
-
-SRC_HC_OPTS += -DUSING_COMPAT
-
-# Use libghccompat.a:
-SRC_HC_OPTS += -i$(GHC_COMPAT_DIR)
-SRC_LD_OPTS += -L$(GHC_COMPAT_DIR) -lghccompat
-
-ifeq "$(ghc_ge_607)" "YES"
-SRC_HC_OPTS += -package directory
-SRC_HC_OPTS += -package pretty
-SRC_HC_OPTS += -package containers
-endif
-
-# And similarly for when booting from .hc files:
-HC_BOOT_LD_OPTS += -L$(GHC_COMPAT_DIR)
-HC_BOOT_LIBS += -lghccompat
-
-ifeq "$(Windows)" "YES"
-# not very nice, but required for -lghccompat on Windows
-SRC_LD_OPTS += -lshell32
-HC_BOOT_LIBS += -lshell32
-endif
-
-# This is horrible. We ought to be able to omit the entire directory
-# from mkDependHS.
-SRC_MKDEPENDHS_OPTS += \
- -optdep--exclude-module=Compat.Unicode \
- -optdep--exclude-module=Trace.Hpc.Mix \
- -optdep--exclude-module=Trace.Hpc.Tix \
- -optdep--exclude-module=Trace.Hpc.Util
-
-PACKAGE_CABAL =
-PACKAGE_HPC =
-
-else
-
-PACKAGE_CABAL = -package Cabal
-PACKAGE_HPC = -package hpc
-
-endif
-
diff --git a/compat/include/directory.h b/compat/include/directory.h
deleted file mode 100644
index 2e26c3d5a1..0000000000
--- a/compat/include/directory.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __DIRECTORY_H__
-#define __DIRECTORY_H__
-
-#if defined(mingw32_HOST_OS)
-extern int __compat_long_path_size();
-extern int __hscore_CSIDL_APPDATA();
-extern int __hscore_getFolderPath(HWND hwndOwner,
- int nFolder,
- HANDLE hToken,
- DWORD dwFlags,
- char* pszPath);
-#endif
-#endif
diff --git a/compiler/Makefile b/compiler/Makefile
index 5e503eac14..be304f9a42 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -483,10 +483,13 @@ endif
# the interpreter is supported on this platform.
ifeq "$(bootstrapped)" "YES"
-SRC_HC_OPTS += -package hpc -package bytestring
-PKG_DEPENDS += hpc bytestring
+SRC_HC_OPTS += -package bytestring
+PKG_DEPENDS += bytestring
endif
+SRC_HC_OPTS += -package hpc
+PKG_DEPENDS += hpc
+
ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES"
# Yes, include the interepreter and Template Haskell extensions
@@ -756,13 +759,6 @@ primop-usage.hs-incl: prelude/primops.txt
#-----------------------------------------------------------------------------
# Linking
-# Include libghccompat in stage1 only. In stage2 onwards, all these
-# libraries will be available from the main libraries.
-
-ifeq "$(stage)" "1"
-include $(GHC_COMPAT_DIR)/compat.mk
-endif
-
ifeq "$(GhcUnregisterised)" "NO"
ifeq "$(HOSTPLATFORM)" "ia64-unknown-linux"
# needed for generating proper relocation in large binaries: trac #856
@@ -1089,12 +1085,8 @@ ifneq "$(BootingFromHc)" "YES"
$(MKDEPENDHS) -M -optdep-f -optdep.depend-BASE $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-osuf $(obj)) $(MKDEPENDHS_OPTS) $(filter-out -split-objs, $(MKDEPENDHS_HC_OPTS)) $(HS_SRCS)
endif
$(MKDEPENDC) -f .depend-BASE $(MKDEPENDC_OPTS) $(foreach way,$(WAYS),-s $(way)) -- $(CC_OPTS) -- $(C_SRCS)
- $(PERL) -pe 'binmode(stdin); binmode(stdout); s@(\S*[._]o)@stage$(stage)/$$1@g; s@(\S*[._]hi)@stage$(stage)/$$1@g; s@^.*/compat.*$$@@g;' <.depend-BASE >.depend-$(stage)
+ $(PERL) -pe 'binmode(stdin); binmode(stdout); s@(\S*[._]o)@stage$(stage)/$$1@g; s@(\S*[._]hi)@stage$(stage)/$$1@g;' <.depend-BASE >.depend-$(stage)
# The binmode stuff tells perl not to add stupid ^M's to the output
-#
-# The /lib/compat replacement is to workaround a bug in the
-# -optdep--exclude-module flag in GHC 6.4. It is not required for any
-# other version of GHC, but doesn't do any harm.
ifeq "$(MakefileDeps)" "YES"
$(CONFIG_HS) : Makefile
diff --git a/compat/cbits/unicode.c b/compiler/cbits/unicode.c
index c239e21c77..c239e21c77 100644
--- a/compat/cbits/unicode.c
+++ b/compiler/cbits/unicode.c
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index b65668e2dd..2b86fd7331 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -60,11 +60,7 @@ import Data.Char ( chr, ord, isSpace )
import Data.Ratio
import Debug.Trace
-#if __GLASGOW_HASKELL__ >= 605
-import Data.Char ( GeneralCategory(..), generalCategory, isPrint, isUpper )
-#else
-import Compat.Unicode ( GeneralCategory(..), generalCategory, isPrint, isUpper )
-#endif
+import Unicode ( GeneralCategory(..), generalCategory, isPrint, isUpper )
}
$unispace = \x05 -- Trick Alex into handling Unicode. See alexGetChar.
diff --git a/compat/Compat/Unicode.hs b/compiler/utils/Unicode.hs
index fe5b0ba5e8..c12dc4600f 100644
--- a/compat/Compat/Unicode.hs
+++ b/compiler/utils/Unicode.hs
@@ -1,5 +1,5 @@
{-# OPTIONS -cpp #-}
-module Compat.Unicode (
+module Unicode (
GeneralCategory(..), generalCategory, isPrint, isUpper
) where
@@ -55,7 +55,10 @@ generalCategory c = toEnum $ fromIntegral $ wgencat $ fromIntegral $ ord c
foreign import ccall unsafe "u_gencat"
wgencat :: CInt -> CInt
+isPrint :: Char -> Bool
isPrint c = iswprint (fromIntegral (ord c)) /= 0
+
+isUpper :: Char -> Bool
isUpper c = iswupper (fromIntegral (ord c)) /= 0
foreign import ccall unsafe "u_iswprint"
diff --git a/libraries/Makefile b/libraries/Makefile
index 8f2c92775e..37debcd1cb 100644
--- a/libraries/Makefile
+++ b/libraries/Makefile
@@ -164,7 +164,7 @@ ifeq "$(ghc_ge_605)" "NO"
CABAL_GHC_FLAGS += -cpp
endif
-BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath
+BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath -i$(HERE_ABS)/hpc
.PHONY: boot
@@ -183,6 +183,10 @@ bootstrapping.conf: cabal-bin
cd Cabal && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
cd Cabal && $(CABAL) build --distpref=dist-bootstrapping
cd Cabal && $(CABAL) install --distpref=dist-bootstrapping --inplace
+ -cd hpc && $(CABAL) clean --distpref=dist-bootstrapping
+ cd hpc && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
+ cd hpc && $(CABAL) build --distpref=dist-bootstrapping
+ cd hpc && $(CABAL) install --distpref=dist-bootstrapping --inplace
mv $@.tmp $@
installPackage/installPackage: installPackage.hs
@@ -327,6 +331,7 @@ distclean: clean
clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
-cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
-cd Cabal && $(CABAL) clean --distpref=dist-bootstrapping
+ -cd hpc && $(CABAL) clean --distpref=dist-bootstrapping
$(RM) -rf bootstrapping/*
$(RM) -f bootstrapping.conf bootstrapping.conf.old
$(RM) -f bootstrapping.conf.tmp bootstrapping.conf.tmp.old
diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile
index adce82949b..5afb448a22 100644
--- a/utils/ghc-pkg/Makefile
+++ b/utils/ghc-pkg/Makefile
@@ -15,16 +15,8 @@ endif
SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
-# This causes libghccompat.a to be used:
-include $(GHC_COMPAT_DIR)/compat.mk
-
SRC_HC_OPTS += $(PACKAGE_CABAL)
-# This is required because libghccompat.a must be built with
-# $(GhcHcOpts) because it is linked to the compiler, and hence
-# we must also build with $(GhcHcOpts) here:
-SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts)
-
ifeq "$(Windows)" "NO"
SRC_HC_OPTS += -package unix
endif
diff --git a/utils/hpc/Makefile b/utils/hpc/Makefile
index 3b1d731050..ac1bf22a9a 100644
--- a/utils/hpc/Makefile
+++ b/utils/hpc/Makefile
@@ -20,8 +20,7 @@ endif
INSTALL_PROGS += $(HS_PROG)
HPC_LIB = $(TOP)/libraries/hpc
-include $(GHC_COMPAT_DIR)/compat.mk
-SRC_HC_OPTS += $(PACKAGE_HPC) -cpp
+SRC_HC_OPTS += -package hpc -cpp
ifeq "$(ghc_ge_607)" "YES"
SRC_HC_OPTS += -package containers