Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ _darcs/
/ghc/stage1/
/ghc/stage2/
/ghc/stage3/
/utils/iserv/stage2*/

# -----------------------------------------------------------------------------
# specific generated files
Expand Down Expand Up @@ -202,7 +201,7 @@ _darcs/
/testsuite_summary*.txt
/testsuite*.xml
/testlog*
/utils/iserv/iserv.cabal
/utils/ghc-iserv/ghc-iserv.cabal
/utils/iserv-proxy/iserv-proxy.cabal
/utils/remote-iserv/remote-iserv.cabal
/utils/mkUserGuidePart/mkUserGuidePart.cabal
Expand Down
84 changes: 44 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,19 @@ CPUS_DETECT_SCRIPT := ./mk/detect-cpu-count.sh
CPUS := $(shell if [ -x $(CPUS_DETECT_SCRIPT) ]; then $(CPUS_DETECT_SCRIPT); else echo 2; fi)
THREADS ?= $(shell echo $$(( $(CPUS) + 1 )))

CONFIGURE_SCRIPTS = \
configure \
rts/configure \
libraries/ghc-internal/configure \
libraries/libffi-clib/configure
Copy link
Member

@hasufell hasufell Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
libraries/libffi-clib/configure
libraries/libffi-clib/configure \
libraries/directory/configure \
libraries/process/configure \
libraries/terminfo/configure \
libraries/time/configure \
libraries/unix/configure


# Files that will be generated by config.status from their .in counterparts
# FIXME: This is stupid. Why do we patch versions across multiple libraries? Idiotic.
# also, why on earth do we use a non standard SnakeCase convention for substitutions
# when CAPITAL_CASE is the standard?
CONFIGURED_FILES := \
ghc/ghc-bin.cabal \
compiler/GHC/CmmToLlvm/Version/Bounds.hs \
compiler/ghc.cabal \
libraries/ghc-boot/ghc-boot.cabal \
libraries/ghc-boot-th/ghc-boot-th.cabal \
Expand All @@ -207,7 +214,7 @@ CONFIGURED_FILES := \
rts/include/ghcversion.h

# --- Main Targets ---
all: _build/bindist # booted will depend on prepare-sources
all: _build/bindist

STAGE_UTIL_TARGETS := \
deriveConstants:deriveConstants \
Expand Down Expand Up @@ -570,7 +577,7 @@ _build/stage1/%: private GHC=$(GHC0)

.PHONY: $(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES))
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: private TARGET_PLATFORM=
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: $(CABAL) configure rts/configure libraries/ghc-internal/configure
$(addprefix _build/stage1/bin/,$(STAGE1_EXECUTABLES)) &: $(CABAL) $(CONFIGURE_SCRIPTS) $(CONFIGURED_FILES) libraries/ghc-boot-th-next/ghc-boot-th-next.cabal
@echo "::group::Building stage1 executables ($(STAGE1_EXECUTABLES))..."
# Force cabal to replan
rm -rf _build/stage1/cache
Expand Down Expand Up @@ -628,7 +635,7 @@ $(addprefix _build/stage2/bin/,$(STAGE2_EXECUTABLES)) &: $(CABAL) stage1
# build them with the stage2 ghc; seems like a better/cleaner idea to me (moritz).
.PHONY: $(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES))
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: private TARGET_PLATFORM=
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: $(CABAL) stage1
$(addprefix _build/stage2/bin/,$(STAGE2_UTIL_EXECUTABLES)) &: $(CABAL) stage1 cabal.project.stage2.settings
@echo "::group::Building stage2 utilities ($(STAGE2_UTIL_EXECUTABLES))..."
# Force cabal to replan
rm -rf _build/stage2/cache
Expand Down Expand Up @@ -958,31 +965,48 @@ _build/bindist/tests.tar.gz:
@tar czf $@ \
testsuite

# --- Configuration ---
# --- Hackage ---

$(GHC1) $(GHC2): | hackage
hackage: _build/packages/hackage.haskell.org/01-index.tar.gz
_build/packages/hackage.haskell.org/01-index.tar.gz: | $(CABAL)
@mkdir -p $(@D)
$(CABAL) $(CABAL_ARGS) update --index-state @1745256340

# booted depends on successful source preparation
configure rts/configure libraries/ghc-internal/configure driver/ghci/ghci-wrapper.cabal libraries/base/base.cabal libraries/ghc-experimental/ghc-experimental.cabal libraries/ghc-boot-th-next/ghc-boot-th-next.cabal libraries/ghci/ghci.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghc-boot/ghc-boot.cabal libraries/template-haskell/template-haskell.cabal libraries/ghc-heap/ghc-heap.cabal libraries/ghc-internal/ghc-internal.cabal compiler/ghc.cabal utils/ghc-pkg/ghc-pkg.cabal utils/runghc/runghc.cabal utils/ghc-iserv/ghc-iserv.cabal utils/remote-iserv/remote-iserv.cabal ghc/ghc-bin.cabal: configure.ac rts/configure.ac libraries/ghc-internal/configure.ac libraries/ghc-boot-th-next/.synth-stamp driver/ghci/ghci-wrapper.cabal.in libraries/base/base.cabal.in libraries/ghc-experimental/ghc-experimental.cabal.in libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in libraries/ghci/ghci.cabal.in libraries/ghc-boot-th/ghc-boot-th.cabal.in libraries/ghc-boot/ghc-boot.cabal.in libraries/template-haskell/template-haskell.cabal.in libraries/ghc-heap/ghc-heap.cabal.in libraries/ghc-internal/ghc-internal.cabal.in compiler/ghc.cabal.in utils/ghc-pkg/ghc-pkg.cabal.in utils/runghc/runghc.cabal.in utils/ghc-iserv/ghc-iserv.cabal.in utils/remote-iserv/remote-iserv.cabal.in ghc/ghc-bin.cabal.in
@echo "::group::Running ./boot script..."
@mkdir -p _build/logs
./boot
@echo ">>> Running ./configure script..."
./configure $(GHC_CONFIGURE_ARGS)
touch $@
# --- Configure and source preparation ---

$(CONFIGURE_SCRIPTS) : % : %.ac
@echo ">>> Running autoreconf $(@D)"
autoreconf $(@D)
@echo "::endgroup::"

# Top level configure script.
#
# NOTE: other configure scripts are run by Cabal
#
# We use --no-create to avoid regenerating files if not needed.
# Each configured file is tracked independently below.
config.status: configure
@echo ">>> Running $(@D)/configure"
$(@D)/configure --no-create $(GHC_CONFIGURE_ARGS)
@echo "::endgroup::"

# --- Clean Targets ---
# Configured files are obtained from their .in counterparts via config.status
$(CONFIGURED_FILES) : % : ./config.status %.in
./config.status $@

# Create ghc-boot-th-next from ghc-boot-th
libraries/ghc-boot-th-next/ghc-boot-th-next.cabal: libraries/ghc-boot-th/ghc-boot-th.cabal
@echo "::group::Synthesizing ghc-boot-th-next (copy & sed from ghc-boot-th)..."
@mkdir -p libraries/ghc-boot-th-next
sed -e 's/^name:[[:space:]]*ghc-boot-th$$/name: ghc-boot-th-next/' $< > $@
@echo "::endgroup::"

# --- Clean targets ---

clean:
@echo "::group::Cleaning build artifacts..."
rm -rf _build
rm -f libraries/ghc-boot-th-next/ghc-boot-th-next.cabal
rm -f libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in
rm -f libraries/ghc-boot-th-next/.synth-stamp
@echo "::endgroup::"

clean-stage1:
Expand All @@ -1004,29 +1028,9 @@ clean-stage3:
distclean: clean
@echo "::group::Cleaning all generated files (distclean)..."
rm -rf autom4te.cache
rm -f config.status config.log config.h configure aclocal.m4
rm -rf build-aux/config.guess build-aux/config.sub build-aux/install-sh build-aux/missing build-aux/compile depcomp
find . -name 'Makefile.in' -delete
rm -f $(CONFIGURED_FILES)
rm -rf libraries/ghc-boot-th-next/ghc-boot-th-next.cabal
rm -f libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in
rm -f libraries/ghc-boot-th-next/.synth-stamp
@echo "::endgroup::"

# --- Synthesis Targets ---
# This is such a hack 😱
libraries/ghc-boot-th-next/.synth-stamp:
@echo "::group::Synthesizing ghc-boot-th-next (copy & sed from ghc-boot-th)..."
@mkdir -p libraries/ghc-boot-th-next
@src=libraries/ghc-boot-th/ghc-boot-th.cabal.in; \
dst=libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in; \
if [ ! -f $$src ]; then echo "Source $$src not found" >&2; exit 1; fi; \
cp -f $$src $$dst.tmp; \
$(SED) -e 's/^name:[[:space:]]*ghc-boot-th$$/name: ghc-boot-th-next/' \
-e 's/ ghc-boot-th/ ghc-boot-th-next/g' \
$$dst.tmp > $$dst; \
rm -f $$dst.tmp; \
touch $@
rm -f config.status config.log config.h aclocal.m4
rm -f $(CONFIGURE_SCRIPTS) $(CONFIGURED_FILES)
rm -rf libraries/ghc-boot-th-next
@echo "::endgroup::"

# Default: skip performance tests (can override with SKIP_PERF_TESTS=NO)
Expand Down Expand Up @@ -1055,8 +1059,8 @@ CANONICAL_TEST_HC_OPTS = \
testsuite-timeout:
$(MAKE) -C testsuite/timeout


# --- Test Target ---

test: _build/bindist testsuite-timeout
@echo "::group::Running tests with THREADS=$(THREADS)" >&2
# If any required tool is missing, testsuite logic will skip related tests.
Expand Down
83 changes: 0 additions & 83 deletions boot

This file was deleted.

36 changes: 17 additions & 19 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
AC_PREREQ([2.69])
AC_INIT([ghc-builder], [0.1.0], [your-email@example.com])
AC_CONFIG_SRCDIR([.]) # A representative .in file
#AC_CONFIG_AUX_DIR([build-aux]) # Recommended place for config.guess, config.sub
AC_CONFIG_MACRO_DIR([m4]) # For any custom m4 macros
# AM_INIT_AUTOMAKE([-Wall -Werror foreign]) # Using some automake conventions

# --- Define GHC Build Options ---
# Usage: ./configure ProjectVersion=X.Y ...
Expand Down Expand Up @@ -79,23 +77,23 @@ AC_SUBST([LlvmMaxVersion])
# --- Files to generate ---
# config.status will create these files by substituting @VAR@ placeholders.
AC_CONFIG_FILES([
ghc/ghc-bin.cabal:ghc/ghc-bin.cabal.in
compiler/ghc.cabal:compiler/ghc.cabal.in
compiler/GHC/CmmToLlvm/Version/Bounds.hs:compiler/GHC/CmmToLlvm/Version/Bounds.hs.in
libraries/ghc-boot/ghc-boot.cabal:libraries/ghc-boot/ghc-boot.cabal.in
libraries/ghc-boot-th/ghc-boot-th.cabal:libraries/ghc-boot-th/ghc-boot-th.cabal.in
libraries/ghc-boot-th-next/ghc-boot-th-next.cabal:libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in
libraries/ghc-heap/ghc-heap.cabal:libraries/ghc-heap/ghc-heap.cabal.in
libraries/template-haskell/template-haskell.cabal:libraries/template-haskell/template-haskell.cabal.in
libraries/ghci/ghci.cabal:libraries/ghci/ghci.cabal.in
utils/ghc-pkg/ghc-pkg.cabal:utils/ghc-pkg/ghc-pkg.cabal.in
utils/ghc-iserv/ghc-iserv.cabal:utils/ghc-iserv/ghc-iserv.cabal.in
utils/runghc/runghc.cabal:utils/runghc/runghc.cabal.in
libraries/ghc-internal/ghc-internal.cabal:libraries/ghc-internal/ghc-internal.cabal.in
libraries/ghc-experimental/ghc-experimental.cabal:libraries/ghc-experimental/ghc-experimental.cabal.in
libraries/base/base.cabal:libraries/base/base.cabal.in
rts/include/ghcversion.h:rts/include/ghcversion.h.in
cabal.project.stage2.settings:cabal.project.stage2.settings.in
ghc/ghc-bin.cabal
compiler/ghc.cabal
compiler/GHC/CmmToLlvm/Version/Bounds.hs
libraries/ghc-boot/ghc-boot.cabal
libraries/ghc-boot-th/ghc-boot-th.cabal
libraries/ghc-boot-th-next/ghc-boot-th-next.cabal
libraries/ghc-heap/ghc-heap.cabal
libraries/template-haskell/template-haskell.cabal
libraries/ghci/ghci.cabal
utils/ghc-pkg/ghc-pkg.cabal
utils/ghc-iserv/ghc-iserv.cabal
utils/runghc/runghc.cabal
libraries/ghc-internal/ghc-internal.cabal
libraries/ghc-experimental/ghc-experimental.cabal
libraries/base/base.cabal
rts/include/ghcversion.h
cabal.project.stage2.settings
])

AC_OUTPUT
Expand Down
Loading