From 0319a561eca36eb99379fc000fad82f8ee71f74f Mon Sep 17 00:00:00 2001 From: Yureka Date: Sat, 24 Dec 2022 13:41:58 +0100 Subject: [PATCH] pkgsMusl.gccgo: fix build --- pkgs/development/compilers/gcc/12/default.nix | 40 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index 78c7a12027ce..3c9362fee1ad 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -16,6 +16,7 @@ , gmp, mpfr, libmpc, gettext, which, patchelf , isl ? null # optional, for the Graphite optimization framework. , zlib ? null +, libucontext ? null , gnatboot ? null , enableMultilib ? false , enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins @@ -70,6 +71,44 @@ let majorVersion = "12"; }) ++ optional langD ../libphobos.patch + # backport fixes to build gccgo with musl libc + ++ optionals (langGo && stdenv.hostPlatform.isMusl) [ + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff"; + hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I="; + }) + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff"; + hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo="; + }) + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff"; + hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk="; + }) + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff"; + hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo="; + }) + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff"; + hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ="; + }) + (fetchpatch { + excludes = [ "gcc/go/gofrontend/MERGE" ]; + url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff"; + hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE="; + }) + (fetchpatch { + url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff"; + hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI="; + }) + ] + # Obtain latest patch with ../update-mcfgthread-patches.sh ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch; @@ -178,6 +217,7 @@ stdenv.mkDerivation ({ targetPackages.stdenv.cc.bintools # For linking code at run-time ] ++ (optional (isl != null) isl) ++ (optional (zlib != null) zlib) + ++ (optional (langGo && stdenv.hostPlatform.isMusl) libucontext) ; depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b6c65ccccdf5..720530d117fc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14491,7 +14491,7 @@ with pkgs; gnu-smalltalk = callPackage ../development/compilers/gnu-smalltalk { }; - gccgo = wrapCC (gcc.cc.override { + gccgo = wrapCC ((if stdenv.hostPlatform.isMusl then gcc_latest else gcc).cc.override { name = "gccgo"; langCC = true; #required for go. langC = true;