[Git][ghc/ghc][wip/cross-ci] 6 commits: hadrian: Don't use mk/config.mk.in
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Sun Aug 7 22:30:35 UTC 2022
Ben Gamari pushed to branch wip/cross-ci at Glasgow Haskell Compiler / GHC
Commits:
afa584a3 by Ben Gamari at 2022-08-07T05:08:52-04:00
hadrian: Don't use mk/config.mk.in
Ultimately we want to drop mk/config.mk so here I extract the bits
needed by the Hadrian bindist installation logic into a Hadrian-specific
file. While doing this I fixed binary distribution installation, #21901.
- - - - -
b9bb45d7 by Ben Gamari at 2022-08-07T05:08:52-04:00
hadrian: Fix naming of cross-compiler wrappers
- - - - -
78d04cfa by Ben Gamari at 2022-08-07T11:44:58-04:00
hadrian: Extend xattr Darwin hack to cover /lib
As noted in #21506, it is now necessary to remove extended attributes
from `/lib` as well as `/bin` to avoid SIP issues on Darwin.
Fixes #21506.
- - - - -
953201c1 by Ben Gamari at 2022-08-07T18:30:24-04:00
gitlab-ci: Introduce validation job for aarch64 cross-compilation
Begins to address #11958.
- - - - -
0426e5c0 by Ben Gamari at 2022-08-07T18:30:24-04:00
Bump process submodule
- - - - -
2e895564 by Ben Gamari at 2022-08-07T18:30:24-04:00
gitlab-ci: Add basic support for cross-compiler testiing
Here we add a simple qemu-based test for cross-compilers.
- - - - -
10 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- distrib/configure.ac.in
- hadrian/bindist/Makefile
- + hadrian/bindist/config.mk.in
- hadrian/src/Packages.hs
- hadrian/src/Rules/BinaryDist.hs
- libraries/process
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -2,7 +2,7 @@ variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
- DOCKER_REV: 58d08589371e78829a3279c6f8b1241e155d7f70
+ DOCKER_REV: 9e4c540d9e4972a36291dfdf81f079f37d748890
# Sequential version number of all cached things.
# Bump to invalidate GitLab CI cache.
=====================================
.gitlab/ci.sh
=====================================
@@ -93,6 +93,7 @@ Environment variables determining build configuration of Hadrian system:
BUILD_FLAVOUR Which flavour to build.
REINSTALL_GHC Build and test a reinstalled "stage3" ghc built using cabal-install
This tests the "reinstall" configuration
+ CROSS_EMULATOR The emulator to use for testing of cross-compilers.
Environment variables determining bootstrap toolchain (Linux):
@@ -564,15 +565,38 @@ function make_install_destdir() {
fi
info "merging file tree from $destdir to $instdir"
cp -a "$destdir/$instdir"/* "$instdir"/
- "$instdir"/bin/ghc-pkg recache
+ "$instdir"/bin/${cross_prefix}ghc-pkg recache
}
-function test_hadrian() {
- if [ -n "${CROSS_TARGET:-}" ]; then
- info "Can't test cross-compiled build."
- return
- fi
+# install the binary distribution in directory $1 to $2.
+function install_bindist() {
+ local bindist="$1"
+ local instdir="$2"
+ pushd "$bindist"
+ case "$(uname)" in
+ MSYS_*|MINGW*)
+ mkdir -p "$instdir"
+ cp -a * "$instdir"
+ ;;
+ *)
+ read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}"
+
+ # FIXME: The bindist configure script shouldn't need to be reminded of
+ # the target platform. See #21970.
+ if [ -n "${target_triple:-}" ]; then
+ args+=( "--target=$target_triple" "--host=$target_triple" )
+ fi
+ run ./configure \
+ --prefix="$instdir" \
+ "${args[@]+"${args[@]}"}"
+ make_install_destdir "$TOP"/destdir "$instdir"
+ ;;
+ esac
+ popd
+}
+
+function test_hadrian() {
check_msys2_deps _build/stage1/bin/ghc --version
check_release_build
@@ -593,7 +617,21 @@ function test_hadrian() {
fi
- if [[ -n "${REINSTALL_GHC:-}" ]]; then
+ if [ -n "${CROSS_TARGET:-}" ]; then
+ if [ -n "${CROSS_EMULATOR:-}" ]; then
+ local instdir="$TOP/_build/install"
+ local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
+ install_bindist _build/bindist/ghc-*/ "$instdir"
+ echo 'main = putStrLn "hello world"' > hello.hs
+ echo "hello world" > expected
+ run "$test_compiler" hello.hs
+ run "$CROSS_EMULATOR" ./hello > actual
+ run diff expected actual
+ else
+ info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
+ return
+ fi
+ elif [[ -n "${REINSTALL_GHC:-}" ]]; then
run_hadrian \
test \
--test-root-dirs=testsuite/tests/stage1 \
@@ -602,20 +640,9 @@ function test_hadrian() {
--test-root-dirs=testsuite/tests/typecheck \
"runtest.opts+=${RUNTEST_ARGS:-}" || fail "hadrian cabal-install test"
else
- cd _build/bindist/ghc-*/
- case "$(uname)" in
- MSYS_*|MINGW*)
- mkdir -p "$TOP"/_build/install
- cp -a * "$TOP"/_build/install
- ;;
- *)
- read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}"
- run ./configure --prefix="$TOP"/_build/install "${args[@]+"${args[@]}"}"
- make_install_destdir "$TOP"/destdir "$TOP"/_build/install
- ;;
- esac
- cd ../../../
- test_compiler="$TOP/_build/install/bin/ghc$exe"
+ local instdir="$TOP/_build/install"
+ local test_compiler="$instdir/bin/ghc$exe"
+ install_bindist _build/bindist/ghc-*/ "$instdir"
if [[ "${WINDOWS_HOST}" == "no" ]]; then
run_hadrian \
@@ -779,6 +806,9 @@ esac
if [ -n "${CROSS_TARGET:-}" ]; then
info "Cross-compiling for $CROSS_TARGET..."
target_triple="$CROSS_TARGET"
+ cross_prefix="$target_triple-"
+else
+ cross_prefix=""
fi
echo "Branch name ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-}"
=====================================
.gitlab/gen_ci.hs
=====================================
@@ -116,6 +116,8 @@ data BuildConfig
, llvmBootstrap :: Bool
, withAssertions :: Bool
, withNuma :: Bool
+ , crossTarget :: Maybe String
+ , crossEmulator :: Maybe String
, fullyStatic :: Bool
, tablesNextToCode :: Bool
, threadSanitiser :: Bool
@@ -126,6 +128,7 @@ configureArgsStr :: BuildConfig -> String
configureArgsStr bc = intercalate " " $
["--enable-unregisterised"| unregisterised bc ]
++ ["--disable-tables-next-to-code" | not (tablesNextToCode bc) ]
+ ++ ["--with-intree-gmp" | Just _ <- pure (crossTarget bc) ]
-- Compute the hadrian flavour from the BuildConfig
mkJobFlavour :: BuildConfig -> Flavour
@@ -156,6 +159,8 @@ vanilla = BuildConfig
, llvmBootstrap = False
, withAssertions = False
, withNuma = False
+ , crossTarget = Nothing
+ , crossEmulator = Nothing
, fullyStatic = False
, tablesNextToCode = True
, threadSanitiser = False
@@ -186,6 +191,14 @@ static = vanilla { fullyStatic = True }
staticNativeInt :: BuildConfig
staticNativeInt = static { bignumBackend = Native }
+crossConfig :: String -- ^ target triple
+ -> Maybe String -- ^ emulator for testing
+ -> BuildConfig
+crossConfig triple emulator =
+ vanilla { crossTarget = Just triple
+ , crossEmulator = emulator
+ }
+
llvm :: BuildConfig
llvm = vanilla { llvmBootstrap = True }
@@ -252,6 +265,7 @@ testEnv arch opsys bc = intercalate "-" $
++ ["unreg" | unregisterised bc ]
++ ["numa" | withNuma bc ]
++ ["no_tntc" | not (tablesNextToCode bc) ]
+ ++ ["cross_"++triple | Just triple <- pure $ crossTarget bc ]
++ [flavourString (mkJobFlavour bc)]
-- | The hadrian flavour string we are going to use for this build
@@ -597,7 +611,8 @@ job arch opsys buildConfig = (jobName, Job {..})
, "BUILD_FLAVOUR" =: flavourString jobFlavour
, "BIGNUM_BACKEND" =: bignumString (bignumBackend buildConfig)
, "CONFIGURE_ARGS" =: configureArgsStr buildConfig
-
+ , maybe M.empty ("CROSS_TARGET" =:) (crossTarget buildConfig)
+ , maybe M.empty ("CROSS_EMULATOR" =:) (crossEmulator buildConfig)
, if withNuma buildConfig then "ENABLE_NUMA" =: "1" else M.empty
]
@@ -773,6 +788,7 @@ jobs = M.fromList $ concatMap flattenJobGroup $
, standardBuilds I386 (Linux Debian9)
, allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) static)
, disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt))
+ , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Just "qemu-aarch64"))
]
where
=====================================
.gitlab/jobs.yaml
=====================================
@@ -1261,6 +1261,67 @@
"XZ_OPT": "-9"
}
},
+ "nightly-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": {
+ "after_script": [
+ ".gitlab/ci.sh save_cache",
+ ".gitlab/ci.sh clean",
+ "cat ci_timings"
+ ],
+ "allow_failure": false,
+ "artifacts": {
+ "expire_in": "8 weeks",
+ "paths": [
+ "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz",
+ "junit.xml"
+ ],
+ "reports": {
+ "junit": "junit.xml"
+ },
+ "when": "always"
+ },
+ "cache": {
+ "key": "x86_64-linux-deb11-$CACHE_REV",
+ "paths": [
+ "cabal-cache",
+ "toolchain"
+ ]
+ },
+ "dependencies": [],
+ "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV",
+ "needs": [
+ {
+ "artifacts": false,
+ "job": "hadrian-ghc-in-ghci"
+ }
+ ],
+ "rules": [
+ {
+ "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+ "when": "on_success"
+ }
+ ],
+ "script": [
+ "sudo chown ghc:ghc -R .",
+ ".gitlab/ci.sh setup",
+ ".gitlab/ci.sh configure",
+ ".gitlab/ci.sh build_hadrian",
+ ".gitlab/ci.sh test_hadrian"
+ ],
+ "stage": "full-build",
+ "tags": [
+ "x86_64-linux"
+ ],
+ "variables": {
+ "BIGNUM_BACKEND": "gmp",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
+ "BUILD_FLAVOUR": "validate",
+ "CONFIGURE_ARGS": "--with-intree-gmp",
+ "CROSS_EMULATOR": "qemu-aarch64",
+ "CROSS_TARGET": "aarch64-linux-gnu",
+ "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
+ "XZ_OPT": "-9"
+ }
+ },
"nightly-x86_64-linux-deb11-validate": {
"after_script": [
".gitlab/ci.sh save_cache",
@@ -3680,6 +3741,66 @@
"TSAN_OPTIONS": "suppressions=$CI_PROJECT_DIR/rts/.tsan-suppressions"
}
},
+ "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate": {
+ "after_script": [
+ ".gitlab/ci.sh save_cache",
+ ".gitlab/ci.sh clean",
+ "cat ci_timings"
+ ],
+ "allow_failure": false,
+ "artifacts": {
+ "expire_in": "2 weeks",
+ "paths": [
+ "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate.tar.xz",
+ "junit.xml"
+ ],
+ "reports": {
+ "junit": "junit.xml"
+ },
+ "when": "always"
+ },
+ "cache": {
+ "key": "x86_64-linux-deb11-$CACHE_REV",
+ "paths": [
+ "cabal-cache",
+ "toolchain"
+ ]
+ },
+ "dependencies": [],
+ "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV",
+ "needs": [
+ {
+ "artifacts": false,
+ "job": "hadrian-ghc-in-ghci"
+ }
+ ],
+ "rules": [
+ {
+ "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+ "when": "on_success"
+ }
+ ],
+ "script": [
+ "sudo chown ghc:ghc -R .",
+ ".gitlab/ci.sh setup",
+ ".gitlab/ci.sh configure",
+ ".gitlab/ci.sh build_hadrian",
+ ".gitlab/ci.sh test_hadrian"
+ ],
+ "stage": "full-build",
+ "tags": [
+ "x86_64-linux"
+ ],
+ "variables": {
+ "BIGNUM_BACKEND": "gmp",
+ "BIN_DIST_NAME": "ghc-x86_64-linux-deb11-cross_aarch64-linux-gnu-validate",
+ "BUILD_FLAVOUR": "validate",
+ "CONFIGURE_ARGS": "--with-intree-gmp",
+ "CROSS_EMULATOR": "qemu-aarch64",
+ "CROSS_TARGET": "aarch64-linux-gnu",
+ "TEST_ENV": "x86_64-linux-deb11-cross_aarch64-linux-gnu-validate"
+ }
+ },
"x86_64-linux-deb11-validate": {
"after_script": [
".gitlab/ci.sh save_cache",
=====================================
distrib/configure.ac.in
=====================================
@@ -256,7 +256,7 @@ AC_SUBST(UseLibdw)
FP_SETTINGS
#
-AC_CONFIG_FILES(mk/config.mk mk/install.mk)
+AC_CONFIG_FILES(config.mk mk/config.mk mk/install.mk)
AC_OUTPUT
# We get caught by
=====================================
hadrian/bindist/Makefile
=====================================
@@ -1,7 +1,8 @@
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
-include mk/config.mk
+include ./mk/project.mk
+include ./config.mk
.PHONY: default
default:
@@ -177,7 +178,9 @@ install_bin_libdir:
$(INSTALL_PROGRAM) $$i "$(DESTDIR)$(ActualBinsDir)"; \
done
# Work around #17418 on Darwin
- if [ -e "${XATTR}" ]; then "${XATTR}" -c -r "$(DESTDIR)$(ActualBinsDir)"; fi
+ if [ -e "${XATTR}" ]; then \
+ "${XATTR}" -c -r "$(DESTDIR)$(ActualBinsDir)"; \
+ fi
install_bin_direct:
@echo "Copying binaries to $(DESTDIR)$(WrapperBinsDir)"
@@ -208,6 +211,10 @@ install_lib: lib/settings
esac; \
done; \
chmod ugo+rx "$$dest"/bin/*
+ # Work around #17418 on Darwin
+ if [ -e "${XATTR}" ]; then \
+ "${XATTR}" -c -r "$(DESTDIR)$(ActualLibsDir)"; \
+ fi
install_docs:
@echo "Copying docs to $(DESTDIR)$(docdir)"
=====================================
hadrian/bindist/config.mk.in
=====================================
@@ -0,0 +1,285 @@
+#-----------------------------------------------------------------------------
+#
+# Definition of installation directories, we don't use half of these, but since
+# the configure script has them on offer while passing through, we might as well
+# set them. Note that we have to be careful, because the GNU coding standards
+# have changed a bit over the course of time, and autoconf development reflects
+# this.
+#
+# A little bit of history regarding autoconf and GNU coding standards, use this
+# as a cheat-sheet for the stuff below:
+#
+# variable | default < 2.60 | default >= 2.60
+# ------------+--------------------+--------------------------------------
+# exec_prefix | ${prefix} | ${prefix}
+# libdir | ${exec_prefix}/lib | ${exec_prefix}/lib
+# datarootdir | NONE! | ${prefix}/share
+# datadir | ${prefix}/share | ${datarootdir}
+# infodir | ${prefix}/info | ${datarootdir}/info
+# mandir | ${prefix}/man | ${datarootdir}/man
+# docdir | NONE! | ${datarootdir}/doc/${PACKAGE_TARNAME}
+# htmldir | NONE! | ${docdir}
+# dvidir | NONE! | ${docdir}
+# pdfdir | NONE! | ${docdir}
+# psdir | NONE! | ${docdir}
+#
+# NOTE: The default e.g. ${docdir} above means that autoconf substitutes the
+# string "${docdir}", not the value of docdir! This is crucial for the GNU
+# coding standards. See #1924.
+
+define set_default
+# $1 = variable to set
+# $2 = default value to use, if configure didn't expand it
+# If $1 starts with an @ then configure didn't set it (because a version
+# of autoconf that is too old was used), so set it to a sensible value
+ifneq "$$(filter @%,$$($1))" ""
+$1 = $2
+endif
+endef
+
+prefix = @prefix@
+
+datarootdir = @datarootdir@
+$(eval $(call set_default,datarootdir,$${prefix}/share))
+
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+datadir = @datadir@
+libdir = @libdir@
+includedir = @includedir@
+mandir = @mandir@
+
+# Note that `./configure --docdir=/foo/bar` should work.
+docdir = @docdir@
+PACKAGE_TARNAME = ghc-${ProjectVersion}
+$(eval $(call set_default,docdir,$${datarootdir}/doc/$${PACKAGE_TARNAME}))
+
+htmldir = @htmldir@
+dvidir = @dvidir@
+pdfdir = @pdfdir@
+psdir = @psdir@
+$(eval $(call set_default,htmldir,$${docdir}))
+$(eval $(call set_default,dvidir,$${docdir}))
+$(eval $(call set_default,pdfdir,$${docdir}))
+$(eval $(call set_default,psdir,$${docdir}))
+
+ifeq "$(RelocatableBuild)" "YES"
+
+# Hack: our directory layouts tend to be different on Windows, so
+# hack around configure's bogus assumptions here.
+datarootdir = $(prefix)
+datadir = $(prefix)/lib
+libdir = $(prefix)/lib
+
+docdir = $(prefix)/doc
+htmldir = $(docdir)
+dvidir = $(docdir)
+pdfdir = $(docdir)
+psdir = $(docdir)
+
+ghclibdir = $(libdir)
+
+else
+
+# Unix: override libdir and datadir to put ghc-specific stuff in
+# a subdirectory with the version number included.
+ghclibdir = $(libdir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)
+endif
+
+ghclibexecdir = $(ghclibdir)
+topdir = $(ghclibdir)
+ghcheaderdir = $(ghclibdir)/rts/include
+
+#-----------------------------------------------------------------------------
+# Utilities needed by the installation Makefile
+
+GENERATED_FILE = chmod a-w
+EXECUTABLE_FILE = chmod +x
+CP = cp
+FIND = @FindCmd@
+INSTALL = @INSTALL@
+INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
+LN_S = @LN_S@
+MV = mv
+SED = @SedCmd@
+SHELL = @SHELL@
+
+#
+# Invocations of `install' for different classes
+# of targets:
+#
+INSTALL_PROGRAM = $(INSTALL) -m 755
+INSTALL_SCRIPT = $(INSTALL) -m 755
+INSTALL_SHLIB = $(INSTALL) -m 755
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_HEADER = $(INSTALL) -m 644
+INSTALL_MAN = $(INSTALL) -m 644
+INSTALL_DOC = $(INSTALL) -m 644
+INSTALL_DIR = $(INSTALL) -m 755 -d
+
+CREATE_SCRIPT = create () { touch "$$1" && chmod 755 "$$1" ; } && create
+CREATE_DATA = create () { touch "$$1" && chmod 644 "$$1" ; } && create
+
+#-----------------------------------------------------------------------------
+# Build configuration
+
+CrossCompiling = @CrossCompiling@
+CrossCompilePrefix = @CrossCompilePrefix@
+GhcUnregisterised = @Unregisterised@
+
+# ArchSupportsSMP should be set iff there is support for that arch in
+# rts/include/stg/SMP.h
+ifeq "$(TargetArch_CPP)" "arm"
+# We don't support load/store barriers pre-ARMv7. See #10433.
+ArchSupportsSMP=$(if $(filter $(ARM_ISA),ARMv5 ARMv6),NO,YES)
+else
+ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le s390x aarch64 riscv64)))
+endif
+
+# The THREADED_RTS requires `BaseReg` to be in a register and the
+# `GhcUnregisterised` mode doesn't allow that.
+GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
+
+# Whether to include GHCi in the compiler. Depends on whether the RTS linker
+# has support for this OS/ARCH combination.
+OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu)))
+ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm aarch64)))
+
+ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
+GhcWithInterpreter=YES
+else
+GhcWithInterpreter=$(if $(findstring YES,$(DYNAMIC_GHC_PROGRAMS)),YES,NO)
+endif
+
+# On Windows we normally want to make a relocatable bindist, to we
+# ignore flags like libdir
+ifeq "$(Windows_Host)" "YES"
+RelocatableBuild = YES
+else
+RelocatableBuild = NO
+endif
+
+
+# runhaskell and hsc2hs are special, in that other compilers besides
+# GHC might provide them. Systems with a package manager often come
+# with tools to manage this kind of clash, e.g. RPM's
+# update-alternatives. When building a distribution for such a system,
+# we recommend setting both of the following to 'YES'.
+#
+# NO_INSTALL_RUNHASKELL = YES
+# NO_INSTALL_HSC2HS = YES
+#
+# NB. we use negative tests here because for binary-distributions we cannot
+# test build-time variables at install-time, so they must default to on.
+
+ifneq "$(DESTDIR)" ""
+override DESTDIR := $(abspath $(DESTDIR))
+endif
+
+# We build the libraries at least the "vanilla" way (way "v")
+# Technically we don't need the v way if DYNAMIC_GHC_PROGRAMS is YES,
+# but with -dynamic-too it's cheap, and makes life easier.
+GhcLibWays = v
+
+# In addition to the normal sequential way, the default is to also build
+# profiled prelude libraries
+# $(if $(filter ...)) allows controlling this expression from build.mk.
+GhcLibWays += $(if $(filter $(BUILD_PROF_LIBS),NO),,p)
+
+# Backward compatibility: although it would be cleaner to test for
+# PlatformSupportsSharedLibs, or perhaps a new variable BUILD_SHARED_LIBS,
+# some users currently expect that DYNAMIC_GHC_PROGRAMS=NO in build.mk implies
+# that dyn is not added to GhcLibWays.
+GhcLibWays += $(if $(filter $(DYNAMIC_GHC_PROGRAMS),NO),,dyn)
+
+# Handy way to test whether we're building shared libs or not.
+BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
+
+# In addition, the RTS is built in some further variations. Ways that
+# make sense here:
+#
+# thr : threaded
+# thr_p : threaded + profiled
+# debug : debugging
+# thr_debug : debugging + threaded
+# p : profiled
+#
+# While the eventlog used to be enabled in only a subset of ways, we now always
+# enable it.
+
+# Usually want the debug version
+GhcRTSWays = debug
+
+# We always have the threaded versions, but note that SMP support may be disabled
+# (see GhcWithSMP).
+GhcRTSWays += thr thr_debug
+GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),thr_p,)
+GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)),dyn debug_dyn thr_dyn thr_debug_dyn,)
+GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),thr_debug_p debug_p,)
+
+# We can only build GHCi threaded if we have a threaded RTS:
+GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
+
+# Configuration for libffi
+UseSystemLibFFI=@UseSystemLibFFI@
+UseLibffiForAdjustors=@UseLibffiForAdjustors@
+
+# GHC needs arch-specific tweak at least in
+# rts/Libdw.c:set_initial_registers()
+GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 s390x), at UseLibdw@,NO))
+
+#-----------------------------------------------------------------------------
+# Settings
+
+# We are in the process of moving the settings file from being entirely
+# generated by configure, to generated being by the build system. Many of these
+# might become redundant.
+# See Note [tooldir: How GHC finds mingw on Windows]
+
+GccExtraViaCOpts = @GccExtraViaCOpts@
+LdHasFilelist = @LdHasFilelist@
+LdHasBuildId = @LdHasBuildId@
+LdHasFilelist = @LdHasFilelist@
+LdIsGNULd = @LdIsGNULd@
+LdHasNoCompactUnwind = @LdHasNoCompactUnwind@
+ArArgs = @ArArgs@
+ArSupportsAtFile = @ArSupportsAtFile@
+ArSupportsDashL = @ArSupportsDashL@
+HaskellHostOs = @HaskellHostOs@
+HaskellHostArch = @HaskellHostArch@
+HaskellTargetOs = @HaskellTargetOs@
+HaskellTargetArch = @HaskellTargetArch@
+TargetWordSize = @TargetWordSize@
+TargetWordBigEndian = @TargetWordBigEndian@
+TargetHasGnuNonexecStack = @TargetHasGnuNonexecStack@
+TargetHasIdentDirective = @TargetHasIdentDirective@
+TargetHasSubsectionsViaSymbols = @TargetHasSubsectionsViaSymbols@
+TargetHasRTSLinker = @TargetHasRTSLinker@
+TargetHasLibm = @TargetHasLibm@
+TablesNextToCode = @TablesNextToCode@
+
+SettingsCCompilerCommand = @SettingsCCompilerCommand@
+SettingsCxxCompilerCommand = @SettingsCxxCompilerCommand@
+SettingsHaskellCPPCommand = @SettingsHaskellCPPCommand@
+SettingsHaskellCPPFlags = @SettingsHaskellCPPFlags@
+SettingsCCompilerFlags = @SettingsCCompilerFlags@
+SettingsCxxCompilerFlags = @SettingsCxxCompilerFlags@
+SettingsCCompilerLinkFlags = @SettingsCCompilerLinkFlags@
+SettingsCCompilerSupportsNoPie = @SettingsCCompilerSupportsNoPie@
+SettingsLdCommand = @SettingsLdCommand@
+SettingsLdFlags = @SettingsLdFlags@
+SettingsMergeObjectsCommand = @SettingsMergeObjectsCommand@
+SettingsMergeObjectsFlags = @SettingsMergeObjectsFlags@
+SettingsArCommand = @SettingsArCommand@
+SettingsOtoolCommand = @SettingsOtoolCommand@
+SettingsInstallNameToolCommand = @SettingsInstallNameToolCommand@
+SettingsRanlibCommand = @SettingsRanlibCommand@
+SettingsDllWrapCommand = @SettingsDllWrapCommand@
+SettingsWindresCommand = @SettingsWindresCommand@
+SettingsLibtoolCommand = @SettingsLibtoolCommand@
+SettingsTouchCommand = @SettingsTouchCommand@
+SettingsClangCommand = @SettingsClangCommand@
+SettingsLlcCommand = @SettingsLlcCommand@
+SettingsOptCommand = @SettingsOptCommand@
+SettingsUseDistroMINGW = @SettingsUseDistroMINGW@
+
=====================================
hadrian/src/Packages.hs
=====================================
@@ -14,7 +14,7 @@ module Packages (
ghcPackages, isGhcPackage,
-- * Package information
- programName, nonHsMainPackage, autogenPath, programPath, timeoutPath,
+ crossPrefix, programName, nonHsMainPackage, autogenPath, programPath, timeoutPath,
rtsContext, rtsBuildPath, libffiBuildPath,
ensureConfigured
) where
@@ -154,15 +154,20 @@ linter name = program name ("linters" -/- name)
setPath :: Package -> FilePath -> Package
setPath pkg path = pkg { pkgPath = path }
+-- | Target prefix to prepend to executable names.
+crossPrefix :: Action String
+crossPrefix = do
+ cross <- flag CrossCompiling
+ targetPlatform <- setting TargetPlatformFull
+ return $ if cross then targetPlatform ++ "-" else ""
+
-- | Given a 'Context', compute the name of the program that is built in it
-- assuming that the corresponding package's type is 'Program'. For example, GHC
-- built in 'Stage0' is called @ghc-stage1 at . If the given package is a
-- 'Library', the function simply returns its name.
programName :: Context -> Action String
programName Context {..} = do
- cross <- flag CrossCompiling
- targetPlatform <- setting TargetPlatformFull
- let prefix = if cross then targetPlatform ++ "-" else ""
+ prefix <- crossPrefix
-- TODO: Can we extract this information from Cabal files?
-- Alp: We could, but then the iserv package would have to
-- use Cabal conditionals + a 'profiling' flag
=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -1,4 +1,4 @@
-{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE TupleSections, MultiWayIf #-}
module Rules.BinaryDist where
import Hadrian.Haskell.Cabal
@@ -254,6 +254,7 @@ bindistRules = do
-- other machine.
need $ map (bindistFilesDir -/-)
(["configure", "Makefile"] ++ bindistInstallFiles)
+ copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in")
forM_ bin_targets $ \(pkg, _) -> do
needed_wrappers <- pkgToWrappers pkg
forM_ needed_wrappers $ \wrapper_name -> do
@@ -346,7 +347,9 @@ compressorExtension Bzip2 = "bz2"
bindistInstallFiles :: [FilePath]
bindistInstallFiles =
[ "config.sub", "config.guess", "install-sh"
- , "mk" -/- "config.mk.in", "mk" -/- "install.mk.in", "mk" -/- "project.mk"
+ , "mk" -/- "config.mk.in" -- TODO: Remove when make is gone
+ , "mk" -/- "install.mk.in" -- TODO: Remove when make is gone
+ , "mk" -/- "project.mk"
, "mk" -/- "relpath.sh"
, "mk" -/- "system-cxx-std-lib-1.0.conf.in"
, "README", "INSTALL" ]
@@ -370,19 +373,20 @@ useGhcPrefix pkg
| pkg == ghciWrapper = False
| otherwise = True
-
-- | Which wrappers point to a specific package
pkgToWrappers :: Package -> Action [String]
-pkgToWrappers pkg
- -- ghc also has the ghci script wrapper
- | pkg == ghc = pure ["ghc", "ghci"]
- | pkg == runGhc = pure ["runghc", "runhaskell"]
- -- These are the packages which we want to expose to the user and hence
- -- there are wrappers installed in the bindist.
- | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, ghc, ghcPkg]
- = (:[]) <$> (programName =<< programContext Stage1 pkg)
- | otherwise = pure []
-
+pkgToWrappers pkg = do
+ prefix <- crossPrefix
+ if -- ghc also has the ghci script wrapper
+ -- N.B. programName would add the crossPrefix therefore we must do the
+ -- same here.
+ | pkg == ghc -> pure $ map (prefix++) ["ghc", "ghci"]
+ | pkg == runGhc -> pure $ map (prefix++) ["runghc", "runhaskell"]
+ -- These are the packages which we want to expose to the user and hence
+ -- there are wrappers installed in the bindist.
+ | pkg `elem` [hpcBin, haddock, hp2ps, hsc2hs, ghc, ghcPkg]
+ -> (:[]) <$> (programName =<< programContext Stage1 pkg)
+ | otherwise -> pure []
wrapper :: FilePath -> Action String
wrapper "ghc" = ghcWrapper
=====================================
libraries/process
=====================================
@@ -1 +1 @@
-Subproject commit 7a7431a0ef586c0f1e602e382398b988c699dfc2
+Subproject commit b95e5fbdeb74e0cc36b6878b60f9807bd0001fa8
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69fe554e77145dff573b3f1a2df8323b0e09b56c...2e89556493ecbeddcc2151d3945837642aaab57b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/69fe554e77145dff573b3f1a2df8323b0e09b56c...2e89556493ecbeddcc2151d3945837642aaab57b
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220807/33563a40/attachment-0001.html>
More information about the ghc-commits
mailing list