-installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
- -$(RM) -rf installPackage
- mkdir installPackage
- $(CP) installPackage.hs installPackage/
-ifeq "$(stage)" "2"
- cd installPackage && ../$(HC) -Wall -cpp \
- --make installPackage -o installPackage \
- $(BOOTSTRAP_INC_1_UP) $(DEPLOYMENT_OPTS)
-else
- cd installPackage && $(GHC) -Wall -cpp \
- --make installPackage -o installPackage \
- $(BOOTSTRAP_INC_1_UP)
-endif
-# TODO: The conditional is yucky, but we need to be able to build with stage1
-# for bindists and as installPackages/ has no Makefile, it seems hard
-# to make this nicer.
+boot: ifBuildable/ifBuildable cabal-bin bootstrapping.conf
+
+cabal-bin: cabal-bin.hs
+ mkdir bootstrapping
+ $(GHC) $(BOOTSTRAPPING_FLAGS) --make cabal-bin -o cabal-bin
+
+bootstrapping.conf: cabal-bin
+ echo "[]" > $@.tmp
+ -cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
+ cd filepath && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
+ cd filepath && $(CABAL) build --distpref=dist-bootstrapping
+ cd filepath && $(CABAL) install --distpref=dist-bootstrapping --inplace
+ -cd Cabal && $(CABAL) clean --distpref=dist-bootstrapping
+ 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 $@