Skip to content

Commit 07d68c5

Browse files
committed
MAKE: Don't build cabal in Makefile anymore
1 parent 9cbe6d3 commit 07d68c5

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

Makefile

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ROOT_DIR := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
9999

100100
GHC0 ?= ghc-9.8.4
101101
PYTHON ?= python3
102-
CABAL ?= _build/stage0/bin/cabal$(EXE_EXT)
102+
CABAL ?= cabal
103103
SED ?= sed
104104

105105
ifeq ($(OS),Windows_NT)
@@ -585,24 +585,6 @@ define copy_all_stage2_h
585585
endef
586586

587587

588-
# --- Bootstrapping and stage 0 ---
589-
590-
# export CABAL := $(shell cabal update 2>&1 >/dev/null && cabal build cabal-install -v0 --disable-tests --project-dir libraries/Cabal && cabal list-bin -v0 --project-dir libraries/Cabal cabal-install:exe:cabal)
591-
$(abspath _build/stage0/bin/cabal$(EXE_EXT)): _build/stage0/bin/cabal$(EXE_EXT)
592-
593-
# --- Stage 0 build ---
594-
595-
# This just builds cabal-install, which is used to build the rest of the project.
596-
597-
# We need an absolute path here otherwise cabal will consider the path relative to `the project directory
598-
_build/stage0/bin/cabal$(EXE_EXT): BUILD_ARGS=-j -w $(GHC0) --disable-tests --project-dir libraries/Cabal --builddir=$(abspath _build/stage0) --ghc-options="-fhide-source-paths"
599-
_build/stage0/bin/cabal$(EXE_EXT):
600-
@echo "::group::Building Cabal..."
601-
@mkdir -p _build/stage0/bin _build/logs
602-
cabal build $(BUILD_ARGS) cabal-install:exe:cabal
603-
cp -rfp $(shell cabal list-bin -v0 $(BUILD_ARGS) cabal-install:exe:cabal | $(CYGPATH)) $@
604-
@echo "::endgroup::"
605-
606588
# --- Stage 1 build ---
607589

608590
_build/stage1/%: private STAGE=stage1
@@ -619,7 +601,7 @@ endif
619601

620602
.PHONY: $(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES))
621603
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: private TARGET_PLATFORM=
622-
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: $(CABAL) $(CONFIGURE_SCRIPTS) $(CONFIGURED_FILES) libraries/ghc-boot-th-next/ghc-boot-th-next.cabal cabal.project.stage1 cabal.project.stage1.local
604+
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: $(CONFIGURE_SCRIPTS) $(CONFIGURED_FILES) libraries/ghc-boot-th-next/ghc-boot-th-next.cabal cabal.project.stage1 cabal.project.stage1.local
623605
@echo "::group::Building stage1 executables ($(STAGE1_EXECUTABLES))..."
624606
# Force cabal to replan
625607
rm -rf _build/stage1/cache
@@ -663,7 +645,7 @@ _build/stage2/%: private GHC=$(realpath _build/stage1/bin/ghc$(EXE_EXT))
663645

664646
.PHONY: $(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES))
665647
$(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES)) &: private TARGET_PLATFORM=
666-
$(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES)) &: $(CABAL) stage1 cabal.project.stage2 stage2-rts
648+
$(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES)) &: stage1 cabal.project.stage2 stage2-rts
667649
@echo "::group::Building stage2 executables ($(STAGE2_EXECUTABLES))..."
668650
# Force cabal to replan
669651
rm -rf _build/stage2/cache
@@ -676,7 +658,7 @@ $(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES)) &: $(CABAL) stage1 cabal.p
676658
stage2-rts: private STAGE=stage2
677659
stage2-rts: private GHC=$(realpath _build/stage1/bin/ghc$(EXE_EXT))
678660
stage2-rts: private TARGET_PLATFORM=
679-
stage2-rts: $(CABAL) stage1 cabal.project.stage2
661+
stage2-rts: stage1 cabal.project.stage2
680662
@echo "::group::Building stage2 RTSes..."
681663
# Force cabal to replan
682664
rm -rf _build/stage2/cache
@@ -691,7 +673,7 @@ stage2-rts: $(CABAL) stage1 cabal.project.stage2
691673
# build them with the stage2 ghc; seems like a better/cleaner idea to me (moritz).
692674
.PHONY: $(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES))
693675
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: private TARGET_PLATFORM=
694-
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: $(CABAL) stage1 cabal.project.stage2.settings stage2-rts
676+
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: stage1 cabal.project.stage2.settings stage2-rts
695677
@echo "::group::Building stage2 utilities ($(STAGE2_UTIL_EXECUTABLES))..."
696678
# Force cabal to replan
697679
rm -rf _build/stage2/cache
@@ -996,27 +978,6 @@ _build/bindist/ghc-%.tar.gz: _build/bindist/lib/targets/% _build/bindist/ghc.tar
996978
$(foreach exe,$(BINDIST_EXECTUABLES),bin/$${triple}-$(exe)) \
997979
lib/targets/$${triple}
998980

999-
_build/bindist/cabal.tar.gz: _build/stage0/bin/cabal$(EXE_EXT)
1000-
@mkdir -p _build/bindist/bin
1001-
@cp $^ _build/bindist/bin/cabal$(EXE_EXT)
1002-
@tar czf $@ \
1003-
--directory=_build/bindist \
1004-
bin/cabal$(EXE_EXT)
1005-
1006-
_build/bindist/haskell-toolchain.tar.gz: _build/bindist/cabal.tar.gz _build/bindist/ghc.tar.gz _build/bindist/ghc-javascript-unknown-ghcjs.tar.gz
1007-
@tar czf $@ \
1008-
--directory=_build/bindist \
1009-
$(foreach exe,$(BINDIST_EXECTUABLES),bin/$(exe)$(EXE_EXT)) \
1010-
lib/ghc-usage.txt \
1011-
lib/ghci-usage.txt \
1012-
lib/package.conf.d \
1013-
lib/settings \
1014-
lib/template-hsc.h \
1015-
lib/$(HOST_PLATFORM) \
1016-
$(foreach exe,$(BINDIST_EXECTUABLES),bin/javascript-unknown-ghcjs-$(exe)) \
1017-
lib/targets/javascript-unknown-ghcjs \
1018-
bin/cabal$(EXE_EXT)
1019-
1020981
_build/bindist/tests.tar.gz:
1021982
@tar czf $@ \
1022983
testsuite
@@ -1030,7 +991,7 @@ hackage: _build/packages/hackage.haskell.org/01-index.tar.gz
1030991
# whatever index-state we set in the project file. Reproducibility is left to
1031992
# index-state.
1032993
.PHONY: _build/packages/hackage.haskell.org/01-index.tar.gz
1033-
_build/packages/hackage.haskell.org/01-index.tar.gz: | $(CABAL)
994+
_build/packages/hackage.haskell.org/01-index.tar.gz:
1034995
@mkdir -p $(@D)
1035996
$(CABAL) $(CABAL_ARGS) update
1036997

0 commit comments

Comments
 (0)