From cdbda2a8c2954a66f2ca000af48cc52d40ab68fa Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 29 Apr 2022 08:28:08 +0100 Subject: [PATCH 01/62] valgrind: 3.18.1 -> 3.19.0 Added trivial update script. Dropped upstreamed rawmemchr patch. changelog: https://valgrind.org/docs/manual/dist.news.html --- .../tools/analysis/valgrind/default.nix | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/pkgs/development/tools/analysis/valgrind/default.nix b/pkgs/development/tools/analysis/valgrind/default.nix index 6e736df235f..fa29eae2db6 100644 --- a/pkgs/development/tools/analysis/valgrind/default.nix +++ b/pkgs/development/tools/analysis/valgrind/default.nix @@ -1,26 +1,18 @@ { lib, stdenv, fetchurl, fetchpatch , autoreconfHook, perl , gdb, cctools, xnu, bootstrap_cmds +, writeScript }: stdenv.mkDerivation rec { pname = "valgrind"; - version = "3.18.1"; + version = "3.19.0"; src = fetchurl { url = "https://sourceware.org/pub/${pname}/${pname}-${version}.tar.bz2"; - sha256 = "sha256-AIWaoTp3Lt33giIl9LRu4NOa++Bx0yd42k2ZmECB9/U="; + sha256 = "sha256-3V40SG8aSD/3vnMAzBa01rJGkJh4d8MnjXl1NNZzjwI="; }; - patches = [ - # Fix tests on Musl. - # https://bugs.kde.org/show_bug.cgi?id=445300 - (fetchpatch { - url = "https://bugsfiles.kde.org/attachment.cgi?id=143535"; - sha256 = "036zyk30rixjvpylw3c7n171n4gpn6zcp7h6ya2dz4h5r478l9i6"; - }) - ]; - outputs = [ "out" "dev" "man" "doc" ]; hardeningDisable = [ "pie" "stackprotector" ]; @@ -59,9 +51,6 @@ stdenv.mkDerivation rec { --replace /usr/bin/ld ${cctools}/bin/ld ''); - # To prevent rebuild on linux when moving darwin's postPatch fixes to preConfigure - postPatch = ""; - configureFlags = lib.optional (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin") "--enable-only64bit" ++ lib.optional stdenv.hostPlatform.isDarwin "--with-xcodedir=${xnu}/include"; @@ -77,6 +66,21 @@ stdenv.mkDerivation rec { done ''; + passthru = { + updateScript = writeScript "update-valgrind" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl pcre common-updater-scripts + + set -eu -o pipefail + + # Expect the text in format of: + # 'Current release: valgrind-3.19.0' + new_version="$(curl -s https://valgrind.org/ | + pcregrep -o1 'Current release: .*>valgrind-([0-9.]+)')" + update-source-version ${pname} "$new_version" + ''; + }; + meta = { homepage = "http://www.valgrind.org/"; description = "Debugging and profiling tool suite"; From 89a0dd24143b3f604451ad2f31c27faf3e274b88 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 29 Apr 2022 21:54:03 -0500 Subject: [PATCH 02/62] wrapCCWith: structured argument for wrapper flags Take a "nixSupport" argument that is an attrset of lists to append to "$out/nix-support/${name}" where name is the name of the attribute. This attrset is available from the passthru of the wrapped compiler. This is an alternative to imperatively issuing flags with extraBuildCommands and makes it possible to append or filter flags with an override. --- pkgs/build-support/cc-wrapper/default.nix | 9 ++++++++- pkgs/top-level/all-packages.nix | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 3738f628b18..ac6257220fd 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -14,6 +14,7 @@ , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , propagateDoc ? cc != null && cc ? man , extraTools ? [], extraPackages ? [], extraBuildCommands ? "" +, nixSupport ? {} , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} , libcxx ? null @@ -155,6 +156,8 @@ stdenv.mkDerivation { (setenv "NIX_CFLAGS_COMPILE_${suffixSalt}" (concat (getenv "NIX_CFLAGS_COMPILE_${suffixSalt}") " -isystem " arg "/include")))) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) ''; + + inherit nixSupport; }; dontBuild = true; @@ -521,7 +524,11 @@ stdenv.mkDerivation { ## ## Extra custom steps ## - + extraBuildCommands; + + extraBuildCommands + + lib.strings.concatStringsSep "; " + (lib.attrsets.mapAttrsToList + (name: value: "echo ${toString value} >> $out/nix-support/${name}") + nixSupport); inherit expand-response-params; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e665d0bdc23..cc3872f7bf8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13932,6 +13932,7 @@ with pkgs; # default. libcxx ? null , extraPackages ? lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW) threadsCross + , nixSupport ? {} , ... } @ extraArgs: callPackage ../build-support/cc-wrapper (let self = { @@ -13943,7 +13944,7 @@ with pkgs; isGNU = cc.isGNU or false; isClang = cc.isClang or false; - inherit cc bintools libc libcxx extraPackages zlib; + inherit cc bintools libc libcxx extraPackages nixSupport zlib; } // extraArgs; in self); wrapCC = cc: wrapCCWith { From ff802de61e44ab70363d245c251ec2b427def6b5 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 30 Apr 2022 21:17:08 -0500 Subject: [PATCH 03/62] llvm-14: use nixSupport arguments with wrapCCWith --- .../development/compilers/llvm/14/default.nix | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 4e5e85684a2..b18b558d5b8 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -158,16 +158,17 @@ let ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [ targetLlvmLibraries.libunwind ]; - extraBuildCommands = '' - echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags - echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' - echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' - echo "-lunwind" >> $out/nix-support/cc-ldflags - '' + lib.optionalString stdenv.targetPlatform.isWasm '' - echo "-fno-exceptions" >> $out/nix-support/cc-cflags - '' + mkExtraBuildCommands cc; + extraBuildCommands = mkExtraBuildCommands cc; + nixSupport.cc-cflags = + [ "-rtlib=compiler-rt" + "-Wno-unused-command-line-argument" + "-B${targetLlvmLibraries.compiler-rt}/lib" + ] + ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" + ++ lib.optional + (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) + "-lunwind" + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; }; clangNoLibcxx = wrapCCWith rec { @@ -177,11 +178,12 @@ let extraPackages = [ targetLlvmLibraries.compiler-rt ]; - extraBuildCommands = '' - echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags - echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags - echo "-nostdlib++" >> $out/nix-support/cc-cflags - '' + mkExtraBuildCommands cc; + extraBuildCommands = mkExtraBuildCommands cc; + nixSupport.cc-cflags = [ + "-rtlib=compiler-rt" + "-B${targetLlvmLibraries.compiler-rt}/lib" + "-nostdlib++" + ]; }; clangNoLibc = wrapCCWith rec { @@ -191,10 +193,11 @@ let extraPackages = [ targetLlvmLibraries.compiler-rt ]; - extraBuildCommands = '' - echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags - echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags - '' + mkExtraBuildCommands cc; + extraBuildCommands = mkExtraBuildCommands cc; + nixSupport.cc-cflags = [ + "-rtlib=compiler-rt" + "-B${targetLlvmLibraries.compiler-rt}/lib" + ]; }; clangNoCompilerRt = wrapCCWith rec { @@ -202,9 +205,8 @@ let libcxx = null; bintools = bintoolsNoLibc'; extraPackages = [ ]; - extraBuildCommands = '' - echo "-nostartfiles" >> $out/nix-support/cc-cflags - '' + mkExtraBuildCommands0 cc; + extraBuildCommands = mkExtraBuildCommands0 cc; + nixSupport.cc-cflags = [ "-nostartfiles" ]; }; clangNoCompilerRtWithLibc = wrapCCWith rec { From 96a8c0ac23c1aca2c6542c85b95ed29b444f4597 Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Tue, 3 May 2022 22:23:08 +0000 Subject: [PATCH 04/62] nixos/postgresql: use postgres 14 for 22.05 postgresql: alias to postgresql_14 --- nixos/doc/manual/from_md/release-notes/rl-2205.section.xml | 5 +++++ nixos/doc/manual/release-notes/rl-2205.section.md | 2 ++ nixos/modules/services/databases/postgresql.nix | 3 ++- pkgs/top-level/all-packages.nix | 6 +++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml index 1e3f269dafb..c6ac5928d1e 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml @@ -89,6 +89,11 @@ have been removed. + + + PostgreSQL now defaults to major version 14. + + The new diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md index dcfabf01ff3..b10c11bc4f4 100644 --- a/nixos/doc/manual/release-notes/rl-2205.section.md +++ b/nixos/doc/manual/release-notes/rl-2205.section.md @@ -30,6 +30,8 @@ In addition to numerous new and upgraded packages, this release has the followin - Pulseaudio has been upgraded to version 15.0 and now optionally [supports additional Bluetooth audio codecs](https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/15.0/#supportforldacandaptxbluetoothcodecsplussbcxqsbcwithhigher-qualityparameters) like aptX or LDAC, with codec switching support being available in `pavucontrol`. This feature is disabled by default but can be enabled by using `hardware.pulseaudio.package = pkgs.pulseaudioFull;`. Existing 3rd party modules that provided similar functionality, like `pulseaudio-modules-bt` or `pulseaudio-hsphfpd` are deprecated and have been removed. +- PostgreSQL now defaults to major version 14. + - The new [`postgresqlTestHook`](https://nixos.org/manual/nixpkgs/stable/#sec-postgresqlTestHook) runs a PostgreSQL server for the duration of package checks. - [`kops`](https://kops.sigs.k8s.io) defaults to 1.22.4, which will enable [Instance Metadata Service Version 2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) and require tokens on new clusters with Kubernetes 1.22. This will increase security by default, but may break some types of workloads. See the [release notes](https://kops.sigs.k8s.io/releases/1.22-notes/) for details. diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 2919022496a..550bd36efff 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -295,7 +295,8 @@ in # Note: when changing the default, make it conditional on # ‘system.stateVersion’ to maintain compatibility with existing # systems! - mkDefault (if versionAtLeast config.system.stateVersion "21.11" then pkgs.postgresql_13 + mkDefault (if versionAtLeast config.system.stateVersion "22.05" then pkgs.postgresql_14 + else if versionAtLeast config.system.stateVersion "21.11" then pkgs.postgresql_13 else if versionAtLeast config.system.stateVersion "20.03" then pkgs.postgresql_11 else if versionAtLeast config.system.stateVersion "17.09" then mkThrow "9_6" else mkThrow "9_5"); diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8a5abce5cfb..0c27fffe84e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22342,12 +22342,12 @@ with pkgs; postgresql_13 postgresql_14 ; - postgresql = postgresql_13.override { this = postgresql; }; + postgresql = postgresql_14.override { this = postgresql; }; postgresqlPackages = recurseIntoAttrs postgresql.pkgs; postgresql11Packages = recurseIntoAttrs postgresql_11.pkgs; postgresql12Packages = recurseIntoAttrs postgresql_12.pkgs; - postgresql13Packages = postgresqlPackages; - postgresql14Packages = recurseIntoAttrs postgresql_14.pkgs; + postgresql13Packages = recurseIntoAttrs postgresql_13.pkgs; + postgresql14Packages = postgresqlPackages; postgresql_jdbc = callPackage ../development/java-modules/postgresql_jdbc { }; From e6491be4e39a7dcd1337ba50cccc00a59c8f44aa Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 2 May 2022 09:45:04 +0100 Subject: [PATCH 05/62] gdb: 11.2 -> 12.1 Added trivial updater script. Refreshed nix-specific patch with path to debug symbols. Dropped upstreamed patches for gcc-12 support and musl support. Changes: https://www.sourceware.org/gdb/download/ANNOUNCEMENT --- .../tools/misc/gdb/debug-info-from-env.patch | 27 ++++++--------- pkgs/development/tools/misc/gdb/default.nix | 34 +++++++++++-------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/pkgs/development/tools/misc/gdb/debug-info-from-env.patch b/pkgs/development/tools/misc/gdb/debug-info-from-env.patch index de59bd2d17b..7a3d78da077 100644 --- a/pkgs/development/tools/misc/gdb/debug-info-from-env.patch +++ b/pkgs/development/tools/misc/gdb/debug-info-from-env.patch @@ -1,24 +1,17 @@ -diff -ur a/gdb/main.c b/gdb/main.c ---- a/gdb/main.c 2020-02-08 13:50:14.000000000 +0100 -+++ b/gdb/main.c 2020-02-24 10:02:07.731806739 +0100 -@@ -567,9 +567,17 @@ - gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX); - } +--- a/gdb/main.c ++++ b/gdb/main.c +@@ -708,8 +708,12 @@ captured_main_1 (struct captured_main_args *context) + if (gdb_sysroot.empty ()) + gdb_sysroot = TARGET_SYSROOT_PREFIX; - debug_file_directory -- = xstrdup (relocate_gdb_directory (DEBUGDIR, -- DEBUGDIR_RELOCATABLE).c_str ()); -+ debug_file_directory = getenv ("NIX_DEBUG_INFO_DIRS"); -+ if (debug_file_directory != NULL) -+ // This might be updated later using -+ // $ set debug-file-directory /to/some/path -+ // which will use xfree. We must then have a xmallocated -+ // copy of the string that can be xfeed later. -+ debug_file_directory = xstrdup (debug_file_directory); +- = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE); ++ const char * nix_debug = getenv ("NIX_DEBUG_INFO_DIRS"); ++ if (nix_debug != NULL) ++ debug_file_directory = nix_debug; + else + debug_file_directory -+ = xstrdup (relocate_gdb_directory (DEBUGDIR, -+ DEBUGDIR_RELOCATABLE).c_str ()); ++ = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE); gdb_datadir = relocate_gdb_directory (GDB_DATADIR, GDB_DATADIR_RELOCATABLE); diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index f21808b1bf7..bc760f79be9 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, targetPackages # Build time -, fetchurl, fetchpatch, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages +, fetchurl, pkg-config, perl, texinfo, setupDebugInfoDirs, buildPackages # Run time , ncurses, readline, gmp, mpfr, expat, libipt, zlib, dejagnu, sourceHighlight @@ -15,6 +15,7 @@ # targetPackages so we get the right libc when cross-compiling and using buildPackages.gdb targetPackages.stdenv.cc.cc.lib ] +, writeScript }: let @@ -27,11 +28,11 @@ assert pythonSupport -> python3 != null; stdenv.mkDerivation rec { pname = targetPrefix + basename; - version = "11.2"; + version = "12.1"; src = fetchurl { url = "mirror://gnu/gdb/${basename}-${version}.tar.xz"; - hash = "sha256-FJfDanGIG4ZxqahKDuQPqreIyjDXuhnYRjw8x4cVLjI="; + hash = "sha256-DheTv48rVNU/Rt6oTM/URvSPgbKXsoxPf8AXuBjWn+0="; }; postPatch = if stdenv.isDarwin then '' @@ -43,20 +44,9 @@ stdenv.mkDerivation rec { patches = [ ./debug-info-from-env.patch - - # Pull upstream fix for gcc-12. Will be included in gdb-12. - (fetchpatch { - name = "gcc-12.patch"; - url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=e97436b1b789dcdb6ffb502263f4c86f8bc22996"; - sha256 = "1mpgw6s9qgnwhwyg3hagc6vhqhvia0l1s8nr22bcahwqxi3wvzcw"; - }) ] ++ lib.optionals stdenv.isDarwin [ ./darwin-target-match.patch - ] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch { - name = "musl-fix-pagesize-page_size.patch"; - url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426"; - hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI="; - }); + ]; nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ]; @@ -115,6 +105,20 @@ stdenv.mkDerivation rec { # TODO: Investigate & fix the test failures. doCheck = false; + passthru = { + updateScript = writeScript "update-gdb" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl pcre common-updater-scripts + + set -eu -o pipefail + + # Expect the text in format of '

GDB version 12.1

' + new_version="$(curl -s https://www.sourceware.org/gdb/ | + pcregrep -o1 '

GDB version ([0-9.]+)

')" + update-source-version ${pname} "$new_version" + ''; + }; + meta = with lib; { description = "The GNU Project debugger"; From cd1d65cfc1cf96049488ee2139b5e73563109c84 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 3 May 2022 07:37:41 -0500 Subject: [PATCH 06/62] gdb: fix w/musl, touchup postPatch expr Take advantage of the bump and drop the if/null construct for optionalString. --- pkgs/development/tools/misc/gdb/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index bc760f79be9..f2dd043b14a 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -35,12 +35,15 @@ stdenv.mkDerivation rec { hash = "sha256-DheTv48rVNU/Rt6oTM/URvSPgbKXsoxPf8AXuBjWn+0="; }; - postPatch = if stdenv.isDarwin then '' + postPatch = lib.optionalString stdenv.isDarwin '' substituteInPlace gdb/darwin-nat.c \ --replace '#include "bfd/mach-o.h"' '#include "mach-o.h"' - '' else if stdenv.hostPlatform.isMusl then '' + '' + lib.optionalString stdenv.hostPlatform.isMusl '' + substituteInPlace sim/erc32/erc32.c --replace sys/fcntl.h fcntl.h + substituteInPlace sim/erc32/interf.c --replace sys/fcntl.h fcntl.h + substituteInPlace sim/erc32/sis.c --replace sys/fcntl.h fcntl.h substituteInPlace sim/ppc/emul_unix.c --replace sys/termios.h termios.h - '' else null; + ''; patches = [ ./debug-info-from-env.patch From bf64063fc306010857fccbf84a584544351a4621 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Thu, 5 May 2022 08:31:55 +0200 Subject: [PATCH 07/62] libqrtr-glib: only enable gtk-doc when not cross-compiling Otherwise this error is shown when cross-compiling: configure: WARNING: You will not be able to create source packages with 'make dist' because gtk-doc >= 1.0 is not found. checking for gtkdoc-check... gtkdoc-check.test checking for gtkdoc-check... /nix/store/c54j3jcj3cijg9kf54lcr94lsc09xd4r-gtk-doc-1.33.2/bin/gtkdoc-check checking for gtkdoc-rebase... /nix/store/c54j3jcj3cijg9kf54lcr94lsc09xd4r-gtk-doc-1.33.2/bin/gtkdoc-rebase checking for gtkdoc-mkpdf... /nix/store/c54j3jcj3cijg9kf54lcr94lsc09xd4r-gtk-doc-1.33.2/bin/gtkdoc-mkpdf checking whether to build gtk-doc documentation... yes configure: error: You must have gtk-doc >= 1.0 installed to build documentation for libqrtr-glib. Please install gtk-doc or disable building the documentation by adding '--disable-gtk-doc' to './configure'. Also enable strictDeps to prevent future issues. --- pkgs/development/libraries/libqrtr-glib/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libqrtr-glib/default.nix b/pkgs/development/libraries/libqrtr-glib/default.nix index 29097710a69..aefc61f1ccf 100644 --- a/pkgs/development/libraries/libqrtr-glib/default.nix +++ b/pkgs/development/libraries/libqrtr-glib/default.nix @@ -20,6 +20,12 @@ stdenv.mkDerivation rec { sha256 = "MNh5sq3m+PRh3vOmd3VdtcAji6v2iNXIPAOz5qvjXO4="; }; + strictDeps = true; + + depsBuildBuild = [ + pkg-config + ]; + nativeBuildInputs = [ pkg-config gobject-introspection @@ -32,7 +38,7 @@ stdenv.mkDerivation rec { glib ]; - configureFlags = [ + configureFlags = lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ "--enable-gtk-doc" ]; From 4447d4071bc69e2e18aef96aa14fc0ec835fd5cd Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 2 May 2022 16:31:58 -0400 Subject: [PATCH 08/62] mingw-w64: 9.0.0 -> 10.0.0 --- .../os-specific/windows/mingw-w64/default.nix | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 38293e65f70..85527157eea 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,14 +1,31 @@ { lib, stdenv, windows, fetchurl }: let - version = "9.0.0"; + version = "10.0.0"; + + knownArches = [ "32" "64" "arm32" "arm64" ]; + enabledArch = + if stdenv.targetPlatform.isAarch32 + then "arm32" + else if stdenv.targetPlatform.isAarch64 + then "arm64" + else if stdenv.targetPlatform.isx86_32 + then "32" + else if stdenv.targetPlatform.isx86_64 + then "64" + else null; + archFlags = + if enabledArch == null + then [] # maybe autoconf will save us + else map (arch: lib.enableFeature (arch == enabledArch) "lib${arch}") knownArches; + in stdenv.mkDerivation { pname = "mingw-w64"; inherit version; src = fetchurl { url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2"; - sha256 = "10a15bi4lyfi0k0haj0klqambicwma6yi7vssgbz8prg815vja8r"; + sha256 = "sha256-umtDCu1yxjo3aFMfaj/8Kw/eLFejslFFDc9ImolPCJQ="; }; outputs = [ "out" "dev" ]; @@ -16,7 +33,7 @@ in stdenv.mkDerivation { configureFlags = [ "--enable-idl" "--enable-secure-api" - ]; + ] ++ archFlags; enableParallelBuilding = true; From 504d38ae7ba872dbf3b9972d33c94912e56807ed Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 2 May 2022 17:15:18 -0400 Subject: [PATCH 09/62] cross: Allow Windows toolchains to use ucrt as libc. --- pkgs/development/compilers/gcc/10/default.nix | 4 ++-- pkgs/development/compilers/gcc/11/default.nix | 4 ++-- pkgs/development/compilers/gcc/4.8/default.nix | 4 ++-- pkgs/development/compilers/gcc/4.9/default.nix | 4 ++-- pkgs/development/compilers/gcc/6/default.nix | 4 ++-- pkgs/development/compilers/gcc/7/default.nix | 4 ++-- pkgs/development/compilers/gcc/8/default.nix | 4 ++-- pkgs/development/compilers/gcc/9/default.nix | 4 ++-- .../compilers/gcc/common/configure-flags.nix | 2 +- pkgs/development/libraries/boost/generic.nix | 6 +++--- pkgs/development/libraries/libiconv/default.nix | 2 +- pkgs/development/libraries/libjpeg-turbo/default.nix | 2 +- pkgs/development/libraries/libxml2/default.nix | 2 +- pkgs/development/libraries/zlib/default.nix | 8 ++++---- pkgs/os-specific/windows/mingw-w64/default.nix | 3 +++ pkgs/os-specific/windows/mingw-w64/headers.nix | 10 +++++++++- pkgs/top-level/all-packages.nix | 4 ++-- 17 files changed, 41 insertions(+), 30 deletions(-) diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 88d4831812f..187d43b5091 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -79,7 +79,7 @@ let majorVersion = "10"; }); /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -292,7 +292,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index ba4b10cf73e..adb441888d8 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -82,7 +82,7 @@ let majorVersion = "11"; ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -296,7 +296,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 8cd0d3c9ce8..03646c65220 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -114,7 +114,7 @@ let majorVersion = "4"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -316,7 +316,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index b3d0f8d5d50..d3bd1b70641 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -130,7 +130,7 @@ let majorVersion = "4"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -332,7 +332,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 62b46df1ab0..d3007f17063 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -111,7 +111,7 @@ let majorVersion = "6"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -345,7 +345,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 1abf14c8a8c..1eb23061f64 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -87,7 +87,7 @@ let majorVersion = "7"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -301,7 +301,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 2dd265b648c..b6c37c77dd0 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -71,7 +71,7 @@ let majorVersion = "8"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -280,7 +280,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 2ecfa1bb1cf..09e4ef3fdff 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -98,7 +98,7 @@ let majorVersion = "9"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -311,7 +311,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index bebf91114d7..100d172403a 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -41,7 +41,7 @@ let inherit (stdenv) buildPlatform hostPlatform targetPlatform; - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 34ab5554e74..27b45a85299 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -9,7 +9,7 @@ , enableDebug ? false , enableSingleThreaded ? false , enableMultiThreaded ? true -, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now +, enableShared ? !(with stdenv.hostPlatform; isStatic || isMinGW) # problems for now , enableStatic ? !enableShared , enablePython ? false , enableNumpy ? false @@ -102,7 +102,7 @@ let ++ optional (toolset != null) "toolset=${toolset}" ++ optional (!enablePython) "--without-python" ++ optional needUserConfig "--user-config=user-config.jam" - ++ optionals (stdenv.hostPlatform.libc == "msvcrt") [ + ++ optionals (stdenv.hostPlatform.isMinGW) [ "threadapi=win32" ] ++ extraB2Args ); @@ -252,7 +252,7 @@ stdenv.mkDerivation { # Make boost header paths relative so that they are not runtime dependencies cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; - '' + optionalString (stdenv.hostPlatform.libc == "msvcrt") '' + '' + optionalString (stdenv.hostPlatform.isMinGW) '' $RANLIB "$out/lib/"*.a ''; diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix index 5be5ecfd82e..8051cf319e9 100644 --- a/pkgs/development/libraries/libiconv/default.nix +++ b/pkgs/development/libraries/libiconv/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { ]; postPatch = - lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc) + lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isMinGW) || stdenv.cc.nativeLibc) '' sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h '' diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix index 75ec20545ca..2e400f9a31c 100644 --- a/pkgs/development/libraries/libjpeg-turbo/default.nix +++ b/pkgs/development/libraries/libjpeg-turbo/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { # This is needed by freeimage patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ] - ++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt") + ++ lib.optional (stdenv.hostPlatform.isMinGW) ./mingw-boolean.patch; outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ]; diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 06c073c718a..494e9042101 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -14,7 +14,7 @@ , pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform , icuSupport ? false , icu -, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic +, enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic , enableStatic ? !enableShared , gnome }: diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 9b9938746ca..ed7ff17dc3d 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation (rec { '' # Non-typical naming confuses libtool which then refuses to use zlib's DLL # in some cases, e.g. when compiling libpng. - + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && shared) '' + + lib.optionalString (stdenv.hostPlatform.isMinGW && shared) '' ln -s zlib1.dll $out/bin/libz.dll ''; @@ -101,7 +101,7 @@ stdenv.mkDerivation (rec { dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static; configurePlatforms = []; - installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ + installFlags = lib.optionals (stdenv.hostPlatform.isMinGW) [ "BINARY_PATH=$(out)/bin" "INCLUDE_PATH=$(dev)/include" "LIBRARY_PATH=$(out)/lib" @@ -112,7 +112,7 @@ stdenv.mkDerivation (rec { makeFlags = [ "PREFIX=${stdenv.cc.targetPrefix}" - ] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ + ] ++ lib.optionals (stdenv.hostPlatform.isMinGW) [ "-f" "win32/Makefile.gcc" ] ++ lib.optionals shared [ # Note that as of writing (zlib 1.2.11), this flag only has an effect @@ -134,6 +134,6 @@ stdenv.mkDerivation (rec { preConfigure = '' export CHOST=${stdenv.hostPlatform.config} ''; -} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") { +} // lib.optionalAttrs (stdenv.hostPlatform.isMinGW) { dontConfigure = true; }) diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 85527157eea..02cfd7b04a7 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -19,6 +19,7 @@ let then [] # maybe autoconf will save us else map (arch: lib.enableFeature (arch == enabledArch) "lib${arch}") knownArches; + crt = stdenv.hostPlatform.libc; in stdenv.mkDerivation { pname = "mingw-w64"; inherit version; @@ -33,6 +34,7 @@ in stdenv.mkDerivation { configureFlags = [ "--enable-idl" "--enable-secure-api" + "--with-default-msvcrt=${crt}" ] ++ archFlags; enableParallelBuilding = true; @@ -43,5 +45,6 @@ in stdenv.mkDerivation { meta = { platforms = lib.platforms.windows; + broken = !(lib.elem crt [ "msvcrt" "ucrt" ]); }; } diff --git a/pkgs/os-specific/windows/mingw-w64/headers.nix b/pkgs/os-specific/windows/mingw-w64/headers.nix index 1fd27a8c457..13ba330ef2a 100644 --- a/pkgs/os-specific/windows/mingw-w64/headers.nix +++ b/pkgs/os-specific/windows/mingw-w64/headers.nix @@ -1,6 +1,8 @@ { stdenvNoCC, mingw_w64 }: -stdenvNoCC.mkDerivation { +let + crt = stdenvNoCC.hostPlatform.libc; +in stdenvNoCC.mkDerivation { name = "${mingw_w64.name}-headers"; inherit (mingw_w64) src meta; @@ -8,4 +10,10 @@ stdenvNoCC.mkDerivation { cd mingw-w64-headers ''; + configureFlags = [ + "--enable-idl" + "--enable-secure-api" + "--with-default-msvcrt=${crt}" + ]; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6d259511e79..80ee2dc3ea0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17415,7 +17415,7 @@ with pkgs; # These are used when buiding compiler-rt / libgcc, prior to building libc. preLibcCrossHeaders = let inherit (stdenv.targetPlatform) libc; - in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers + in if libc == "msvcrt" || libc == "ucrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross else null; @@ -17434,7 +17434,7 @@ with pkgs; else if name == "newlib" then targetPackages.newlibCross or newlibCross else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross else if name == "musl" then targetPackages.muslCross or muslCross - else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 + else if name == "msvcrt" || name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if name == "libSystem" then if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries From 4b503b2a58fd7776a497b1c0109f5de1eb76fdb4 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 06:15:15 -0400 Subject: [PATCH 10/62] cc-wrapper: clang doesn't support -fPIC on Windows --- pkgs/build-support/cc-wrapper/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 3738f628b18..76f218de4d2 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -476,6 +476,8 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" pic" '' + optionalString targetPlatform.isMinGW '' hardening_unsupported_flags+=" stackprotector fortify" + '' + optionalString (targetPlatform.isWindows && isClang) '' + hardening_unsupported_flags+=" pic" '' + optionalString targetPlatform.isAvr '' hardening_unsupported_flags+=" stackprotector pic" '' + optionalString (targetPlatform.libc == "newlib") '' From a73b59a157f149369283eda571b61f7990e6afa3 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 08:57:03 -0400 Subject: [PATCH 11/62] llvm-bintools: Include aliases for windres and dlltool on Windows --- pkgs/development/compilers/llvm/13/bintools/default.nix | 9 ++++++--- pkgs/development/compilers/llvm/14/bintools/default.nix | 9 ++++++--- pkgs/development/compilers/llvm/git/bintools/default.nix | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index 53f7941e336..e01e152d159 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -1,11 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ runCommand, stdenv, llvm, lld, version, lib }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -26,4 +26,7 @@ in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' +'' + lib.optionalString stdenv.targetPlatform.isWindows '' + ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres + ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool +'') diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index 53f7941e336..e01e152d159 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -1,11 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ runCommand, stdenv, llvm, lld, version, lib }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -26,4 +26,7 @@ in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' +'' + lib.optionalString stdenv.targetPlatform.isWindows '' + ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres + ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool +'') diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index 53f7941e336..e01e152d159 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -1,11 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version }: +{ runCommand, stdenv, llvm, lld, version, lib }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -26,4 +26,7 @@ in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' +'' + lib.optionalString stdenv.targetPlatform.isWindows '' + ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres + ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool +'') From b00016d9d92187f9fb39d4890e44be3f1f2a21f0 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 7 May 2022 06:13:58 -0400 Subject: [PATCH 12/62] bintools-wrapper: Remove LDEMULATION setting. As far as I can tell, this has never actually done anything, as LDEMULATION is not exported. I tried exporting it and builds broke, and as it doesn't seem to have caused any problems as a noop all these years it didn't seem worth investigating further. --- .../bintools-wrapper/default.nix | 33 ------------------- .../bintools-wrapper/ld-wrapper.sh | 5 --- 2 files changed, 38 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index c2d67169c9c..4c2a13da015 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -184,39 +184,6 @@ stdenv.mkDerivation { done ''; - emulation = let - fmt = - /**/ if targetPlatform.isDarwin then "mach-o" - else if targetPlatform.isWindows then "pe" - else "elf" + toString targetPlatform.parsed.cpu.bits; - endianPrefix = if targetPlatform.isBigEndian then "big" else "little"; - sep = optionalString (!targetPlatform.isMips && !targetPlatform.isPower && !targetPlatform.isRiscV) "-"; - arch = - /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64" - else if targetPlatform.isAarch32 then endianPrefix + "arm" - else if targetPlatform.isx86_64 then "x86-64" - else if targetPlatform.isx86_32 then "i386" - else if targetPlatform.isMips then { - mips = "btsmipn32"; # n32 variant - mipsel = "ltsmipn32"; # n32 variant - mips64 = "btsmip"; - mips64el = "ltsmip"; - }.${targetPlatform.parsed.cpu.name} - else if targetPlatform.isMmix then "mmix" - else if targetPlatform.isPower then if targetPlatform.isBigEndian then "ppc" else "lppc" - else if targetPlatform.isSparc then "sparc" - else if targetPlatform.isMsp430 then "msp430" - else if targetPlatform.isAvr then "avr" - else if targetPlatform.isAlpha then "alpha" - else if targetPlatform.isVc4 then "vc4" - else if targetPlatform.isOr1k then "or1k" - else if targetPlatform.isM68k then "m68k" - else if targetPlatform.isS390 then "s390" - else if targetPlatform.isRiscV then "lriscv" - else throw "unknown emulation for platform: ${targetPlatform.config}"; - in if targetPlatform.useLLVM or false then "" - else targetPlatform.bfdEmulation or (fmt + sep + arch); - strictDeps = true; depsTargetTargetPropagated = extraPackages; diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index fb01c5096d5..f8bddabbc68 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -93,11 +93,6 @@ if [ -e @out@/nix-support/add-local-ldflags-before.sh ]; then fi -# Specify the target emulation if nothing is passed in ("-m" overrides this -# environment variable). Ensures we never blindly fallback on targeting the host -# platform. -: ${LDEMULATION:=@emulation@} - # Three tasks: # # 1. Find all -L... switches for rpath From dee9af932383801ccd5bbb5f48109a556c1b632c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 9 May 2022 09:57:59 -0400 Subject: [PATCH 13/62] bintools: Add isXXX flags to check linker type --- pkgs/build-support/bintools-wrapper/default.nix | 9 +++++++++ pkgs/development/compilers/llvm/10/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/11/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/12/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/13/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/14/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/7/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/8/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/9/bintools/default.nix | 2 +- pkgs/development/compilers/llvm/git/bintools/default.nix | 2 +- pkgs/development/tools/misc/binutils/default.nix | 5 +++++ pkgs/os-specific/darwin/binutils/default.nix | 1 + 12 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index c2d67169c9c..2a1a8699485 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -31,6 +31,13 @@ # Darwin code signing support utilities , postLinkSignHook ? null, signingUtils ? null + +# Linker type +, isLld ? bintools.isLld or false +, isCctools ? bintools.isCctools or false +, isGNU ? bintools.isGNU or false +, isGold ? bintools.isGold or false +, isBfd ? bintools.isBfd or false }: with lib; @@ -113,6 +120,8 @@ stdenv.mkDerivation { passthru = { inherit bintools libc nativeTools nativeLibc nativePrefix; + inherit isLld isCctools isGNU isGold isBfd; + emacsBufferSetup = pkgs: '' ; We should handle propagation here too (mapc diff --git a/pkgs/development/compilers/llvm/10/bintools/default.nix b/pkgs/development/compilers/llvm/10/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/10/bintools/default.nix +++ b/pkgs/development/compilers/llvm/10/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/11/bintools/default.nix b/pkgs/development/compilers/llvm/11/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/11/bintools/default.nix +++ b/pkgs/development/compilers/llvm/11/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/12/bintools/default.nix b/pkgs/development/compilers/llvm/12/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/12/bintools/default.nix +++ b/pkgs/development/compilers/llvm/12/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index e01e152d159..4c16957aeb4 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index e01e152d159..4c16957aeb4 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/7/bintools/default.nix b/pkgs/development/compilers/llvm/7/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/7/bintools/default.nix +++ b/pkgs/development/compilers/llvm/7/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/8/bintools/default.nix b/pkgs/development/compilers/llvm/8/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/8/bintools/default.nix +++ b/pkgs/development/compilers/llvm/8/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/9/bintools/default.nix b/pkgs/development/compilers/llvm/9/bintools/default.nix index 53f7941e336..5735bf5a685 100644 --- a/pkgs/development/compilers/llvm/9/bintools/default.nix +++ b/pkgs/development/compilers/llvm/9/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index e01e152d159..4c16957aeb4 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index da2b4864552..4fdda9d67d9 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -197,6 +197,11 @@ stdenv.mkDerivation { inherit targetPrefix; hasGold = enableGold; isGNU = true; + # TODO Currently platform.linker == "gold" has no effect outside + # of building GHC. If/when that's fixed, these flags should + # probably move to the invocations of bintools-wrapper + isGold = false; + isBfd = true; }; meta = with lib; { diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index c5bc50cafd7..a25306dcf35 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -65,6 +65,7 @@ stdenv.mkDerivation { passthru = { inherit targetPrefix; + isCctools = true; }; meta = { From 4c0d5f80fcdef2024f73c584f7450a6f37ced8cd Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 09:36:46 -0400 Subject: [PATCH 14/62] bintools-wrapper: Don't pass -z to lld targeting Windows --- pkgs/build-support/bintools-wrapper/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 2a1a8699485..16a9a0c7b22 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -335,6 +335,11 @@ stdenv.mkDerivation { echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags '' + # lld's MinGW driver (e.g. `ld.lld -m i386pep`) does not support the `-z` flag. + + optionalString (targetPlatform.isWindows && isLld) '' + hardening_unsupported_flags+=" relro bindnow" + '' + ## ## GNU specific extra strip flags ## From 078a07708a6add846447272f0797fbde778a0522 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 10:51:22 -0400 Subject: [PATCH 15/62] libunwind: Fix build against compiler-rt-using clang --- pkgs/build-support/cc-wrapper/default.nix | 3 ++- pkgs/development/compilers/llvm/13/default.nix | 3 +++ pkgs/development/compilers/llvm/13/libunwind/default.nix | 4 +++- pkgs/development/compilers/llvm/14/default.nix | 3 +++ pkgs/development/compilers/llvm/14/libunwind/default.nix | 4 +++- pkgs/development/compilers/llvm/git/default.nix | 3 +++ pkgs/development/compilers/llvm/git/libunwind/default.nix | 4 +++- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 76f218de4d2..202a5cc577b 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -17,6 +17,7 @@ , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} , libcxx ? null +, isCompilerRT ? false }: with lib; @@ -145,7 +146,7 @@ stdenv.mkDerivation { # Binutils, and Apple's "cctools"; "bintools" as an attempt to find an # unused middle-ground name that evokes both. inherit bintools; - inherit libc nativeTools nativeLibc nativePrefix isGNU isClang; + inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT; emacsBufferSetup = pkgs: '' ; We should handle propagation here too diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 874be111ade..b72d4244285 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -168,6 +168,7 @@ let '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -182,6 +183,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags echo "-nostdlib++" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -195,6 +197,7 @@ let echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/13/libunwind/default.nix b/pkgs/development/compilers/llvm/13/libunwind/default.nix index b6017e74172..c6cc148239e 100644 --- a/pkgs/development/compilers/llvm/13/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/13/libunwind/default.nix @@ -17,7 +17,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; + cmakeFlags = + lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" + ++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 4e5e85684a2..4de667d894e 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -168,6 +168,7 @@ let '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -182,6 +183,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags echo "-nostdlib++" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -195,6 +197,7 @@ let echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix index 109b92f1e02..7940fa4b3a1 100644 --- a/pkgs/development/compilers/llvm/14/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/14/libunwind/default.nix @@ -31,7 +31,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; + cmakeFlags = + lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" + ++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 0f45acffb27..6b96190c042 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -168,6 +168,7 @@ let '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -182,6 +183,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags echo "-nostdlib++" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -195,6 +197,7 @@ let echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; + isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/git/libunwind/default.nix b/pkgs/development/compilers/llvm/git/libunwind/default.nix index c6d9eda5e47..30874588d8d 100644 --- a/pkgs/development/compilers/llvm/git/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/git/libunwind/default.nix @@ -31,7 +31,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; + cmakeFlags = + lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" + ++ lib.optional stdenv.cc.isCompilerRT "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst From 5ca96b948c7acc307b9b0d7d6ff5f60c77763d8e Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 10:55:48 -0400 Subject: [PATCH 16/62] libcxxabi: Fix build against compiler-rt-using clang --- pkgs/development/compilers/llvm/13/libcxxabi/default.nix | 3 ++- pkgs/development/compilers/llvm/14/libcxxabi/default.nix | 3 ++- pkgs/development/compilers/llvm/git/libcxxabi/default.nix | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 0bdbee07b73..93a3b2a1ec8 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -37,7 +37,8 @@ stdenv.mkDerivation rec { "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ]; + ] ++ lib.optional stdenv.cc.isCompilerRT + "-DLIBCXXABI_USE_COMPILER_RT=ON"; installPhase = if stdenv.isDarwin then '' diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index 07aaa2737ce..25f90230b7b 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix @@ -47,7 +47,8 @@ stdenv.mkDerivation rec { "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ]; + ] ++ lib.optional stdenv.cc.isCompilerRT + "-DLIBCXXABI_USE_COMPILER_RT=ON"; installPhase = if stdenv.isDarwin then '' diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index d64708ab040..0fecc396250 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -47,7 +47,9 @@ stdenv.mkDerivation rec { "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ]; + ] ++ lib.optional stdenv.cc.isCompilerRT + "-DLIBCXXABI_USE_COMPILER_RT=ON"; + installPhase = if stdenv.isDarwin then '' From b7b9b73760c421ccf7323ab6827dec3c31bef344 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 13:02:37 -0400 Subject: [PATCH 17/62] libcxx/libcxxabi: Fix build on Windows with lld --- .../compilers/llvm/13/libcxx/default.nix | 12 ++++++-- .../compilers/llvm/13/libcxxabi/default.nix | 20 +++++++++---- .../compilers/llvm/14/libcxx/default.nix | 12 ++++++-- .../compilers/llvm/14/libcxxabi/default.nix | 26 +++++++++++++---- .../compilers/llvm/git/libcxx/default.nix | 13 +++++++-- .../compilers/llvm/git/libcxxabi/default.nix | 28 +++++++++++++++---- 6 files changed, 85 insertions(+), 26 deletions(-) diff --git a/pkgs/development/compilers/llvm/13/libcxx/default.nix b/pkgs/development/compilers/llvm/13/libcxx/default.nix index 0ce73ed97af..c5b8293676a 100644 --- a/pkgs/development/compilers/llvm/13/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxx/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version -, libcxxabi +, libcxxabi, libunwind , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; + buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -41,7 +41,13 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; + ] + ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" + ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" + "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" + ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 93a3b2a1ec8..66ec96e3518 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -2,9 +2,14 @@ , enableShared ? !stdenv.hostPlatform.isStatic , standalone ? stdenv.hostPlatform.useLLVM or false , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm -}: +}: let + # lld doesn't support unresolved references on Windows https://github.com/llvm/llvm-project/issues/55245 + semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; -stdenv.mkDerivation rec { + enableShared' = enableShared && !semi-static; + + useLLVMUnwinder = standalone && withLibunwind; +in stdenv.mkDerivation rec { pname = "libcxxabi"; inherit version; @@ -26,17 +31,22 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ]; buildInputs = lib.optional withLibunwind libunwind; + passthru = { inherit semi-static useLLVMUnwinder; }; + cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" ] ++ lib.optionals standalone [ "-DLLVM_ENABLE_LIBCXX=ON" - ] ++ lib.optionals (standalone && withLibunwind) [ + ] ++ lib.optionals useLLVMUnwinder [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared) [ + ] ++ lib.optionals (!enableShared') [ "-DLIBCXXABI_ENABLE_SHARED=OFF" + ] ++ lib.optionals semi-static [ + "-DLIBCXX_ENABLE_SHARED=ON" + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" ] ++ lib.optional stdenv.cc.isCompilerRT "-DLIBCXXABI_USE_COMPILER_RT=ON"; @@ -57,7 +67,7 @@ stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared '' + '' + lib.optionalString enableShared' '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix index 8891a69937a..8bdc7aa7967 100644 --- a/pkgs/development/compilers/llvm/14/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand , cmake, python3, fixDarwinDylibNames, version -, libcxxabi +, libcxxabi, libunwind , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; + buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -57,7 +57,13 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; + ] + ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" + ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" + "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" + ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index 25f90230b7b..c31c4c90ad2 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix @@ -2,9 +2,17 @@ , monorepoSrc, runCommand , cxx-headers, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic -}: +}: let + withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm; -stdenv.mkDerivation rec { + semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; + + enableShared' = enableShared && !semi-static; + + standalone = stdenv.hostPlatform.useLLVM or false; + + useLLVMUnwinder = standalone && withLibunwind; +in stdenv.mkDerivation rec { pname = "libcxxabi"; inherit version; @@ -35,18 +43,24 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional withLibunwind libunwind; + + passthru = { inherit semi-static useLLVMUnwinder; }; cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" - ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + ] ++ lib.optionals standalone [ "-DLLVM_ENABLE_LIBCXX=ON" + ] ++ lib.optionals useLLVMUnwinder [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared) [ + ] ++ lib.optionals (!enableShared') [ "-DLIBCXXABI_ENABLE_SHARED=OFF" + ] ++ lib.optionals semi-static [ + "-DLIBCXX_ENABLE_SHARED=ON" + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" ] ++ lib.optional stdenv.cc.isCompilerRT "-DLIBCXXABI_USE_COMPILER_RT=ON"; @@ -67,7 +81,7 @@ stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared '' + '' + lib.optionalString enableShared' '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 diff --git a/pkgs/development/compilers/llvm/git/libcxx/default.nix b/pkgs/development/compilers/llvm/git/libcxx/default.nix index 8891a69937a..774bd8a9a9b 100644 --- a/pkgs/development/compilers/llvm/git/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxx/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand , cmake, python3, fixDarwinDylibNames, version -, libcxxabi +, libcxxabi, libunwind , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; + buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -57,7 +57,14 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; + ] + ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" + ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" + "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" + ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; + buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index 0fecc396250..26388e42f22 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -2,7 +2,17 @@ , monorepoSrc, runCommand , cxx-headers, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic -}: +}: let + withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm; + + semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; + + enableShared' = enableShared && !semi-static; + + standalone = stdenv.hostPlatform.useLLVM or false; + + useLLVMUnwinder = standalone && withLibunwind; +in stdenv.mkDerivation rec { pname = "libcxxabi"; @@ -35,22 +45,28 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional withLibunwind libunwind; + + passthru = { inherit semi-static useLLVMUnwinder; }; + cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" - ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + ] ++ lib.optionals standalone [ "-DLLVM_ENABLE_LIBCXX=ON" + ] ++ lib.optionals useLLVMUnwinder [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared) [ + ] ++ lib.optionals (!enableShared') [ "-DLIBCXXABI_ENABLE_SHARED=OFF" + ] ++ lib.optionals semi-static [ + "-DLIBCXX_ENABLE_SHARED=ON" + "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" ] ++ lib.optional stdenv.cc.isCompilerRT "-DLIBCXXABI_USE_COMPILER_RT=ON"; - installPhase = if stdenv.isDarwin then '' for file in lib/*.dylib; do @@ -68,7 +84,7 @@ stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared '' + '' + lib.optionalString enableShared' '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 From 5c0654f26211aa9e8a0f6783de3e89c5ca1d2724 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 06:16:15 -0400 Subject: [PATCH 18/62] cross: Add mingwW64-llvm cross-system. --- lib/systems/examples.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 997a7a8c273..19dba63f4f5 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -301,6 +301,15 @@ rec { libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain }; + # 64 bit mingw-w64 with a llvm-based toolchain targetting ucrt + # + # Inspired by mstorsjo/llvm-mingw + mingwW64-llvm = { + config = "x86_64-w64-mingw32"; + libc = "ucrt"; + useLLVM = true; + }; + # BSDs amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd; From 15aa32e082124e37587b5fb250598a7019694500 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 3 May 2022 15:11:15 -0400 Subject: [PATCH 19/62] llvm-bintools: passthru targetPrefix. This is expected e.g. by the GHC cross-compilation code --- pkgs/development/compilers/llvm/13/bintools/default.nix | 8 +++++++- pkgs/development/compilers/llvm/14/bintools/default.nix | 8 +++++++- pkgs/development/compilers/llvm/git/bintools/default.nix | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index 4c16957aeb4..dcdad1af46f 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -5,7 +5,13 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' +in runCommand "llvm-binutils-${version}" { + preferLocalBuild = true; + passthru = { + isLld = true; + targetPrefix = prefix; + }; +} ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index 4c16957aeb4..dcdad1af46f 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -5,7 +5,13 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' +in runCommand "llvm-binutils-${version}" { + preferLocalBuild = true; + passthru = { + isLld = true; + targetPrefix = prefix; + }; +} ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index 4c16957aeb4..dcdad1af46f 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -5,7 +5,13 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ('' +in runCommand "llvm-binutils-${version}" { + preferLocalBuild = true; + passthru = { + isLld = true; + targetPrefix = prefix; + }; +} ('' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) From d68a532d1be6b5ef579e3b950d01d85b8bcdfd85 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 07:20:03 -0400 Subject: [PATCH 20/62] Set a default machine type when using lld targeting Windows. Fixes autotools checks parsing --help --- .../bintools-wrapper/add-lld-ldflags-before.sh | 6 ++++++ .../build-support/bintools-wrapper/default.nix | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh diff --git a/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh new file mode 100644 index 00000000000..265339eb185 --- /dev/null +++ b/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh @@ -0,0 +1,6 @@ +# ld.lld has two incompatible command-line drivers: One for the gnu-compatible COFF linker and one for +# the ELF linker. If no emulation is set (with -m), it will default to the ELF linker; +# unfortunately, some configure scripts use `ld --help` to check for certain Windows-specific flags, +# which don't show up in the help for the ELF linker. So we set a default -m here. + +extraBefore+=("-m" "@mtype@") diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 16a9a0c7b22..59de0ef90a3 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -384,6 +384,24 @@ stdenv.mkDerivation { '' ) + ## + ## Set the default machine type so that $prefix-ld.lld uses the COFF driver for --help + ## + ## Needed because autotools parses --help for linker features... + ## + + optionalString (isLld && stdenv.targetPlatform.isWindows) (let + mtype = + /**/ if targetPlatform.isx86_32 then "i386pe" + else if targetPlatform.isx86_64 then "i386pep" + else if targetPlatform.isAarch32 then "thumb2pe" + else if targetPlatform.isAarch64 then "arm64pe" + else throw "unsupported target arch for lld"; + in '' + export mtype=${mtype} + substituteAll ${./add-lld-ldflags-before.sh} add-local-ldflags-before.sh + cat add-local-ldflags-before.sh >> $out/nix-support/add-local-ldflags-before.sh + '') + ## ## Code signing on Apple Silicon ## From 98a853c37d90d4b0696deb6a5f3a47a877f48568 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 06:38:25 -0400 Subject: [PATCH 21/62] Add msys2 libtool patch for mingw + clang + compiler-rt libtool upstream seems quite slow to merge... --- ...ingw-Create-UAC-manifest-files.mingw.patch | 99 +++++++++++++++++++ .../libtool/0005-Fix-seems-to-be-moved.patch | 24 +++++ .../0006-Fix-strict-ansi-vs-posix.patch | 22 +++++ ...0007-fix-cr-for-awk-in-configure.all.patch | 22 +++++ ...0010-libtool-2.4.2-include-process-h.patch | 24 +++++ ...-static-archives-compiler-internal-l.patch | 33 +++++++ ...files-over-linker-scripts-for-mingw-.patch | 83 ++++++++++++++++ ...-linking-compiler-support-libraries-.patch | 38 +++++++ .../0014-Support-llvm-objdump-f-output.patch | 39 ++++++++ .../tools/misc/libtool/libtool2.nix | 14 +++ 10 files changed, 398 insertions(+) create mode 100644 pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch create mode 100644 pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch create mode 100644 pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch create mode 100644 pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch create mode 100644 pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch create mode 100644 pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch create mode 100644 pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch create mode 100644 pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch create mode 100644 pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch diff --git a/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch b/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch new file mode 100644 index 00000000000..310002b8231 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch @@ -0,0 +1,99 @@ +[PATCH 2/6] [cygwin|mingw] Create UAC manifest files. + +* build-aux/ltmain.in (func_emit_exe_manifest): New function. +(func_mode_link) [cygwin|mingw]: Create manifest files for wrapper +and target exe when target name matches heuristic that triggers +UAC problems for newer win32 OSs. Clean up $cwrapper.manifest on +error. Ensure manifest files have executable permission. +(func_mode_uninstall): Clean up manifest files. +Various reports by Eric Blake, Kai Tietz, and Cesar Strauss. +--- + build-auxltmain.in | 50 ++++++++++++++++++++++++++++++++++++++++++- + 1 files changed, 48 insertions(+), 2 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index 0418007..1821779 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -4277,6 +4277,41 @@ EOF + } + # end: func_emit_cwrapperexe_src + ++# func_emit_exe_manifest ++# emit a Win32 UAC manifest for executable on stdout ++# Must ONLY be called from within func_mode_link because ++# it depends on a number of variable set therein. ++func_emit_exe_manifest () ++{ ++ cat < ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++EOF ++} ++ + # func_win32_import_lib_p ARG + # True if ARG is an import lib, as indicated by $file_magic_cmd + func_win32_import_lib_p () +@@ -8237,7 +8272,7 @@ EOF + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper +- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 ++ trap "$RM $cwrappersource $cwrapper $cwrapper.manifest; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + +@@ -8257,6 +8292,16 @@ EOF + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then ++ # Create the UAC manifests first if necessary (but the ++ # manifest files must have executable permission regardless). ++ case $output_name in ++ *instal*|*patch*|*setup*|*update*) ++ func_emit_exe_manifest > $cwrapper.manifest ++ func_emit_exe_manifest > $output_path/$objdir/$output_name.exe.manifest ++ chmod +x $cwrapper.manifest ++ chmod +x $output_path/$objdir/$output_name.exe.manifest ++ ;; ++ esac + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result +@@ -8777,8 +8822,9 @@ func_mode_uninstall () + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" ++ func_append rmfiles " ${name}.manifest $objdir/${name}.manifest" + if test yes = "$fast_install" && test -n "$relink_command"; then +- func_append rmfiles " $odir/lt-$name" ++ func_append rmfiles " $odir/lt-$name $objdir/lt-${name}.manifest" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" +-- +1.7.1 + diff --git a/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch b/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch new file mode 100644 index 00000000000..73c249db391 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch @@ -0,0 +1,24 @@ +[PATCH 5/6] Fix "seems to be moved" +* build-aux/ltmain.in (func_mode_link): Compare files by inode +to fix "seems to be moved" warning. +--- + build-aux/ltmain.in | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index af46cb8..244bb5b 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -6283,7 +6283,9 @@ func_mode_link () + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" +- test "$absdir" != "$libdir" && \ ++ abs_inode=`ls -i "$deplib" | awk '{print $1}'` ++ lib_inode=`ls -i "$libdir/$(basename $deplib)" | awk '{print $1}'` ++ test "$abs_inode" != "$lib_inode" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir +-- +1.7.0.2.msysgit.0 \ No newline at end of file diff --git a/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch b/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch new file mode 100644 index 00000000000..486ad76112e --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch @@ -0,0 +1,22 @@ +[PATCH 6/6] Fix STRICT_ANSI vs POSIX +* build-aux/ltmain.in (func_mode_link): Also check for _POSIX +as well as __STRICT_ANSI__ to avoid re-definitions. +--- + build-aux/ltmain.in | 4 +++- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index af46cb8..244bb5b 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -3382,7 +3382,7 @@ + + /* declarations of non-ANSI functions */ + #if defined __MINGW32__ +-# ifdef __STRICT_ANSI__ ++# if defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR) || defined(_POSIX_) + int _putenv (const char *); + # endif + #elif defined __CYGWIN__ +-- +1.7.0.2.msysgit.0 \ No newline at end of file diff --git a/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch b/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch new file mode 100644 index 00000000000..65d5185a36f --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch @@ -0,0 +1,22 @@ +--- libtool-2.4.2/configure.orig 2011-10-17 10:18:58.000000000 +0000 ++++ libtool-2.4.2/configure 2013-08-04 19:01:30.220494400 +0000 +@@ -28825,7 +28825,7 @@ + fi + ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` + if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then +- ac_cs_awk_cr='\\r' ++ ac_cs_awk_cr='\r' + else + ac_cs_awk_cr=$ac_cr + fi +--- libtool-2.4.2/libltdl/configure.orig 2011-10-17 10:19:47.000000000 +0000 ++++ libtool-2.4.2/libltdl/configure 2013-08-05 11:49:24.990792500 +0000 +@@ -13574,7 +13574,7 @@ + fi + ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` + if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then +- ac_cs_awk_cr='\\r' ++ ac_cs_awk_cr='\r' + else + ac_cs_awk_cr=$ac_cr + fi diff --git a/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch b/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch new file mode 100644 index 00000000000..82ecf5266b7 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch @@ -0,0 +1,24 @@ +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index 0418007..91276c2 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -4163,6 +4163,7 @@ + # include + # include + # ifdef __CYGWIN__ ++# include + # include + # endif + #endif +diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh +index 0418007..91276c2 100644 +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -4163,6 +4163,7 @@ + # include + # include + # ifdef __CYGWIN__ ++# include + # include + # endif + #endif diff --git a/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch b/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch new file mode 100644 index 00000000000..49cc0706551 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch @@ -0,0 +1,33 @@ +From a18473ed4e5574dab899db640b8efeff78939b54 Mon Sep 17 00:00:00 2001 +From: Manoj Gupta +Date: Wed, 10 Oct 2018 10:50:23 +0300 +Subject: [PATCH 1/2] Pick up clang_rt static archives compiler internal + libraries + +Libtool checks only for libraries linked as -l* when trying to +find internal compiler libraries. Clang, however uses the absolute +path to link its internal libraries e.g. compiler_rt. This patch +handles clang's statically linked libraries when finding internal +compiler libraries. +https://crbug.com/749263 +https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866 +--- + m4/libtool.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/m4/libtool.m4 b/m4/libtool.m4 +index b55a6e5..d9322d0 100644 +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -7556,7 +7556,7 @@ if AC_TRY_EVAL(ac_compile); then + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + +- -L* | -R* | -l*) ++ -L* | -R* | -l* | */libclang_rt.*.a) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || +-- +2.7.4 + diff --git a/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch b/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch new file mode 100644 index 00000000000..7bdb62dbfb8 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch @@ -0,0 +1,83 @@ +From ec15841963ca3aab3bc88fb0932c014337284bfc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Wed, 10 Oct 2018 10:47:21 +0300 +Subject: [PATCH 2/2] Prefer response files over linker scripts for mingw tools + +The GCC/binutils tools support response files just fine, while +lld (impersonating GNU ld) only supports response files, not +linker scripts. Using a linker script as input just to pass a +list of files is overkill for cases when a response file is enough. +--- + build-aux/ltmain.in | 28 ++++++++++++++-------------- + m4/libtool.m4 | 2 ++ + 2 files changed, 16 insertions(+), 14 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index e2fb263..db5d590 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -7932,20 +7932,7 @@ EOF + last_robj= + k=1 + +- if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then +- output=$output_objdir/$output_la.lnkscript +- func_verbose "creating GNU ld script: $output" +- echo 'INPUT (' > $output +- for obj in $save_libobjs +- do +- func_to_tool_file "$obj" +- $ECHO "$func_to_tool_file_result" >> $output +- done +- echo ')' >> $output +- func_append delfiles " $output" +- func_to_tool_file "$output" +- output=$func_to_tool_file_result +- elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then ++ if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output +@@ -7964,6 +7951,19 @@ EOF + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" ++ elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then ++ output=$output_objdir/$output_la.lnkscript ++ func_verbose "creating GNU ld script: $output" ++ echo 'INPUT (' > $output ++ for obj in $save_libobjs ++ do ++ func_to_tool_file "$obj" ++ $ECHO "$func_to_tool_file_result" >> $output ++ done ++ echo ')' >> $output ++ func_append delfiles " $output" ++ func_to_tool_file "$output" ++ output=$func_to_tool_file_result + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." +diff --git a/m4/libtool.m4 b/m4/libtool.m4 +index d9322d0..9046a84 100644 +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -5130,6 +5130,7 @@ _LT_EOF + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ++ _LT_TAGVAR(file_list_spec, $1)='@' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' +@@ -6706,6 +6707,7 @@ if test yes != "$_lt_caught_CXX_error"; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ++ _LT_TAGVAR(file_list_spec, $1)='@' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' +-- +2.7.4 + diff --git a/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch b/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch new file mode 100644 index 00000000000..b75b191a7cb --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch @@ -0,0 +1,38 @@ +From b9f77cae8cfbe850e58cac686fcb4d246b5bfc51 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Mon, 19 Aug 2019 13:34:51 +0300 +Subject: [PATCH] Allow statically linking compiler support libraries when + linking a library + +For cases with deplibs_check_method="file_magic ..." (as it is for mingw), +there were previously no way that a static library could be accepted +here. +--- + build-aux/ltmain.in | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index e2fb2633..db4d775c 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -5870,8 +5870,15 @@ func_mode_link () + fi + case $linkmode in + lib) +- # Linking convenience modules into shared libraries is allowed, +- # but linking other static libraries is non-portable. ++ # Linking convenience modules and compiler provided static libraries ++ # into shared libraries is allowed, but linking other static ++ # libraries is non-portable. ++ case $deplib in ++ */libgcc*.$libext | */libclang_rt*.$libext) ++ deplibs="$deplib $deplibs" ++ continue ++ ;; ++ esac + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) +-- +2.17.1 + diff --git a/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch b/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch new file mode 100644 index 00000000000..d6570502d94 --- /dev/null +++ b/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch @@ -0,0 +1,39 @@ +From 03dabb6a70847761e65572a2a7b770a3b1b9f123 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= +Date: Mon, 12 Apr 2021 23:44:10 +0200 +Subject: [PATCH] Support llvm-objdump -f output + +--- + build-aux/ltmain.in | 2 +- + m4/libtool.m4 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in +index a9f070a..4a434cc 100644 +--- a/build-aux/ltmain.in ++++ b/build-aux/ltmain.in +@@ -3019,7 +3019,7 @@ func_win32_libid () + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | +- $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then ++ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || +diff --git a/m4/libtool.m4 b/m4/libtool.m4 +index 21a7d60..594be9c 100644 +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -3473,7 +3473,7 @@ mingw* | pw32*) + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. +- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' ++ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; +-- +2.31.1 + diff --git a/pkgs/development/tools/misc/libtool/libtool2.nix b/pkgs/development/tools/misc/libtool/libtool2.nix index 3d15752fc0a..e2f4e97993d 100644 --- a/pkgs/development/tools/misc/libtool/libtool2.nix +++ b/pkgs/development/tools/misc/libtool/libtool2.nix @@ -23,6 +23,20 @@ stdenv.mkDerivation rec { # https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html FILECMD = "${file}/bin/file"; + patches = [ + # Patches from msys2 fixing various bugs with useClang platforms + # targeting Windows. Especially https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866 + ./0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch + ./0005-Fix-seems-to-be-moved.patch + ./0006-Fix-strict-ansi-vs-posix.patch + ./0007-fix-cr-for-awk-in-configure.all.patch + ./0010-libtool-2.4.2-include-process-h.patch + ./0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch + ./0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch + ./0013-Allow-statically-linking-compiler-support-libraries-.patch + ./0014-Support-llvm-objdump-f-output.patch + ]; + # Normally we'd use autoreconfHook, but that includes libtoolize. postPatch = '' aclocal -I m4 From f4d583000192d0e8759ebaac60ec6b32488117ea Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 06:40:35 -0400 Subject: [PATCH 22/62] libffi: autoreconf on Windows for libtool fix --- pkgs/development/libraries/libffi/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index 6a22d585fbc..f5ecd2cc876 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -45,6 +45,8 @@ stdenv.mkDerivation rec { checkInputs = [ dejagnu ]; + nativeBuildInputs = lib.optional stdenv.hostPlatform.isWindows autoreconfHook; + meta = with lib; { description = "A foreign function call interface library"; longDescription = '' From b08eed0cbc92b3bca1347f4534f1059b42e06de4 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 07:46:07 -0400 Subject: [PATCH 23/62] libffi: Fix build for Windows with lld --- pkgs/development/libraries/libffi/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index f5ecd2cc876..890fb9f62e4 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -32,7 +32,9 @@ stdenv.mkDerivation rec { # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 "--disable-exec-static-tramp" - ]; + ] ++ + # ld.lld on Windows doesn't support --version-script. + lib.optional (stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld) "--disable-symvers"; preCheck = '' # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. From f28101d2a421da8b9836a9e339dc8b27353f60d3 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 07:50:03 -0400 Subject: [PATCH 24/62] gmp: autoreconf on Windows for libtool fixes. --- pkgs/development/libraries/gmp/6.x.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix index af4f15a151f..838fe432caf 100644 --- a/pkgs/development/libraries/gmp/6.x.nix +++ b/pkgs/development/libraries/gmp/6.x.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchurl, m4 , cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm -, buildPackages +, buildPackages, autoreconfHook , withStatic ? stdenv.hostPlatform.isStatic }: @@ -29,7 +29,7 @@ let self = stdenv.mkDerivation rec { passthru.static = self.out; depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ m4 ]; + nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.hostPlatform.isWindows autoreconfHook; configureFlags = [ "--with-pic" From 5e8a857310a580d6f7a3d56ec99295792143d496 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 6 May 2022 10:53:39 -0400 Subject: [PATCH 25/62] ncurses: Fix building against ucrt --- pkgs/development/libraries/ncurses/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index 2740b95986c..a661f5f216c 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -46,7 +46,13 @@ stdenv.mkDerivation rec { ]; # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: - CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED"; + CFLAGS = + # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: + /**/ if stdenv.isSunOS then "-D_XOPEN_SOURCE_EXTENDED" + # ucrt doesn't support X_OK to access() without this flag + else if stdenv.hostPlatform.libc == "ucrt" then "-D__USE_MINGW_ACCESS" + else ""; + depsBuildBuild = [ buildPackages.stdenv.cc From ece10a711f5a2c406d8907c66c99c61f776c2ac1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 7 May 2022 06:30:58 -0400 Subject: [PATCH 26/62] ghcHEAD: Fix Windows cross-compilation with lld. By specifying pkgs.libffi here instead of letting callPackage handle it, we confuse the splicing logic and put the host libffi into NIX_LDFLAGS_FOR_TARGET. This previously hasn't been a problem, as we also pass an explicit configure flag pointing to the target libffi, and so the only side-effect is a senseless -rpath flag. ld.lld (rightly) does not recognize the -rpath flag when targeting Windows, however, so this causes build failures. --- pkgs/top-level/haskell-packages.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c46a7f1bcd2..fac1d546832 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -145,7 +145,6 @@ in { inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12; llvmPackages = pkgs.llvmPackages_12; - libffi = pkgs.libffi; }; ghcjs = compiler.ghcjs810; From 0d6bcb513bf2f2fe92ff8b2fae75da95007a03e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 15:51:43 +0200 Subject: [PATCH 27/62] makeBinaryWrapper: move into its own folder The derivation is complex enough to warrant moving out of all-packages.nix --- doc/stdenv/stdenv.chapter.md | 2 +- .../make-binary-wrapper/default.nix | 20 +++++++++++++++ .../make-binary-wrapper.sh | 2 +- pkgs/test/default.nix | 8 +++++- pkgs/top-level/all-packages.nix | 25 +------------------ 5 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix rename pkgs/build-support/setup-hooks/{ => make-binary-wrapper}/make-binary-wrapper.sh (99%) diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md index d5d27cbf086..b57698cb90b 100644 --- a/doc/stdenv/stdenv.chapter.md +++ b/doc/stdenv/stdenv.chapter.md @@ -869,7 +869,7 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]} ``` -There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation. +There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation. `wrapProgram` is a convenience function you probably want to use most of the time, implemented by both `makeWrapper` and `makeBinaryWrapper`. diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix new file mode 100644 index 00000000000..f27a4c9fcdf --- /dev/null +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix @@ -0,0 +1,20 @@ +{ stdenv +, lib +, makeSetupHook +, dieHook +, tests +, cc ? stdenv.cc +, sanitizers ? [] +}: + +makeSetupHook { + deps = [ dieHook cc ]; + + substitutions = { + cc = let + san = lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers); + in "${cc}/bin/cc ${san}"; + + passthru.tests = tests.makeBinaryWrapper; + }; +} ./make-binary-wrapper.sh diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh similarity index 99% rename from pkgs/build-support/setup-hooks/make-binary-wrapper.sh rename to pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh index 3931b37c242..abcde2429ee 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh @@ -43,7 +43,7 @@ makeWrapper() { mkdir -p "$(dirname "$wrapper")" makeDocumentedCWrapper "$original" "$@" | \ - @CC@ \ + @cc@ \ -Wall -Werror -Wpedantic \ -Wno-overlength-strings \ -Os \ diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 2ab03bda8b7..e3253498958 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -71,7 +71,13 @@ with pkgs; dhall = callPackage ./dhall { }; - makeWrapper = callPackage ./make-wrapper {}; + makeWrapper = callPackage ./make-wrapper { }; + makeBinaryWrapper = callPackage ./make-binary-wrapper { + makeBinaryWrapper = pkgs.makeBinaryWrapper.override { + sanitizers = pkgs.lib.optionals (! (pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64)) + [ "undefined" "address" ]; + }; + }; pkgs-lib = recurseIntoAttrs (import ../pkgs-lib/tests { inherit pkgs; }); } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b7554dda398..a9b955db651 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -783,30 +783,7 @@ with pkgs; } ../build-support/setup-hooks/make-wrapper.sh; - makeBinaryWrapper = let - f = { cc, sanitizers }: let - san = lib.concatMapStringsSep " " (s: "-fsanitize=${s}") sanitizers; - script = runCommand "make-binary-wrapper.sh" {} '' - substitute ${../build-support/setup-hooks/make-binary-wrapper.sh} $out \ - --replace " @CC@ " " ${cc}/bin/cc ${san} " - ''; - in - makeSetupHook { - deps = [ dieHook cc ]; - substitutions.passthru.tests = callPackage ../test/make-binary-wrapper { - makeBinaryWrapper = makeBinaryWrapper.override { - sanitizers = (if stdenv.isDarwin && stdenv.isAarch64 - then [ ] - else [ "undefined" "address" ] - ); - }; - }; - } script; - in - lib.makeOverridable f { - cc = stdenv.cc; - sanitizers = [ ]; - }; + makeBinaryWrapper = callPackage ../build-support/setup-hooks/make-binary-wrapper { }; makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }: callPackage ../build-support/kernel/modules-closure.nix { From 62245943aa12a06cc976ca94c632d70049316415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 16:01:59 +0200 Subject: [PATCH 28/62] makeWrapper,makeBinaryWrapper: introduce explicitly named functions Because both versions might end up in a derivation's build inputs, it might be useful to be able to explicitly select which function to use. --- .../networking/instant-messengers/discord/linux.nix | 5 +++-- pkgs/applications/science/logic/tlaplus/toolbox.nix | 4 ++-- .../setup-hooks/make-binary-wrapper/make-binary-wrapper.sh | 6 ++++-- pkgs/build-support/setup-hooks/make-wrapper.sh | 6 ++++-- pkgs/tools/security/cryptomator/default.nix | 4 ++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/discord/linux.nix b/pkgs/applications/networking/instant-messengers/discord/linux.nix index f5d984bf3a6..b36dc935f1c 100644 --- a/pkgs/applications/networking/instant-messengers/discord/linux.nix +++ b/pkgs/applications/networking/instant-messengers/discord/linux.nix @@ -24,7 +24,8 @@ stdenv.mkDerivation rec { libxshmfence mesa nss - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook + makeWrapper ]; dontWrapGApps = true; @@ -78,7 +79,7 @@ stdenv.mkDerivation rec { patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \ $out/opt/${binaryName}/${binaryName} - wrapProgram $out/opt/${binaryName}/${binaryName} \ + wrapProgramShell $out/opt/${binaryName}/${binaryName} \ "''${gappsWrapperArgs[@]}" \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}" \ --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ diff --git a/pkgs/applications/science/logic/tlaplus/toolbox.nix b/pkgs/applications/science/logic/tlaplus/toolbox.nix index d84f0b2abf6..ff763608cba 100644 --- a/pkgs/applications/science/logic/tlaplus/toolbox.nix +++ b/pkgs/applications/science/logic/tlaplus/toolbox.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook ]; dontWrapGApps = true; @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$(find "$out/toolbox" -name jspawnhelper)" - makeWrapper $out/toolbox/toolbox $out/bin/tla-toolbox \ + makeShellWrapper $out/toolbox/toolbox $out/bin/tla-toolbox \ --chdir "$out/toolbox" \ --add-flags "-data ~/.tla-toolbox" \ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gtk3 libXtst glib zlib ]}" \ diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh index abcde2429ee..9496c918580 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh @@ -32,7 +32,8 @@ assertExecutable() { # To troubleshoot a binary wrapper after you compiled it, # use the `strings` command or open the binary file in a text editor. -makeWrapper() { +makeWrapper() { makeBinaryWrapper "$@"; } +makeBinaryWrapper() { local NIX_CFLAGS_COMPILE= NIX_CFLAGS_LINK= local original="$1" local wrapper="$2" @@ -52,7 +53,8 @@ makeWrapper() { } # Syntax: wrapProgram -wrapProgram() { +wrapProgram() { wrapProgramBinary "$@"; } +wrapProgramBinary() { local prog="$1" local hidden diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh index 7d598956168..c6188c2cd96 100644 --- a/pkgs/build-support/setup-hooks/make-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-wrapper.sh @@ -29,7 +29,8 @@ assertExecutable() { # --prefix-contents ENV SEP FILES : like --suffix-each, but contents of FILES # are read first and used as VALS # --suffix-contents -makeWrapper() { +makeWrapper() { makeShellWrapper "$@"; } +makeShellWrapper() { local original="$1" local wrapper="$2" local params varName value command separator n fileNames @@ -193,7 +194,8 @@ filterExisting() { } # Syntax: wrapProgram -wrapProgram() { +wrapProgram() { wrapProgramShell "$@"; } +wrapProgramShell() { local prog="$1" local hidden diff --git a/pkgs/tools/security/cryptomator/default.nix b/pkgs/tools/security/cryptomator/default.nix index 5a1886e49e5..9517427fefd 100644 --- a/pkgs/tools/security/cryptomator/default.nix +++ b/pkgs/tools/security/cryptomator/default.nix @@ -65,7 +65,7 @@ in stdenv.mkDerivation rec { rm $out/share/cryptomator/libs/jff*.jar cp -f ${jffi}/share/java/jffi-complete.jar $out/share/cryptomator/libs/ - makeWrapper ${jre}/bin/java $out/bin/cryptomator \ + makeShellWrapper ${jre}/bin/java $out/bin/cryptomator \ --add-flags "--class-path '$out/share/cryptomator/libs/*'" \ --add-flags "--module-path '$out/share/cryptomator/mods'" \ --add-flags "-Dcryptomator.logDir='~/.local/share/Cryptomator/logs'" \ @@ -102,7 +102,7 @@ in stdenv.mkDerivation rec { autoPatchelfHook maven makeWrapper - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + wrapGAppsHook jdk ]; buildInputs = [ fuse jre glib jffi ]; From 81b9c712cec8b0edf772c3ffb113e39867bfc86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 16:03:29 +0200 Subject: [PATCH 29/62] wrapGAppsHook: rename argument to makeWrapper ...and pass it makeBinaryWrapper in all-packages.nix --- pkgs/applications/editors/vscode/generic.nix | 2 +- pkgs/applications/networking/browsers/brave/default.nix | 2 +- .../networking/instant-messengers/signal-desktop/default.nix | 2 +- pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 +++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix index e1003180050..b4731b5701c 100644 --- a/pkgs/applications/editors/vscode/generic.nix +++ b/pkgs/applications/editors/vscode/generic.nix @@ -72,7 +72,7 @@ let ++ lib.optionals stdenv.isLinux [ autoPatchelfHook nodePackages.asar - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + (wrapGAppsHook.override { inherit makeWrapper; }) ]; dontBuild = true; diff --git a/pkgs/applications/networking/browsers/brave/default.nix b/pkgs/applications/networking/browsers/brave/default.nix index 79b9b498fbd..1a3e74c558b 100644 --- a/pkgs/applications/networking/browsers/brave/default.nix +++ b/pkgs/applications/networking/browsers/brave/default.nix @@ -104,7 +104,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ dpkg - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + (wrapGAppsHook.override { inherit makeWrapper; }) ]; buildInputs = [ diff --git a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix index 96c6809b045..0fe099c9d7e 100644 --- a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix @@ -40,7 +40,7 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ autoPatchelfHook dpkg - (wrapGAppsHook.override { makeBinaryWrapper = makeWrapper; }) + (wrapGAppsHook.override { inherit makeWrapper; }) ]; buildInputs = [ diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix index 8c10f67c152..d7699b2557f 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -1,7 +1,7 @@ { stdenv , lib , makeSetupHook -, makeBinaryWrapper +, makeWrapper , gobject-introspection , isGraphical ? true , gtk3 @@ -34,7 +34,7 @@ makeSetupHook { ] ++ [ # We use the wrapProgram function. - makeBinaryWrapper + makeWrapper ]; substitutions = { passthru.tests = let diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a9b955db651..2a01e4909ca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -880,7 +880,9 @@ with pkgs; findXMLCatalogs = makeSetupHook { } ../build-support/setup-hooks/find-xml-catalogs.sh; - wrapGAppsHook = callPackage ../build-support/setup-hooks/wrap-gapps-hook { }; + wrapGAppsHook = callPackage ../build-support/setup-hooks/wrap-gapps-hook { + makeWrapper = makeBinaryWrapper; + }; wrapGAppsHook4 = wrapGAppsHook.override { gtk3 = gtk4; }; From 8b79ef2cb6ac286ae3489bcc5a3e6bd546dac67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 16:08:46 +0200 Subject: [PATCH 30/62] makeBinaryWrapper: remove cc from deps Fixes https://github.com/NixOS/nixpkgs/issues/172249 --- .../setup-hooks/make-binary-wrapper/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix index f27a4c9fcdf..a78d52fb42c 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix @@ -1,5 +1,6 @@ { stdenv , lib +, darwin , makeSetupHook , dieHook , tests @@ -8,7 +9,9 @@ }: makeSetupHook { - deps = [ dieHook cc ]; + deps = [ dieHook ] + # https://github.com/NixOS/nixpkgs/issues/148189 + ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) darwin.cctools; substitutions = { cc = let From 2ae69114a11c6a80a58abc6984fde8851ee8fe40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 10 May 2022 16:10:12 +0200 Subject: [PATCH 31/62] makeWrapper: implement --inherit-argv0 For symmetry/interoperability with makeBinaryWrapper. Implemented as --argv0 '$0' --- pkgs/applications/editors/neovim/utils.nix | 2 +- .../networking/browsers/firefox/wrapper.nix | 5 +---- pkgs/applications/video/mpv/wrapper.nix | 4 ++-- .../make-binary-wrapper/make-binary-wrapper.sh | 10 ++++------ pkgs/build-support/setup-hooks/make-wrapper.sh | 17 ++++++++++------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index e721457f2df..ee0abb58289 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -108,7 +108,7 @@ let hostprog_check_table); in [ - "--argv0" "$0" "--add-flags" (lib.escapeShellArgs flags) + "--inherit-argv0" "--add-flags" (lib.escapeShellArgs flags) ] ++ lib.optionals withRuby [ "--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}" ] ++ lib.optionals (binPath != "") [ diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 1a5556b82be..3da36e520c3 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -237,10 +237,7 @@ let parseMakeCWrapperCall() { shift # makeCWrapper oldExe=$1; shift - for arg do case $arg in - --inherit-argv0) oldWrapperArgs+=(--argv0 '$0');; # makeWrapper doesn't understand --inherit-argv0 - *) oldWrapperArgs+=("$arg");; - esac done + oldWrapperArgs=("$@") } eval "parseMakeCWrapperCall ''${wrapperCmd//"${browser}"/"$out"}" rm "$executablePath" diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index 28414c3756d..3dfe83e2449 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -32,7 +32,7 @@ let # All arguments besides the input and output binaries (${mpv}/bin/mpv and # $out/bin/mpv). These are used by the darwin specific makeWrapper call # used to wrap $out/Applications/mpv.app/Contents/MacOS/mpv as well. - mostMakeWrapperArgs = lib.strings.escapeShellArgs ([ "--argv0" "'$0'" + mostMakeWrapperArgs = lib.strings.escapeShellArgs ([ "--inherit-argv0" # These are always needed (TODO: Explain why) "--prefix" "LUA_CPATH" ";" "${mpv.luaEnv}/lib/lua/${mpv.lua.luaversion}/?.so" "--prefix" "LUA_PATH" ";" "${mpv.luaEnv}/share/lua/${mpv.lua.luaversion}/?.lua" @@ -53,7 +53,7 @@ let )) ++ extraMakeWrapperArgs) ; umpvWrapperArgs = lib.strings.escapeShellArgs ([ - "--argv0" "'$0'" + "--inherit-argv0" "--set" "MPV" "${placeholder "out"}/bin/mpv" ] ++ extraUmpvWrapperArgs) ; diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh index 9496c918580..ff3f1d3f0c7 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh @@ -15,17 +15,17 @@ assertExecutable() { # makeWrapper EXECUTABLE OUT_PATH ARGS # ARGS: -# --argv0 NAME : set name of executed process to NAME -# (otherwise it’s called …-wrapped) +# --argv0 NAME : set the name of the executed process to NAME +# (if unset or empty, defaults to EXECUTABLE) # --inherit-argv0 : the executable inherits argv0 from the wrapper. # (use instead of --argv0 '$0') -# --set VAR VAL : add VAR with value VAL to the executable’s -# environment +# --set VAR VAL : add VAR with value VAL to the executable's environment # --set-default VAR VAL : like --set, but only adds VAR if not already set in # the environment # --unset VAR : remove VAR from the environment # --chdir DIR : change working directory (use instead of --run "cd DIR") # --add-flags FLAGS : add FLAGS to invocation of executable +# TODO(@ncfavier): --append-flags # --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP # --suffix @@ -65,8 +65,6 @@ wrapProgramBinary() { hidden="${hidden}_" done mv "$prog" "$hidden" - # Silence warning about unexpanded $0: - # shellcheck disable=SC2016 makeWrapper "$hidden" "$prog" --inherit-argv0 "${@:2}" } diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh index c6188c2cd96..8a38c39efc4 100644 --- a/pkgs/build-support/setup-hooks/make-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-wrapper.sh @@ -11,16 +11,18 @@ assertExecutable() { # makeWrapper EXECUTABLE OUT_PATH ARGS # ARGS: -# --argv0 NAME : set name of executed process to NAME -# (otherwise it’s called …-wrapped) -# --set VAR VAL : add VAR with value VAL to the executable’s -# environment +# --argv0 NAME : set the name of the executed process to NAME +# (if unset or empty, defaults to EXECUTABLE) +# --inherit-argv0 : the executable inherits argv0 from the wrapper. +# (use instead of --argv0 '$0') +# --set VAR VAL : add VAR with value VAL to the executable's environment # --set-default VAR VAL : like --set, but only adds VAR if not already set in # the environment # --unset VAR : remove VAR from the environment # --chdir DIR : change working directory (use instead of --run "cd DIR") # --run COMMAND : run command before the executable # --add-flags FLAGS : add FLAGS to invocation of executable +# TODO(@ncfavier): --append-flags # --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP # --suffix @@ -166,6 +168,9 @@ makeShellWrapper() { elif [[ "$p" == "--argv0" ]]; then argv0="${params[$((n + 1))]}" n=$((n + 1)) + elif [[ "$p" == "--inherit-argv0" ]]; then + # Whichever comes last of --argv0 and --inherit-argv0 wins + argv0='$0' else die "makeWrapper doesn't understand the arg $p" fi @@ -206,7 +211,5 @@ wrapProgramShell() { hidden="${hidden}_" done mv "$prog" "$hidden" - # Silence warning about unexpanded $0: - # shellcheck disable=SC2016 - makeWrapper "$hidden" "$prog" --argv0 '$0' "${@:2}" + makeWrapper "$hidden" "$prog" --inherit-argv0 "${@:2}" } From 88369997e1db7e1819b7b940fc2740f188d6608d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Wed, 11 May 2022 22:00:24 +0200 Subject: [PATCH 32/62] makeBinaryWrapper: add extractCmd A small shell script that can be used to extract a binary wrapper's makeCWrapper call from its embedded docstring, without depending on makeBinaryWrapper. --- pkgs/applications/networking/browsers/firefox/wrapper.nix | 4 ++-- .../setup-hooks/make-binary-wrapper/default.nix | 6 ++++++ .../setup-hooks/make-binary-wrapper/make-binary-wrapper.sh | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 3da36e520c3..43830158326 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, makeDesktopItem, makeWrapper, lndir, config +{ stdenv, lib, makeDesktopItem, makeWrapper, makeBinaryWrapper, lndir, config , fetchurl, zip, unzip, jq, xdg-utils, writeText ## various stuff that can be plugged in @@ -229,7 +229,7 @@ let # Symbolic link: wrap the link's target. oldExe="$(readlink -v --canonicalize-existing "$executablePath")" rm "$executablePath" - elif wrapperCmd=$(strings -dw "$executablePath" | sed -n '/^makeCWrapper/,/^$/ p'); [[ $wrapperCmd ]]; then + elif wrapperCmd=$(${makeBinaryWrapper.extractCmd} "$executablePath"); [[ $wrapperCmd ]]; then # If the executable is a binary wrapper, we need to update its target to # point to $out, but we can't just edit the binary in-place because of length # issues. So we extract the command used to create the wrapper and add the diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix index a78d52fb42c..318624011b7 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix @@ -3,6 +3,7 @@ , darwin , makeSetupHook , dieHook +, writeShellScript , tests , cc ? stdenv.cc , sanitizers ? [] @@ -18,6 +19,11 @@ makeSetupHook { san = lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers); in "${cc}/bin/cc ${san}"; + # Extract the function call used to create a binary wrapper from its embedded docstring + passthru.extractCmd = writeShellScript "extract-binary-wrapper-cmd" '' + strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p' + ''; + passthru.tests = tests.makeBinaryWrapper; }; } ./make-binary-wrapper.sh diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh index ff3f1d3f0c7..6b8f5d60eb6 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh @@ -311,8 +311,9 @@ void set_env_suffix(char *env, char *sep, char *suffix) { " } -# Embed a C string which shows up as readable text in the compiled binary wrapper -# documentationString ARGS +# Embed a C string which shows up as readable text in the compiled binary wrapper, +# giving instructions for recreating the wrapper. +# Keep in sync with makeBinaryWrapper.extractCmd docstring() { printf '%s' "const char * DOCSTRING = \"$(escapeStringLiteral " @@ -333,7 +334,7 @@ makeCWrapper $(formatArgs "$@") # formatArgs EXECUTABLE ARGS formatArgs() { - printf '%s' "$1" + printf '%s' "${1@Q}" shift while [ $# -gt 0 ]; do case "$1" in From c6a4414766547f32ba4b70261c42db3578ddafff Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Wed, 11 May 2022 23:50:44 +0000 Subject: [PATCH 33/62] postgresqlPackages.pg_safeupdate: 1.2 -> 1.4 This fixes the build with PostgreSQL 14. --- pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix b/pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix index b2a58b6bc3e..5e9976c014d 100644 --- a/pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix +++ b/pkgs/servers/sql/postgresql/ext/pg_safeupdate.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "pg-safeupdate"; - version = "1.2"; + version = "1.4"; buildInputs = [ postgresql ]; @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { owner = "eradman"; repo = pname; rev = version; - sha256 = "010m57jcv5v8pyfm1cqs3a306y750lvnvla9m5d98v5vdx3349jg"; + sha256 = "sha256-1cyvVEC9MQGMr7Tg6EUbsVBrMc8ahdFS3+CmDkmAq4Y="; }; installPhase = '' From 5a19730b5d346134bd7e8bc64185d5d430790cd3 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 12 May 2022 04:20:00 +0000 Subject: [PATCH 34/62] postgresql_10: 10.20 -> 10.21 https://www.postgresql.org/docs/release/10.21/ --- pkgs/servers/sql/postgresql/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 0998ddb573d..4199e2696e9 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -202,9 +202,9 @@ let in self: { postgresql_10 = self.callPackage generic { - version = "10.20"; + version = "10.21"; psqlSchema = "10.0"; # should be 10, but changing it is invasive - sha256 = "sha256-h94W1ZvP5C+mBcMSxZvl4pToo+astlXdetR8u5MKZZ8="; + sha256 = "sha256-0yGYhW1Sqab11QZC74ZoesBYvW78pcntV754CElvRdE="; this = self.postgresql_10; thisAttr = "postgresql_10"; inherit self; From 74707e7b120750c9ca2668b3c3abd1bc5a787722 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 12 May 2022 04:20:00 +0000 Subject: [PATCH 35/62] postgresql_11: 11.15 -> 11.16 https://www.postgresql.org/docs/release/11.16/ --- pkgs/servers/sql/postgresql/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 4199e2696e9..4d940e3bccb 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -212,9 +212,9 @@ in self: { }; postgresql_11 = self.callPackage generic { - version = "11.15"; + version = "11.16"; psqlSchema = "11.1"; # should be 11, but changing it is invasive - sha256 = "sha256-yPWOjr1PRWf0+boQMus+meAlHYfL4+VktIVZDjeoeeM="; + sha256 = "sha256-LdnhEfCllJ7nyswGXOoPshCSkpuuMQzgW/AbT/xRA6U="; this = self.postgresql_11; thisAttr = "postgresql_11"; inherit self; From 9d599ca124c568db7e348ba5ff6bbd12559a4e03 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 12 May 2022 04:20:00 +0000 Subject: [PATCH 36/62] postgresql_12: 12.10 -> 12.11 https://www.postgresql.org/docs/release/12.11/ --- pkgs/servers/sql/postgresql/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 4d940e3bccb..50a4617f408 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -221,9 +221,9 @@ in self: { }; postgresql_12 = self.callPackage generic { - version = "12.10"; + version = "12.11"; psqlSchema = "12"; - sha256 = "sha256-g90ZLmA0lRGSuahtwZzzcXqLghIOLxGgo2cjyCDSslc="; + sha256 = "sha256-ECYkil/Svur0PkxyNqyBflbVi2gaM1hWRl37x1s+gwI="; this = self.postgresql_12; thisAttr = "postgresql_12"; inherit self; From 84e86fc9ee92e7214e07e685ff87312b5a66da15 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 12 May 2022 04:20:00 +0000 Subject: [PATCH 37/62] postgresql_13: 13.6 -> 13.7 https://www.postgresql.org/docs/release/13.7/ --- pkgs/servers/sql/postgresql/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 50a4617f408..9e4472f0fb5 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -230,9 +230,9 @@ in self: { }; postgresql_13 = self.callPackage generic { - version = "13.6"; + version = "13.7"; psqlSchema = "13"; - sha256 = "sha256-uvx/o9nU2o/nG4TGO6i9/oCSk1wwwKqFwkssCFCPZ/w="; + sha256 = "sha256-G5Bb9PPYNhSjk7PFH9NFkQ/SYeT1Ekpo2aH906KkY5k="; this = self.postgresql_13; thisAttr = "postgresql_13"; inherit self; From 242c4aaf39096a2ed9e7022adbf51ccee102fd80 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 12 May 2022 04:20:00 +0000 Subject: [PATCH 38/62] postgresql_14: 14.2 -> 14.3 https://www.postgresql.org/docs/release/14.3/ --- pkgs/servers/sql/postgresql/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix index 9e4472f0fb5..bfbac087bc3 100644 --- a/pkgs/servers/sql/postgresql/default.nix +++ b/pkgs/servers/sql/postgresql/default.nix @@ -239,9 +239,9 @@ in self: { }; postgresql_14 = self.callPackage generic { - version = "14.2"; + version = "14.3"; psqlSchema = "14"; - sha256 = "sha256-LPeLLkaJEvgQHWldtTQM8xPC6faKYS+3FCdSToyal3o="; + sha256 = "sha256-J5BXNov1mpGcBa2o+VxeBKu0PnS5oqacPUaiDgeprzg="; this = self.postgresql_14; thisAttr = "postgresql_14"; inherit self; From 3c77d361b5e8e8d9173282538067cce6bcc3cc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 12 May 2022 00:25:07 +0200 Subject: [PATCH 39/62] makeShellWrapper: add explicitly named attribute So that things that use the makeShellWrapper/wrapProgramShell functions can depend on makeShellWrapper explicitly, which should ease migration in the future. --- .../networking/instant-messengers/discord/linux.nix | 4 ++-- pkgs/applications/science/logic/tlaplus/toolbox.nix | 4 ++-- pkgs/tools/security/cryptomator/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/discord/linux.nix b/pkgs/applications/networking/instant-messengers/discord/linux.nix index b36dc935f1c..b960caa64d8 100644 --- a/pkgs/applications/networking/instant-messengers/discord/linux.nix +++ b/pkgs/applications/networking/instant-messengers/discord/linux.nix @@ -1,5 +1,5 @@ { pname, version, src, meta, binaryName, desktopName, autoPatchelfHook -, makeDesktopItem, lib, stdenv, wrapGAppsHook, makeWrapper, alsa-lib, at-spi2-atk +, makeDesktopItem, lib, stdenv, wrapGAppsHook, makeShellWrapper, alsa-lib, at-spi2-atk , at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig, freetype, gdk-pixbuf , glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid, libX11 , libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext, libXfixes @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { mesa nss wrapGAppsHook - makeWrapper + makeShellWrapper ]; dontWrapGApps = true; diff --git a/pkgs/applications/science/logic/tlaplus/toolbox.nix b/pkgs/applications/science/logic/tlaplus/toolbox.nix index ff763608cba..3c53e66c8bd 100644 --- a/pkgs/applications/science/logic/tlaplus/toolbox.nix +++ b/pkgs/applications/science/logic/tlaplus/toolbox.nix @@ -1,6 +1,6 @@ { lib , fetchzip -, makeWrapper +, makeShellWrapper , makeDesktopItem , stdenv , gtk3 @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { buildInputs = [ gtk3 ]; nativeBuildInputs = [ - makeWrapper + makeShellWrapper wrapGAppsHook ]; diff --git a/pkgs/tools/security/cryptomator/default.nix b/pkgs/tools/security/cryptomator/default.nix index 9517427fefd..ccd5318ffb6 100644 --- a/pkgs/tools/security/cryptomator/default.nix +++ b/pkgs/tools/security/cryptomator/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, fetchFromGitHub , autoPatchelfHook , fuse, jffi -, maven, jdk, jre, makeWrapper, glib, wrapGAppsHook +, maven, jdk, jre, makeShellWrapper, glib, wrapGAppsHook }: let @@ -101,7 +101,7 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ autoPatchelfHook maven - makeWrapper + makeShellWrapper wrapGAppsHook jdk ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2a01e4909ca..f76663faff3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -774,7 +774,9 @@ with pkgs; makeInitrdNG = callPackage ../build-support/kernel/make-initrd-ng.nix; makeInitrdNGTool = callPackage ../build-support/kernel/make-initrd-ng-tool.nix {}; - makeWrapper = makeSetupHook + makeWrapper = makeShellWrapper; + + makeShellWrapper = makeSetupHook { deps = [ dieHook ]; substitutions = { shell = targetPackages.runtimeShell; From 4b0f59afccb060fd7bfd9b107a21bd8a0fdac775 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 12 May 2022 00:05:03 +0200 Subject: [PATCH 40/62] binutils: add upstream patch to fix issue with parallel use of dlltool https://sourceware.org/bugzilla/show_bug.cgi?id=28885 Patch taken from the upstream binutils-2_38-branch branch. --- .../tools/misc/binutils/default.nix | 6 ++++ .../deterministic-temp-prefixes.patch | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index da2b4864552..88b6d3a705e 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -82,6 +82,12 @@ stdenv.mkDerivation { # override this behavior, forcing ld to search DT_RPATH even when # cross-compiling. ./always-search-rpath.patch + + # Fixed in 2.39 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28885 + # https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=99852365513266afdd793289813e8e565186c9e6 + # https://github.com/NixOS/nixpkgs/issues/170946 + ./deterministic-temp-prefixes.patch ] ++ lib.optional targetPlatform.isiOS ./support-ios.patch # This patch was suggested by Nick Clifton to fix diff --git a/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch b/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch new file mode 100644 index 00000000000..3c27340b9c0 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/deterministic-temp-prefixes.patch @@ -0,0 +1,36 @@ +From 99852365513266afdd793289813e8e565186c9e6 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 23 Mar 2022 11:39:49 +0000 +Subject: [PATCH] dlltool: Use the output name as basis for deterministic temp + prefixes + + PR 28885 + * dlltool.c (main): use imp_name rather than dll_name when + generating a temporary file name. +--- + binutils/ChangeLog | 9 +++++++++ + binutils/dlltool.c | 7 ++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/binutils/dlltool.c b/binutils/dlltool.c +index d95bf3f5470..89871510b45 100644 +--- a/binutils/dlltool.c ++++ b/binutils/dlltool.c +@@ -3992,10 +3992,11 @@ main (int ac, char **av) + if (tmp_prefix == NULL) + { + /* If possible use a deterministic prefix. */ +- if (dll_name) ++ if (imp_name || delayimp_name) + { +- tmp_prefix = xmalloc (strlen (dll_name) + 2); +- sprintf (tmp_prefix, "%s_", dll_name); ++ const char *input = imp_name ? imp_name : delayimp_name; ++ tmp_prefix = xmalloc (strlen (input) + 2); ++ sprintf (tmp_prefix, "%s_", input); + for (i = 0; tmp_prefix[i]; i++) + if (!ISALNUM (tmp_prefix[i])) + tmp_prefix[i] = '_'; +-- +2.31.1 + From 3e385d9a8262fedc647f59aebc5464d7a9212c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 12 May 2022 15:23:38 +0200 Subject: [PATCH 41/62] makeBinaryWrapper: add comment --- .../build-support/setup-hooks/make-binary-wrapper/default.nix | 4 +--- pkgs/test/default.nix | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix index 318624011b7..fd0fa3ea009 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix @@ -15,9 +15,7 @@ makeSetupHook { ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) darwin.cctools; substitutions = { - cc = let - san = lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers); - in "${cc}/bin/cc ${san}"; + cc = "${cc}/bin/cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}"; # Extract the function call used to create a binary wrapper from its embedded docstring passthru.extractCmd = writeShellScript "extract-binary-wrapper-cmd" '' diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index e3253498958..4b850f1509c 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -74,6 +74,8 @@ with pkgs; makeWrapper = callPackage ./make-wrapper { }; makeBinaryWrapper = callPackage ./make-binary-wrapper { makeBinaryWrapper = pkgs.makeBinaryWrapper.override { + # Enable sanitizers in the tests only, to avoid the performance cost in regular usage. + # The sanitizers cause errors on aarch64-darwin, see https://github.com/NixOS/nixpkgs/pull/150079#issuecomment-994132734 sanitizers = pkgs.lib.optionals (! (pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64)) [ "undefined" "address" ]; }; From 8e8577806de026f1cb7d012ae0c95a3496f84925 Mon Sep 17 00:00:00 2001 From: Thekla Frie Date: Wed, 11 May 2022 23:18:05 +0200 Subject: [PATCH 42/62] gtk: fix missing immodules.cache this file used to be generated by the gtk build process, but this stopped being the case when upstream switched to a different post-install system with version 3.24.32. this is not an upstream bug since distributions are supposed to generate this file on their own anyways [1]. Fixes #172406. [1]: https://gitlab.gnome.org/GNOME/gtk/-/issues/4908 --- pkgs/development/libraries/gtk/3.x.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 5e0dcf6ce03..60fe817880b 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -201,6 +201,8 @@ stdenv.mkDerivation rec { for f in $dev/bin/gtk-encode-symbolic-svg; do wrapProgram $f --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" done + '' + lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) '' + GTK_PATH="''${out:?}/lib/gtk-3.0/3.0.0/immodules/" ''${dev:?}/bin/gtk-query-immodules-3.0 > "''${out:?}/lib/gtk-3.0/3.0.0/immodules.cache" ''; # Wrap demos From be29f4575e6ba2f0610180ab765f1b767578968e Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 30 Nov 2021 14:49:53 +0800 Subject: [PATCH 43/62] rustc: expose correct llvmPackages for cross compile --- pkgs/development/compilers/rust/1_60.nix | 2 +- pkgs/development/compilers/rust/default.nix | 4 ++-- pkgs/development/compilers/rust/rustc.nix | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/rust/1_60.nix b/pkgs/development/compilers/rust/1_60.nix index 0153b5d23a9..16f8512952d 100644 --- a/pkgs/development/compilers/rust/1_60.nix +++ b/pkgs/development/compilers/rust/1_60.nix @@ -33,7 +33,7 @@ import ./default.nix { llvmShared = llvm_14.override { enableSharedLibraries = true; }; # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox - llvmPackagesForBuild = pkgsBuildBuild.llvmPackages_14; + llvmPackages = llvmPackages_14; # Note: the version MUST be one version prior to the version we're # building diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index 6dfc8a49063..6c579373f5d 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -10,7 +10,7 @@ , llvmSharedForBuild , llvmSharedForHost , llvmSharedForTarget -, llvmPackagesForBuild # Exposed through rustc for LTO in Firefox +, llvmPackages # Exposed through rustc for LTO in Firefox }: { stdenv, lib , buildPackages @@ -64,7 +64,7 @@ in version = rustcVersion; sha256 = rustcSha256; inherit enableRustcDev; - inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackagesForBuild; + inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackages; patches = rustcPatches; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 1087ac05908..d167cf91c36 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -1,5 +1,5 @@ { lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget -, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackagesForBuild +, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages , fetchurl, file, python3 , darwin, cmake, rust, rustPlatform , pkg-config, openssl @@ -179,7 +179,7 @@ in stdenv.mkDerivation rec { passthru = { llvm = llvmShared; - llvmPackages = llvmPackagesForBuild; + inherit llvmPackages; }; meta = with lib; { From f6c57619358d51e71a5298503c84e1c1ce4f9f12 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Tue, 3 May 2022 10:23:35 +0800 Subject: [PATCH 44/62] firefox-unwrapped: fix cross compilation --- .../networking/browsers/firefox/common.nix | 24 +++++++++++++++---- pkgs/misc/sndio/default.nix | 1 + pkgs/top-level/all-packages.nix | 6 +---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 9321e491099..948adc407d7 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -65,6 +65,7 @@ , xorg , zip , zlib +, pkgsBuildBuild # optionals @@ -139,16 +140,21 @@ let # Target the LLVM version that rustc is built with for LTO. llvmPackages0 = rustc.llvmPackages; + llvmPackagesBuildBuild0 = pkgsBuildBuild.rustc.llvmPackages; # Force the use of lld and other llvm tools for LTO llvmPackages = llvmPackages0.override { bootBintoolsNoLibc = null; bootBintools = null; }; + llvmPackagesBuildBuild = llvmPackagesBuildBuild0.override { + bootBintoolsNoLibc = null; + bootBintools = null; + }; # LTO requires LLVM bintools including ld.lld and llvm-ar. buildStdenv = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override { - inherit (llvmPackages) bintools; + bintools = if ltoSupport then buildPackages.rustc.llvmPackages.bintools else stdenv.cc.bintools; }); # Compile the wasm32 sysroot to build the RLBox Sandbox @@ -193,10 +199,15 @@ buildStdenv.mkDerivation ({ # two patches. patchFlags = [ "-p1" "-l" ]; + # if not explicitly set, wrong cc from buildStdenv would be used + HOST_CC = "${llvmPackagesBuildBuild.stdenv.cc}/bin/cc"; + HOST_CXX = "${llvmPackagesBuildBuild.stdenv.cc}/bin/c++"; + nativeBuildInputs = [ autoconf cargo - llvmPackages.llvm # llvm-objdump + gnum4 + llvmPackagesBuildBuild.bintools makeWrapper nodejs perl @@ -273,13 +284,16 @@ buildStdenv.mkDerivation ({ export MOZILLA_OFFICIAL=1 ''; + # firefox has a different definition of configurePlatforms from nixpkgs, see configureFlags + configurePlatforms = [ ]; + configureFlags = [ "--disable-tests" "--disable-updater" "--enable-application=${application}" "--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}" "--enable-system-pixman" - "--with-libclang-path=${llvmPackages.libclang.lib}/lib" + "--with-libclang-path=${llvmPackagesBuildBuild.libclang.lib}/lib" "--with-system-ffi" "--with-system-icu" "--with-system-jpeg" @@ -290,6 +304,9 @@ buildStdenv.mkDerivation ({ "--with-system-png" # needs APNG support "--with-system-webp" "--with-system-zlib" + # for firefox, host is buildPlatform, target is hostPlatform + "--host=${buildStdenv.buildPlatform.config}" + "--target=${buildStdenv.hostPlatform.config}" ] # LTO is done using clang and lld on Linux. ++ lib.optionals ltoSupport [ @@ -332,7 +349,6 @@ buildStdenv.mkDerivation ({ fontconfig freetype glib - gnum4 gtk3 icu libffi diff --git a/pkgs/misc/sndio/default.nix b/pkgs/misc/sndio/default.nix index 7b5774d8054..ea2229f264e 100644 --- a/pkgs/misc/sndio/default.nix +++ b/pkgs/misc/sndio/default.nix @@ -11,6 +11,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; buildInputs = lib.optional stdenv.hostPlatform.isLinux alsa-lib; + configurePlatforms = []; postInstall = '' install -Dm644 contrib/sndiod.service $out/lib/systemd/system/sndiod.service diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 984834fb16e..4446eabbccb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26447,11 +26447,7 @@ with pkgs; filezilla = callPackage ../applications/networking/ftp/filezilla { }; - buildMozillaMach = - let callPackage = newScope { - inherit (rustPackages) cargo rustc; - }; - in opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) {}; + buildMozillaMach = opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) {}; firefoxPackages = recurseIntoAttrs (callPackage ../applications/networking/browsers/firefox/packages.nix {}); From 4abc8088b7c4c6c7d87a9b65ed10461bcdd85266 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 13 May 2022 07:35:12 +0000 Subject: [PATCH 45/62] e2fsprogs: patch for CVE-2022-1304 Did a basic smoke test of e2fsck. --- pkgs/tools/filesystems/e2fsprogs/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/filesystems/e2fsprogs/default.nix b/pkgs/tools/filesystems/e2fsprogs/default.nix index d4c4738be75..7273d805a32 100644 --- a/pkgs/tools/filesystems/e2fsprogs/default.nix +++ b/pkgs/tools/filesystems/e2fsprogs/default.nix @@ -23,15 +23,20 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.isLinux [ fuse ]; # Only use glibc's __GNUC_PREREQ(X,Y) (checks if compiler is gcc version >= X.Y) when using glibc - patches = if stdenv.hostPlatform.libc == "glibc" then null - else [ - (fetchpatch { + patches = [ + (fetchpatch { + name = "CVE-2022-1304.patch"; + url = "https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/patch/?id=ab51d587bb9b229b1fade1afd02e1574c1ba5c76"; + sha256 = "sha256-YEEow34/81NBOc6F6FS6i505FCQ7GHeIz0a0qWNs7Fg="; + }) + ] ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ + (fetchpatch { url = "https://raw.githubusercontent.com/void-linux/void-packages/9583597eb3e6e6b33f61dbc615d511ce030bc443/srcpkgs/e2fsprogs/patches/fix-glibcism.patch"; sha256 = "1gfcsr0i3q8q2f0lqza8na0iy4l4p3cbii51ds6zmj0y4hz2dwhb"; excludes = [ "lib/ext2fs/hashmap.h" ]; extraPrefix = ""; - }) - ]; + }) + ]; postPatch = '' # Remove six failing tests From 5d15a099b94be16ee619053ed6bcbddefd561a19 Mon Sep 17 00:00:00 2001 From: Maxine Aubrey Date: Fri, 13 May 2022 22:54:42 +0200 Subject: [PATCH 46/62] gtk4: patch fixing g-c-c crashes --- pkgs/development/libraries/gtk/4.x.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/libraries/gtk/4.x.nix b/pkgs/development/libraries/gtk/4.x.nix index e59e471a51e..a93459c1f87 100644 --- a/pkgs/development/libraries/gtk/4.x.nix +++ b/pkgs/development/libraries/gtk/4.x.nix @@ -2,6 +2,7 @@ , stdenv , substituteAll , fetchurl +, fetchpatch , pkg-config , gettext , graphene @@ -77,6 +78,15 @@ stdenv.mkDerivation rec { sha256 = "pXrNDkSCmBcA/fhllsdBPLYe9H915HR/2oCegjG42Ww="; }; + patches = [ + # Fix GNOME Control Center crash. + # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4670 + (fetchpatch { + url = "https://gitlab.gnome.org/GNOME/gtk/-/commit/ae0166973795e750f08b89f9f0ef974d7ac48bc7.patch"; + sha256 = "qPOplocE+RcTFIEveJe8YLKiUpe7o6CiA834rZpS0Fs="; + }) + ]; + nativeBuildInputs = [ gettext gobject-introspection From 20c371f91e48412ca219c1c7b5249da4ead329bc Mon Sep 17 00:00:00 2001 From: Maxine Aubrey Date: Fri, 13 May 2022 22:57:22 +0200 Subject: [PATCH 47/62] gtk3: 3.24.33 -> 3.24.33-2022-03-11 --- pkgs/development/libraries/gtk/3.x.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 5e0dcf6ce03..82332840e48 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -1,7 +1,7 @@ { lib , stdenv , substituteAll -, fetchurl +, fetchzip , pkg-config , gettext , docbook-xsl-nons @@ -60,7 +60,7 @@ in stdenv.mkDerivation rec { pname = "gtk+3"; - version = "3.24.33"; + version = "3.24.33-2022-03-11"; outputs = [ "out" "dev" ] ++ lib.optional withGtkDoc "devdoc"; outputBin = "dev"; @@ -70,9 +70,9 @@ stdenv.mkDerivation rec { gtkCleanImmodulesCache ]; - src = fetchurl { - url = "mirror://gnome/sources/gtk+/${lib.versions.majorMinor version}/gtk+-${version}.tar.xz"; - sha256 = "sha256-WIsGUi4l0VeemJtvnYob2/L+E83gGgTpBP80aiJeeAE="; + src = fetchzip { + url = "https://gitlab.gnome.org/GNOME/gtk/-/archive/9d1d2f0a6643570274121fc1473e46a6edc2e32d/gtk-9d1d2f0a6643570274121fc1473e46a6edc2e32d.tar.gz"; + sha256 = "sha256-+K1Kp3Sklrj/Ly0pSktfQwfcrIKpbf05NQbMDhWJZNI="; }; patches = [ From d5cf6ab1b15a7c461d2000bbfdf250f120f19b40 Mon Sep 17 00:00:00 2001 From: midchildan Date: Mon, 16 May 2022 02:40:19 +0900 Subject: [PATCH 48/62] pandas: fix darwin build --- pkgs/development/python-modules/pandas/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/python-modules/pandas/default.nix b/pkgs/development/python-modules/pandas/default.nix index 5188ce63795..582d0c815a7 100644 --- a/pkgs/development/python-modules/pandas/default.nix +++ b/pkgs/development/python-modules/pandas/default.nix @@ -103,6 +103,10 @@ buildPythonPackage rec { ] ++ lib.optionals stdenv.isDarwin [ "test_locale" "test_clipboard" + # ValueError: cannot reindex on an axis with duplicate labels + # + # Attempts to reproduce this problem outside of Hydra failed. + "test_reindex_timestamp_with_fold" ]; # Tests have relative paths, and need to reference compiled C extensions From 408492b2346c2fd2675884792e614b9faa7f25d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 6 May 2022 01:21:16 +0200 Subject: [PATCH 49/62] python310Packages.python-mimeparse: execute tests --- .../development/python-modules/python-mimeparse/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/python-mimeparse/default.nix b/pkgs/development/python-modules/python-mimeparse/default.nix index ccc8dc78f44..ab91a5d5e2e 100644 --- a/pkgs/development/python-modules/python-mimeparse/default.nix +++ b/pkgs/development/python-modules/python-mimeparse/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, pytestCheckHook }: buildPythonPackage rec { @@ -12,8 +13,9 @@ buildPythonPackage rec { sha256 = "76e4b03d700a641fd7761d3cd4fdbbdcd787eade1ebfac43f877016328334f78"; }; - # error: invalid command 'test' - doCheck = false; + checkInputs = [ + pytestCheckHook + ]; meta = with lib; { description = "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges"; From 92f4c6ed823ce10c484daa6582a908c5ae9ad61b Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Tue, 17 May 2022 05:45:38 -0400 Subject: [PATCH 50/62] lua: fix on darwin by using makeBinaryWrapper (#172749) --- pkgs/development/interpreters/lua-5/default.nix | 6 +++++- pkgs/development/interpreters/lua-5/interpreter.nix | 1 + pkgs/tools/typesetting/sile/default.nix | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix index 3e36f77dab4..5230a46afef 100644 --- a/pkgs/development/interpreters/lua-5/default.nix +++ b/pkgs/development/interpreters/lua-5/default.nix @@ -1,10 +1,11 @@ # similar to interpreters/python/default.nix -{ stdenv, lib, callPackage, fetchurl, fetchpatch }: +{ stdenv, lib, callPackage, fetchurl, fetchpatch, makeBinaryWrapper }: rec { lua5_4 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "4"; patch = "3"; }; hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq"; + makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch; }; @@ -16,6 +17,7 @@ rec { lua5_3 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "3"; patch = "6"; }; hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw"; + makeWrapper = makeBinaryWrapper; patches = lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ]; @@ -29,6 +31,7 @@ rec { lua5_2 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "2"; patch = "4"; }; hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; + makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch; }; @@ -40,6 +43,7 @@ rec { lua5_1 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "1"; patch = "5"; }; hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; + makeWrapper = makeBinaryWrapper; patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch) ++ [ ./CVE-2014-5461.patch ]; }; diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index de61714f242..1fb56851ce5 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -126,6 +126,7 @@ self = stdenv.mkDerivation rec { passthru = rec { buildEnv = callPackage ./wrapper.nix { lua = self; + inherit makeWrapper; inherit (luaPackages) requiredLuaModules; }; withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;}; diff --git a/pkgs/tools/typesetting/sile/default.nix b/pkgs/tools/typesetting/sile/default.nix index 32374149190..7aca12e341c 100644 --- a/pkgs/tools/typesetting/sile/default.nix +++ b/pkgs/tools/typesetting/sile/default.nix @@ -114,7 +114,6 @@ stdenv.mkDerivation rec { homepage = "https://sile-typesetter.org"; changelog = "https://github.com/sile-typesetter/sile/raw/v${version}/CHANGELOG.md"; platforms = platforms.unix; - broken = stdenv.isDarwin; # https://github.com/NixOS/nixpkgs/issues/23018 maintainers = with maintainers; [ doronbehar alerque ]; license = licenses.mit; }; From c911240e9cc2a7c12c985bd32700b9657b5698a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Wed, 18 May 2022 13:50:23 +0200 Subject: [PATCH 51/62] Revert "Add mingwW64-llvm cross-system." --- lib/systems/examples.nix | 9 -- .../add-lld-ldflags-before.sh | 6 -- .../bintools-wrapper/default.nix | 32 ------ pkgs/build-support/cc-wrapper/default.nix | 5 +- pkgs/development/compilers/gcc/10/default.nix | 4 +- pkgs/development/compilers/gcc/11/default.nix | 4 +- .../development/compilers/gcc/4.8/default.nix | 4 +- .../development/compilers/gcc/4.9/default.nix | 4 +- pkgs/development/compilers/gcc/6/default.nix | 4 +- pkgs/development/compilers/gcc/7/default.nix | 4 +- pkgs/development/compilers/gcc/8/default.nix | 4 +- pkgs/development/compilers/gcc/9/default.nix | 4 +- .../compilers/gcc/common/configure-flags.nix | 2 +- .../compilers/llvm/10/bintools/default.nix | 2 +- .../compilers/llvm/11/bintools/default.nix | 2 +- .../compilers/llvm/12/bintools/default.nix | 2 +- .../compilers/llvm/13/bintools/default.nix | 15 +-- .../development/compilers/llvm/13/default.nix | 3 - .../compilers/llvm/13/libcxx/default.nix | 12 +-- .../compilers/llvm/13/libcxxabi/default.nix | 23 ++--- .../compilers/llvm/13/libunwind/default.nix | 4 +- .../compilers/llvm/14/bintools/default.nix | 15 +-- .../development/compilers/llvm/14/default.nix | 3 - .../compilers/llvm/14/libcxx/default.nix | 12 +-- .../compilers/llvm/14/libcxxabi/default.nix | 29 ++---- .../compilers/llvm/14/libunwind/default.nix | 4 +- .../compilers/llvm/7/bintools/default.nix | 2 +- .../compilers/llvm/8/bintools/default.nix | 2 +- .../compilers/llvm/9/bintools/default.nix | 2 +- .../compilers/llvm/git/bintools/default.nix | 15 +-- .../compilers/llvm/git/default.nix | 3 - .../compilers/llvm/git/libcxx/default.nix | 13 +-- .../compilers/llvm/git/libcxxabi/default.nix | 30 ++---- .../compilers/llvm/git/libunwind/default.nix | 4 +- pkgs/development/libraries/boost/generic.nix | 6 +- pkgs/development/libraries/gmp/6.x.nix | 4 +- pkgs/development/libraries/libffi/default.nix | 6 +- .../libraries/libiconv/default.nix | 2 +- .../libraries/libjpeg-turbo/default.nix | 2 +- .../development/libraries/libxml2/default.nix | 2 +- .../development/libraries/ncurses/default.nix | 8 +- pkgs/development/libraries/zlib/default.nix | 8 +- .../tools/misc/binutils/default.nix | 5 - ...ingw-Create-UAC-manifest-files.mingw.patch | 99 ------------------- .../libtool/0005-Fix-seems-to-be-moved.patch | 24 ----- .../0006-Fix-strict-ansi-vs-posix.patch | 22 ----- ...0007-fix-cr-for-awk-in-configure.all.patch | 22 ----- ...0010-libtool-2.4.2-include-process-h.patch | 24 ----- ...-static-archives-compiler-internal-l.patch | 33 ------- ...files-over-linker-scripts-for-mingw-.patch | 83 ---------------- ...-linking-compiler-support-libraries-.patch | 38 ------- .../0014-Support-llvm-objdump-f-output.patch | 39 -------- .../tools/misc/libtool/libtool2.nix | 14 --- pkgs/os-specific/darwin/binutils/default.nix | 1 - .../os-specific/windows/mingw-w64/default.nix | 26 +---- .../os-specific/windows/mingw-w64/headers.nix | 10 +- pkgs/top-level/all-packages.nix | 4 +- pkgs/top-level/haskell-packages.nix | 1 + 58 files changed, 85 insertions(+), 681 deletions(-) delete mode 100644 pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh delete mode 100644 pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch delete mode 100644 pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch delete mode 100644 pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch delete mode 100644 pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch delete mode 100644 pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch delete mode 100644 pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch delete mode 100644 pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch delete mode 100644 pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch delete mode 100644 pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 19dba63f4f5..997a7a8c273 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -301,15 +301,6 @@ rec { libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain }; - # 64 bit mingw-w64 with a llvm-based toolchain targetting ucrt - # - # Inspired by mstorsjo/llvm-mingw - mingwW64-llvm = { - config = "x86_64-w64-mingw32"; - libc = "ucrt"; - useLLVM = true; - }; - # BSDs amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd; diff --git a/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh deleted file mode 100644 index 265339eb185..00000000000 --- a/pkgs/build-support/bintools-wrapper/add-lld-ldflags-before.sh +++ /dev/null @@ -1,6 +0,0 @@ -# ld.lld has two incompatible command-line drivers: One for the gnu-compatible COFF linker and one for -# the ELF linker. If no emulation is set (with -m), it will default to the ELF linker; -# unfortunately, some configure scripts use `ld --help` to check for certain Windows-specific flags, -# which don't show up in the help for the ELF linker. So we set a default -m here. - -extraBefore+=("-m" "@mtype@") diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index e4fb3c6d6a6..4c2a13da015 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -31,13 +31,6 @@ # Darwin code signing support utilities , postLinkSignHook ? null, signingUtils ? null - -# Linker type -, isLld ? bintools.isLld or false -, isCctools ? bintools.isCctools or false -, isGNU ? bintools.isGNU or false -, isGold ? bintools.isGold or false -, isBfd ? bintools.isBfd or false }: with lib; @@ -120,8 +113,6 @@ stdenv.mkDerivation { passthru = { inherit bintools libc nativeTools nativeLibc nativePrefix; - inherit isLld isCctools isGNU isGold isBfd; - emacsBufferSetup = pkgs: '' ; We should handle propagation here too (mapc @@ -302,11 +293,6 @@ stdenv.mkDerivation { echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags '' - # lld's MinGW driver (e.g. `ld.lld -m i386pep`) does not support the `-z` flag. - + optionalString (targetPlatform.isWindows && isLld) '' - hardening_unsupported_flags+=" relro bindnow" - '' - ## ## GNU specific extra strip flags ## @@ -351,24 +337,6 @@ stdenv.mkDerivation { '' ) - ## - ## Set the default machine type so that $prefix-ld.lld uses the COFF driver for --help - ## - ## Needed because autotools parses --help for linker features... - ## - + optionalString (isLld && stdenv.targetPlatform.isWindows) (let - mtype = - /**/ if targetPlatform.isx86_32 then "i386pe" - else if targetPlatform.isx86_64 then "i386pep" - else if targetPlatform.isAarch32 then "thumb2pe" - else if targetPlatform.isAarch64 then "arm64pe" - else throw "unsupported target arch for lld"; - in '' - export mtype=${mtype} - substituteAll ${./add-lld-ldflags-before.sh} add-local-ldflags-before.sh - cat add-local-ldflags-before.sh >> $out/nix-support/add-local-ldflags-before.sh - '') - ## ## Code signing on Apple Silicon ## diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 6e8e65fbb3f..ac6257220fd 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -18,7 +18,6 @@ , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} , libcxx ? null -, isCompilerRT ? false }: with lib; @@ -147,7 +146,7 @@ stdenv.mkDerivation { # Binutils, and Apple's "cctools"; "bintools" as an attempt to find an # unused middle-ground name that evokes both. inherit bintools; - inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT; + inherit libc nativeTools nativeLibc nativePrefix isGNU isClang; emacsBufferSetup = pkgs: '' ; We should handle propagation here too @@ -480,8 +479,6 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" pic" '' + optionalString targetPlatform.isMinGW '' hardening_unsupported_flags+=" stackprotector fortify" - '' + optionalString (targetPlatform.isWindows && isClang) '' - hardening_unsupported_flags+=" pic" '' + optionalString targetPlatform.isAvr '' hardening_unsupported_flags+=" stackprotector pic" '' + optionalString (targetPlatform.libc == "newlib") '' diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 187d43b5091..88d4831812f 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -79,7 +79,7 @@ let majorVersion = "10"; }); /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -292,7 +292,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index 806c09c16cf..607c9eeac2f 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -83,7 +83,7 @@ let majorVersion = "11"; ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -297,7 +297,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 03646c65220..8cd0d3c9ce8 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -114,7 +114,7 @@ let majorVersion = "4"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -316,7 +316,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index d3bd1b70641..b3d0f8d5d50 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -130,7 +130,7 @@ let majorVersion = "4"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -332,7 +332,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index d3007f17063..62b46df1ab0 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -111,7 +111,7 @@ let majorVersion = "6"; javaAwtGtk = langJava && x11Support; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -345,7 +345,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 1eb23061f64..1abf14c8a8c 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -87,7 +87,7 @@ let majorVersion = "7"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -301,7 +301,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index b6c37c77dd0..2dd265b648c 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -71,7 +71,7 @@ let majorVersion = "8"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -280,7 +280,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 09e4ef3fdff..2ecfa1bb1cf 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -98,7 +98,7 @@ let majorVersion = "9"; ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -311,7 +311,7 @@ stdenv.mkDerivation ({ }; } -// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) { +// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; } diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index 100d172403a..bebf91114d7 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -41,7 +41,7 @@ let inherit (stdenv) buildPlatform hostPlatform targetPlatform; - crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; + crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) diff --git a/pkgs/development/compilers/llvm/10/bintools/default.nix b/pkgs/development/compilers/llvm/10/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/10/bintools/default.nix +++ b/pkgs/development/compilers/llvm/10/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/11/bintools/default.nix b/pkgs/development/compilers/llvm/11/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/11/bintools/default.nix +++ b/pkgs/development/compilers/llvm/11/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/12/bintools/default.nix b/pkgs/development/compilers/llvm/12/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/12/bintools/default.nix +++ b/pkgs/development/compilers/llvm/12/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/13/bintools/default.nix b/pkgs/development/compilers/llvm/13/bintools/default.nix index dcdad1af46f..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/13/bintools/default.nix +++ b/pkgs/development/compilers/llvm/13/bintools/default.nix @@ -1,17 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version, lib }: +{ runCommand, stdenv, llvm, lld, version }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { - preferLocalBuild = true; - passthru = { - isLld = true; - targetPrefix = prefix; - }; -} ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" { ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' + lib.optionalString stdenv.targetPlatform.isWindows '' - ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres - ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool -'') +'' diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index b72d4244285..874be111ade 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -168,7 +168,6 @@ let '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -183,7 +182,6 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags echo "-nostdlib++" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -197,7 +195,6 @@ let echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/13/libcxx/default.nix b/pkgs/development/compilers/llvm/13/libcxx/default.nix index c5b8293676a..0ce73ed97af 100644 --- a/pkgs/development/compilers/llvm/13/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxx/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version -, libcxxabi, libunwind +, libcxxabi , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); + buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -41,13 +41,7 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] - ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" - ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" - "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" - ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; + ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 66ec96e3518..0bdbee07b73 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -2,14 +2,9 @@ , enableShared ? !stdenv.hostPlatform.isStatic , standalone ? stdenv.hostPlatform.useLLVM or false , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm -}: let - # lld doesn't support unresolved references on Windows https://github.com/llvm/llvm-project/issues/55245 - semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; +}: - enableShared' = enableShared && !semi-static; - - useLLVMUnwinder = standalone && withLibunwind; -in stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "libcxxabi"; inherit version; @@ -31,24 +26,18 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ]; buildInputs = lib.optional withLibunwind libunwind; - passthru = { inherit semi-static useLLVMUnwinder; }; - cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" ] ++ lib.optionals standalone [ "-DLLVM_ENABLE_LIBCXX=ON" - ] ++ lib.optionals useLLVMUnwinder [ + ] ++ lib.optionals (standalone && withLibunwind) [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared') [ + ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ] ++ lib.optionals semi-static [ - "-DLIBCXX_ENABLE_SHARED=ON" - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" - ] ++ lib.optional stdenv.cc.isCompilerRT - "-DLIBCXXABI_USE_COMPILER_RT=ON"; + ]; installPhase = if stdenv.isDarwin then '' @@ -67,7 +56,7 @@ in stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared' '' + '' + lib.optionalString enableShared '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 diff --git a/pkgs/development/compilers/llvm/13/libunwind/default.nix b/pkgs/development/compilers/llvm/13/libunwind/default.nix index c6cc148239e..b6017e74172 100644 --- a/pkgs/development/compilers/llvm/13/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/13/libunwind/default.nix @@ -17,9 +17,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = - lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" - ++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; + cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix index dcdad1af46f..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/14/bintools/default.nix +++ b/pkgs/development/compilers/llvm/14/bintools/default.nix @@ -1,17 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version, lib }: +{ runCommand, stdenv, llvm, lld, version }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { - preferLocalBuild = true; - passthru = { - isLld = true; - targetPrefix = prefix; - }; -} ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" { ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' + lib.optionalString stdenv.targetPlatform.isWindows '' - ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres - ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool -'') +'' diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 5df6bcae47e..b18b558d5b8 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -169,7 +169,6 @@ let (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; - isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -185,7 +184,6 @@ let "-B${targetLlvmLibraries.compiler-rt}/lib" "-nostdlib++" ]; - isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -200,7 +198,6 @@ let "-rtlib=compiler-rt" "-B${targetLlvmLibraries.compiler-rt}/lib" ]; - isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix index 8bdc7aa7967..8891a69937a 100644 --- a/pkgs/development/compilers/llvm/14/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand , cmake, python3, fixDarwinDylibNames, version -, libcxxabi, libunwind +, libcxxabi , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); + buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -57,13 +57,7 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] - ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" - ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" - "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" - ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; + ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index c31c4c90ad2..07aaa2737ce 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix @@ -2,17 +2,9 @@ , monorepoSrc, runCommand , cxx-headers, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic -}: let - withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm; +}: - semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; - - enableShared' = enableShared && !semi-static; - - standalone = stdenv.hostPlatform.useLLVM or false; - - useLLVMUnwinder = standalone && withLibunwind; -in stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "libcxxabi"; inherit version; @@ -43,26 +35,19 @@ in stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional withLibunwind libunwind; - - passthru = { inherit semi-static useLLVMUnwinder; }; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" - ] ++ lib.optionals standalone [ + ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" - ] ++ lib.optionals useLLVMUnwinder [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared') [ + ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ] ++ lib.optionals semi-static [ - "-DLIBCXX_ENABLE_SHARED=ON" - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" - ] ++ lib.optional stdenv.cc.isCompilerRT - "-DLIBCXXABI_USE_COMPILER_RT=ON"; + ]; installPhase = if stdenv.isDarwin then '' @@ -81,7 +66,7 @@ in stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared' '' + '' + lib.optionalString enableShared '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix index 7940fa4b3a1..109b92f1e02 100644 --- a/pkgs/development/compilers/llvm/14/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/14/libunwind/default.nix @@ -31,9 +31,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = - lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" - ++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; + cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst diff --git a/pkgs/development/compilers/llvm/7/bintools/default.nix b/pkgs/development/compilers/llvm/7/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/7/bintools/default.nix +++ b/pkgs/development/compilers/llvm/7/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/8/bintools/default.nix b/pkgs/development/compilers/llvm/8/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/8/bintools/default.nix +++ b/pkgs/development/compilers/llvm/8/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/9/bintools/default.nix b/pkgs/development/compilers/llvm/9/bintools/default.nix index 5735bf5a685..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/9/bintools/default.nix +++ b/pkgs/development/compilers/llvm/9/bintools/default.nix @@ -5,7 +5,7 @@ let if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } '' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) diff --git a/pkgs/development/compilers/llvm/git/bintools/default.nix b/pkgs/development/compilers/llvm/git/bintools/default.nix index dcdad1af46f..53f7941e336 100644 --- a/pkgs/development/compilers/llvm/git/bintools/default.nix +++ b/pkgs/development/compilers/llvm/git/bintools/default.nix @@ -1,17 +1,11 @@ -{ runCommand, stdenv, llvm, lld, version, lib }: +{ runCommand, stdenv, llvm, lld, version }: let prefix = if stdenv.hostPlatform != stdenv.targetPlatform then "${stdenv.targetPlatform.config}-" else ""; -in runCommand "llvm-binutils-${version}" { - preferLocalBuild = true; - passthru = { - isLld = true; - targetPrefix = prefix; - }; -} ('' +in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' mkdir -p $out/bin for prog in ${lld}/bin/*; do ln -s $prog $out/bin/${prefix}$(basename $prog) @@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" { ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip ln -s ${lld}/bin/lld $out/bin/${prefix}ld -'' + lib.optionalString stdenv.targetPlatform.isWindows '' - ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres - ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool -'') +'' diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 6b96190c042..0f45acffb27 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -168,7 +168,6 @@ let '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoLibcxx = wrapCCWith rec { @@ -183,7 +182,6 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags echo "-nostdlib++" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoLibc = wrapCCWith rec { @@ -197,7 +195,6 @@ let echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; - isCompilerRT = true; }; clangNoCompilerRt = wrapCCWith rec { diff --git a/pkgs/development/compilers/llvm/git/libcxx/default.nix b/pkgs/development/compilers/llvm/git/libcxx/default.nix index 774bd8a9a9b..8891a69937a 100644 --- a/pkgs/development/compilers/llvm/git/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxx/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand , cmake, python3, fixDarwinDylibNames, version -, libcxxabi, libunwind +, libcxxabi , enableShared ? !stdenv.hostPlatform.isStatic # If headersOnly is true, the resulting package would only include the headers. @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); + buildInputs = lib.optionals (!headersOnly) [ libcxxabi ]; cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" @@ -57,14 +57,7 @@ stdenv.mkDerivation rec { "-DLIBCXX_ENABLE_THREADS=OFF" "-DLIBCXX_ENABLE_FILESYSTEM=OFF" "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] - ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" - ++ lib.optionals (!headersOnly && libcxxabi.semi-static) [ - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE" - "-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib" - ] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder) - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"; - + ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index 26388e42f22..d64708ab040 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -2,17 +2,7 @@ , monorepoSrc, runCommand , cxx-headers, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic -}: let - withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm; - - semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld; - - enableShared' = enableShared && !semi-static; - - standalone = stdenv.hostPlatform.useLLVM or false; - - useLLVMUnwinder = standalone && withLibunwind; -in +}: stdenv.mkDerivation rec { pname = "libcxxabi"; @@ -45,27 +35,19 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional withLibunwind libunwind; - - passthru = { inherit semi-static useLLVMUnwinder; }; - + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" - ] ++ lib.optionals standalone [ + ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" - ] ++ lib.optionals useLLVMUnwinder [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF" "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared') [ + ] ++ lib.optionals (!enableShared) [ "-DLIBCXXABI_ENABLE_SHARED=OFF" - ] ++ lib.optionals semi-static [ - "-DLIBCXX_ENABLE_SHARED=ON" - "-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON" - ] ++ lib.optional stdenv.cc.isCompilerRT - "-DLIBCXXABI_USE_COMPILER_RT=ON"; + ]; installPhase = if stdenv.isDarwin then '' @@ -84,7 +66,7 @@ stdenv.mkDerivation rec { install -d -m 755 $out/include $out/lib install -m 644 lib/libc++abi.a $out/lib install -m 644 ../include/cxxabi.h $out/include - '' + lib.optionalString enableShared' '' + '' + lib.optionalString enableShared '' install -m 644 lib/libc++abi.so.1.0 $out/lib ln -s libc++abi.so.1.0 $out/lib/libc++abi.so ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 diff --git a/pkgs/development/compilers/llvm/git/libunwind/default.nix b/pkgs/development/compilers/llvm/git/libunwind/default.nix index 30874588d8d..c6d9eda5e47 100644 --- a/pkgs/development/compilers/llvm/git/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/git/libunwind/default.nix @@ -31,9 +31,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = - lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF" - ++ lib.optional stdenv.cc.isCompilerRT "-DLIBUNWIND_USE_COMPILER_RT=TRUE"; + cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; meta = llvm_meta // { # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index d54cd24492d..b9bdec0cd07 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -9,7 +9,7 @@ , enableDebug ? false , enableSingleThreaded ? false , enableMultiThreaded ? true -, enableShared ? !(with stdenv.hostPlatform; isStatic || isMinGW) # problems for now +, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now , enableStatic ? !enableShared , enablePython ? false , enableNumpy ? false @@ -103,7 +103,7 @@ let ++ optional (toolset != null) "toolset=${toolset}" ++ optional (!enablePython) "--without-python" ++ optional needUserConfig "--user-config=user-config.jam" - ++ optionals (stdenv.hostPlatform.isMinGW) [ + ++ optionals (stdenv.hostPlatform.libc == "msvcrt") [ "threadapi=win32" ] ++ extraB2Args ); @@ -257,7 +257,7 @@ stdenv.mkDerivation { # Make boost header paths relative so that they are not runtime dependencies cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; - '' + optionalString (stdenv.hostPlatform.isMinGW) '' + '' + optionalString (stdenv.hostPlatform.libc == "msvcrt") '' $RANLIB "$out/lib/"*.a ''; diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix index 838fe432caf..af4f15a151f 100644 --- a/pkgs/development/libraries/gmp/6.x.nix +++ b/pkgs/development/libraries/gmp/6.x.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchurl, m4 , cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm -, buildPackages, autoreconfHook +, buildPackages , withStatic ? stdenv.hostPlatform.isStatic }: @@ -29,7 +29,7 @@ let self = stdenv.mkDerivation rec { passthru.static = self.out; depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.hostPlatform.isWindows autoreconfHook; + nativeBuildInputs = [ m4 ]; configureFlags = [ "--with-pic" diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix index 890fb9f62e4..6a22d585fbc 100644 --- a/pkgs/development/libraries/libffi/default.nix +++ b/pkgs/development/libraries/libffi/default.nix @@ -32,9 +32,7 @@ stdenv.mkDerivation rec { # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 "--disable-exec-static-tramp" - ] ++ - # ld.lld on Windows doesn't support --version-script. - lib.optional (stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld) "--disable-symvers"; + ]; preCheck = '' # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. @@ -47,8 +45,6 @@ stdenv.mkDerivation rec { checkInputs = [ dejagnu ]; - nativeBuildInputs = lib.optional stdenv.hostPlatform.isWindows autoreconfHook; - meta = with lib; { description = "A foreign function call interface library"; longDescription = '' diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix index 8051cf319e9..5be5ecfd82e 100644 --- a/pkgs/development/libraries/libiconv/default.nix +++ b/pkgs/development/libraries/libiconv/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { ]; postPatch = - lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isMinGW) || stdenv.cc.nativeLibc) + lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc) '' sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h '' diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix index 2e400f9a31c..75ec20545ca 100644 --- a/pkgs/development/libraries/libjpeg-turbo/default.nix +++ b/pkgs/development/libraries/libjpeg-turbo/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { # This is needed by freeimage patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ] - ++ lib.optional (stdenv.hostPlatform.isMinGW) + ++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt") ./mingw-boolean.patch; outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ]; diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 8672889d5f0..f0b4d0baf4f 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -14,7 +14,7 @@ , pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform , icuSupport ? false , icu -, enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic , enableStatic ? !enableShared , gnome }: diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index a661f5f216c..2740b95986c 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -46,13 +46,7 @@ stdenv.mkDerivation rec { ]; # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: - CFLAGS = - # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris: - /**/ if stdenv.isSunOS then "-D_XOPEN_SOURCE_EXTENDED" - # ucrt doesn't support X_OK to access() without this flag - else if stdenv.hostPlatform.libc == "ucrt" then "-D__USE_MINGW_ACCESS" - else ""; - + CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED"; depsBuildBuild = [ buildPackages.stdenv.cc diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index ed7ff17dc3d..9b9938746ca 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation (rec { '' # Non-typical naming confuses libtool which then refuses to use zlib's DLL # in some cases, e.g. when compiling libpng. - + lib.optionalString (stdenv.hostPlatform.isMinGW && shared) '' + + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && shared) '' ln -s zlib1.dll $out/bin/libz.dll ''; @@ -101,7 +101,7 @@ stdenv.mkDerivation (rec { dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static; configurePlatforms = []; - installFlags = lib.optionals (stdenv.hostPlatform.isMinGW) [ + installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ "BINARY_PATH=$(out)/bin" "INCLUDE_PATH=$(dev)/include" "LIBRARY_PATH=$(out)/lib" @@ -112,7 +112,7 @@ stdenv.mkDerivation (rec { makeFlags = [ "PREFIX=${stdenv.cc.targetPrefix}" - ] ++ lib.optionals (stdenv.hostPlatform.isMinGW) [ + ] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ "-f" "win32/Makefile.gcc" ] ++ lib.optionals shared [ # Note that as of writing (zlib 1.2.11), this flag only has an effect @@ -134,6 +134,6 @@ stdenv.mkDerivation (rec { preConfigure = '' export CHOST=${stdenv.hostPlatform.config} ''; -} // lib.optionalAttrs (stdenv.hostPlatform.isMinGW) { +} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") { dontConfigure = true; }) diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 185d9f609c8..88b6d3a705e 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -203,11 +203,6 @@ stdenv.mkDerivation { inherit targetPrefix; hasGold = enableGold; isGNU = true; - # TODO Currently platform.linker == "gold" has no effect outside - # of building GHC. If/when that's fixed, these flags should - # probably move to the invocations of bintools-wrapper - isGold = false; - isBfd = true; }; meta = with lib; { diff --git a/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch b/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch deleted file mode 100644 index 310002b8231..00000000000 --- a/pkgs/development/tools/misc/libtool/0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch +++ /dev/null @@ -1,99 +0,0 @@ -[PATCH 2/6] [cygwin|mingw] Create UAC manifest files. - -* build-aux/ltmain.in (func_emit_exe_manifest): New function. -(func_mode_link) [cygwin|mingw]: Create manifest files for wrapper -and target exe when target name matches heuristic that triggers -UAC problems for newer win32 OSs. Clean up $cwrapper.manifest on -error. Ensure manifest files have executable permission. -(func_mode_uninstall): Clean up manifest files. -Various reports by Eric Blake, Kai Tietz, and Cesar Strauss. ---- - build-auxltmain.in | 50 ++++++++++++++++++++++++++++++++++++++++++- - 1 files changed, 48 insertions(+), 2 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index 0418007..1821779 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -4277,6 +4277,41 @@ EOF - } - # end: func_emit_cwrapperexe_src - -+# func_emit_exe_manifest -+# emit a Win32 UAC manifest for executable on stdout -+# Must ONLY be called from within func_mode_link because -+# it depends on a number of variable set therein. -+func_emit_exe_manifest () -+{ -+ cat < -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+EOF -+} -+ - # func_win32_import_lib_p ARG - # True if ARG is an import lib, as indicated by $file_magic_cmd - func_win32_import_lib_p () -@@ -8237,7 +8272,7 @@ EOF - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper -- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 -+ trap "$RM $cwrappersource $cwrapper $cwrapper.manifest; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - -@@ -8257,6 +8292,16 @@ EOF - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host"; then -+ # Create the UAC manifests first if necessary (but the -+ # manifest files must have executable permission regardless). -+ case $output_name in -+ *instal*|*patch*|*setup*|*update*) -+ func_emit_exe_manifest > $cwrapper.manifest -+ func_emit_exe_manifest > $output_path/$objdir/$output_name.exe.manifest -+ chmod +x $cwrapper.manifest -+ chmod +x $output_path/$objdir/$output_name.exe.manifest -+ ;; -+ esac - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result -@@ -8777,8 +8822,9 @@ func_mode_uninstall () - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.$objext" -+ func_append rmfiles " ${name}.manifest $objdir/${name}.manifest" - if test yes = "$fast_install" && test -n "$relink_command"; then -- func_append rmfiles " $odir/lt-$name" -+ func_append rmfiles " $odir/lt-$name $objdir/lt-${name}.manifest" - fi - if test "X$noexename" != "X$name"; then - func_append rmfiles " $odir/lt-$noexename.c" --- -1.7.1 - diff --git a/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch b/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch deleted file mode 100644 index 73c249db391..00000000000 --- a/pkgs/development/tools/misc/libtool/0005-Fix-seems-to-be-moved.patch +++ /dev/null @@ -1,24 +0,0 @@ -[PATCH 5/6] Fix "seems to be moved" -* build-aux/ltmain.in (func_mode_link): Compare files by inode -to fix "seems to be moved" warning. ---- - build-aux/ltmain.in | 4 +++- - 1 files changed, 3 insertions(+), 1 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index af46cb8..244bb5b 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -6283,7 +6283,9 @@ func_mode_link () - eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "'$deplib' is not a valid libtool archive" -- test "$absdir" != "$libdir" && \ -+ abs_inode=`ls -i "$deplib" | awk '{print $1}'` -+ lib_inode=`ls -i "$libdir/$(basename $deplib)" | awk '{print $1}'` -+ test "$abs_inode" != "$lib_inode" && \ - func_warning "'$deplib' seems to be moved" - - path=-L$absdir --- -1.7.0.2.msysgit.0 \ No newline at end of file diff --git a/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch b/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch deleted file mode 100644 index 486ad76112e..00000000000 --- a/pkgs/development/tools/misc/libtool/0006-Fix-strict-ansi-vs-posix.patch +++ /dev/null @@ -1,22 +0,0 @@ -[PATCH 6/6] Fix STRICT_ANSI vs POSIX -* build-aux/ltmain.in (func_mode_link): Also check for _POSIX -as well as __STRICT_ANSI__ to avoid re-definitions. ---- - build-aux/ltmain.in | 4 +++- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index af46cb8..244bb5b 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -3382,7 +3382,7 @@ - - /* declarations of non-ANSI functions */ - #if defined __MINGW32__ --# ifdef __STRICT_ANSI__ -+# if defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR) || defined(_POSIX_) - int _putenv (const char *); - # endif - #elif defined __CYGWIN__ --- -1.7.0.2.msysgit.0 \ No newline at end of file diff --git a/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch b/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch deleted file mode 100644 index 65d5185a36f..00000000000 --- a/pkgs/development/tools/misc/libtool/0007-fix-cr-for-awk-in-configure.all.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- libtool-2.4.2/configure.orig 2011-10-17 10:18:58.000000000 +0000 -+++ libtool-2.4.2/configure 2013-08-04 19:01:30.220494400 +0000 -@@ -28825,7 +28825,7 @@ - fi - ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` - if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then -- ac_cs_awk_cr='\\r' -+ ac_cs_awk_cr='\r' - else - ac_cs_awk_cr=$ac_cr - fi ---- libtool-2.4.2/libltdl/configure.orig 2011-10-17 10:19:47.000000000 +0000 -+++ libtool-2.4.2/libltdl/configure 2013-08-05 11:49:24.990792500 +0000 -@@ -13574,7 +13574,7 @@ - fi - ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` - if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then -- ac_cs_awk_cr='\\r' -+ ac_cs_awk_cr='\r' - else - ac_cs_awk_cr=$ac_cr - fi diff --git a/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch b/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch deleted file mode 100644 index 82ecf5266b7..00000000000 --- a/pkgs/development/tools/misc/libtool/0010-libtool-2.4.2-include-process-h.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index 0418007..91276c2 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -4163,6 +4163,7 @@ - # include - # include - # ifdef __CYGWIN__ -+# include - # include - # endif - #endif -diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh -index 0418007..91276c2 100644 ---- a/build-aux/ltmain.sh -+++ b/build-aux/ltmain.sh -@@ -4163,6 +4163,7 @@ - # include - # include - # ifdef __CYGWIN__ -+# include - # include - # endif - #endif diff --git a/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch b/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch deleted file mode 100644 index 49cc0706551..00000000000 --- a/pkgs/development/tools/misc/libtool/0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a18473ed4e5574dab899db640b8efeff78939b54 Mon Sep 17 00:00:00 2001 -From: Manoj Gupta -Date: Wed, 10 Oct 2018 10:50:23 +0300 -Subject: [PATCH 1/2] Pick up clang_rt static archives compiler internal - libraries - -Libtool checks only for libraries linked as -l* when trying to -find internal compiler libraries. Clang, however uses the absolute -path to link its internal libraries e.g. compiler_rt. This patch -handles clang's statically linked libraries when finding internal -compiler libraries. -https://crbug.com/749263 -https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866 ---- - m4/libtool.m4 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/m4/libtool.m4 b/m4/libtool.m4 -index b55a6e5..d9322d0 100644 ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -7556,7 +7556,7 @@ if AC_TRY_EVAL(ac_compile); then - for p in `eval "$output_verbose_link_cmd"`; do - case $prev$p in - -- -L* | -R* | -l*) -+ -L* | -R* | -l* | */libclang_rt.*.a) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test x-L = "$p" || --- -2.7.4 - diff --git a/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch b/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch deleted file mode 100644 index 7bdb62dbfb8..00000000000 --- a/pkgs/development/tools/misc/libtool/0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch +++ /dev/null @@ -1,83 +0,0 @@ -From ec15841963ca3aab3bc88fb0932c014337284bfc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Wed, 10 Oct 2018 10:47:21 +0300 -Subject: [PATCH 2/2] Prefer response files over linker scripts for mingw tools - -The GCC/binutils tools support response files just fine, while -lld (impersonating GNU ld) only supports response files, not -linker scripts. Using a linker script as input just to pass a -list of files is overkill for cases when a response file is enough. ---- - build-aux/ltmain.in | 28 ++++++++++++++-------------- - m4/libtool.m4 | 2 ++ - 2 files changed, 16 insertions(+), 14 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index e2fb263..db5d590 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -7932,20 +7932,7 @@ EOF - last_robj= - k=1 - -- if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then -- output=$output_objdir/$output_la.lnkscript -- func_verbose "creating GNU ld script: $output" -- echo 'INPUT (' > $output -- for obj in $save_libobjs -- do -- func_to_tool_file "$obj" -- $ECHO "$func_to_tool_file_result" >> $output -- done -- echo ')' >> $output -- func_append delfiles " $output" -- func_to_tool_file "$output" -- output=$func_to_tool_file_result -- elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then -+ if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then - output=$output_objdir/$output_la.lnk - func_verbose "creating linker input file list: $output" - : > $output -@@ -7964,6 +7951,19 @@ EOF - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" -+ elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then -+ output=$output_objdir/$output_la.lnkscript -+ func_verbose "creating GNU ld script: $output" -+ echo 'INPUT (' > $output -+ for obj in $save_libobjs -+ do -+ func_to_tool_file "$obj" -+ $ECHO "$func_to_tool_file_result" >> $output -+ done -+ echo ')' >> $output -+ func_append delfiles " $output" -+ func_to_tool_file "$output" -+ output=$func_to_tool_file_result - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." -diff --git a/m4/libtool.m4 b/m4/libtool.m4 -index d9322d0..9046a84 100644 ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -5130,6 +5130,7 @@ _LT_EOF - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] -+ _LT_TAGVAR(file_list_spec, $1)='@' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' -@@ -6706,6 +6707,7 @@ if test yes != "$_lt_caught_CXX_error"; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes -+ _LT_TAGVAR(file_list_spec, $1)='@' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' --- -2.7.4 - diff --git a/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch b/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch deleted file mode 100644 index b75b191a7cb..00000000000 --- a/pkgs/development/tools/misc/libtool/0013-Allow-statically-linking-compiler-support-libraries-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b9f77cae8cfbe850e58cac686fcb4d246b5bfc51 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Mon, 19 Aug 2019 13:34:51 +0300 -Subject: [PATCH] Allow statically linking compiler support libraries when - linking a library - -For cases with deplibs_check_method="file_magic ..." (as it is for mingw), -there were previously no way that a static library could be accepted -here. ---- - build-aux/ltmain.in | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index e2fb2633..db4d775c 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -5870,8 +5870,15 @@ func_mode_link () - fi - case $linkmode in - lib) -- # Linking convenience modules into shared libraries is allowed, -- # but linking other static libraries is non-portable. -+ # Linking convenience modules and compiler provided static libraries -+ # into shared libraries is allowed, but linking other static -+ # libraries is non-portable. -+ case $deplib in -+ */libgcc*.$libext | */libclang_rt*.$libext) -+ deplibs="$deplib $deplibs" -+ continue -+ ;; -+ esac - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) --- -2.17.1 - diff --git a/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch b/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch deleted file mode 100644 index d6570502d94..00000000000 --- a/pkgs/development/tools/misc/libtool/0014-Support-llvm-objdump-f-output.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 03dabb6a70847761e65572a2a7b770a3b1b9f123 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= -Date: Mon, 12 Apr 2021 23:44:10 +0200 -Subject: [PATCH] Support llvm-objdump -f output - ---- - build-aux/ltmain.in | 2 +- - m4/libtool.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in -index a9f070a..4a434cc 100644 ---- a/build-aux/ltmain.in -+++ b/build-aux/ltmain.in -@@ -3019,7 +3019,7 @@ func_win32_libid () - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | -- $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then -+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)' >/dev/null; then - case $nm_interface in - "MS dumpbin") - if func_cygming_ms_implib_p "$1" || -diff --git a/m4/libtool.m4 b/m4/libtool.m4 -index 21a7d60..594be9c 100644 ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -3473,7 +3473,7 @@ mingw* | pw32*) - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. -- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' -+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; --- -2.31.1 - diff --git a/pkgs/development/tools/misc/libtool/libtool2.nix b/pkgs/development/tools/misc/libtool/libtool2.nix index e2f4e97993d..3d15752fc0a 100644 --- a/pkgs/development/tools/misc/libtool/libtool2.nix +++ b/pkgs/development/tools/misc/libtool/libtool2.nix @@ -23,20 +23,6 @@ stdenv.mkDerivation rec { # https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html FILECMD = "${file}/bin/file"; - patches = [ - # Patches from msys2 fixing various bugs with useClang platforms - # targeting Windows. Especially https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866 - ./0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch - ./0005-Fix-seems-to-be-moved.patch - ./0006-Fix-strict-ansi-vs-posix.patch - ./0007-fix-cr-for-awk-in-configure.all.patch - ./0010-libtool-2.4.2-include-process-h.patch - ./0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch - ./0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch - ./0013-Allow-statically-linking-compiler-support-libraries-.patch - ./0014-Support-llvm-objdump-f-output.patch - ]; - # Normally we'd use autoreconfHook, but that includes libtoolize. postPatch = '' aclocal -I m4 diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index a25306dcf35..c5bc50cafd7 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -65,7 +65,6 @@ stdenv.mkDerivation { passthru = { inherit targetPrefix; - isCctools = true; }; meta = { diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 02cfd7b04a7..38293e65f70 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,32 +1,14 @@ { lib, stdenv, windows, fetchurl }: let - version = "10.0.0"; - - knownArches = [ "32" "64" "arm32" "arm64" ]; - enabledArch = - if stdenv.targetPlatform.isAarch32 - then "arm32" - else if stdenv.targetPlatform.isAarch64 - then "arm64" - else if stdenv.targetPlatform.isx86_32 - then "32" - else if stdenv.targetPlatform.isx86_64 - then "64" - else null; - archFlags = - if enabledArch == null - then [] # maybe autoconf will save us - else map (arch: lib.enableFeature (arch == enabledArch) "lib${arch}") knownArches; - - crt = stdenv.hostPlatform.libc; + version = "9.0.0"; in stdenv.mkDerivation { pname = "mingw-w64"; inherit version; src = fetchurl { url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2"; - sha256 = "sha256-umtDCu1yxjo3aFMfaj/8Kw/eLFejslFFDc9ImolPCJQ="; + sha256 = "10a15bi4lyfi0k0haj0klqambicwma6yi7vssgbz8prg815vja8r"; }; outputs = [ "out" "dev" ]; @@ -34,8 +16,7 @@ in stdenv.mkDerivation { configureFlags = [ "--enable-idl" "--enable-secure-api" - "--with-default-msvcrt=${crt}" - ] ++ archFlags; + ]; enableParallelBuilding = true; @@ -45,6 +26,5 @@ in stdenv.mkDerivation { meta = { platforms = lib.platforms.windows; - broken = !(lib.elem crt [ "msvcrt" "ucrt" ]); }; } diff --git a/pkgs/os-specific/windows/mingw-w64/headers.nix b/pkgs/os-specific/windows/mingw-w64/headers.nix index 13ba330ef2a..1fd27a8c457 100644 --- a/pkgs/os-specific/windows/mingw-w64/headers.nix +++ b/pkgs/os-specific/windows/mingw-w64/headers.nix @@ -1,8 +1,6 @@ { stdenvNoCC, mingw_w64 }: -let - crt = stdenvNoCC.hostPlatform.libc; -in stdenvNoCC.mkDerivation { +stdenvNoCC.mkDerivation { name = "${mingw_w64.name}-headers"; inherit (mingw_w64) src meta; @@ -10,10 +8,4 @@ in stdenvNoCC.mkDerivation { cd mingw-w64-headers ''; - configureFlags = [ - "--enable-idl" - "--enable-secure-api" - "--with-default-msvcrt=${crt}" - ]; - } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3248f770f33..b6a1f5e4570 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17405,7 +17405,7 @@ with pkgs; # These are used when buiding compiler-rt / libgcc, prior to building libc. preLibcCrossHeaders = let inherit (stdenv.targetPlatform) libc; - in if libc == "msvcrt" || libc == "ucrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers + in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross else null; @@ -17424,7 +17424,7 @@ with pkgs; else if name == "newlib" then targetPackages.newlibCross or newlibCross else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross else if name == "musl" then targetPackages.muslCross or muslCross - else if name == "msvcrt" || name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 + else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if name == "libSystem" then if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index fac1d546832..c46a7f1bcd2 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -145,6 +145,7 @@ in { inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12; llvmPackages = pkgs.llvmPackages_12; + libffi = pkgs.libffi; }; ghcjs = compiler.ghcjs810; From 39ef6322b5b9dcddaee2a1caf7b07c09747784a2 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 18 May 2022 02:57:29 +0200 Subject: [PATCH 52/62] openldap: 2.4.58 -> 2.6.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_5/ANNOUNCEMENT https://git.openldap.org/openldap/openldap/-/blob/OPENLDAP_REL_ENG_2_6/ANNOUNCEMENT Co-Authored-By: Andreas Schrägle --- .../from_md/release-notes/rl-2205.section.xml | 12 ++ .../manual/release-notes/rl-2205.section.md | 2 + .../libraries/openldap/default.nix | 120 ++++++++++-------- 3 files changed, 84 insertions(+), 50 deletions(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml index c0f36fcfd35..c4f7d64d97b 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml @@ -672,6 +672,18 @@ the IPv6 loopback address (::1).
+ + + openldap (and therefore the slapd LDAP + server) were updated to version 2.6.2. The project introduced + backwards-incompatible changes, namely the removal of the bdb, + hdb, ndb, and shell backends in slapd. Therefore before + updating, dump your database slapcat -n 1 + in LDIF format, and reimport it after updating your + services.openldap.settings, which + represents your cn=config. + + openssh has been update to 8.9p1, changing diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md index 5902957a535..f07439d34a1 100644 --- a/nixos/doc/manual/release-notes/rl-2205.section.md +++ b/nixos/doc/manual/release-notes/rl-2205.section.md @@ -238,6 +238,8 @@ In addition to numerous new and upgraded packages, this release has the followin - In the ncdns module, the default value of `services.ncdns.address` has been changed to the IPv6 loopback address (`::1`). +- `openldap` (and therefore the slapd LDAP server) were updated to version 2.6.2. The project introduced backwards-incompatible changes, namely the removal of the bdb, hdb, ndb, and shell backends in slapd. Therefore before updating, dump your database `slapcat -n 1` in LDIF format, and reimport it after updating your `services.openldap.settings`, which represents your `cn=config`. + - `openssh` has been update to 8.9p1, changing the FIDO security key middleware interface. - `git` no longer hardcodes the path to openssh' ssh binary to reduce the amount of rebuilds. If you are using git with ssh remotes and do not have a ssh binary in your enviroment consider adding `openssh` to it or switching to `gitFull`. diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix index 4ecfc569ae1..44afffc7204 100644 --- a/pkgs/development/libraries/openldap/default.nix +++ b/pkgs/development/libraries/openldap/default.nix @@ -1,33 +1,48 @@ -{ lib, stdenv, fetchurl, openssl, db, groff, libtool, libsodium -, withCyrusSasl ? true +{ lib +, stdenv +, fetchurl + +# dependencies , cyrus_sasl +, db +, groff +, libsodium +, libtool +, openssl +, systemdMinimal }: stdenv.mkDerivation rec { pname = "openldap"; - version = "2.4.58"; + version = "2.6.2"; src = fetchurl { url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz"; - sha256 = "sha256-V7WSVL4V0L9qmrPVFMHAV3ewISMpFTMTSofJRGj49Hs="; + hash = "sha256-gdCTRSMutiSG7PWsrNLFbAxFtKbIwGZhLn9CGiOhz4c"; }; # TODO: separate "out" and "bin" - outputs = [ "out" "dev" "man" "devdoc" ]; + outputs = [ + "out" + "dev" + "man" + "devdoc" + ]; enableParallelBuilding = true; - nativeBuildInputs = [ groff ]; - - buildInputs = [ openssl cyrus_sasl db libsodium libtool ]; + nativeBuildInputs = [ + groff + ]; - # Disable install stripping as it breaks cross-compiling. - # We strip binaries anyway in fixupPhase. - makeFlags= [ - "STRIP=" - "prefix=$(out)" - "moduledir=$(out)/lib/modules" - "CC=${stdenv.cc.targetPrefix}cc" + buildInputs = [ + cyrus_sasl + db + libsodium + libtool + openssl + ] ++ lib.optionals (stdenv.isLinux) [ + systemdMinimal ]; preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' @@ -35,56 +50,61 @@ stdenv.mkDerivation rec { ''; configureFlags = [ - "--enable-overlays" - "--disable-dependency-tracking" # speeds up one-time build - "--enable-modules" - "--sysconfdir=/etc" - "--localstatedir=/var" + "--enable-argon2" "--enable-crypt" + "--enable-modules" + "--enable-overlays" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--with-yielding_select=yes" "ac_cv_func_memcmp_working=yes" - ] ++ lib.optional (!withCyrusSasl) "--without-cyrus-sasl" - ++ lib.optional stdenv.isFreeBSD "--with-pic"; + ] ++ lib.optional stdenv.isFreeBSD "--with-pic"; + + makeFlags= [ + "CC=${stdenv.cc.targetPrefix}cc" + "STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase. + "prefix=${placeholder "out"}" + "sysconfdir=${placeholder "out"}/etc" + "systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + # contrib modules require these + "moduledir=${placeholder "out"}/lib/modules" + "mandir=${placeholder "out"}/share/man" + ]; + + extraContribModules = [ + # https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules + "passwd/sha2" + "passwd/pbkdf2" + "passwd/totp" + ]; postBuild = '' - make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/sha2 - make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/pbkdf2 - make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/argon2 + for module in ${lib.concatStringsSep " " extraContribModules}; do + make $makeFlags CC=$CC -C contrib/slapd-modules/$module + done ''; - doCheck = false; # needs a running LDAP server + preCheck = '' + substituteInPlace tests/scripts/all \ + --replace "/bin/rm" "rm" + ''; - installFlags = [ - "sysconfdir=$(out)/etc" - "localstatedir=$(out)/var" - "moduledir=$(out)/lib/modules" - # The argon2 module hardcodes /usr/bin/install as the path for the - # `install` binary, which is overridden here. - "INSTALL=install" - ]; + doCheck = true; - # 1. Libraries left in the build location confuse `patchelf --shrink-rpath` - # Delete these to let patchelf discover the right path instead. - # FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98 - # is in Nixpkgs patchelf. - # 2. Fixup broken libtool for openssl and cyrus_sasl (if it is not disabled) + # The directory is empty and serve no purpose. preFixup = '' rm -r $out/var - rm -r libraries/*/.libs - rm -r contrib/slapd-modules/passwd/*/.libs - for f in $out/lib/libldap.la $out/lib/libldap_r.la; do - substituteInPlace "$f" --replace '-lssl' '-L${lib.getLib openssl}/lib -lssl' - '' + lib.optionalString withCyrusSasl '' - substituteInPlace "$f" --replace '-lsasl2' '-L${cyrus_sasl.out}/lib -lsasl2' - '' + '' - done ''; + installFlags = [ + "prefix=${placeholder "out"}" + "moduledir=${placeholder "out"}/lib/modules" + "INSTALL=install" + ]; + postInstall = '' - make $installFlags install -C contrib/slapd-modules/passwd/sha2 - make $installFlags install -C contrib/slapd-modules/passwd/pbkdf2 - make $installFlags install-lib -C contrib/slapd-modules/passwd/argon2 + for module in ${lib.concatStringsSep " " extraContribModules}; do + make $installFlags install -C contrib/slapd-modules/$module + done chmod +x "$out"/lib/*.{so,dylib} ''; From 1d24e9ae37c3a71d91a624bc28a2e25c54c35a2f Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 18 May 2022 15:25:34 +0200 Subject: [PATCH 53/62] openldap: update maintainers --- pkgs/development/libraries/openldap/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix index 44afffc7204..f781539a7ad 100644 --- a/pkgs/development/libraries/openldap/default.nix +++ b/pkgs/development/libraries/openldap/default.nix @@ -112,7 +112,7 @@ stdenv.mkDerivation rec { homepage = "https://www.openldap.org/"; description = "An open source implementation of the Lightweight Directory Access Protocol"; license = licenses.openldap; - maintainers = with maintainers; [ lovek323 ]; + maintainers = with maintainers; [ ajs124 das_j hexa ]; platforms = platforms.unix; }; } From 885d4e047b807719996a0c497b63ab6d77eba439 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 19 May 2022 22:06:41 +0200 Subject: [PATCH 54/62] nixos/openldap: use upstream unit defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenLDAP since version 2.5.4¹ supports sd_notify, so we should make use of it. Also updates the unit description and documentation with the values upstream provides. Starts slapd only after reaching `network-online.target`, which ensures binding to specific ip addresses is possible, since `network.target` only guarantees interfaces exist, but not that addressing is finished. [1] https://bugs.openldap.org/show_bug.cgi?id=8707 --- nixos/modules/services/databases/openldap.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index 2c1e25d4308..1967a2371bd 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -268,9 +268,14 @@ in { }; systemd.services.openldap = { - description = "LDAP server"; + description = "OpenLDAP Server Daemon"; + documentation = [ + "man:slapd" + "man:slapd-config" + "man:slapd-mdb" + ]; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; + after = [ "network-online.target" ]; preStart = let settingsFile = pkgs.writeText "config.ldif" (lib.concatStringsSep "\n" (attrsToLdif "cn=config" cfg.settings)); @@ -306,7 +311,7 @@ in { "${openldap}/libexec/slapd" "-u" cfg.user "-g" cfg.group "-F" configDir "-h" (lib.concatStringsSep " " cfg.urlList) ]); - Type = "forking"; + Type = "notify"; PIDFile = cfg.settings.attrs.olcPidFile; }; }; From ac7627e62dac6b1cfe608b646dacf180a21a218f Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 19 May 2022 22:46:52 +0200 Subject: [PATCH 55/62] gtk4: Fix incorrect merge For some reason, https://github.com/NixOS/nixpkgs/commit/17a8a7deacaea8a5490ae2316d947982c86052c8 re-introduced the patch, even though it was removed in https://github.com/NixOS/nixpkgs/commit/ff29d2caa935a8e6216380dfcd7ee714fd8bd5bf. --- pkgs/development/libraries/gtk/4.x.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkgs/development/libraries/gtk/4.x.nix b/pkgs/development/libraries/gtk/4.x.nix index 92f1df9d65d..e67599e0555 100644 --- a/pkgs/development/libraries/gtk/4.x.nix +++ b/pkgs/development/libraries/gtk/4.x.nix @@ -2,7 +2,6 @@ , stdenv , substituteAll , fetchurl -, fetchpatch , pkg-config , gettext , graphene @@ -78,15 +77,6 @@ stdenv.mkDerivation rec { sha256 = "p5orvMeTG3A/xPofy+G5BuIpoVIthU1SKAF2anm8rJ8="; }; - patches = [ - # Fix GNOME Control Center crash. - # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4670 - (fetchpatch { - url = "https://gitlab.gnome.org/GNOME/gtk/-/commit/ae0166973795e750f08b89f9f0ef974d7ac48bc7.patch"; - sha256 = "qPOplocE+RcTFIEveJe8YLKiUpe7o6CiA834rZpS0Fs="; - }) - ]; - nativeBuildInputs = [ gettext gobject-introspection From 63d81ddf9f45b727fc3cf0f2d5ae8bbdc3fc8ad3 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 21 May 2022 08:05:07 +0100 Subject: [PATCH 56/62] pkgsi686Linux.gdb: fix formatting for 32-bit systems A few rare targets don't have clean format strings on 32-bit systems: https://github.com/NixOS/nixpkgs/pull/171216#issuecomment-1133541978 /build/gdb-12.1/_build/sim/../../sim/cris/sim-if.c:575:28: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=] We pull in patch pending upstream inclusion. --- .../misc/gdb/32-bit-BFD_VMA-format.patch | 68 +++++++++++++++++++ pkgs/development/tools/misc/gdb/default.nix | 4 ++ 2 files changed, 72 insertions(+) create mode 100644 pkgs/development/tools/misc/gdb/32-bit-BFD_VMA-format.patch diff --git a/pkgs/development/tools/misc/gdb/32-bit-BFD_VMA-format.patch b/pkgs/development/tools/misc/gdb/32-bit-BFD_VMA-format.patch new file mode 100644 index 00000000000..41ce4540d2d --- /dev/null +++ b/pkgs/development/tools/misc/gdb/32-bit-BFD_VMA-format.patch @@ -0,0 +1,68 @@ +Fix iWerror=format build for 32-bit systems. +https://sourceware.org/pipermail/gdb-patches/2022-May/189288.html +--- a/sim/cris/sim-if.c ++++ b/sim/cris/sim-if.c +@@ -257,7 +257,8 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) + + if (verbose) + sim_io_printf (sd, +- "Loading segment at 0x%" BFD_VMA_FMT "x, size 0x%lx\n", ++ "Loading segment at 0x%" BFD_VMA_FMT "x, " ++ "size 0x%" BFD_VMA_FMT "x\n", + lma, phdr[i].p_filesz); + + if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 +@@ -265,7 +266,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) + { + sim_io_eprintf (sd, + "%s: could not read segment at 0x%" BFD_VMA_FMT "x, " +- "size 0x%lx\n", ++ "size 0x%" BFD_VMA_FMT "x\n", + STATE_MY_NAME (sd), lma, phdr[i].p_filesz); + free (buf); + return FALSE; +@@ -275,7 +276,7 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) + { + sim_io_eprintf (sd, + "%s: could not load segment at 0x%" BFD_VMA_FMT "x, " +- "size 0x%lx\n", ++ "size 0x%" BFD_VMA_FMT "x\n", + STATE_MY_NAME (sd), lma, phdr[i].p_filesz); + free (buf); + return FALSE; +@@ -572,7 +573,8 @@ cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) + memory area, so we go via a temporary area. Luckily, the + interpreter is supposed to be small, less than 0x40000 + bytes. */ +- sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", ++ sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x," ++ "0x%" BFD_VMA_FMT "x", + interp_load_addr, interpsiz); + + /* Now that memory for the interpreter is defined, load it. */ +--- a/sim/m32c/syscalls.c ++++ b/sim/m32c/syscalls.c +@@ -299,8 +299,8 @@ m32c_syscall (int id) + + rv = gettimeofday (&tv, 0); + if (trace) +- printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, +- tv.tv_usec, tvaddr); ++ printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", ++ (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); + mem_put_si (tvaddr, tv.tv_sec); + mem_put_si (tvaddr + 4, tv.tv_usec); + put_reg (r0, rv); +--- a/sim/rx/syscalls.c ++++ b/sim/rx/syscalls.c +@@ -270,8 +270,8 @@ rx_syscall (int id) + + rv = gettimeofday (&tv, 0); + if (trace) +- printf ("gettimeofday: %ld sec %ld usec to 0x%x\n", tv.tv_sec, +- tv.tv_usec, tvaddr); ++ printf ("gettimeofday: %lld sec %lld usec to 0x%x\n", ++ (long long)tv.tv_sec, (long long)tv.tv_usec, tvaddr); + mem_put_si (tvaddr, tv.tv_sec); + mem_put_si (tvaddr + 4, tv.tv_usec); + put_reg (1, rv); diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index f2dd043b14a..d9b56428f5c 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -49,6 +49,10 @@ stdenv.mkDerivation rec { ./debug-info-from-env.patch ] ++ lib.optionals stdenv.isDarwin [ ./darwin-target-match.patch + # Does not nave to be conditional. We apply it conditionally + # to speed up inclusion to nearby nixos release. + ] ++ lib.optionals stdenv.is32bit [ + ./32-bit-BFD_VMA-format.patch ]; nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ]; From 30aeecfc6f52ca3485b12d7353a94a61fc7fee4d Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 22 May 2022 13:28:52 +0200 Subject: [PATCH 57/62] wine: enable parallel build again The issue with dlltool was fixed in 4b0f59afccb060fd7bfd9b107a21bd8a0fdac775. --- pkgs/applications/emulators/wine/base.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/applications/emulators/wine/base.nix b/pkgs/applications/emulators/wine/base.nix index 47852d69e3b..7788b13b4ec 100644 --- a/pkgs/applications/emulators/wine/base.nix +++ b/pkgs/applications/emulators/wine/base.nix @@ -175,9 +175,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { done ''; - # Until https://github.com/NixOS/nixpkgs/pull/172617 is applied, - # parallel builds do not always work because of a bug in dlltool. - enableParallelBuilding = false; + enableParallelBuilding = true; # https://bugs.winehq.org/show_bug.cgi?id=43530 # https://github.com/NixOS/nixpkgs/issues/31989 From 9f4060c55289472edcd6a47b92cb3dc98380cbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 22 May 2022 15:45:36 +0200 Subject: [PATCH 58/62] Revert "lua: fix on darwin by using makeBinaryWrapper (#172749)" This reverts commit 92f4c6ed823ce10c484daa6582a908c5ae9ad61b. On aarch64-darwin this completely broke lua instead of improving it; let's revert at least until that's resolved. https://github.com/NixOS/nixpkgs/pull/172749#issuecomment-1133759233 --- pkgs/development/interpreters/lua-5/default.nix | 6 +----- pkgs/development/interpreters/lua-5/interpreter.nix | 1 - pkgs/tools/typesetting/sile/default.nix | 1 + 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix index 5230a46afef..3e36f77dab4 100644 --- a/pkgs/development/interpreters/lua-5/default.nix +++ b/pkgs/development/interpreters/lua-5/default.nix @@ -1,11 +1,10 @@ # similar to interpreters/python/default.nix -{ stdenv, lib, callPackage, fetchurl, fetchpatch, makeBinaryWrapper }: +{ stdenv, lib, callPackage, fetchurl, fetchpatch }: rec { lua5_4 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "4"; patch = "3"; }; hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq"; - makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch; }; @@ -17,7 +16,6 @@ rec { lua5_3 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "3"; patch = "6"; }; hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw"; - makeWrapper = makeBinaryWrapper; patches = lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ]; @@ -31,7 +29,6 @@ rec { lua5_2 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "2"; patch = "4"; }; hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; - makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch; }; @@ -43,7 +40,6 @@ rec { lua5_1 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "1"; patch = "5"; }; hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; - makeWrapper = makeBinaryWrapper; patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch) ++ [ ./CVE-2014-5461.patch ]; }; diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index 1fb56851ce5..de61714f242 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -126,7 +126,6 @@ self = stdenv.mkDerivation rec { passthru = rec { buildEnv = callPackage ./wrapper.nix { lua = self; - inherit makeWrapper; inherit (luaPackages) requiredLuaModules; }; withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;}; diff --git a/pkgs/tools/typesetting/sile/default.nix b/pkgs/tools/typesetting/sile/default.nix index 7aca12e341c..32374149190 100644 --- a/pkgs/tools/typesetting/sile/default.nix +++ b/pkgs/tools/typesetting/sile/default.nix @@ -114,6 +114,7 @@ stdenv.mkDerivation rec { homepage = "https://sile-typesetter.org"; changelog = "https://github.com/sile-typesetter/sile/raw/v${version}/CHANGELOG.md"; platforms = platforms.unix; + broken = stdenv.isDarwin; # https://github.com/NixOS/nixpkgs/issues/23018 maintainers = with maintainers; [ doronbehar alerque ]; license = licenses.mit; }; From 4b6af00b8dc0c75be7cf7ab4550dc88148669cfb Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 22 May 2022 17:38:49 +0200 Subject: [PATCH 59/62] python3Packages.ldap: fix linking with openldap 2.5+ --- ...her-libldap-is-threadsafe-on-startup.patch | 94 +++++++++++++++++++ .../python-modules/ldap/default.nix | 4 + 2 files changed, 98 insertions(+) create mode 100644 pkgs/development/python-modules/ldap/0001-Check-whether-libldap-is-threadsafe-on-startup.patch diff --git a/pkgs/development/python-modules/ldap/0001-Check-whether-libldap-is-threadsafe-on-startup.patch b/pkgs/development/python-modules/ldap/0001-Check-whether-libldap-is-threadsafe-on-startup.patch new file mode 100644 index 00000000000..f2b7812cf70 --- /dev/null +++ b/pkgs/development/python-modules/ldap/0001-Check-whether-libldap-is-threadsafe-on-startup.patch @@ -0,0 +1,94 @@ +From 3593e2c299c0ac0402f23d44cdbe8e6ff3687b68 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= +Date: Thu, 27 Jan 2022 10:35:56 +0000 +Subject: [PATCH] Check whether libldap is threadsafe on startup. + +Closes #432 +--- + Lib/ldap/constants.py | 2 -- + Modules/constants.c | 10 ++++++++++ + setup.cfg | 6 ++++-- + setup.py | 1 - + 4 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/Lib/ldap/constants.py b/Lib/ldap/constants.py +index 1c1d76a..f76609b 100644 +--- a/Lib/ldap/constants.py ++++ b/Lib/ldap/constants.py +@@ -341,9 +341,7 @@ CONSTANTS = ( + # XXX - these should be errors + Int('URL_ERR_BADSCOPE'), + Int('URL_ERR_MEM'), +- # Int('LIBLDAP_R'), + +- Feature('LIBLDAP_R', 'HAVE_LIBLDAP_R'), + Feature('SASL_AVAIL', 'HAVE_SASL'), + Feature('TLS_AVAIL', 'HAVE_TLS'), + Feature('INIT_FD_AVAIL', 'HAVE_LDAP_INIT_FD'), +diff --git a/Modules/constants.c b/Modules/constants.c +index 07d6065..8d6f63b 100644 +--- a/Modules/constants.c ++++ b/Modules/constants.c +@@ -197,6 +197,8 @@ int + LDAPinit_constants(PyObject *m) + { + PyObject *exc, *nobj; ++ struct ldap_apifeature_info info = { 1, "X_OPENLDAP_THREAD_SAFE", 0 }; ++ int thread_safe = 0; + + /* simple constants */ + +@@ -221,6 +223,14 @@ LDAPinit_constants(PyObject *m) + return -1; + Py_INCREF(LDAPexception_class); + ++#ifdef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ++ if (ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &info) == LDAP_SUCCESS) { ++ thread_safe = (info.ldapaif_version == 1); ++ } ++#endif ++ if (PyModule_AddIntConstant(m, "LIBLDAP_R", thread_safe) != 0) ++ return -1; ++ + /* Generated constants -- see Lib/ldap/constants.py */ + + #define add_err(n) do { \ +diff --git a/setup.cfg b/setup.cfg +index 2e372ba..a75f186 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -5,7 +5,9 @@ license_file = LICENCE + defines = HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R + extra_compile_args = + extra_objects = +-libs = ldap_r lber ++# Uncomment this if your libldap is not thread-safe and you need libldap_r ++# instead ++#libs = ldap_r lber + + [install] + compile = 1 +@@ -13,7 +15,7 @@ optimize = 1 + + [bdist_rpm] + provides = python-ldap +-requires = python libldap-2_4 ++requires = python libldap-2 + vendor = python-ldap project + packager = python-ldap team + distribution_name = openSUSE 11.x +diff --git a/setup.py b/setup.py +index 119b571..b193957 100644 +--- a/setup.py ++++ b/setup.py +@@ -132,7 +132,6 @@ setup( + extra_objects = LDAP_CLASS.extra_objects, + runtime_library_dirs = (not sys.platform.startswith("win"))*LDAP_CLASS.library_dirs, + define_macros = LDAP_CLASS.defines + \ +- ('ldap_r' in LDAP_CLASS.libs or 'oldap_r' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ + ('sasl' in LDAP_CLASS.libs or 'sasl2' in LDAP_CLASS.libs or 'libsasl' in LDAP_CLASS.libs)*[('HAVE_SASL',None)] + \ + ('ssl' in LDAP_CLASS.libs and 'crypto' in LDAP_CLASS.libs)*[('HAVE_TLS',None)] + \ + [ +-- +2.36.0 + diff --git a/pkgs/development/python-modules/ldap/default.nix b/pkgs/development/python-modules/ldap/default.nix index f9acc0a7674..b58f6bafed5 100644 --- a/pkgs/development/python-modules/ldap/default.nix +++ b/pkgs/development/python-modules/ldap/default.nix @@ -12,6 +12,10 @@ buildPythonPackage rec { sha256 = "60464c8fc25e71e0fd40449a24eae482dcd0fb7fcf823e7de627a6525b3e0d12"; }; + patches = [ + ./0001-Check-whether-libldap-is-threadsafe-on-startup.patch + ]; + propagatedBuildInputs = [ pyasn1 pyasn1-modules ]; checkInputs = [ pytestCheckHook ]; From 1cc6f08cdd8ebb37e33473e81893b4f480eabe16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Sun, 22 May 2022 21:46:06 +0200 Subject: [PATCH 60/62] makeBinaryWrapper: fix codesign on aarch64-darwin Reverts 8b79ef2c on aarch64-darwin, no-op on other platforms. --- pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix index fd0fa3ea009..34bed3bb297 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix @@ -1,6 +1,5 @@ { stdenv , lib -, darwin , makeSetupHook , dieHook , writeShellScript @@ -12,7 +11,7 @@ makeSetupHook { deps = [ dieHook ] # https://github.com/NixOS/nixpkgs/issues/148189 - ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) darwin.cctools; + ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) cc; substitutions = { cc = "${cc}/bin/cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}"; From be2ceef4f126ffb083b37bc3830f31f8c4a433e7 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Sun, 22 May 2022 23:44:55 +0200 Subject: [PATCH 61/62] openldap: fix cross-compilation --- pkgs/development/libraries/openldap/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix index f781539a7ad..c57aa560fc2 100644 --- a/pkgs/development/libraries/openldap/default.nix +++ b/pkgs/development/libraries/openldap/default.nix @@ -68,6 +68,9 @@ stdenv.mkDerivation rec { # contrib modules require these "moduledir=${placeholder "out"}/lib/modules" "mandir=${placeholder "out"}/share/man" + ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + # Can be unconditional, doing it like this to prevent a mass rebuild. + "STRIP_OPTS=" ]; extraContribModules = [ From 4ddea71bbd7ea3586520598b9b6c2b3789fd2405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 23 May 2022 10:28:05 +0200 Subject: [PATCH 62/62] Re-Revert "lua: fix on darwin by using makeBinaryWrapper (#172749)" This reverts commit 9f4060c55289472edcd6a47b92cb3dc98380cbd8. After the previous merge commit this should work now. --- pkgs/development/interpreters/lua-5/default.nix | 6 +++++- pkgs/development/interpreters/lua-5/interpreter.nix | 1 + pkgs/tools/typesetting/sile/default.nix | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix index 3e36f77dab4..5230a46afef 100644 --- a/pkgs/development/interpreters/lua-5/default.nix +++ b/pkgs/development/interpreters/lua-5/default.nix @@ -1,10 +1,11 @@ # similar to interpreters/python/default.nix -{ stdenv, lib, callPackage, fetchurl, fetchpatch }: +{ stdenv, lib, callPackage, fetchurl, fetchpatch, makeBinaryWrapper }: rec { lua5_4 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "4"; patch = "3"; }; hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq"; + makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch; }; @@ -16,6 +17,7 @@ rec { lua5_3 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "3"; patch = "6"; }; hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw"; + makeWrapper = makeBinaryWrapper; patches = lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ]; @@ -29,6 +31,7 @@ rec { lua5_2 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "2"; patch = "4"; }; hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; + makeWrapper = makeBinaryWrapper; patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch; }; @@ -40,6 +43,7 @@ rec { lua5_1 = callPackage ./interpreter.nix { sourceVersion = { major = "5"; minor = "1"; patch = "5"; }; hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; + makeWrapper = makeBinaryWrapper; patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch) ++ [ ./CVE-2014-5461.patch ]; }; diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index de61714f242..1fb56851ce5 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -126,6 +126,7 @@ self = stdenv.mkDerivation rec { passthru = rec { buildEnv = callPackage ./wrapper.nix { lua = self; + inherit makeWrapper; inherit (luaPackages) requiredLuaModules; }; withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;}; diff --git a/pkgs/tools/typesetting/sile/default.nix b/pkgs/tools/typesetting/sile/default.nix index 32374149190..7aca12e341c 100644 --- a/pkgs/tools/typesetting/sile/default.nix +++ b/pkgs/tools/typesetting/sile/default.nix @@ -114,7 +114,6 @@ stdenv.mkDerivation rec { homepage = "https://sile-typesetter.org"; changelog = "https://github.com/sile-typesetter/sile/raw/v${version}/CHANGELOG.md"; platforms = platforms.unix; - broken = stdenv.isDarwin; # https://github.com/NixOS/nixpkgs/issues/23018 maintainers = with maintainers; [ doronbehar alerque ]; license = licenses.mit; };