From 373b03fe979abe898a387e02ca22007b768e343e Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 6 Feb 2007 00:32:32 +0000 Subject: [PATCH] Don't use compat when compiling utils with stage1 --- compat/compat.mk | 13 +++++++++++++ utils/ghc-pkg/Main.hs | 10 ++++++++-- utils/ghc-pkg/Makefile | 2 ++ utils/hsc2hs/Main.hs | 6 +++++- utils/runghc/runghc.hs | 9 +++++++-- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/compat/compat.mk b/compat/compat.mk index 48b2bea..82a3792 100644 --- a/compat/compat.mk +++ b/compat/compat.mk @@ -6,6 +6,10 @@ # 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 @@ -42,3 +46,12 @@ SRC_MKDEPENDHS_OPTS += \ -optdep--exclude-module=Distribution.Compiler \ -optdep--exclude-module=Distribution.Version \ -optdep--exclude-module=System.Directory.Internals + +PACKAGE_CABAL = + +else + +PACKAGE_CABAL = -package Cabal + +endif + diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index a54101c..19be560 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -21,8 +21,14 @@ import Distribution.Compat.ReadP import Distribution.ParseUtils import Distribution.Package import Distribution.Version -import Compat.Directory ( getAppUserDataDirectory, createDirectoryIfMissing ) -import Compat.RawSystem ( rawSystem ) + +#ifdef USING_COMPAT +import Compat.Directory ( getAppUserDataDirectory, createDirectoryIfMissing ) +import Compat.RawSystem ( rawSystem ) +#else +import System.Directory ( getAppUserDataDirectory, createDirectoryIfMissing ) +import System.Cmd ( rawSystem ) +#endif import Prelude diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile index f30b087..19d5a12 100644 --- a/utils/ghc-pkg/Makefile +++ b/utils/ghc-pkg/Makefile @@ -12,6 +12,8 @@ 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: diff --git a/utils/hsc2hs/Main.hs b/utils/hsc2hs/Main.hs index 75ea57b..77b948f 100644 --- a/utils/hsc2hs/Main.hs +++ b/utils/hsc2hs/Main.hs @@ -42,7 +42,11 @@ import System.IO ( openFile, IOMode(..), hClose ) #endif #if defined(__GLASGOW_HASKELL__) && !defined(BUILD_NHC) -import Compat.RawSystem ( rawSystem ) +#ifdef USING_COMPAT +import Compat.RawSystem ( rawSystem ) +#else +import System.Cmd ( rawSystem ) +#endif #define HAVE_rawSystem #elif __NHC__ >= 117 import System.Cmd ( rawSystem ) diff --git a/utils/runghc/runghc.hs b/utils/runghc/runghc.hs index 1d4907d..83163bd 100644 --- a/utils/runghc/runghc.hs +++ b/utils/runghc/runghc.hs @@ -28,8 +28,13 @@ import Data.List import System.Exit import Data.Char -import Compat.RawSystem ( rawSystem ) -import Compat.Directory ( findExecutable ) +#ifdef USING_COMPAT +import Compat.RawSystem ( rawSystem ) +import Compat.Directory ( findExecutable ) +#else +import System.Cmd ( rawSystem ) +import System.Directory ( findExecutable ) +#endif main = do args <- getArgs -- 1.7.10.4