From 1f167aa460ef03acfe552fcad0410a512ec5fb79 Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Mon, 27 Oct 2025 20:40:58 +0300 Subject: [PATCH 1/3] ghc: provide JavaScript CPP command for ghcjs build --- pkgs/development/compilers/ghc/common-hadrian.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 9de5636d43a3..1097692029db 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -859,6 +859,12 @@ stdenv.mkDerivation ( ghc-settings-edit "$settingsFile" \ "windres command" "${toolPath "windres" installCC}" '' + + lib.optionalString stdenv.targetPlatform.isGhcjs '' + ghc-settings-edit "$settingsFile" \ + "JavaScript CPP command" "${toolPath "cc" installCC}" + ghc-settings-edit "$settingsFile" \ + "JavaScript CPP flags" "-E" + '' + '' # Install the bash completion file. From c316b3deabce78783df6e382d1fef08ba739b4c4 Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Thu, 30 Oct 2025 14:18:34 +0300 Subject: [PATCH 2/3] Restrict to ghc < 9.12 --- pkgs/development/compilers/ghc/common-hadrian.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 1097692029db..4bd05012e7f9 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -859,7 +859,7 @@ stdenv.mkDerivation ( ghc-settings-edit "$settingsFile" \ "windres command" "${toolPath "windres" installCC}" '' - + lib.optionalString stdenv.targetPlatform.isGhcjs '' + + lib.optionalString (stdenv.targetPlatform.isGhcjs && lib.versionOlder version "9.12") '' ghc-settings-edit "$settingsFile" \ "JavaScript CPP command" "${toolPath "cc" installCC}" ghc-settings-edit "$settingsFile" \ From 44f1db823f47d3e408e284458c4252a1e0dffdf7 Mon Sep 17 00:00:00 2001 From: Slava Gorbunov Date: Fri, 31 Oct 2025 15:40:36 +0300 Subject: [PATCH 3/3] Use the same CPP flags as ghc-9.12 --- pkgs/development/compilers/ghc/common-hadrian.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 4bd05012e7f9..62691f861584 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -863,7 +863,7 @@ stdenv.mkDerivation ( ghc-settings-edit "$settingsFile" \ "JavaScript CPP command" "${toolPath "cc" installCC}" ghc-settings-edit "$settingsFile" \ - "JavaScript CPP flags" "-E" + "JavaScript CPP flags" "-E -CC -Wno-unicode -nostdinc" '' + ''