Don't use compat when compiling utils with stage1
authorIan Lynagh <igloo@earth.li>
Tue, 6 Feb 2007 00:32:32 +0000 (00:32 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 6 Feb 2007 00:32:32 +0000 (00:32 +0000)
compat/compat.mk
utils/ghc-pkg/Main.hs
utils/ghc-pkg/Makefile
utils/hsc2hs/Main.hs
utils/runghc/runghc.hs

index 48b2bea..82a3792 100644 (file)
@@ -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
+
index a54101c..19be560 100644 (file)
@@ -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
 
index f30b087..19d5a12 100644 (file)
@@ -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:
index 75ea57b..77b948f 100644 (file)
@@ -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 )
index 1d4907d..83163bd 100644 (file)
@@ -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