[Git][ghc/ghc][wip/fix-darwin-toolchain-cruft] ci: update darwin boot ghc to 9.10.3
Cheng Shao pushed to branch wip/fix-darwin-toolchain-cruft at Glasgow Haskell Compiler / GHC Commits: 03155fb0 by Cheng Shao at 2026-01-19T17:48:40+00:00 ci: update darwin boot ghc to 9.10.3 This patch updates darwin boot ghc to 9.10.3, along with other related updates, and pays off some technical debt here: - Update `nixpkgs` and use the `nixpkgs-25.05-darwin` channel. - Update the `niv` template. - Update LLVM to 21 and update `llvm-targets` to reflect LLVM 21 layout changes for arm64/x86_64 darwin targets. - Use `stdenvNoCC` to prevent nix packaged apple sdk from being used by boot ghc, and manually set `DEVELOPER_DIR`/`SDKROOT` to enforce the usage of system-wide command line sdk for macos. - When building nix derivation for boot ghc, run `configure` via the `arch` command so that `configure` and its subprocesses pick up the manually specified architecture. - Remove the previous horrible hack that obliterates `configure` to make autoconf test result in true. `configure` now properly does its job. - Remove the now obsolete configure args and post install settings file patching logic. - Use `scheme-small` for texlive to avoid build failures in certain unused texlive packages, especially on x86_64-darwin. - - - - - 3 changed files: - .gitlab/darwin/nix/sources.json - .gitlab/darwin/toolchain.nix - llvm-targets Changes: ===================================== .gitlab/darwin/nix/sources.json ===================================== @@ -1,26 +1,14 @@ { - "niv": { - "branch": "master", - "description": "Easy dependency management for Nix projects", - "homepage": "https://github.com/nmattia/niv", - "owner": "nmattia", - "repo": "niv", - "rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070", - "sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx", - "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42...", - "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" - }, "nixpkgs": { - "branch": "nixos-unstable", + "branch": "nixpkgs-25.05-darwin", "description": "Nix Packages collection", "homepage": "", "owner": "nixos", "repo": "nixpkgs", - "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", - "sha256": "1anwxmjpm21msnnlrjdz19w31bxnbpn4kgf93sn3npihi7wf4a8h", + "rev": "3e3f3c7f9977dc123c23ee21e8085ed63daf8c37", + "sha256": "0jnmv6gpzhqb0jyhj7qi7vjfwbn4cqs5blm5xia7q5i0ma2bbkcd", "type": "tarball", - "url": "https://github.com/nixos/nixpkgs/archive/2893f56de08021cffd9b6b6dfc70fd9ccd5...", + "url": "https://github.com/nixos/nixpkgs/archive/3e3f3c7f9977dc123c23ee21e8085ed63da...", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" } } ===================================== .gitlab/darwin/toolchain.nix ===================================== @@ -11,69 +11,67 @@ let hsPkgs = pkgs.haskellPackages; alex = hsPkgs.alex; happy = hsPkgs.happy; - targetTriple = pkgs.stdenv.targetPlatform.config; + targetTriple = pkgs.stdenvNoCC.targetPlatform.config; ghcBindists = let version = ghc.version; in { - aarch64-darwin = hostPkgs.fetchurl { + aarch64-darwin = hostPkgs.fetchzip { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz"; - sha256 = "sha256-/6+DtdeossBJIMbjkJwL4h3eJ7rzgNCV+ifoQKOi6AQ="; + hash = "sha512-xUlt7zc/OT3a1SR0BxmFFgrabPkWUENATdw4NbQwEi5+nH5yPau+HSrGI5UUoKdO4gdpgZlPaxtI7eSk0fx1+g=="; }; - x86_64-darwin = hostPkgs.fetchurl { + x86_64-darwin = hostPkgs.fetchzip { url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; - sha256 = "sha256-jPIhiJMOENesUnDUJeIaPatgavc6ZVSTY5NFIAxlC+k="; + hash = "sha512-4/INeJwPPGbOj9MepwnIvIg2lvFkqS8w/3U/I8f6gCsoNlgwPr78iyY9vd6vfMONR1GxNQU3L/lxE07F3P0Qag=="; }; - }; - ghc = pkgs.stdenv.mkDerivation rec { - version = "9.10.1"; + ghc = pkgs.stdenvNoCC.mkDerivation rec { + version = "9.10.3"; name = "ghc"; - src = ghcBindists.${pkgs.stdenv.hostPlatform.system}; + src = ghcBindists.${pkgs.stdenvNoCC.hostPlatform.system}; + + dontUpdateAutotoolsGnuConfigScripts = true; + configureFlags = [ - "CC=/usr/bin/clang" - "CLANG=/usr/bin/clang" "AR=/usr/bin/ar" - "LLC=${llvm}/bin/llc" - "OPT=${llvm}/bin/opt" - "LLVMAS=${llvm_clang}/bin/clang" - "CONF_CC_OPTS_STAGE2=--target=${targetTriple}" - "CONF_CXX_OPTS_STAGE2=--target=${targetTriple}" - "CONF_GCC_LINKER_OPTS_STAGE2=--target=${targetTriple}" + "CC=/usr/bin/clang" + "CXX=/usr/bin/clang++" + "INSTALL=/usr/bin/install" + "INSTALL_NAME_TOOL=/usr/bin/install_name_tool" + "MergeObjsCmd=/usr/bin/ld" + "NM=/usr/bin/nm" + "OTOOL=/usr/bin/otool" + "RANLIB=/usr/bin/ranlib" ]; - buildPhase = "true"; - - # This is a horrible hack because the configure script invokes /usr/bin/clang - # without a `--target` flag. Then depending on whether the `nix` binary itself is - # a native x86 or arm64 binary means that /usr/bin/clang thinks it needs to run in - # x86 or arm64 mode. - - # The correct answer for the check in question is the first one we try, so by replacing - # the condition to true; we select the right C++ standard library still. - preConfigure = '' - sed "s/\"\$CC\" -o actest actest.o \''${1} 2>\/dev\/null/true/i" configure > configure.new - mv configure.new configure - chmod +x configure - cat configure + # Use the arch command to explicitly specify architecture, so that + # configure and its subprocesses would pick up the architecture we + # choose via the system argument. + preConfigure = pkgs.lib.optionalString (system == "aarch64-darwin") '' + substituteInPlace configure \ + --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -arm64 /bin/sh" + '' + pkgs.lib.optionalString (system == "x86_64-darwin") '' + substituteInPlace configure \ + --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -x86_64 /bin/sh" + '' + '' + unset DEVELOPER_DIR SDKROOT + export DEVELOPER_DIR="$(/usr/bin/xcode-select --print-path)" + export SDKROOT="$(/usr/bin/xcrun --sdk macosx --show-sdk-path)" ''; + dontPatchShebangsInConfigure = true; + # N.B. Work around #20253. nativeBuildInputs = [ pkgs.gnused ]; - postInstallPhase = '' - settings="$out/lib/ghc-${version}/settings" - sed -i -e "s%\"llc\"%\"${llvm}/bin/llc\"%" $settings - sed -i -e "s%\"opt\"%\"${llvm}/bin/opt\"%" $settings - sed -i -e "s%\"clang\"%\"/usr/bin/clang\"%" $settings - sed -i -e 's%("C compiler command", "")%("C compiler command", "/usr/bin/clang")%' $settings - sed -i -e 's%("C compiler flags", "")%("C compiler flags", "--target=${targetTriple}")%' $settings - sed -i -e 's%("C++ compiler flags", "")%("C++ compiler flags", "--target=${targetTriple}")%' $settings - sed -i -e 's%("C compiler link flags", "")%("C compiler link flags", "--target=${targetTriple}")%' $settings - ''; + + dontBuild = true; + + enableParallelInstalling = true; + + dontFixup = true; # Sanity check: verify that we can compile hello world. doInstallCheck = true; installCheckPhase = '' - unset DYLD_LIBRARY_PATH $out/bin/ghc --info cd $TMP mkdir test-ghc; cd test-ghc @@ -91,13 +89,13 @@ let ourtexlive = with pkgs; texlive.combine { inherit (texlive) - scheme-medium collection-xetex fncychap titlesec tabulary varwidth + scheme-small collection-xetex fncychap tex-gyre titlesec tabulary varwidth framed capt-of wrapfig needspace dejavu-otf helvetic upquote; }; fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; }; - llvm = pkgs.llvm_15; - llvm_clang = pkgs.llvmPackages_15.clang-unwrapped; + llvm = pkgs.llvm_21; + llvm_clang = pkgs.llvmPackages_21.clang-unwrapped; in pkgs.writeTextFile { name = "toolchain"; ===================================== llvm-targets ===================================== @@ -44,8 +44,8 @@ ,("riscv64-unknown-linux", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+m +a +f +d +c +relax")) ,("loongarch64-unknown-linux-gnu", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+f +d")) ,("loongarch64-unknown-linux", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+f +d")) -,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "penryn", "")) -,("arm64-apple-darwin", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+v8.3a +fp-armv8 +neon +crc +crypto +fullfp16 +ras +lse +rdm +rcpc +zcm +zcz +sha2 +aes")) +,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "core2", "")) +,("arm64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32", "apple-m1", "+v8.4a +aes +altnzcv +ccdp +ccpp +complxnum +crc +dotprod +flagm +fp-armv8 +fp16fml +fptoint +fullfp16 +jsconv +lse +neon +pauth +perfmon +predres +ras +rcpc +rdm +sb +sha2 +sha3 +specrestrict +ssbs")) ,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "apple-a7", "+fp-armv8 +neon +crypto +zcm +zcz +sha2 +aes")) ,("x86_64-apple-ios", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "core2", "")) ,("amd64-portbld-freebsd", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "")) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/03155fb0e37175a4a0f02e5a6536517b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/03155fb0e37175a4a0f02e5a6536517b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Cheng Shao (@TerrorJack)