$(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
"$(CP)" $< $@
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/ghc-cabal.hs | $$(dir $$@)/. bootstrapping/.
- "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/ghc-cabal.hs -o $@ \
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*.hs)
+
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs | $$(dir $$@)/. bootstrapping/.
+ "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \
+ -no-user-package-conf \
-Wall $(WERROR) \
-DCABAL_VERSION=$(CABAL_VERSION) \
-odir bootstrapping \
$(eval $(call all-target,$(GHC_CABAL_DIR),$(GHC_CABAL_INPLACE)))
# -----------------------------------------------------------------------------
-# dummy-ghc
-
-# This is a tiny program to fool Cabal's configure that we have a
-# stage1 GHC, which lets us configure all the packages before we've
-# build stage1.
-
-$(GHC_CABAL_DIR)_dist-dummy-ghc_MODULES = dummy-ghc
-$(GHC_CABAL_DIR)_dist-dummy-ghc_PROG = dummy-ghc$(exeext)
+# Now make another copy that goes in bindists. This needs to be built
+# with the in-tree compiler.
-# depend on project.mk, so we pick up the new version number if it changes.
-$(GHC_CABAL_DIR)/dist-dummy-ghc/build/dummy-ghc.hs : $(GHC_CABAL_DIR)/ghc.mk $(MKDIRHIER) mk/project.mk compiler/main/DynFlags.hs
- "$(MKDIRHIER)" $(dir $@)
- "$(RM)" $(RM_OPTS) $@
- echo 'import System.Environment' >> $@
- echo 'import System.Cmd' >> $@
- echo 'import System.Exit' >> $@
- echo 'main :: IO ()' >> $@
- echo 'main = do args <- getArgs' >> $@
- echo ' case args of' >> $@
- echo ' ["--numeric-version"] ->' >> $@
- echo ' putStrLn "$(ProjectVersion)"' >> $@
- echo ' ["--supported-languages"] ->' >> $@
- echo ' mapM_ putStrLn extensions' >> $@
- echo ' _ ->' >> $@
- echo ' do e <- rawSystem "$(GHC_STAGE0)" args' >> $@
- echo ' exitWith e' >> $@
-# This unpleasant sed script grabs the lines between the
-# xFlags ::
-# line and the
-# ]
-# line of compiler/main/DynFlags.hs, and if they look like
-# ( "PostfixOperators", ...
-# then it translates them into
-# ["PostfixOperators"] ++
- echo 'extensions :: [String]' >> $@
- echo 'extensions =' >> $@
- sed '/^xFlags/,/]/s/^[[:space:]]*([[:space:]]*\("[^"]*"\)[^"]*/ [\1] ++/p;d' compiler/main/DynFlags.hs >> $@
- echo ' []' >> $@
+$(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_MODULES = Main
-# We don't build dummy-ghc with Cabal, so we need to pass -package
-# flags manually
-utils/ghc-cabal_dist-dummy-ghc_HC_OPTS = -package process
-$(eval $(call build-prog,utils/ghc-cabal,dist-dummy-ghc,0))
+$(eval $(call build-prog,utils/ghc-cabal,dist-install,1))