diff --git a/.gitignore b/.gitignore index f6d6b0bc9006..040d69579923 100644 --- a/.gitignore +++ b/.gitignore @@ -95,7 +95,6 @@ _darcs/ /ghc/stage1/ /ghc/stage2/ /ghc/stage3/ -/utils/iserv/stage2*/ # ----------------------------------------------------------------------------- # specific generated files @@ -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 diff --git a/Makefile b/Makefile index 65aa7aff1086..6fba725d0da1 100644 --- a/Makefile +++ b/Makefile @@ -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 + # 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 \ @@ -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 \ @@ -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 @@ -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 @@ -958,7 +965,7 @@ _build/bindist/tests.tar.gz: @tar czf $@ \ testsuite -# --- Configuration --- +# --- Hackage --- $(GHC1) $(GHC2): | hackage hackage: _build/packages/hackage.haskell.org/01-index.tar.gz @@ -966,23 +973,40 @@ _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: @@ -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) @@ -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. diff --git a/boot b/boot deleted file mode 100755 index c73ed3a430b0..000000000000 --- a/boot +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 - -import glob -import os -import os.path -import sys -from textwrap import dedent -import subprocess -import re -import shutil - -# Packages whose libraries aren't in the submodule root -EXCEPTIONS = { - 'libraries/containers/': 'libraries/containers/containers/' -} - -def print_err(s): - print(dedent(s), file=sys.stderr) - -def die(mesg): - print_err(mesg) - sys.exit(1) - -def check_boot_packages(): - # Check that we have all boot packages. - for l in open('packages', 'r'): - if l.startswith('#'): - continue - - parts = [part for part in l.split(' ') if part] - if len(parts) != 4: - die("Error: Bad line in packages file: " + l) - - dir_ = parts[0] - tag = parts[1] - - # If tag is not "-" then it is an optional repository, so its - # absence isn't an error. - if tag == '-': - # We would like to just check for a .git directory here, - # but in an lndir tree we avoid making .git directories, - # so it doesn't exist. We therefore require that every repo - # has a LICENSE file instead. - license_path = os.path.join(EXCEPTIONS.get(dir_+'/', dir_), 'LICENSE') - if not os.path.isfile(license_path): - die("""\ - Error: %s doesn't exist - Maybe you haven't run 'git submodule update --init'? - """ % license_path) - -def autoreconf(): - # Run autoreconf on everything that needs it. - processes = {} - if os.name == 'nt': - # Get the normalized ACLOCAL_PATH for Windows - # This is necessary since on Windows this will be a Windows - # path, which autoreconf doesn't know doesn't know how to handle. - ac_local = os.getenv('ACLOCAL_PATH', '') - ac_local_arg = re.sub(r';', r':', ac_local) - ac_local_arg = re.sub(r'\\', r'/', ac_local_arg) - ac_local_arg = re.sub(r'(\w):/', r'/\1/', ac_local_arg) - reconf_cmd = 'ACLOCAL_PATH=%s autoreconf' % ac_local_arg - else: - reconf_cmd = 'autoreconf' - - for dir_ in ['.', 'rts'] + glob.glob('libraries/*/'): - if os.path.isfile(os.path.join(dir_, 'configure.ac')): - print("Booting %s" % dir_) - processes[dir_] = subprocess.Popen(['sh', '-c', reconf_cmd], cwd=dir_) - - # Wait for all child processes to finish. - fail = False - for k,v in processes.items(): - code = v.wait() - if code != 0: - print_err('autoreconf in %s failed with exit code %d' % (k, code)) - fail = True - - if fail: - sys.exit(1) - -check_boot_packages() -autoreconf() diff --git a/configure.ac b/configure.ac index 12056742ccdf..224f12cbc7da 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ... @@ -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