From b0b0a06788d5a7b3a3b35063b058f1326f10e983 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 23 Mar 2020 00:25:34 -0400 Subject: [PATCH 01/80] bintools: only add macos flags when targeting macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can’t set this for cross-compiling since we use the GNU linker. Instead, set these flags only when targetPlatform is macOS. Fixes #80754 Fixes #83141 --- pkgs/build-support/bintools-wrapper/default.nix | 5 +++++ pkgs/stdenv/darwin/default.nix | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 84020505a63..74feeece230 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -248,6 +248,11 @@ stdenv.mkDerivation { printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before '') + + optionalString stdenv.targetPlatform.isMacOS '' + # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID. + echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before + '' + + optionalString (!nativeTools) '' ## ## User env support diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index ef1ebfc32c1..2d5a191fc32 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -36,9 +36,7 @@ in rec { export NIX_IGNORE_LD_THROUGH_GCC=1 export SDKROOT= - # Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID. export MACOSX_DEPLOYMENT_TARGET=${macosVersionMin} - export NIX_LDFLAGS+=" -macosx_version_min ${macosVersionMin} -sdk_version ${appleSdkVersion} -no_uuid" # Workaround for https://openradar.appspot.com/22671534 on 10.11. export gl_cv_func_getcwd_abort_bug=no From b9a4e6953d0234cde64ac0cc55136adb3e92794b Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Wed, 1 Apr 2020 03:20:33 +0200 Subject: [PATCH 02/80] kernel: fix config generation Addresses https://github.com/NixOS/nixpkgs/issues/71803: Kernel options are not merged as described, especially the "optional" aspects. The error silences legitimate warnings. --- lib/kernel.nix | 8 +- nixos/modules/system/boot/kernel_config.nix | 5 +- pkgs/os-specific/linux/kernel/generic.nix | 3 - pkgs/test/kernel.nix | 88 +++++++++++++-------- 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/lib/kernel.nix b/lib/kernel.nix index 2ce19f8cb68..a0f986ee116 100644 --- a/lib/kernel.nix +++ b/lib/kernel.nix @@ -8,10 +8,10 @@ with lib; option = x: x // { optional = true; }; - yes = { tristate = "y"; }; - no = { tristate = "n"; }; - module = { tristate = "m"; }; - freeform = x: { freeform = x; }; + yes = { tristate = "y"; optional = false; }; + no = { tristate = "n"; optional = false; }; + module = { tristate = "m"; optional = false; }; + freeform = x: { freeform = x; optional = false; }; /* Common patterns/legacy used in common-config/hardened-config.nix diff --git a/nixos/modules/system/boot/kernel_config.nix b/nixos/modules/system/boot/kernel_config.nix index a316782dfc5..85bd420e304 100644 --- a/nixos/modules/system/boot/kernel_config.nix +++ b/nixos/modules/system/boot/kernel_config.nix @@ -22,7 +22,7 @@ let mergeFalseByDefault = locs: defs: if defs == [] then abort "This case should never happen." - else if any (x: x == false) defs then false + else if any (x: x == false) (getValues defs) then false else true; kernelItem = types.submodule { @@ -55,6 +55,7 @@ let default = false; description = '' Wether option should generate a failure when unused. + Upon merging values, mandatory wins over optional. ''; }; }; @@ -121,7 +122,7 @@ in type = types.attrsOf kernelItem; example = literalExample '' with lib.kernel; { "9P_NET" = yes; - USB = optional yes; + USB = option yes; MMC_BLOCK_MINORS = freeform "32"; }''; description = '' diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index e6e1bd84236..a9d0cf45168 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -158,11 +158,8 @@ let ; }).config; - # structuredConfig = moduleStructuredConfig.settings; }; - - }; # end of configfile derivation kernel = (callPackage ./manual-config.nix {}) { diff --git a/pkgs/test/kernel.nix b/pkgs/test/kernel.nix index 86f1b8d8e9a..a4da1003033 100644 --- a/pkgs/test/kernel.nix +++ b/pkgs/test/kernel.nix @@ -1,53 +1,79 @@ +# to run these tests: +# nix-instantiate --eval --strict . -A tests.kernel-config +# +# make sure to use NON EXISTING kernel settings else they may conflict with +# common-config.nix { lib, pkgs }: -with lib.kernel; -with lib.asserts; -with lib.modules; +with lib; +with kernel; -# To test nixos/modules/system/boot/kernel_config.nix; let - # copied from release-lib.nix - assertTrue = bool: - if bool - then pkgs.runCommand "evaluated-to-true" {} "touch $out" - else pkgs.runCommand "evaluated-to-false" {} "false"; - lts_kernel = pkgs.linuxPackages.kernel; - kernelTestConfig = structuredConfig: (lts_kernel.override { - structuredExtraConfig = structuredConfig; - }).configfile.structuredConfig; + # to see the result once the module transformed the lose structured config + getConfig = structuredConfig: + (lts_kernel.override { + structuredExtraConfig = structuredConfig; + }).configfile.structuredConfig; mandatoryVsOptionalConfig = mkMerge [ - { USB_DEBUG = option yes;} - { USB_DEBUG = yes;} + { NIXOS_FAKE_USB_DEBUG = yes;} + { NIXOS_FAKE_USB_DEBUG = option yes; } ]; freeformConfig = mkMerge [ - { MMC_BLOCK_MINORS = freeform "32"; } # same as default, won't trigger any error - { MMC_BLOCK_MINORS = freeform "64"; } # will trigger an error but the message is not great: + { NIXOS_FAKE_MMC_BLOCK_MINORS = freeform "32"; } # same as default, won't trigger any error + { NIXOS_FAKE_MMC_BLOCK_MINORS = freeform "64"; } # will trigger an error but the message is not great: ]; yesWinsOverNoConfig = mkMerge [ - # default for "8139TOO_PIO" is no - { "8139TOO_PIO" = yes; } # yes wins over no by default - { "8139TOO_PIO" = no; } + # default for "NIXOS_TEST_BOOLEAN" is no + { "NIXOS_TEST_BOOLEAN" = yes; } # yes wins over no by default + { "NIXOS_TEST_BOOLEAN" = no; } ]; + + optionalNoWins = mkMerge [ + { NIXOS_FAKE_USB_DEBUG = option yes;} + { NIXOS_FAKE_USB_DEBUG = yes;} + ]; + + allOptionalRemainOptional = mkMerge [ + { NIXOS_FAKE_USB_DEBUG = option yes;} + { NIXOS_FAKE_USB_DEBUG = option yes;} + ]; + in -{ +runTests { + testEasy = { + expr = (getConfig { NIXOS_FAKE_USB_DEBUG = yes;}).NIXOS_FAKE_USB_DEBUG; + expected = { tristate = "y"; optional = false; freeform = null; }; + }; + # mandatory flag should win over optional - mandatoryCheck = (kernelTestConfig mandatoryVsOptionalConfig); + testMandatoryCheck = { + expr = (getConfig mandatoryVsOptionalConfig).NIXOS_FAKE_USB_DEBUG.optional; + expected = false; + }; + + testYesWinsOverNo = { + expr = (getConfig yesWinsOverNoConfig)."NIXOS_TEST_BOOLEAN".tristate; + expected = "y"; + }; + + testAllOptionalRemainOptional = { + expr = (getConfig allOptionalRemainOptional)."NIXOS_FAKE_USB_DEBUG".optional; + expected = true; + }; # check that freeform options are unique # Should trigger - # > The option `settings.MMC_BLOCK_MINORS.freeform' has conflicting definitions, in `' and `' - freeformCheck = let - res = builtins.tryEval ( (kernelTestConfig freeformConfig).MMC_BLOCK_MINORS.freeform); - in - assertTrue (res.success == false); + # > The option `settings.NIXOS_FAKE_MMC_BLOCK_MINORS.freeform' has conflicting definitions, in `' and `' + testTreeform = let + res = builtins.tryEval ( (getConfig freeformConfig).NIXOS_FAKE_MMC_BLOCK_MINORS.freeform); + in { + expr = res.success; + expected = false; + }; - yesVsNoCheck = let - res = kernelTestConfig yesWinsOverNoConfig; - in - assertTrue (res."8139TOO_PIO".tristate == "y"); } From 121b17e1ac3fa41d82c827a9a9cfa505a0730871 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Wed, 1 Apr 2020 22:25:21 +0200 Subject: [PATCH 03/80] kernel: fix errors in configuration With the fix in kernel configuration merging, some kernel configuration items marked as mandatory now correctly trigger an error when unused (while they previously were unused). --- pkgs/os-specific/linux/kernel/common-config.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index 2c8b8de65b3..f1762054661 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -42,7 +42,7 @@ let TIMER_STATS = whenOlder "4.11" yes; DEBUG_NX_TEST = whenOlder "4.11" no; DEBUG_STACK_USAGE = no; - DEBUG_STACKOVERFLOW = mkIf (!features.grsecurity) no; + DEBUG_STACKOVERFLOW = mkIf (!features.grsecurity) (option no); RCU_TORTURE_TEST = no; SCHEDSTATS = no; DETECT_HUNG_TASK = yes; @@ -179,7 +179,7 @@ let # needed for ss INET_DIAG = yes; - INET_TCP_DIAG = module; + INET_TCP_DIAG = option module; INET_UDP_DIAG = module; INET_RAW_DIAG = whenAtLeast "4.14" module; INET_DIAG_DESTROY = whenAtLeast "4.9" yes; @@ -337,7 +337,7 @@ let CIFS_STATS = whenOlder "4.19" yes; CIFS_WEAK_PW_HASH = yes; CIFS_UPCALL = yes; - CIFS_ACL = yes; + CIFS_ACL = option yes; CIFS_DFS_UPCALL = yes; CIFS_SMB2 = whenOlder "4.13" yes; @@ -368,7 +368,7 @@ let DEBUG_SET_MODULE_RONX = { optional = true; tristate = whenOlder "4.11" "y"; }; RANDOMIZE_BASE = option yes; STRICT_DEVMEM = option yes; # Filter access to /dev/mem - SECURITY_SELINUX_BOOTPARAM_VALUE = freeform "0"; # Disable SELinux by default + SECURITY_SELINUX_BOOTPARAM_VALUE = option (freeform "0"); # Disable SELinux by default # Prevent processes from ptracing non-children processes SECURITY_YAMA = option yes; DEVKMEM = mkIf (!features.grsecurity) no; # Disable /dev/kmem @@ -676,7 +676,7 @@ let KEXEC_JUMP = option yes; # Windows Logical Disk Manager (Dynamic Disk) support - LDM_PARTITION = yes; + LDM_PARTITION = option yes; LOGIRUMBLEPAD2_FF = yes; # Logitech Rumblepad 2 force feedback LOGO = no; # not needed MEDIA_ATTACH = yes; From bc6b37e9678f3a095211764b8d4f8c12d8ea7d4e Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Sat, 11 Apr 2020 14:04:25 +0200 Subject: [PATCH 04/80] fixup! kernel: fix errors in configuration --- pkgs/os-specific/linux/kernel/common-config.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index f1762054661..53f2988e9cd 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -179,7 +179,6 @@ let # needed for ss INET_DIAG = yes; - INET_TCP_DIAG = option module; INET_UDP_DIAG = module; INET_RAW_DIAG = whenAtLeast "4.14" module; INET_DIAG_DESTROY = whenAtLeast "4.9" yes; From b52a5c2dbf8c5c7580bc28ead8a40b4f33db6d2c Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 10 May 2020 13:00:52 +0000 Subject: [PATCH 05/80] serd: 0.30.2 -> 0.30.4 --- pkgs/development/libraries/serd/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/serd/default.nix b/pkgs/development/libraries/serd/default.nix index 9e83bdae28e..6829275e99e 100644 --- a/pkgs/development/libraries/serd/default.nix +++ b/pkgs/development/libraries/serd/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "serd"; - version = "0.30.2"; + version = "0.30.4"; src = fetchurl { url = "https://download.drobilla.net/${pname}-${version}.tar.bz2"; - sha256 = "00kjjgs5a8r72khgpya14scvl3n58wqwl5927y14z03j25q04ccx"; + sha256 = "168rn3m32c59qbar120f83ibcnnd987ij9p053kybgl7cmm6358c"; }; nativeBuildInputs = [ pkgconfig python3 wafHook ]; From ec7e931c90e05ece6534d58c179d0835f78b9270 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 10 May 2020 18:47:02 +0000 Subject: [PATCH 06/80] libv4l: 1.18.0 -> 1.18.1 --- pkgs/os-specific/linux/v4l-utils/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/v4l-utils/default.nix b/pkgs/os-specific/linux/v4l-utils/default.nix index 73944bd6eb7..c23c37aa56d 100644 --- a/pkgs/os-specific/linux/v4l-utils/default.nix +++ b/pkgs/os-specific/linux/v4l-utils/default.nix @@ -12,11 +12,11 @@ let # we need to use stdenv.mkDerivation in order not to pollute the libv4l’s closure with Qt in stdenv.mkDerivation rec { pname = "v4l-utils"; - version = "1.18.0"; + version = "1.18.1"; src = fetchurl { url = "https://linuxtv.org/downloads/${pname}/${pname}-${version}.tar.bz2"; - sha256 = "03c80acbv2znfxs1l32yx30znmjrqq7kxhiwl2309lpf5s10vdkc"; + sha256 = "0hpkqm2bpg1ma2shjzcf6xsrpyjd8h5cakgh8a3iyh126wjl5z15"; }; outputs = [ "out" ] ++ lib.optional withUtils "lib" ++ [ "dev" ]; From 1ad856542297c3d0a8536a91a6bd39d1371909cf Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 10 May 2020 21:33:28 +0000 Subject: [PATCH 07/80] vim: 8.2.0510 -> 8.2.0701 --- pkgs/applications/editors/vim/common.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/vim/common.nix b/pkgs/applications/editors/vim/common.nix index 8bdc0c0753c..47e71e2da4d 100644 --- a/pkgs/applications/editors/vim/common.nix +++ b/pkgs/applications/editors/vim/common.nix @@ -1,12 +1,12 @@ { lib, fetchFromGitHub }: rec { - version = "8.2.0510"; + version = "8.2.0701"; src = fetchFromGitHub { owner = "vim"; repo = "vim"; rev = "v${version}"; - sha256 = "16ggwf238pzzkn3ng6n09qz9cgdzha9vc0ghlcxhwilnjh12l7p9"; + sha256 = "1cbh2nhbvhp4kclc9fd8gqij2vi11c5zwdwn1nzg805k06hwmsrp"; }; enableParallelBuilding = true; From 23ce1eed34c97df283ad85ab40b8b33a6a8818eb Mon Sep 17 00:00:00 2001 From: Gaelan Steele Date: Mon, 11 May 2020 00:12:05 -0700 Subject: [PATCH 08/80] stdenv: only build LLVM once on darwin --- pkgs/stdenv/darwin/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index ef1ebfc32c1..53fb282fea2 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -307,7 +307,7 @@ in rec { inherit gnumake gzip gnused bzip2 gawk ed xz patch bash python3 ncurses libffi zlib gmp pcre gnugrep - coreutils findutils diffutils patchutils ninja; + coreutils findutils diffutils patchutils ninja libxml2; # Hack to make sure we don't link ncurses in bootstrap tools. The proper # solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib, @@ -321,7 +321,7 @@ in rec { llvmPackages_7 = super.llvmPackages_7 // (let tools = super.llvmPackages_7.tools.extend (llvmSelf: _: { clang-unwrapped = llvmPackages_7.clang-unwrapped.override { llvm = llvmSelf.llvm; }; - llvm = llvmPackages_7.llvm.override { libxml2 = self.darwin.libxml2-nopython; }; + llvm = llvmPackages_7.llvm.override { inherit libxml2; }; }); libraries = super.llvmPackages_7.libraries.extend (llvmSelf: _: { inherit (llvmPackages_7) libcxx libcxxabi compiler-rt; @@ -332,9 +332,8 @@ in rec { inherit (darwin) dyld Libsystem libiconv locale; cctools = super.darwin.cctools.override { enableTapiSupport = false; }; - libxml2-nopython = super.libxml2.override { pythonSupport = false; }; CF = super.darwin.CF.override { - libxml2 = libxml2-nopython; + inherit libxml2; python3 = prevStage.python3; }; }; @@ -419,9 +418,9 @@ in rec { gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.lib patch pcre.out gettext binutils.bintools darwin.binutils darwin.binutils.bintools curl.out openssl.out libssh2.out nghttp2.lib libkrb5 - cc.expand-response-params + cc.expand-response-params libxml2.out ]) ++ (with pkgs.darwin; [ - dyld Libsystem CF cctools ICU libiconv locale libxml2-nopython.out + dyld Libsystem CF cctools ICU libiconv locale ]); overrides = lib.composeExtensions persistent (self: super: { From 1ac5398589916a6a433e845342c9b85c4c52f5dc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 28 Apr 2020 00:08:48 -0400 Subject: [PATCH 09/80] *-wrapper; Switch from `infixSalt` to `suffixSalt` I hate the thing too even though I made it, and rather just get rid of it. But we can't do that yet. In the meantime, this brings us more inline with autoconf and will make it slightly easier for me to write a pkg-config wrapper, which we need. --- nixos/doc/manual/release-notes/rl-2009.xml | 6 +++ pkgs/applications/video/mplayer/default.nix | 2 +- .../bintools-wrapper/add-flags.sh | 26 +++++----- .../bintools-wrapper/add-hardening.sh | 2 +- .../bintools-wrapper/default.nix | 8 ++-- .../bintools-wrapper/ld-wrapper.sh | 20 ++++---- .../bintools-wrapper/setup-hook.sh | 11 ++--- pkgs/build-support/build-fhs-userenv/env.nix | 2 +- pkgs/build-support/cc-wrapper/add-flags.sh | 32 ++++++------- .../build-support/cc-wrapper/add-hardening.sh | 2 +- pkgs/build-support/cc-wrapper/cc-wrapper.sh | 24 +++++----- pkgs/build-support/cc-wrapper/default.nix | 8 ++-- pkgs/build-support/cc-wrapper/gnat-wrapper.sh | 10 ++-- pkgs/build-support/cc-wrapper/setup-hook.sh | 26 +++++----- pkgs/build-support/setup-hooks/role.bash | 14 ++---- pkgs/build-support/wrapper-common/utils.bash | 32 ++++++------- pkgs/development/compilers/gcc/10/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 +- pkgs/development/compilers/gcc/builder.sh | 48 +++++++++---------- .../gcc/common/extra-target-flags.nix | 4 +- .../compilers/gcc/libstdc++-hook.sh | 2 +- .../development/compilers/graalvm/default.nix | 2 +- .../compilers/llvm/10/libc++/setup-hook.sh | 4 +- .../compilers/llvm/5/libc++/setup-hook.sh | 4 +- .../compilers/llvm/6/libc++/setup-hook.sh | 4 +- .../compilers/llvm/7/libc++/setup-hook.sh | 4 +- .../compilers/llvm/8/libc++/setup-hook.sh | 4 +- .../compilers/llvm/9/libc++/setup-hook.sh | 4 +- .../idris-modules/idris-wrapper.nix | 2 +- .../libraries/gettext/gettext-setup-hook.sh | 2 +- .../libraries/libiconv/setup-hook.sh | 2 +- .../tools/build-managers/cmake/default.nix | 6 ++- .../misc/texinfo/cross-tools-flags.patch | 2 +- .../bsd/netbsd/compat-setup-hook.sh | 6 +-- pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh | 2 +- .../linux/kernel-headers/default.nix | 4 +- pkgs/stdenv/generic/default.nix | 4 +- 42 files changed, 183 insertions(+), 180 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 3673f6e0d9c..b0b8c9f5144 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -367,6 +367,12 @@ php.override { The default output of buildGoPackage is now $out instead of $bin. + + + The cc- and binutils-wrapper's "infix salt" and _BUILD_ and _TARGET_ user infixes have been replaced with with a "suffix salt" and suffixes and _FOR_BUILD and _FOR_TARGET. + This matches the autotools convention for env vars which standard for these things, making interfacing with other tools easier. + + diff --git a/pkgs/applications/video/mplayer/default.nix b/pkgs/applications/video/mplayer/default.nix index 5a72fe91ddd..1dd6b593f0f 100644 --- a/pkgs/applications/video/mplayer/default.nix +++ b/pkgs/applications/video/mplayer/default.nix @@ -182,7 +182,7 @@ stdenv.mkDerivation rec { preConfigure = '' configureFlagsArray+=( "--cc=$CC" - "--host-cc=$BUILD_CC" + "--host-cc=$CC_FOR_BUILD" "--as=$AS" "--nm=$NM" "--ar=$AR" diff --git a/pkgs/build-support/bintools-wrapper/add-flags.sh b/pkgs/build-support/bintools-wrapper/add-flags.sh index e5c0556556c..e99beb38158 100644 --- a/pkgs/build-support/bintools-wrapper/add-flags.sh +++ b/pkgs/build-support/bintools-wrapper/add-flags.sh @@ -1,32 +1,32 @@ # See cc-wrapper for comments. var_templates_list=( - NIX+IGNORE_LD_THROUGH_GCC - NIX+LDFLAGS - NIX+LDFLAGS_BEFORE - NIX+LDFLAGS_AFTER - NIX+LDFLAGS_HARDEN - NIX+HARDENING_ENABLE + NIX_IGNORE_LD_THROUGH_GCC + NIX_LDFLAGS + NIX_LDFLAGS_BEFORE + NIX_LDFLAGS_AFTER + NIX_LDFLAGS_HARDEN + NIX_HARDENING_ENABLE ) var_templates_bool=( - NIX+SET_BUILD_ID - NIX+DONT_SET_RPATH + NIX_SET_BUILD_ID + NIX_DONT_SET_RPATH ) accumulateRoles for var in "${var_templates_list[@]}"; do - mangleVarList "$var" ${role_infixes[@]+"${role_infixes[@]}"} + mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"} done for var in "${var_templates_bool[@]}"; do - mangleVarBool "$var" ${role_infixes[@]+"${role_infixes[@]}"} + mangleVarBool "$var" ${role_suffixes[@]+"${role_suffixes[@]}"} done if [ -e @out@/nix-support/libc-ldflags ]; then - NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)" + NIX_LDFLAGS_@suffixSalt@+=" $(< @out@/nix-support/libc-ldflags)" fi if [ -e @out@/nix-support/libc-ldflags-before ]; then - NIX_@infixSalt@_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_@infixSalt@_LDFLAGS_BEFORE" + NIX_LDFLAGS_BEFORE_@suffixSalt@="$(< @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE_@suffixSalt@" fi -export NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET=1 +export NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@=1 diff --git a/pkgs/build-support/bintools-wrapper/add-hardening.sh b/pkgs/build-support/bintools-wrapper/add-hardening.sh index b7180870860..5e49b7bd905 100644 --- a/pkgs/build-support/bintools-wrapper/add-hardening.sh +++ b/pkgs/build-support/bintools-wrapper/add-hardening.sh @@ -5,7 +5,7 @@ declare -A hardeningEnableMap=() # Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The # array expansion also prevents undefined variables from causing trouble with # `set -u`. -for flag in ${NIX_@infixSalt@_HARDENING_ENABLE-}; do +for flag in ${NIX_HARDENING_ENABLE_@suffixSalt@-}; do hardeningEnableMap["$flag"]=1 done diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 5cc99c6412a..a91afa0c0b3 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -45,7 +45,7 @@ let coreutils_bin = if nativeTools then "" else getBin coreutils; # See description in cc-wrapper. - infixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; # The dynamic linker has different names on different platforms. This is a # shell glob that ought to match it. @@ -83,7 +83,7 @@ stdenv.mkDerivation { shell = getBin shell + shell.shellPath or ""; gnugrep_bin = if nativeTools then "" else gnugrep; - inherit targetPrefix infixSalt; + inherit targetPrefix suffixSalt; outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info"); @@ -95,9 +95,9 @@ stdenv.mkDerivation { (mapc (lambda (arg) (when (file-directory-p (concat arg "/lib")) - (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib"))) + (setenv "NIX_LDFLAGS_${suffixSalt}" (concat (getenv "NIX_LDFLAGS_${suffixSalt}") " -L" arg "/lib"))) (when (file-directory-p (concat arg "/lib64")) - (setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib64")))) + (setenv "NIX_LDFLAGS_${suffixSalt}" (concat (getenv "NIX_LDFLAGS_${suffixSalt}") " -L" arg "/lib64")))) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) ''; }; diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index ed2f00a8974..81b5a90edd5 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -16,7 +16,7 @@ fi source @out@/nix-support/utils.bash -if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then source @out@/nix-support/add-flags.sh fi @@ -24,7 +24,7 @@ fi # Optionally filter out paths not refering to the store. expandResponseParams "$@" if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}" - && ( -z "$NIX_@infixSalt@_IGNORE_LD_THROUGH_GCC" || -z "${NIX_@infixSalt@_LDFLAGS_SET:-}" ) ]]; then + && ( -z "$NIX_IGNORE_LD_THROUGH_GCC_@suffixSalt@" || -z "${NIX_LDFLAGS_SET_@suffixSalt@:-}" ) ]]; then rest=() nParams=${#params[@]} declare -i n=0 @@ -60,12 +60,12 @@ source @out@/nix-support/add-hardening.sh extraAfter=() extraBefore=(${hardeningLDFlags[@]+"${hardeningLDFlags[@]}"}) -if [ -z "${NIX_@infixSalt@_LDFLAGS_SET:-}" ]; then - extraAfter+=($NIX_@infixSalt@_LDFLAGS) - extraBefore+=($NIX_@infixSalt@_LDFLAGS_BEFORE) +if [ -z "${NIX_LDFLAGS_SET_@suffixSalt@:-}" ]; then + extraAfter+=($NIX_LDFLAGS_@suffixSalt@) + extraBefore+=($NIX_LDFLAGS_BEFORE_@suffixSalt@) fi -extraAfter+=($NIX_@infixSalt@_LDFLAGS_AFTER) +extraAfter+=($NIX_LDFLAGS_AFTER_@suffixSalt@) # Specify the target emulation if nothing is passed in ("-m" overrides this # environment variable). Ensures we never blindly fallback on targeting the host @@ -84,8 +84,8 @@ declare -A libs declare -i relocatable=0 link32=0 if - [ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ] \ - || [ "$NIX_@infixSalt@_SET_BUILD_ID" = 1 ] \ + [ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 ] \ + || [ "$NIX_SET_BUILD_ID_@suffixSalt@" = 1 ] \ || [ -e @out@/nix-support/dynamic-linker-m32 ] then prev= @@ -144,7 +144,7 @@ if [ -e "@out@/nix-support/dynamic-linker-m32" ] && (( "$link32" )); then fi # Add all used dynamic libraries to the rpath. -if [ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ]; then +if [ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 ]; then # For each directory in the library search path (-L...), # see if it contains a dynamic library used by a -l... flag. If # so, add the directory to the rpath. @@ -186,7 +186,7 @@ fi # Only add --build-id if this is a final link. FIXME: should build gcc # with --enable-linker-build-id instead? -if [ "$NIX_@infixSalt@_SET_BUILD_ID" = 1 ] && ! (( "$relocatable" )); then +if [ "$NIX_SET_BUILD_ID_@suffixSalt@" = 1 ] && ! (( "$relocatable" )); then extraAfter+=(--build-id) fi diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh index a714bd151c9..7e9547b96c2 100644 --- a/pkgs/build-support/bintools-wrapper/setup-hook.sh +++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh @@ -10,11 +10,11 @@ bintoolsWrapper_addLDVars () { # See ../setup-hooks/role.bash - local role_post role_pre + local role_post getHostRoleEnvHook if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then - export NIX_${role_pre}LDFLAGS+=" -L$1/lib64" + export NIX_LDFLAGS${role_post}+=" -L$1/lib64" fi if [[ -d "$1/lib" ]]; then @@ -24,7 +24,7 @@ bintoolsWrapper_addLDVars () { # directories and bloats the size of the environment variable space. local -a glob=( $1/lib/lib* ) if [ "${#glob[*]}" -gt 0 ]; then - export NIX_${role_pre}LDFLAGS+=" -L$1/lib" + export NIX_LDFLAGS${role_post}+=" -L$1/lib" fi fi } @@ -52,7 +52,7 @@ fi # Export tool environment variables so various build systems use the right ones. -export NIX_${role_pre}BINTOOLS=@out@ +export NIX_BINTOOLS${role_post}=@out@ for cmd in \ ar as ld nm objcopy objdump readelf ranlib strip strings size windres @@ -60,7 +60,6 @@ do if PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null then - export "${role_pre}${cmd^^}=@targetPrefix@${cmd}"; export "${cmd^^}${role_post}=@targetPrefix@${cmd}"; fi done @@ -70,4 +69,4 @@ done export NIX_HARDENING_ENABLE # No local scope in sourced file -unset -v role_pre role_post cmd upper_case +unset -v role_post cmd upper_case diff --git a/pkgs/build-support/build-fhs-userenv/env.nix b/pkgs/build-support/build-fhs-userenv/env.nix index 8de43d5a919..083e7617b50 100644 --- a/pkgs/build-support/build-fhs-userenv/env.nix +++ b/pkgs/build-support/build-fhs-userenv/env.nix @@ -58,7 +58,7 @@ let # Force compilers and other tools to look in default search paths unset NIX_ENFORCE_PURITY - export NIX_CC_WRAPPER_${stdenv.cc.infixSalt}_TARGET_HOST=1 + export NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}=1 export NIX_CFLAGS_COMPILE='-idirafter /usr/include' export NIX_CFLAGS_LINK='-L/usr/lib -L/usr/lib32' export NIX_LDFLAGS='-L/usr/lib -L/usr/lib32' diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index 323ea5bfd77..3398f11e8c2 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -5,15 +5,15 @@ # wrapped binary just inherit the work of the forker's wrapper script. var_templates_list=( - NIX+CFLAGS_COMPILE - NIX+CFLAGS_COMPILE_BEFORE - NIX+CFLAGS_LINK - NIX+CXXSTDLIB_COMPILE - NIX+CXXSTDLIB_LINK - NIX+GNATFLAGS_COMPILE + NIX_CFLAGS_COMPILE + NIX_CFLAGS_COMPILE_BEFORE + NIX_CFLAGS_LINK + NIX_CXXSTDLIB_COMPILE + NIX_CXXSTDLIB_LINK + NIX_GNATFLAGS_COMPILE ) var_templates_bool=( - NIX+ENFORCE_NO_NATIVE + NIX_ENFORCE_NO_NATIVE ) accumulateRoles @@ -21,37 +21,37 @@ accumulateRoles # We need to mangle names for hygiene, but also take parameters/overrides # from the environment. for var in "${var_templates_list[@]}"; do - mangleVarList "$var" ${role_infixes[@]+"${role_infixes[@]}"} + mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"} done for var in "${var_templates_bool[@]}"; do - mangleVarBool "$var" ${role_infixes[@]+"${role_infixes[@]}"} + mangleVarBool "$var" ${role_suffixes[@]+"${role_suffixes[@]}"} done # `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld. -NIX_@infixSalt@_CFLAGS_COMPILE="-B@out@/bin/ $NIX_@infixSalt@_CFLAGS_COMPILE" +NIX_CFLAGS_COMPILE_@suffixSalt@="-B@out@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@" # Export and assign separately in order that a failing $(..) will fail # the script. if [ -e @out@/nix-support/libc-cflags ]; then - NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/libc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" + NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@" fi if [ -e @out@/nix-support/cc-cflags ]; then - NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" + NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@" fi if [ -e @out@/nix-support/gnat-cflags ]; then - NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE" + NIX_GNATFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE_@suffixSalt@" fi if [ -e @out@/nix-support/cc-ldflags ]; then - NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" + NIX_LDFLAGS_@suffixSalt@+=" $(< @out@/nix-support/cc-ldflags)" fi if [ -e @out@/nix-support/cc-cflags-before ]; then - NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE="$(< @out@/nix-support/cc-cflags-before) $NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE" + NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="$(< @out@/nix-support/cc-cflags-before) $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@" fi # That way forked processes will not extend these environment variables again. -export NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET=1 +export NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@=1 diff --git a/pkgs/build-support/cc-wrapper/add-hardening.sh b/pkgs/build-support/cc-wrapper/add-hardening.sh index fc40fe7408b..8e2fe6c407e 100644 --- a/pkgs/build-support/cc-wrapper/add-hardening.sh +++ b/pkgs/build-support/cc-wrapper/add-hardening.sh @@ -5,7 +5,7 @@ declare -A hardeningEnableMap=() # Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The # array expansion also prevents undefined variables from causing trouble with # `set -u`. -for flag in ${NIX_@infixSalt@_HARDENING_ENABLE-}; do +for flag in ${NIX_HARDENING_ENABLE_@suffixSalt@-}; do hardeningEnableMap["$flag"]=1 done diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index ba3dfc96f5c..cf00202221e 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -18,12 +18,12 @@ fi source @out@/nix-support/utils.bash # Flirting with a layer violation here. -if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then source @bintools@/nix-support/add-flags.sh fi # Put this one second so libc ldflags take priority. -if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then source @out@/nix-support/add-flags.sh fi @@ -113,7 +113,7 @@ fi # Clear march/mtune=native -- they bring impurity. -if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then +if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then rest=() # Old bash empty array hack for p in ${params+"${params[@]}"}; do @@ -129,36 +129,36 @@ fi if [[ "$isCpp" = 1 ]]; then if [[ "$cppInclude" = 1 ]]; then - NIX_@infixSalt@_CFLAGS_COMPILE+=" ${NIX_@infixSalt@_CXXSTDLIB_COMPILE:-@default_cxx_stdlib_compile@}" + NIX_CFLAGS_COMPILE_@suffixSalt@+=" ${NIX_CXXSTDLIB_COMPILE_@suffixSalt@:-@default_cxx_stdlib_compile@}" fi - NIX_@infixSalt@_CFLAGS_LINK+=" $NIX_@infixSalt@_CXXSTDLIB_LINK" + NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@" fi source @out@/nix-support/add-hardening.sh # Add the flags for the C compiler proper. -extraAfter=($NIX_@infixSalt@_CFLAGS_COMPILE) -extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"} $NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE) +extraAfter=($NIX_CFLAGS_COMPILE_@suffixSalt@) +extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@) if [ "$dontLink" != 1 ]; then # Add the flags that should only be passed to the compiler when # linking. - extraAfter+=($NIX_@infixSalt@_CFLAGS_LINK) + extraAfter+=($NIX_CFLAGS_LINK_@suffixSalt@) # Add the flags that should be passed to the linker (and prevent - # `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again). - for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do + # `ld-wrapper' from adding NIX_LDFLAGS_@suffixSalt@ again). + for i in $NIX_LDFLAGS_BEFORE_@suffixSalt@; do extraBefore+=("-Wl,$i") done - for i in $NIX_@infixSalt@_LDFLAGS; do + for i in $NIX_LDFLAGS_@suffixSalt@; do if [ "${i:0:3}" = -L/ ]; then extraAfter+=("$i") else extraAfter+=("-Wl,$i") fi done - export NIX_@infixSalt@_LDFLAGS_SET=1 + export NIX_LDFLAGS_SET_@suffixSalt@=1 fi # As a very special hack, if the arguments are just `-v', then don't diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 1b7c5750727..9cbc9d1b11d 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -53,12 +53,12 @@ let "-isystem ${libcxx}/include/c++/v1" else ""; - # The "infix salt" is a arbitrary string added in the middle of env vars + # The "suffix salt" is a arbitrary string added in the end of env vars # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used # without interfering. For the moment, it is defined as the target triple, # adjusted to be a valid bash identifier. This should be considered an # unstable implementation detail, however. - infixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; expand-response-params = if buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null" @@ -105,7 +105,7 @@ stdenv.mkDerivation { shell = getBin shell + shell.shellPath or ""; gnugrep_bin = if nativeTools then "" else gnugrep; - inherit targetPrefix infixSalt; + inherit targetPrefix suffixSalt; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ]; @@ -122,7 +122,7 @@ stdenv.mkDerivation { (mapc (lambda (arg) (when (file-directory-p (concat arg "/include")) - (setenv "NIX_${infixSalt}_CFLAGS_COMPILE" (concat (getenv "NIX_${infixSalt}_CFLAGS_COMPILE") " -isystem " arg "/include")))) + (setenv "NIX_CFLAGS_COMPILE_${suffixSalt}" (concat (getenv "NIX_CFLAGS_COMPILE_${suffixSalt}") " -isystem " arg "/include")))) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) ''; }; diff --git a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh index 15b53d76c63..d3f7d382c19 100644 --- a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh @@ -18,12 +18,12 @@ fi source @out@/nix-support/utils.bash # Flirting with a layer violation here. -if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then source @bintools@/nix-support/add-flags.sh fi # Put this one second so libc ldflags take priority. -if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then +if [ -z "${NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then source @out@/nix-support/add-flags.sh fi @@ -108,7 +108,7 @@ fi # Clear march/mtune=native -- they bring impurity. -if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then +if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then rest=() # Old bash empty array hack for p in ${params+"${params[@]}"}; do @@ -124,12 +124,12 @@ fi if [ "$(basename $0)x" = "gnatmakex" ]; then extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink") - extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE) + extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@) fi if [ "$(basename $0)x" = "gnatbindx" ]; then extraBefore=() - extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE) + extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@) fi if [ "$(basename $0)x" = "gnatlinkx" ]; then diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index 5b13f268309..6a913cc4eac 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -6,9 +6,9 @@ # tools. For example: # # # Flags for compiling (whether or not linking) C code for the... -# NIX_BUILD_CFLAGS_COMPILE # ...build platform -# NIX_CFLAGS_COMPILE # ...host platform -# NIX_TARGET_CFLAGS_COMPILE # ...target platform +# NIX_CFLAGS_COMPILE_FOR_BUILD # ...build platform +# NIX_CFLAGS_COMPILE # ...host platform +# NIX_CFLAGS_COMPILE_FOR_TARGET # ...target platform # # Notice that these platforms are the 3 *relative* to the package using # cc-wrapper, not absolute like `x86_64-pc-linux-gnu`. @@ -33,12 +33,12 @@ # The basic strategy is: # # - Everyone exclusively *adds information* to relative-platform-specific -# environment variables, like `NIX_TARGET_CFLAGS_COMPILE`, to communicate +# environment variables, like `NIX_CFLAGS_COMPILE_FOR_TARGET`, to communicate # with the wrapped binaries. # # - The wrapped binaries will exclusively *read* cc-wrapper-derivation-specific -# environment variables distinguished with with `infixSalt`, like -# `NIX_@infixSalt@_CFLAGS_COMPILE`. +# environment variables distinguished with with `suffixSalt`, like +# `NIX_CFLAGS_COMPILE_@suffixSalt@`. # # - `add-flags`, beyond its old task of reading extra flags stuck inside the # cc-wrapper derivation, will convert the relative-platform-specific @@ -65,15 +65,15 @@ # function is guaranteed to be exactly the same. ccWrapper_addCVars () { # See ../setup-hooks/role.bash - local role_post role_pre + local role_post getHostRoleEnvHook if [ -d "$1/include" ]; then - export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include" + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include" fi if [ -d "$1/Library/Frameworks" ]; then - export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks" + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks" fi } @@ -105,10 +105,10 @@ fi # Export tool environment variables so various build systems use the right ones. -export NIX_${role_pre}CC=@out@ +export NIX_CC${role_post}=@out@ -export ${role_pre}CC=@named_cc@ -export ${role_pre}CXX=@named_cxx@ +export CC${role_post}=@named_cc@ +export CXX${role_post}=@named_cxx@ export CC${role_post}=@named_cc@ export CXX${role_post}=@named_cxx@ @@ -117,4 +117,4 @@ export CXX${role_post}=@named_cxx@ export NIX_HARDENING_ENABLE # No local scope in sourced file -unset -v role_pre role_post +unset -v role_post diff --git a/pkgs/build-support/setup-hooks/role.bash b/pkgs/build-support/setup-hooks/role.bash index 6f1c36f5c05..cf69e732e7c 100644 --- a/pkgs/build-support/setup-hooks/role.bash +++ b/pkgs/build-support/setup-hooks/role.bash @@ -3,21 +3,17 @@ # derivation) in which the derivation is used. # # The role is intened to be use as part of other variables names like -# - $NIX_${role_pre}_SOMETHING -# - $NIX_SOMETHING_${role_post} +# - $NIX_SOMETHING${role_post} function getRole() { case $1 in -1) - role_pre='BUILD_' role_post='_FOR_BUILD' ;; 0) - role_pre='' role_post='' ;; 1) - role_pre='TARGET_' role_post='_FOR_TARGET' ;; *) @@ -54,18 +50,18 @@ function getTargetRoleEnvHook() { } # This variant is inteneded specifically for code-prodocing tool wrapper scripts -# `NIX_@wrapperName@_@infixSalt@_TARGET_*` tracks this (needs to be an exported +# `NIX_@wrapperName@_TARGET_*_@suffixSalt@` tracks this (needs to be an exported # env var so can't use fancier data structures). function getTargetRoleWrapper() { case $targetOffset in -1) - export NIX_@wrapperName@_@infixSalt@_TARGET_BUILD=1 + export NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@=1 ;; 0) - export NIX_@wrapperName@_@infixSalt@_TARGET_HOST=1 + export NIX_@wrapperName@_TARGET_HOST_@suffixSalt@=1 ;; 1) - export NIX_@wrapperName@_@infixSalt@_TARGET_TARGET=1 + export NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@=1 ;; *) echo "@name@: used as improper sort of dependency" >2 diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash index 4fd57162072..8c4680a8e44 100644 --- a/pkgs/build-support/wrapper-common/utils.bash +++ b/pkgs/build-support/wrapper-common/utils.bash @@ -1,29 +1,29 @@ -# Accumulate infixes for taking in the right input parameters with the `mangle*` +# Accumulate suffixes for taking in the right input parameters with the `mangle*` # functions below. See setup-hook for details. accumulateRoles() { - declare -ga role_infixes=() - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_BUILD:-}" ]; then - role_infixes+=(_BUILD_) + declare -ga role_suffixes=() + if [ "${NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@:-}" ]; then + role_suffixes+=('_FOR_BUILD') fi - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_HOST:-}" ]; then - role_infixes+=(_) + if [ "${NIX_@wrapperName@_TARGET_HOST_@suffixSalt@:-}" ]; then + role_suffixes+=('') fi - if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_TARGET:-}" ]; then - role_infixes+=(_TARGET_) + if [ "${NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@:-}" ]; then + role_suffixes+=('_FOR_TARGET') fi } mangleVarList() { local var="$1" shift - local -a role_infixes=("$@") + local -a role_suffixes=("$@") - local outputVar="${var/+/_@infixSalt@_}" + local outputVar="${var}_@suffixSalt@" declare -gx ${outputVar}+='' # For each role we serve, we accumulate the input parameters into our own # cc-wrapper-derivation-specific environment variables. - for infix in "${role_infixes[@]}"; do - local inputVar="${var/+/${infix}}" + for suffix in "${role_suffixes[@]}"; do + local inputVar="${var}${suffix}" if [ -v "$inputVar" ]; then export ${outputVar}+="${!outputVar:+ }${!inputVar}" fi @@ -33,12 +33,12 @@ mangleVarList() { mangleVarBool() { local var="$1" shift - local -a role_infixes=("$@") + local -a role_suffixes=("$@") - local outputVar="${var/+/_@infixSalt@_}" + local outputVar="${var}_@suffixSalt@" declare -gxi ${outputVar}+=0 - for infix in "${role_infixes[@]}"; do - local inputVar="${var/+/${infix}}" + for suffix in "${role_suffixes[@]}"; do + local inputVar="${var}${suffix}" if [ -v "$inputVar" ]; then # "1" in the end makes `let` return success error code when # expression itself evaluates to zero. diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 4a4cfce5cc4..ae723a14531 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -239,8 +239,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index b35b69e87e1..6a2c506b1bf 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -264,8 +264,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index f7fbe1ec554..0a35ed023c6 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -276,8 +276,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 173ca128ee0..f3b15eac55d 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -292,8 +292,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 9153268a12b..89933c22edd 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -247,8 +247,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index e3091a062be..5a6e20c0f41 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -234,8 +234,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 7a5535e2a89..03ffec835c9 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -239,8 +239,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index b806f5a6e50..4b14cdb94cd 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -25,12 +25,12 @@ echo "\$LIBRARY_PATH is \`${LIBRARY_PATH-}'" if test "$noSysDirs" = "1"; then declare \ - EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \ - EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_BUILD EXTRA_FLAGS EXTRA_FLAGS_FOR_TARGET \ + EXTRA_LDFLAGS_FOR_BUILD EXTRA_LDFLAGS_FOR_TARGET # Extract flags from Bintools Wrappers - for pre in 'BUILD_' ''; do - curBintools="NIX_${pre}BINTOOLS" + for post in '_FOR_BUILD' ''; do + curBintools="NIX_BINTOOLS${post}" declare -a extraLDFlags=() if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then @@ -48,14 +48,14 @@ if test "$noSysDirs" = "1"; then extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir" "${extraLDFlags[@]}") for i in "${extraLDFlags[@]}"; do - declare EXTRA_${pre}LDFLAGS+=" -Wl,$i" + declare EXTRA_LDFLAGS${post}+=" -Wl,$i" done done # Extract flags from CC Wrappers - for pre in 'BUILD_' ''; do - curCC="NIX_${pre}CC" - curFIXINC="NIX_${pre}FIXINC_DUMMY" + for post in '_FOR_BUILD' ''; do + curCC="NIX_CC${post}" + curFIXINC="NIX_FIXINC_DUMMY${post}" declare -a extraFlags=() if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then @@ -69,11 +69,11 @@ if test "$noSysDirs" = "1"; then # Use *real* header files, otherwise a limits.h is generated that # does not include Libc's limits.h (notably missing SSIZE_MAX, # which breaks the build). - declare NIX_${pre}FIXINC_DUMMY="$libc_devdir/include" + declare NIX_FIXINC_DUMMY${post}="$libc_devdir/include" else # Hack: support impure environments. extraFlags=("-isystem" "/usr/include") - declare NIX_${pre}FIXINC_DUMMY=/usr/include + declare NIX_FIXINC_DUMMY${post}=/usr/include fi extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}") @@ -89,13 +89,13 @@ if test "$noSysDirs" = "1"; then extraFlags=("-O2" "${extraFlags[@]}") fi - declare EXTRA_${pre}FLAGS="${extraFlags[*]}" + declare EXTRA_FLAGS${post}="${extraFlags[*]}" done if test -z "${targetConfig-}"; then # host = target, so the flags are the same - EXTRA_TARGET_FLAGS="$EXTRA_FLAGS" - EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS" + EXTRA_FLAGS_FOR_TARGET="$EXTRA_FLAGS" + EXTRA_LDFLAGS_FOR_TARGET="$EXTRA_LDFLAGS" fi # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find @@ -103,31 +103,31 @@ if test "$noSysDirs" = "1"; then # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx # for the startfiles. makeFlagsArray+=( - "BUILD_SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" - "SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" + "BUILD_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD" + "SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD" "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY" - "LDFLAGS_FOR_BUILD=$EXTRA_BUILD_LDFLAGS" + "LDFLAGS_FOR_BUILD=$EXTRA_LDFLAGS_FOR_BUILD" #"LDFLAGS=$EXTRA_LDFLAGS" - "LDFLAGS_FOR_TARGET=$EXTRA_TARGET_LDFLAGS" + "LDFLAGS_FOR_TARGET=$EXTRA_LDFLAGS_FOR_TARGET" - "CFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" - "CXXFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" - "FLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" + "CFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" + "CXXFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" + "FLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" # It seems there is a bug in GCC 5 #"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" #"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" - "CFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" - "CXXFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" - "FLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" + "CFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" + "CXXFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" + "FLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" ) if test -z "${targetConfig-}"; then makeFlagsArray+=( "BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" - "BOOT_LDFLAGS=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" + "BOOT_LDFLAGS=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" ) fi diff --git a/pkgs/development/compilers/gcc/common/extra-target-flags.nix b/pkgs/development/compilers/gcc/common/extra-target-flags.nix index bce9a8d4738..0b659368cd0 100644 --- a/pkgs/development/compilers/gcc/common/extra-target-flags.nix +++ b/pkgs/development/compilers/gcc/common/extra-target-flags.nix @@ -5,7 +5,7 @@ let in { - EXTRA_TARGET_FLAGS = let + EXTRA_FLAGS_FOR_TARGET = let mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ "-idirafter ${lib.getDev dep}${dep.incdir or "/include"}" ] ++ stdenv.lib.optionals (! crossStageStatic) [ @@ -15,7 +15,7 @@ in ++ lib.optionals (!crossStageStatic) (mkFlags threadsCross) ; - EXTRA_TARGET_LDFLAGS = let + EXTRA_LDFLAGS_FOR_TARGET = let mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" ] ++ (if crossStageStatic then [ diff --git a/pkgs/development/compilers/gcc/libstdc++-hook.sh b/pkgs/development/compilers/gcc/libstdc++-hook.sh index 60c610a8e7a..f5b4123b64d 100644 --- a/pkgs/development/compilers/gcc/libstdc++-hook.sh +++ b/pkgs/development/compilers/gcc/libstdc++-hook.sh @@ -1,4 +1,4 @@ # See pkgs/build-support/setup-hooks/role.bash getHostRole -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@" diff --git a/pkgs/development/compilers/graalvm/default.nix b/pkgs/development/compilers/graalvm/default.nix index 244ee4c010e..337e0f735eb 100644 --- a/pkgs/development/compilers/graalvm/default.nix +++ b/pkgs/development/compilers/graalvm/default.nix @@ -462,7 +462,7 @@ in rec { export CC="gcc" export CPP="gcc -E" export NIX_CXXSTDLIB_LINK="" - export NIX_TARGET_CXXSTDLIB_LINK="" + export NIX_CXXSTDLIB_LINK_FOR_TARGET="" export OPENSSL_PREFIX=$(realpath openssl) # this fixes error: impure path 'LibFFIHeaderDirectives' used in link export NIX_ENFORCE_PURITY=0 diff --git a/pkgs/development/compilers/llvm/10/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/10/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/10/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/10/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/8/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/8/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/8/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/8/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh index 6611259165a..3a274aecc23 100644 --- a/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh +++ b/pkgs/development/compilers/llvm/9/libc++/setup-hook.sh @@ -2,5 +2,5 @@ getHostRole linkCxxAbi="@linkCxxAbi@" -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" -export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1" +export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" diff --git a/pkgs/development/idris-modules/idris-wrapper.nix b/pkgs/development/idris-modules/idris-wrapper.nix index 4e1d2f9c82e..68a1a0f267a 100644 --- a/pkgs/development/idris-modules/idris-wrapper.nix +++ b/pkgs/development/idris-modules/idris-wrapper.nix @@ -7,7 +7,7 @@ symlinkJoin { postBuild = '' wrapProgram $out/bin/idris \ --run 'export IDRIS_CC=''${IDRIS_CC:-${stdenv.cc}/bin/cc}' \ - --set NIX_CC_WRAPPER_${stdenv.cc.infixSalt}_TARGET_HOST 1 \ + --set 'NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}' 1 \ --prefix NIX_CFLAGS_COMPILE " " "-I${lib.getDev gmp}/include" \ --prefix NIX_CFLAGS_LINK " " "-L${lib.getLib gmp}/lib" ''; diff --git a/pkgs/development/libraries/gettext/gettext-setup-hook.sh b/pkgs/development/libraries/gettext/gettext-setup-hook.sh index 69020146f84..5cc9655a89b 100644 --- a/pkgs/development/libraries/gettext/gettext-setup-hook.sh +++ b/pkgs/development/libraries/gettext/gettext-setup-hook.sh @@ -13,5 +13,5 @@ addEnvHooks "$hostOffset" gettextDataDirsHook if [ -n "@gettextNeedsLdflags@" -a -z "${dontAddExtraLibs-}" ]; then # See pkgs/build-support/setup-hooks/role.bash getHostRole - export NIX_${role_pre}LDFLAGS+=" -lintl" + export NIX_LDFLAGS${role_post}+=" -lintl" fi diff --git a/pkgs/development/libraries/libiconv/setup-hook.sh b/pkgs/development/libraries/libiconv/setup-hook.sh index 120cf06c61b..3d9656ffe5d 100644 --- a/pkgs/development/libraries/libiconv/setup-hook.sh +++ b/pkgs/development/libraries/libiconv/setup-hook.sh @@ -4,5 +4,5 @@ # See pkgs/build-support/setup-hooks/role.bash if [ -z "${dontAddExtraLibs-}" ]; then getHostRole - export NIX_${role_pre}LDFLAGS+=" -liconv" + export NIX_LDFLAGS${role_post}+=" -liconv" fi diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index 756e0cf7100..52a4c0ca719 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -63,8 +63,10 @@ stdenv.mkDerivation rec { --subst-var-by libc_lib ${lib.getLib stdenv.cc.libc} substituteInPlace Modules/FindCxxTest.cmake \ --replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell} - # BUILD_CC and BUILD_CXX are used to bootstrap cmake - configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$BUILD_CC CXX=$BUILD_CXX $configureFlags" + '' + # CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake + + '' + configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags" ''; configureFlags = [ diff --git a/pkgs/development/tools/misc/texinfo/cross-tools-flags.patch b/pkgs/development/tools/misc/texinfo/cross-tools-flags.patch index f0e4230d7ec..da28a309719 100644 --- a/pkgs/development/tools/misc/texinfo/cross-tools-flags.patch +++ b/pkgs/development/tools/misc/texinfo/cross-tools-flags.patch @@ -4,7 +4,7 @@ diff -ur texinfo-6.5/configure texinfo-6.5-patched/configure @@ -23281,7 +23281,7 @@ # env -i gives this build host configure a clean environment; # consequently, we have to re-initialize $PATH. - env -i CC="$BUILD_CC" AR="$BUILD_AR" RANLIB="$BUILD_RANLIB" \ + env -i CC="$CC_FOR_BUILD" AR="$AR_FOR_BUILD" RANLIB="$RANLIB_FOR_BUILD" \ - PATH="$PATH" \ + PATH="$PATH" CFLAGS="$NATIVE_TOOLS_CFLAGS" LDFLAGS="$NATIVE_TOOLS_LDFLAGS" \ tools_only=1 \ diff --git a/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh b/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh index 81df09eba17..3c49337a937 100644 --- a/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh +++ b/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh @@ -1,6 +1,6 @@ # See pkgs/build-support/setup-hooks/role.bash getHostRole -export NIX_${role_pre}LDFLAGS+=" -lnbcompat" -export NIX_${role_pre}CFLAGS_COMPILE+=" -DHAVE_NBTOOL_CONFIG_H" -export NIX_${role_pre}CFLAGS_COMPILE+=" -include nbtool_config.h" +export NIX_LDFLAGS${role_post}+=" -lnbcompat" +export NIX_CFLAGS_COMPILE${role_post}+=" -DHAVE_NBTOOL_CONFIG_H" +export NIX_CFLAGS_COMPILE${role_post}+=" -include nbtool_config.h" diff --git a/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh b/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh index 5cf8c753aec..b6cb5aaca05 100644 --- a/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh +++ b/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh @@ -1,4 +1,4 @@ # See pkgs/build-support/setup-hooks/role.bash getHostRole -export NIX_${role_pre}LDFLAGS+=" -lfts" +export NIX_LDFLAGS${role_post}+=" -lfts" diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index 52b280c3026..59656f54db2 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -29,8 +29,8 @@ let "cc-version:=9999" "cc-fullversion:=999999" # `$(..)` expanded by make alone - "HOSTCC:=$(BUILD_CC)" - "HOSTCXX:=$(BUILD_CXX)" + "HOSTCC:=$(CC_FOR_BUILD)" + "HOSTCXX:=$(CXX_FOR_BUILD)" ]; # Skip clean on darwin, case-sensitivity issues. diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 77d70e84258..e17b41eab32 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -98,7 +98,7 @@ let # TODO: This really wants to be in stdenv/darwin but we don't have hostPlatform # there (yet?) so it goes here until then. preHook = preHook+ lib.optionalString buildPlatform.isDarwin '' - export NIX_BUILD_DONT_SET_RPATH=1 + export NIX_DONT_SET_RPATH_FOR_BUILD=1 '' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) '' export NIX_DONT_SET_RPATH=1 export NIX_NO_SELF_RPATH=1 @@ -107,7 +107,7 @@ let # think the best solution would just be to fixup linux RPATHs so we don't # need to set `-rpath` anywhere. # + lib.optionalString targetPlatform.isDarwin '' - # export NIX_TARGET_DONT_SET_RPATH=1 + # export NIX_DONT_SET_RPATH_FOR_TARGET=1 # '' ; From ee5975319b149007a0100f15cc3356d352fb5b1c Mon Sep 17 00:00:00 2001 From: xbreak Date: Mon, 11 May 2020 18:34:11 +0000 Subject: [PATCH 10/80] qt5: Add missing include path to pkg-config files This is achieved by patching qtbase `qmake/generators/makefile.cpp` to unconditionally add the missing `-I${includedir}`. The include path is otherwise conditioned on whether it is already available or not. Since there is no unified set of system include paths in nix this cause problems as reported in #52457. --- pkgs/development/libraries/qt-5/5.12/default.nix | 5 +++++ .../qtbase.patch.d/0014-qtbase-pkg-config.patch | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch diff --git a/pkgs/development/libraries/qt-5/5.12/default.nix b/pkgs/development/libraries/qt-5/5.12/default.nix index 78d711e969b..3123e83960e 100644 --- a/pkgs/development/libraries/qt-5/5.12/default.nix +++ b/pkgs/development/libraries/qt-5/5.12/default.nix @@ -67,6 +67,11 @@ let ./qtbase.patch.d/0010-qtbase-qtpluginpath.patch ./qtbase.patch.d/0011-qtbase-assert.patch ./qtbase.patch.d/0012-fix-header_module.patch + + # Ensure -I${includedir} is added to Cflags in pkg-config files. + # See https://github.com/NixOS/nixpkgs/issues/52457 + ./qtbase.patch.d/0014-qtbase-pkg-config.patch + # https://bugreports.qt.io/browse/QTBUG-81715 # remove after updating to qt > 5.12.7 (fetchpatch { diff --git a/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch b/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch new file mode 100644 index 00000000000..90caaea1cf4 --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch @@ -0,0 +1,14 @@ +diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp +--- a/qmake/generators/makefile.cpp ++++ b/qmake/generators/makefile.cpp +@@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile() + << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ") + // << varGlue("DEFINES","-D"," -D"," ") + ; +- if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir)) +- t << "-I${includedir}"; ++ t << "-I${includedir}"; + if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle") + && libDir != QLatin1String("/Library/Frameworks")) { + t << " -F${libdir}"; + From b6beb43dd7c20e34d3d9e2078b0fa2945009c9b9 Mon Sep 17 00:00:00 2001 From: Gaelan Steele Date: Tue, 12 May 2020 11:52:29 -0700 Subject: [PATCH 11/80] kexectools: always pass host and target to configure Fixes #56290. --- pkgs/os-specific/linux/kexectools/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/os-specific/linux/kexectools/default.nix b/pkgs/os-specific/linux/kexectools/default.nix index b1abf50f5f1..a70cb2e087f 100644 --- a/pkgs/os-specific/linux/kexectools/default.nix +++ b/pkgs/os-specific/linux/kexectools/default.nix @@ -14,6 +14,9 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" "pic" "relro" "pie" ]; + # Prevent kexec-tools from using uname to detect target, which is wrong in + # cases like compiling for aarch32 on aarch64 + configurePlatforms = [ "build" "host" ]; configureFlags = [ "BUILD_CC=${buildPackages.stdenv.cc.targetPrefix}cc" ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; buildInputs = [ zlib ]; From c10f0a32d26832a419e294765244eb05fda650a9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 13 May 2020 04:39:18 +0000 Subject: [PATCH 12/80] Revert "Revert "libbfd: fix build"" This reverts commit 237ef3095c7604a36ab231d282fcfce02613130d. Looks like we're trying to bump binutils again? --- .../build-components-separately.patch | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/pkgs/development/tools/misc/binutils/build-components-separately.patch b/pkgs/development/tools/misc/binutils/build-components-separately.patch index d3cd0d2131c..38fa4934a28 100644 --- a/pkgs/development/tools/misc/binutils/build-components-separately.patch +++ b/pkgs/development/tools/misc/binutils/build-components-separately.patch @@ -1,19 +1,8 @@ -From bc09a9236f67e710d545ac11bcdac7b55dbcc1a0 Mon Sep 17 00:00:00 2001 -From: John Ericson -Date: Thu, 12 Oct 2017 11:16:57 -0400 -Subject: [PATCH] Build components separately - ---- - bfd/configure.ac | 18 +++--------------- - opcodes/Makefile.am | 17 +++++++++++++---- - opcodes/configure.ac | 45 ++++++--------------------------------------- - 3 files changed, 22 insertions(+), 58 deletions(-) - diff --git a/bfd/configure.ac b/bfd/configure.ac -index 9a183c1628..8728837384 100644 +index c5bfbd5d..45ad4c26 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac -@@ -241,31 +241,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, +@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, LT_LIB_M @@ -33,26 +22,26 @@ index 9a183c1628..8728837384 100644 - SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" - fi - - # More hacks to build DLLs on Windows. case "${host}" in + # More hacks to build DLLs on Windows. *-*-cygwin*) SHARED_LDFLAGS="-no-undefined" - SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32" + SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32" ;; - # Hack to build or1k-src on OSX - or1k*-*-darwin*) + # Use built-in libintl on macOS, since it is not provided by libc. + *-*-darwin*) - SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl" + SHARED_LIBADD="-liberty -lintl" ;; esac diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am -index 925e7ff651..47b395c195 100644 +index 4f06074a..6836c589 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am -@@ -52,7 +52,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir) +@@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir) endif # This is where bfd.h lives. @@ -61,7 +50,7 @@ index 925e7ff651..47b395c195 100644 BUILD_LIBS = @BUILD_LIBS@ BUILD_LIB_DEPS = @BUILD_LIB_DEPS@ -@@ -303,7 +303,7 @@ OFILES = @BFD_MACHINES@ +@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@ # development.sh is used to determine -Werror default. CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh @@ -70,7 +59,7 @@ index 925e7ff651..47b395c195 100644 disassemble.lo: disassemble.c if am__fastdepCC -@@ -324,12 +324,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c +@@ -322,12 +322,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c # old version of libbfd, or to pick up libbfd for the wrong architecture # if host != build. So for building with shared libraries we use a # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la. @@ -95,10 +84,10 @@ index 925e7ff651..47b395c195 100644 # the build directory so that we don't have to convert all the # programs that use libopcodes.a simultaneously. This is a hack which diff --git a/opcodes/configure.ac b/opcodes/configure.ac -index b9f5eb8a4f..ef2c2152b7 100644 +index 00be9c88..6e589ae4 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac -@@ -89,6 +89,7 @@ AC_PROG_INSTALL +@@ -86,6 +86,7 @@ AC_PROG_INSTALL AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h) ACX_HEADER_STRING @@ -106,7 +95,7 @@ index b9f5eb8a4f..ef2c2152b7 100644 AC_CHECK_DECLS([basename, stpcpy]) -@@ -134,61 +135,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, +@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, LT_LIB_M @@ -173,6 +162,3 @@ index b9f5eb8a4f..ef2c2152b7 100644 ;; esac --- -2.14.2 - From 58d0719bddfdd24afa4031aef50085fc26818ffe Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Mon, 11 May 2020 00:06:26 +0000 Subject: [PATCH 13/80] wavpack: 5.2.0 -> 5.3.0 --- pkgs/development/libraries/wavpack/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/wavpack/default.nix b/pkgs/development/libraries/wavpack/default.nix index 329de97d39e..78794430860 100644 --- a/pkgs/development/libraries/wavpack/default.nix +++ b/pkgs/development/libraries/wavpack/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { pname = "wavpack"; - version = "5.2.0"; + version = "5.3.0"; enableParallelBuilding = true; @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "http://www.wavpack.com/${pname}-${version}.tar.bz2"; - sha256 = "062f97bvm466ygvix3z0kbgffvvrc5cg2ak568jaq8r56v28q8rw"; + sha256 = "00baiag7rlkzc6545dqdp4p5sr7xc3n97n7qdkgx58c544x0pw5n"; }; meta = with stdenv.lib; { From ee2922a4b4733bf74cdc5bac1de98a255d553447 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 10 May 2020 12:48:24 +0000 Subject: [PATCH 14/80] sysstat: 12.3.1 -> 12.3.2 --- pkgs/os-specific/linux/sysstat/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/sysstat/default.nix b/pkgs/os-specific/linux/sysstat/default.nix index a27f6585202..258da07c40b 100644 --- a/pkgs/os-specific/linux/sysstat/default.nix +++ b/pkgs/os-specific/linux/sysstat/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, gettext, bzip2 }: stdenv.mkDerivation rec { - name = "sysstat-12.3.1"; + name = "sysstat-12.3.2"; src = fetchurl { url = "http://pagesperso-orange.fr/sebastien.godard/${name}.tar.xz"; - sha256 = "1hf1sy7akribmgavadqccxpy49yv0zfb3m81d2bj6jf8pyzwcrbq"; + sha256 = "0gaas16q2f7qmrv4sbqk2l2mrc7yr64s33bzw4094p59fkylm7k4"; }; buildInputs = [ gettext ]; From a1e13f6140a568b73c1c36bb9ef79d7876ccaae3 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Wed, 13 May 2020 14:34:10 -0400 Subject: [PATCH 15/80] go: stop setting GOPATH The compiler does not need it anymore, has not needed it for many years iirc. This just goes in and pollutes the environment overriding the users GOPATH and causing grief. Go even warns about it itself, without vs with this commit: ```sh ~> go env GOPATH /home/manny/go ~> nix-shell -p go ~> go env GOPATH warning: GOPATH set to GOROOT (/nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go) has no effect /nix/store/gvw1mfpdrk7i82884yhxf9lf5j3c12zm-go-1.14.1/share/go ~> exit ~> nix-shell -I nixpkgs=cloned/NixOS/nixpkgs -p go ~> go env GOPATH /home/manny/go ~> exit ``` --- pkgs/development/compilers/go/1.14.nix | 2 -- pkgs/development/compilers/go/1.4.nix | 2 -- pkgs/development/compilers/go/setup-hook.sh | 5 ----- 3 files changed, 9 deletions(-) delete mode 100644 pkgs/development/compilers/go/setup-hook.sh diff --git a/pkgs/development/compilers/go/1.14.nix b/pkgs/development/compilers/go/1.14.nix index 9ee5b6fa624..4d83e12b3b2 100644 --- a/pkgs/development/compilers/go/1.14.nix +++ b/pkgs/development/compilers/go/1.14.nix @@ -229,8 +229,6 @@ stdenv.mkDerivation rec { runHook postInstall ''; - setupHook = ./setup-hook.sh; - disallowedReferences = [ goBootstrap ]; meta = with stdenv.lib; { diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix index fc3fb0ad0e5..af125d60ed0 100644 --- a/pkgs/development/compilers/go/1.4.nix +++ b/pkgs/development/compilers/go/1.4.nix @@ -151,8 +151,6 @@ stdenv.mkDerivation rec { ./all.bash ''; - setupHook = ./setup-hook.sh; - meta = with stdenv.lib; { branch = "1.4"; homepage = "http://golang.org/"; diff --git a/pkgs/development/compilers/go/setup-hook.sh b/pkgs/development/compilers/go/setup-hook.sh deleted file mode 100644 index 7dce15eeb10..00000000000 --- a/pkgs/development/compilers/go/setup-hook.sh +++ /dev/null @@ -1,5 +0,0 @@ -addToGoPath() { - addToSearchPath GOPATH $1/share/go -} - -addEnvHooks "$targetOffset" addToGoPath From b14d99777815df862a5aaccd4957bf06cecacfb4 Mon Sep 17 00:00:00 2001 From: Gaelan Steele Date: Wed, 13 May 2020 09:22:11 -0700 Subject: [PATCH 16/80] nss: fix building for aarch32 on aarch64 There are two ways to build a package for aarch32 on an aarch64 machine: either by cross compiling as normal, or by adding armv6l/armv7l to extraPlatforms and doing a non-cross compile. Previously, NSS failed to build with both methods: when using extraPlatforms, things failed because NSS includes an armv8-specific file (presumably based on the result of uname); when cross compiling, NSS's build system expects to receive an architecture name of arm (not armv6l or whatever), so was failing to include some arch-specific code and failed with a linker error. This commit fixes those things by a) always passing the arch, even when not cross-compiling, and b) special-casing aarch32 to always pass in an arch of arm. --- pkgs/development/libraries/nss/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix index d48b5a6ba73..5251c680361 100644 --- a/pkgs/development/libraries/nss/default.nix +++ b/pkgs/development/libraries/nss/default.nix @@ -53,7 +53,9 @@ in stdenv.mkDerivation rec { preConfigure = "cd nss"; makeFlags = let - cpu = stdenv.hostPlatform.parsed.cpu.name; + # NSS's build systems expects aarch32 to be called arm; if we pass in armv6l/armv7l, it + # fails with a linker error + cpu = if stdenv.hostPlatform.isAarch32 then "arm" else stdenv.hostPlatform.parsed.cpu.name; in [ "NSPR_INCLUDE_DIR=${nspr.dev}/include" "NSPR_LIB_DIR=${nspr.out}/lib" @@ -64,9 +66,11 @@ in stdenv.mkDerivation rec { "USE_SYSTEM_ZLIB=1" "NSS_USE_SYSTEM_SQLITE=1" "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc" - ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with + # uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64 "OS_TEST=${cpu}" "CPU_ARCH=${cpu}" + ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=1" "NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling ] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1" From 8d41f9f281a8317faa45c4270e8d48bf657cc1a0 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 15 May 2020 09:54:39 +1000 Subject: [PATCH 17/80] go: 1.14.2 -> 1.14.3 https://golang.org/doc/devel/release.html#go1.14.minor --- pkgs/development/compilers/go/1.14.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.14.nix b/pkgs/development/compilers/go/1.14.nix index 4d83e12b3b2..9aaf85c598f 100644 --- a/pkgs/development/compilers/go/1.14.nix +++ b/pkgs/development/compilers/go/1.14.nix @@ -30,11 +30,11 @@ in stdenv.mkDerivation rec { pname = "go"; - version = "1.14.2"; + version = "1.14.3"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; - sha256 = "0z3zxsnhmsxplnwfw1l9gr6jgglwp50sr3p5njknv9i6jzk89plq"; + sha256 = "0mmgf74snprdiajgh99jjliwjl5im71qcgm5qrxpnyfisiw3f0lk"; }; # perl is used for testing go vet From e7d4b315daf79752a1d6df1754395f68fdb90484 Mon Sep 17 00:00:00 2001 From: Piotr Bogdan Date: Fri, 15 May 2020 13:37:59 +0100 Subject: [PATCH 18/80] pulseaudio: enable soxr (resampler) support --- pkgs/servers/pulseaudio/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index b9fb104d5f6..e15efd4b47d 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -3,7 +3,7 @@ , xorg, libcap, alsaLib, glib, dconf , avahi, libjack2, libasyncns, lirc, dbus , sbc, bluez5, udev, openssl, fftwFloat -, speexdsp, systemd, webrtc-audio-processing +, soxr, speexdsp, systemd, webrtc-audio-processing , x11Support ? false @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { lib.optionals stdenv.isLinux [ libcap ]; buildInputs = - [ libtool libsndfile speexdsp fftwFloat ] + [ libtool libsndfile soxr speexdsp fftwFloat ] ++ lib.optionals stdenv.isLinux [ glib dbus ] ++ lib.optionals stdenv.isDarwin [ CoreServices AudioUnit Cocoa ] ++ lib.optionals (!libOnly) ( From c1983f71a275f8d68ab8bbe9c99f5870235434db Mon Sep 17 00:00:00 2001 From: Izorkin Date: Fri, 15 May 2020 16:37:48 +0300 Subject: [PATCH 19/80] mariadb-connector-c: 3.1.7 -> 3.1.8 --- pkgs/servers/sql/mariadb/connector-c/3_1.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/sql/mariadb/connector-c/3_1.nix b/pkgs/servers/sql/mariadb/connector-c/3_1.nix index e3fc6604530..fb6835775fb 100644 --- a/pkgs/servers/sql/mariadb/connector-c/3_1.nix +++ b/pkgs/servers/sql/mariadb/connector-c/3_1.nix @@ -1,6 +1,6 @@ { callPackage, ... } @ args: callPackage ./. (args // { - version = "3.1.7"; - sha256 = "16pmdms454jbralaw6rpx0rjlf2297p6h3q8wfk0n87kbn7vrxv4"; + version = "3.1.8"; + sha256 = "0yrzhsxmjiwkhchagx8dymzhvxl3k5h40wn9wpicqjvgjb9k8523"; }) From 282cb2f8d6ca4bbd18eacfa5ca8a05481def71fa Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 15 May 2020 16:54:26 +0200 Subject: [PATCH 20/80] =?UTF-8?q?meson:=200.54.1=20=E2=86=92=200.54.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/mesonbuild/meson/compare/0.54.1...0.54.2 --- pkgs/development/tools/build-managers/meson/default.nix | 4 ++-- .../tools/build-managers/meson/more-env-vars.patch | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index a2dc1424d65..0a61b8d02a9 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -8,11 +8,11 @@ python3Packages.buildPythonApplication rec { pname = "meson"; - version = "0.54.1"; + version = "0.54.2"; src = python3Packages.fetchPypi { inherit pname version; - sha256 = "L3b7RXJ2K+E+5HkpJhAJG0UJr1eIvM6zkf4iK80Cltw="; + sha256 = "p3Fu6uj43/AC5BR2Qliatklv+DnkN2pa7XYfg8H6BFU="; }; postFixup = '' diff --git a/pkgs/development/tools/build-managers/meson/more-env-vars.patch b/pkgs/development/tools/build-managers/meson/more-env-vars.patch index a8f860f03cc..6326f5ec3cf 100644 --- a/pkgs/development/tools/build-managers/meson/more-env-vars.patch +++ b/pkgs/development/tools/build-managers/meson/more-env-vars.patch @@ -1,16 +1,13 @@ diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py -index ac13a710..e0d07c51 100644 +index 17058df6b..7a68b7f15 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py -@@ -119,9 +119,9 @@ def get_env_var_pair(for_machine: MachineChoice, +@@ -120,7 +120,7 @@ def get_env_var_pair(for_machine: MachineChoice, # compiling we fall back on the unprefixed host version. This # allows native builds to never need to worry about the 'BUILD_*' # ones. - ([var_name + '_FOR_BUILD'] if is_cross else [var_name]), + [var_name + '_FOR_BUILD'] + ([] if is_cross else [var_name]), # Always just the unprefixed host verions -- ([] if is_cross else [var_name]), -+ [var_name], + [var_name] )[for_machine] - for var in candidates: - value = os.environ.get(var) From 1bc7b68b1cac260d80cb33d52c86867a31f3d424 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 15 May 2020 19:50:13 +0200 Subject: [PATCH 21/80] gobject-introspection: clean up the expression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * format with nixpkgs-fmt * reorder the attributes * use pkg-config instead of the pkgconfig alias * optional → optionals * remove top-level `with lib;` --- .../gobject-introspection/default.nix | 99 ++++++++++++------- 1 file changed, 66 insertions(+), 33 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 0d514c3fd7d..1a92afc9859 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -1,31 +1,80 @@ -{ stdenv, fetchurl, glib, flex, bison, meson, ninja, pkgconfig, libffi, python3 -, libintl, cctools, cairo, gnome3, glibcLocales -, substituteAll, nixStoreDir ? builtins.storeDir +{ stdenv +, fetchurl +, glib +, flex +, bison +, meson +, ninja +, pkg-config +, libffi +, python3 +, libintl +, cctools +, cairo +, gnome3 +, glibcLocales +, substituteAll +, nixStoreDir ? builtins.storeDir , x11Support ? true }: + # now that gobject-introspection creates large .gir files (eg gtk3 case) # it may be worth thinking about using multiple derivation outputs # In that case its about 6MB which could be separated -with stdenv.lib; stdenv.mkDerivation rec { pname = "gobject-introspection"; version = "1.64.1"; + # outputs TODO: share/gobject-introspection-1.0/tests is needed during build + # by pygobject3 (and maybe others), but it's only searched in $out + outputs = [ "out" "dev" "man" ]; + outputBin = "dev"; + src = fetchurl { url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; sha256 = "19vz7vp10h0zj3f491yk72dp89bix6rgkzxg4qcm4d6151ksxgl0"; }; - outputs = [ "out" "dev" "man" ]; - outputBin = "dev"; + patches = [ + (substituteAll { + src = ./test_shlibs.patch; + inherit nixStoreDir; + }) - LC_ALL = "en_US.UTF-8"; # for tests + (substituteAll { + src = ./absolute_shlib_path.patch; + inherit nixStoreDir; + }) + ] ++ stdenv.lib.optionals x11Support [ + # https://github.com/NixOS/nixpkgs/issues/34080 + (substituteAll { + src = ./absolute_gir_path.patch; + cairoLib = "${stdenv.lib.getLib cairo}/lib"; + }) + ]; - nativeBuildInputs = [ meson ninja pkgconfig libintl glibcLocales ]; - buildInputs = [ flex bison python3 setupHook/*move .gir*/ ] - ++ stdenv.lib.optional stdenv.isDarwin cctools; - propagatedBuildInputs = [ libffi glib ]; + nativeBuildInputs = [ + meson + ninja + pkg-config + libintl + glibcLocales + ]; + + buildInputs = [ + flex + bison + python3 + setupHook /*move .gir*/ + ] ++ stdenv.lib.optionals stdenv.isDarwin [ + cctools + ]; + + propagatedBuildInputs = [ + libffi + glib + ]; mesonFlags = [ "--datadir=${placeholder "dev"}/share" @@ -33,28 +82,10 @@ stdenv.mkDerivation rec { "-Dcairo=disabled" ]; - # outputs TODO: share/gobject-introspection-1.0/tests is needed during build - # by pygobject3 (and maybe others), but it's only searched in $out - - setupHook = ./setup-hook.sh; - - patches = [ - (substituteAll { - src = ./test_shlibs.patch; - inherit nixStoreDir; - }) - (substituteAll { - src = ./absolute_shlib_path.patch; - inherit nixStoreDir; - }) - ] ++ stdenv.lib.optional x11Support # https://github.com/NixOS/nixpkgs/issues/34080 - (substituteAll { - src = ./absolute_gir_path.patch; - cairoLib = "${getLib cairo}/lib"; - }); - doCheck = !stdenv.isAarch64; + LC_ALL = "en_US.UTF-8"; # for tests + preBuild = '' # Our gobject-introspection patches make the shared library paths absolute # in the GIR files. When running tests, the library is not yet installed, @@ -68,6 +99,8 @@ stdenv.mkDerivation rec { rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} ''; + setupHook = ./setup-hook.sh; + passthru = { updateScript = gnome3.updateScript { packageName = pname; @@ -76,9 +109,9 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "A middleware layer between C libraries and language bindings"; - homepage = "http://live.gnome.org/GObjectIntrospection"; + homepage = "http://live.gnome.org/GObjectIntrospection"; maintainers = with maintainers; [ lovek323 lethalman ]; - platforms = platforms.unix; + platforms = platforms.unix; license = with licenses; [ gpl2 lgpl2 ]; longDescription = '' From fbb86b1fa81ae7f29c6775066f6ce089db5ff6d3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 15 May 2020 19:55:13 +0200 Subject: [PATCH 22/80] gobject-introspection: more clean-ups * remove glibcLocales now that glibc contains C.UTF-8 * remove libintl, that should be in by default or something * update homepage * add gnome team to maintainers * remove the temporary libregress closer its creation --- .../libraries/gobject-introspection/default.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 1a92afc9859..7ff5498e5a9 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -8,11 +8,9 @@ , pkg-config , libffi , python3 -, libintl , cctools , cairo , gnome3 -, glibcLocales , substituteAll , nixStoreDir ? builtins.storeDir , x11Support ? true @@ -58,8 +56,6 @@ stdenv.mkDerivation rec { meson ninja pkg-config - libintl - glibcLocales ]; buildInputs = [ @@ -84,9 +80,7 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isAarch64; - LC_ALL = "en_US.UTF-8"; # for tests - - preBuild = '' + preCheck = '' # Our gobject-introspection patches make the shared library paths absolute # in the GIR files. When running tests, the library is not yet installed, # though, so we need to replace the absolute path with a local one during build. @@ -95,7 +89,7 @@ stdenv.mkDerivation rec { ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} ''; - preInstall = '' + postCheck = '' rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} ''; @@ -109,8 +103,8 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "A middleware layer between C libraries and language bindings"; - homepage = "http://live.gnome.org/GObjectIntrospection"; - maintainers = with maintainers; [ lovek323 lethalman ]; + homepage = "https://gi.readthedocs.io/"; + maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 ]); platforms = platforms.unix; license = with licenses; [ gpl2 lgpl2 ]; From e4a009a109f36686adde6fe15e00475072c45abf Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 15 May 2020 21:03:52 +0200 Subject: [PATCH 23/80] gobject-introspection: consolidate patches and add comments --- .../absolute_shlib_path.patch | 43 +++++++++++++++++++ .../gobject-introspection/default.nix | 9 ++-- .../gobject-introspection/test_shlibs.patch | 43 ------------------- 3 files changed, 47 insertions(+), 48 deletions(-) delete mode 100644 pkgs/development/libraries/gobject-introspection/test_shlibs.patch diff --git a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch index 6e56d3fab41..775c2985530 100644 --- a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch +++ b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch @@ -140,3 +140,46 @@ def extract_libtool(la_file): +--- a/tests/scanner/test_shlibs.py ++++ b/tests/scanner/test_shlibs.py +@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path + + class TestLddParser(unittest.TestCase): + ++ def test_resolve_from_ldd_output_nix(self): ++ output = '''\ ++ libglib-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0 (0x00007f0ee1b28000) ++ libgobject-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgobject-2.0.so.0 (0x00007f0ee18cf000) ++ libgio-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0 (0x00007f0ee1502000) ++ libxml2.so.2 => @nixStoreDir@/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8/lib/libxml2.so.2 (0x00007f0ee119c000) ++ libsqlite3.so.0 => @nixStoreDir@/ck5ay23hsmlc67pg3m34kzd1k2hhvww0-sqlite-3.24.0/lib/libsqlite3.so.0 (0x00007f0ee0e98000) ++ libpsl.so.5 => @nixStoreDir@/qn3l2gn7m76f318676wflrs2z6d4rrkj-libpsl-0.20.2-list-2017-02-03/lib/libpsl.so.5 (0x00007f0ee0c88000) ++ libc.so.6 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6 (0x00007f0ee08d4000) ++ libpcre.so.1 => @nixStoreDir@/hxbq8lpc53qsf1bc0dfcsm47wmcxzjvh-pcre-8.42/lib/libpcre.so.1 (0x00007f0ee0662000) ++ @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0ee20ff000) ++ libblkid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libblkid.so.1 (0x00007f0edd0cd000) ++ libuuid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libuuid.so.1 (0x00007f0edcec5000) ++ librt.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/librt.so.1 (0x00007f0edccbd000) ++ libstdc++.so.6 => @nixStoreDir@/3v5r7fkrbkw2qajadvjbf6p6qriz9p1i-gcc-7.3.0-lib/lib/libstdc++.so.6 (0x00007f0edc936000) ++ libgcc_s.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0edc720000) ++ ''' ++ libraries = ['glib-2.0', 'gio-2.0'] ++ ++ self.assertEqual( ++ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0', ++ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'], ++ resolve_from_ldd_output(libraries, output)) ++ + def test_resolve_from_ldd_output(self): + output = '''\ + libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000) +@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase): + + self.assertEqual( + sanitize_shlib_path('/foo/bar'), +- '/foo/bar' if sys.platform == 'darwin' else 'bar') ++ # NixOS always want the absolute path ++ '/foo/bar') + + def test_unresolved_library(self): + output = '' diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 7ff5498e5a9..42c2b42f948 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -35,16 +35,15 @@ stdenv.mkDerivation rec { }; patches = [ - (substituteAll { - src = ./test_shlibs.patch; - inherit nixStoreDir; - }) - + # Make g-ir-scanner put absolute path to GIR files it generates + # so that programs can just dlopen them without having to muck + # with LD_LIBRARY_PATH environment variable. (substituteAll { src = ./absolute_shlib_path.patch; inherit nixStoreDir; }) ] ++ stdenv.lib.optionals x11Support [ + # Hardcode the cairo shared library path in the Cairo gir shipped with this package. # https://github.com/NixOS/nixpkgs/issues/34080 (substituteAll { src = ./absolute_gir_path.patch; diff --git a/pkgs/development/libraries/gobject-introspection/test_shlibs.patch b/pkgs/development/libraries/gobject-introspection/test_shlibs.patch deleted file mode 100644 index 65b5a1a13b9..00000000000 --- a/pkgs/development/libraries/gobject-introspection/test_shlibs.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/tests/scanner/test_shlibs.py -+++ b/tests/scanner/test_shlibs.py -@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path - - class TestLddParser(unittest.TestCase): - -+ def test_resolve_from_ldd_output_nix(self): -+ output = '''\ -+ libglib-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0 (0x00007f0ee1b28000) -+ libgobject-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgobject-2.0.so.0 (0x00007f0ee18cf000) -+ libgio-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0 (0x00007f0ee1502000) -+ libxml2.so.2 => @nixStoreDir@/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8/lib/libxml2.so.2 (0x00007f0ee119c000) -+ libsqlite3.so.0 => @nixStoreDir@/ck5ay23hsmlc67pg3m34kzd1k2hhvww0-sqlite-3.24.0/lib/libsqlite3.so.0 (0x00007f0ee0e98000) -+ libpsl.so.5 => @nixStoreDir@/qn3l2gn7m76f318676wflrs2z6d4rrkj-libpsl-0.20.2-list-2017-02-03/lib/libpsl.so.5 (0x00007f0ee0c88000) -+ libc.so.6 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6 (0x00007f0ee08d4000) -+ libpcre.so.1 => @nixStoreDir@/hxbq8lpc53qsf1bc0dfcsm47wmcxzjvh-pcre-8.42/lib/libpcre.so.1 (0x00007f0ee0662000) -+ @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0ee20ff000) -+ libblkid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libblkid.so.1 (0x00007f0edd0cd000) -+ libuuid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libuuid.so.1 (0x00007f0edcec5000) -+ librt.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/librt.so.1 (0x00007f0edccbd000) -+ libstdc++.so.6 => @nixStoreDir@/3v5r7fkrbkw2qajadvjbf6p6qriz9p1i-gcc-7.3.0-lib/lib/libstdc++.so.6 (0x00007f0edc936000) -+ libgcc_s.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0edc720000) -+ ''' -+ libraries = ['glib-2.0', 'gio-2.0'] -+ -+ self.assertEqual( -+ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0', -+ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'], -+ resolve_from_ldd_output(libraries, output)) -+ - def test_resolve_from_ldd_output(self): - output = '''\ - libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000) -@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase): - - self.assertEqual( - sanitize_shlib_path('/foo/bar'), -- '/foo/bar' if sys.platform == 'darwin' else 'bar') -+ # NixOS always want the absolute path -+ '/foo/bar') - - def test_unresolved_library(self): - output = '' From fd5ea9d5f20bbb79ace51abeb411efb17556a60d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 15 May 2020 21:32:37 +0200 Subject: [PATCH 24/80] gobject-introspection: add docs --- .../libraries/gobject-introspection/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 42c2b42f948..5c7ad4bbac7 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -5,6 +5,10 @@ , bison , meson , ninja +, gtk-doc +, docbook-xsl-nons +, docbook_xml_dtd_43 +, docbook_xml_dtd_45 , pkg-config , libffi , python3 @@ -26,7 +30,7 @@ stdenv.mkDerivation rec { # outputs TODO: share/gobject-introspection-1.0/tests is needed during build # by pygobject3 (and maybe others), but it's only searched in $out - outputs = [ "out" "dev" "man" ]; + outputs = [ "out" "dev" "devdoc" "man" ]; outputBin = "dev"; src = fetchurl { @@ -55,6 +59,10 @@ stdenv.mkDerivation rec { meson ninja pkg-config + gtk-doc + docbook-xsl-nons + docbook_xml_dtd_43 + docbook_xml_dtd_45 ]; buildInputs = [ @@ -75,6 +83,7 @@ stdenv.mkDerivation rec { "--datadir=${placeholder "dev"}/share" "-Ddoctool=disabled" "-Dcairo=disabled" + "-Dgtk_doc=true" ]; doCheck = !stdenv.isAarch64; From 27edd9efb3cea58629091778fcbf1c3ca994f075 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 16 May 2020 00:20:32 +0000 Subject: [PATCH 25/80] cross/tests: Use `crossPkgs.runCommand` so we have `strictDeps` --- pkgs/test/cross/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix index 6c31a16f2fd..e65805c6a40 100644 --- a/pkgs/test/cross/default.nix +++ b/pkgs/test/cross/default.nix @@ -13,7 +13,7 @@ let compareTest = { emulator, pkgFun, hostPkgs, crossPkgs, exec, args ? [] }: let pkgName = (pkgFun hostPkgs).name; args' = lib.concatStringsSep " " args; - in pkgs.runCommand "test-${pkgName}-${crossPkgs.hostPlatform.config}" { + in crossPkgs.runCommand "test-${pkgName}-${crossPkgs.hostPlatform.config}" { nativeBuildInputs = [ pkgs.dos2unix ]; } '' # Just in case we are using wine, get rid of that annoying extra From ee8cfe4bf3319e4eb30ab3be6bf890f615f89453 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Apr 2020 23:56:25 -0400 Subject: [PATCH 26/80] treewide: pkg-config has `targetPrefix` --- pkgs/applications/editors/mg/default.nix | 2 +- pkgs/applications/graphics/ImageMagick/7.0.nix | 2 +- pkgs/applications/graphics/ImageMagick/default.nix | 4 ++-- pkgs/applications/misc/stupidterm/default.nix | 2 +- pkgs/build-support/dotnetbuildhelpers/default.nix | 2 +- pkgs/development/libraries/ffmpeg/generic.nix | 1 - pkgs/development/libraries/gtkd/default.nix | 2 +- pkgs/development/python-modules/pkgconfig/default.nix | 2 +- pkgs/development/python-modules/zstd/default.nix | 2 +- pkgs/os-specific/linux/batman-adv/alfred.nix | 2 +- pkgs/os-specific/linux/batman-adv/batctl.nix | 2 +- pkgs/tools/networking/openconnect_pa/default.nix | 2 +- 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/editors/mg/default.nix b/pkgs/applications/editors/mg/default.nix index 612cdcc7f88..ef6943001b9 100644 --- a/pkgs/applications/editors/mg/default.nix +++ b/pkgs/applications/editors/mg/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - makeFlags = [ "PKG_CONFIG=${buildPackages.pkgconfig}/bin/pkg-config" ]; + makeFlags = [ "PKG_CONFIG=${buildPackages.pkgconfig}/bin/${buildPackages.pkgconfig.targetPrefix}pkg-config" ]; installPhase = '' install -m 555 -Dt $out/bin mg diff --git a/pkgs/applications/graphics/ImageMagick/7.0.nix b/pkgs/applications/graphics/ImageMagick/7.0.nix index f2542301119..cbc72f91dcc 100644 --- a/pkgs/applications/graphics/ImageMagick/7.0.nix +++ b/pkgs/applications/graphics/ImageMagick/7.0.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation { moveToOutput "lib/ImageMagick-*/config-Q16HDRI" "$dev" # includes configure params for file in "$dev"/bin/*-config; do substituteInPlace "$file" --replace pkg-config \ - "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/pkg-config'" + "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config'" done '' + lib.optionalString (ghostscript != null) '' for la in $out/lib/*.la; do diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix index 0ded57b1a72..583a845c3c7 100644 --- a/pkgs/applications/graphics/ImageMagick/default.nix +++ b/pkgs/applications/graphics/ImageMagick/default.nix @@ -85,9 +85,9 @@ stdenv.mkDerivation { moveToOutput "lib/ImageMagick-*/config-Q16" "$dev" # includes configure params for file in "$dev"/bin/*-config; do substituteInPlace "$file" --replace "${pkgconfig}/bin/pkg-config -config" \ - ${pkgconfig}/bin/pkg-config + ${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config substituteInPlace "$file" --replace ${pkgconfig}/bin/pkg-config \ - "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/pkg-config'" + "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config'" done '' + lib.optionalString (ghostscript != null) '' for la in $out/lib/*.la; do diff --git a/pkgs/applications/misc/stupidterm/default.nix b/pkgs/applications/misc/stupidterm/default.nix index 0a6e947f15c..2016059d81e 100644 --- a/pkgs/applications/misc/stupidterm/default.nix +++ b/pkgs/applications/misc/stupidterm/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation { sha256 = "1f73wvqqvj5pr3fvb7jjc4bi1iwgkkknz24k8n69mdb75jnfjipp"; }; - makeFlags = [ "PKGCONFIG=${pkgconfig}/bin/pkg-config" "binary=stupidterm" ]; + makeFlags = [ "PKGCONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" "binary=stupidterm" ]; installPhase = '' install -D stupidterm $out/bin/stupidterm diff --git a/pkgs/build-support/dotnetbuildhelpers/default.nix b/pkgs/build-support/dotnetbuildhelpers/default.nix index 0edfd0b467a..809619ed55d 100644 --- a/pkgs/build-support/dotnetbuildhelpers/default.nix +++ b/pkgs/build-support/dotnetbuildhelpers/default.nix @@ -12,7 +12,7 @@ cp -v "$script" "$target"/"$scriptName" chmod 755 "$target"/"$scriptName" patchShebangs "$target"/"$scriptName" - substituteInPlace "$target"/"$scriptName" --replace pkg-config ${pkgconfig}/bin/pkg-config + substituteInPlace "$target"/"$scriptName" --replace pkg-config ${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config substituteInPlace "$target"/"$scriptName" --replace monodis ${mono}/bin/monodis done '' diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index f56447668ea..881166ef9b9 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -163,7 +163,6 @@ stdenv.mkDerivation rec { ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-prefix=${stdenv.cc.targetPrefix}" "--enable-cross-compile" - "--pkg-config=pkg-config" # Override ffmpeg's ./configure assumption that pkg-config is prefixed by the architecture. (e.g. aarch64-unknown-linux-gnu-pkg-config) ] ++ optional stdenv.cc.isClang "--cc=clang"); depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/libraries/gtkd/default.nix b/pkgs/development/libraries/gtkd/default.nix index a03dc51f00c..5cef820db14 100644 --- a/pkgs/development/libraries/gtkd/default.nix +++ b/pkgs/development/libraries/gtkd/default.nix @@ -117,7 +117,7 @@ in stdenv.mkDerivation rec { makeFlags = [ "prefix=${placeholder "out"}" - "PKG_CONFIG=${pkgconfig}/bin/pkg-config" + "PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" ]; # The .pc files does not declare an `includedir=`, so the multiple diff --git a/pkgs/development/python-modules/pkgconfig/default.nix b/pkgs/development/python-modules/pkgconfig/default.nix index c338f6d47e5..ff9e3cc39aa 100644 --- a/pkgs/development/python-modules/pkgconfig/default.nix +++ b/pkgs/development/python-modules/pkgconfig/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { patches = [ ./executable.patch ]; postPatch = '' - substituteInPlace pkgconfig/pkgconfig.py --replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkgconfig}/bin/pkg-config"' + substituteInPlace pkgconfig/pkgconfig.py --replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config"' ''; meta = with lib; { diff --git a/pkgs/development/python-modules/zstd/default.nix b/pkgs/development/python-modules/zstd/default.nix index 75856a88b7e..c96e08ccb51 100644 --- a/pkgs/development/python-modules/zstd/default.nix +++ b/pkgs/development/python-modules/zstd/default.nix @@ -12,7 +12,7 @@ buildPythonPackage rec { postPatch = '' substituteInPlace setup.py \ - --replace "/usr/bin/pkg-config" "${pkgconfig}/bin/pkg-config" + --replace "/usr/bin/pkg-config" "${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" ''; nativeBuildInputs = [ pkgconfig ]; diff --git a/pkgs/os-specific/linux/batman-adv/alfred.nix b/pkgs/os-specific/linux/batman-adv/alfred.nix index c1fb3ef5ee1..04217b8989b 100644 --- a/pkgs/os-specific/linux/batman-adv/alfred.nix +++ b/pkgs/os-specific/linux/batman-adv/alfred.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { buildInputs = [ gpsd libcap libnl ]; preBuild = '' - makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/pkg-config" + makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" ''; meta = { diff --git a/pkgs/os-specific/linux/batman-adv/batctl.nix b/pkgs/os-specific/linux/batman-adv/batctl.nix index 5767c4aa72c..3b1cf183e08 100644 --- a/pkgs/os-specific/linux/batman-adv/batctl.nix +++ b/pkgs/os-specific/linux/batman-adv/batctl.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { buildInputs = [ libnl ]; preBuild = '' - makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/pkg-config" + makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" ''; meta = { diff --git a/pkgs/tools/networking/openconnect_pa/default.nix b/pkgs/tools/networking/openconnect_pa/default.nix index 2c452847aa3..4b108dc303e 100644 --- a/pkgs/tools/networking/openconnect_pa/default.nix +++ b/pkgs/tools/networking/openconnect_pa/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation { }; preConfigure = '' - export PKG_CONFIG=${pkgconfig}/bin/pkg-config + export PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config export LIBXML2_CFLAGS="-I ${libxml2.dev}/include/libxml2" export LIBXML2_LIBS="-L${libxml2.out}/lib -lxml2" ''; From c71ab32a678a98ce1ec069956bc55d6ea606f55c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 27 Apr 2020 22:39:58 -0400 Subject: [PATCH 27/80] pkg-config-wrapper: Init This fixes longstanding build issues --- .../pkg-config-wrapper/add-flags.sh | 12 ++ .../pkg-config-wrapper/default.nix | 117 ++++++++++++++++++ .../pkg-config-wrapper/pkg-config-wrapper.sh | 21 ++++ .../pkg-config-wrapper/setup-hook.sh | 29 +++++ .../python-modules/pkgconfig/default.nix | 2 +- .../tools/misc/pkg-config/default.nix | 2 - .../tools/misc/pkg-config/setup-hook.sh | 6 - pkgs/test/cross/default.nix | 14 +++ pkgs/top-level/all-packages.nix | 17 ++- 9 files changed, 208 insertions(+), 12 deletions(-) create mode 100644 pkgs/build-support/pkg-config-wrapper/add-flags.sh create mode 100644 pkgs/build-support/pkg-config-wrapper/default.nix create mode 100644 pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh create mode 100644 pkgs/build-support/pkg-config-wrapper/setup-hook.sh delete mode 100644 pkgs/development/tools/misc/pkg-config/setup-hook.sh diff --git a/pkgs/build-support/pkg-config-wrapper/add-flags.sh b/pkgs/build-support/pkg-config-wrapper/add-flags.sh new file mode 100644 index 00000000000..35ecf62ca23 --- /dev/null +++ b/pkgs/build-support/pkg-config-wrapper/add-flags.sh @@ -0,0 +1,12 @@ +# See cc-wrapper for comments. +var_templates_list=( + PKG_CONFIG_PATH +) + +accumulateRoles + +for var in "${var_templates_list[@]}"; do + mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"} +done + +export NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@=1 diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix new file mode 100644 index 00000000000..87efc3b18aa --- /dev/null +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -0,0 +1,117 @@ +# The wrapper script ensures variables like PKG_CONFIG_PATH and +# PKG_CONFIG_PATH_FOR_BUILD work properly. + +{ stdenvNoCC +, buildPackages +, pkg-config +, propagateDoc ? pkg-config != null && pkg-config ? man +, extraPackages ? [], extraBuildCommands ? "" +}: + +with stdenvNoCC.lib; + +let + stdenv = stdenvNoCC; + inherit (stdenv) hostPlatform targetPlatform; + + # Prefix for binaries. Customarily ends with a dash separator. + # + # TODO(@Ericson2314) Make unconditional, or optional but always true by + # default. + targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) + (targetPlatform.config + "-"); + + # See description in cc-wrapper. + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; + +in + +stdenv.mkDerivation { + pname = targetPrefix + pkg-config.pname + "-wrapper"; + inherit (pkg-config) version; + + preferLocalBuild = true; + + shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or ""; + + inherit targetPrefix suffixSalt; + + outputs = [ "out" ] ++ optionals propagateDoc [ "man" ]; + + passthru = { + inherit pkg-config; + }; + + dontBuild = true; + dontConfigure = true; + + unpackPhase = '' + src=$PWD + ''; + + installPhase = + '' + mkdir -p $out/bin $out/nix-support + + wrap() { + local dst="$1" + local wrapper="$2" + export prog="$3" + substituteAll "$wrapper" "$out/bin/$dst" + chmod +x "$out/bin/$dst" + } + + echo $pkg-config > $out/nix-support/orig-pkg-config + + wrap ${targetPrefix}pkg-config ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/pkg-config" + ''; + + strictDeps = true; + + wrapperName = "PKG_CONFIG_WRAPPER"; + + setupHooks = [ + ../setup-hooks/role.bash + ./setup-hook.sh + ]; + + postFixup = + '' + + ## + ## User env support + ## + + # Propagate the underling unwrapped pkg-config so that if you + # install the wrapper, you get anything else it might provide. + printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages + '' + + + optionalString propagateDoc '' + ## + ## Man page and info support + ## + + ln -s ${pkg-config.man} $man + '' + + + '' + substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh + substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash + + ## + ## Extra custom steps + ## + '' + + + extraBuildCommands; + + meta = + let pkg-config_ = if pkg-config != null then pkg-config else {}; in + (if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) // + { description = + stdenv.lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_ + + " (wrapper script)"; + priority = 10; + }; +} diff --git a/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh new file mode 100644 index 00000000000..f7c7429eb0b --- /dev/null +++ b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh @@ -0,0 +1,21 @@ +#! @shell@ +set -eu -o pipefail +o posix +shopt -s nullglob + +if (( "${NIX_DEBUG:-0}" >= 7 )); then + set -x +fi + +source @out@/nix-support/utils.bash + +if [ -z "${NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then + source @out@/nix-support/add-flags.sh +fi + +if (( ${#role_suffixes[@]} > 0 )); then + # replace env var with nix-modified one + PKG_CONFIG_PATH=$PKG_CONFIG_PATH_@suffixSalt@ exec @prog@ "$@" +else + # pkg-config isn't a bonafied dependency so ignore setup hook entirely + exec @prog@ "$@" +fi diff --git a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh new file mode 100644 index 00000000000..12b9af5e583 --- /dev/null +++ b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh @@ -0,0 +1,29 @@ +# pkg-config Wrapper hygiene +# +# See comments in cc-wrapper's setup hook. This works exactly the same way. + +# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a +# native compile. +# +# TODO(@Ericson2314): No native exception +[[ -z ${strictDeps-} ]] || (( "$hostOffset" < 0 )) || return 0 + +pkgConfigWrapper_addPkgConfigPath () { + # See ../setup-hooks/role.bash + local role_post + getHostRoleEnvHook + + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig" + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig" +} + +# See ../setup-hooks/role.bash +getTargetRole +getTargetRoleWrapper + +addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath + +export PKG_CONFIG${role_post}=@targetPrefix@pkg-config + +# No local scope in sourced file +unset -v role_post diff --git a/pkgs/development/python-modules/pkgconfig/default.nix b/pkgs/development/python-modules/pkgconfig/default.nix index 2e6fb7c4705..c338f6d47e5 100644 --- a/pkgs/development/python-modules/pkgconfig/default.nix +++ b/pkgs/development/python-modules/pkgconfig/default.nix @@ -4,7 +4,7 @@ buildPythonPackage rec { pname = "pkgconfig"; version = "1.5.1"; - setupHook = pkgconfig.setupHook; + setupHooks = pkgconfig.setupHooks; src = fetchPypi { inherit pname version; diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix index 494b8d893d4..d5e766283ce 100644 --- a/pkgs/development/tools/misc/pkg-config/default.nix +++ b/pkgs/development/tools/misc/pkg-config/default.nix @@ -6,8 +6,6 @@ stdenv.mkDerivation rec { pname = "pkg-config"; version = "0.29.2"; - setupHook = ./setup-hook.sh; - src = fetchurl { url = "https://pkgconfig.freedesktop.org/releases/${pname}-${version}.tar.gz"; sha256 = "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"; diff --git a/pkgs/development/tools/misc/pkg-config/setup-hook.sh b/pkgs/development/tools/misc/pkg-config/setup-hook.sh deleted file mode 100644 index 34a9b9f1173..00000000000 --- a/pkgs/development/tools/misc/pkg-config/setup-hook.sh +++ /dev/null @@ -1,6 +0,0 @@ -addPkgConfigPath () { - addToSearchPath PKG_CONFIG_PATH $1/lib/pkgconfig - addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig -} - -addEnvHooks "$targetOffset" addPkgConfigPath diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix index e65805c6a40..c5a24143773 100644 --- a/pkgs/test/cross/default.nix +++ b/pkgs/test/cross/default.nix @@ -91,6 +91,20 @@ let pkgFun = pkgs: pkgs.hello; }; + pkg-config = {platformFun, crossPkgs, emulator}: crossPkgs.runCommand + "test-pkg-config-${crossPkgs.hostPlatform.config}" + { + depsBuildBuild = [ crossPkgs.pkgsBuildBuild.pkg-config ]; + nativeBuildInputs = [ crossPkgs.pkgsBuildHost.pkg-config crossPkgs.buildPackages.zlib ]; + depsBuildTarget = [ crossPkgs.pkgsBuildTarget.pkg-config ]; + buildInputs = [ crossPkgs.zlib ]; + NIX_DEBUG = 7; + } '' + mkdir $out + ${crossPkgs.pkgsBuildBuild.pkg-config.targetPrefix}pkg-config --cflags zlib > "$out/for-build" + ${crossPkgs.pkgsBuildHost.pkg-config.targetPrefix}pkg-config --cflags zlib > "$out/for-host" + ! diff "$out/for-build" "$out/for-host" + ''; }; in { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 23bd5ffd771..680177a2610 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -329,7 +329,11 @@ in # break dependency cycles fetchurl = stdenv.fetchurlBoot; zlib = buildPackages.zlib.override { fetchurl = stdenv.fetchurlBoot; }; - pkgconfig = buildPackages.pkgconfig.override { fetchurl = stdenv.fetchurlBoot; }; + pkgconfig = buildPackages.pkgconfig.override (old: { + pkg-config = old.pkg-config.override { + fetchurl = stdenv.fetchurlBoot; + }; + }); perl = buildPackages.perl.override { fetchurl = stdenv.fetchurlBoot; }; openssl = buildPackages.openssl.override { fetchurl = stdenv.fetchurlBoot; @@ -10737,10 +10741,17 @@ in pkgconf = callPackage ../development/tools/misc/pkgconf {}; - pkg-config = callPackage ../development/tools/misc/pkg-config { }; + pkg-config-unwrapped = callPackage ../development/tools/misc/pkg-config { }; + pkg-config = callPackage ../build-support/pkg-config-wrapper { + pkg-config = pkg-config-unwrapped; + }; pkgconfig = pkg-config; # added 2018-02-02 - pkg-configUpstream = lowPrio (pkg-config.override { vanilla = true; }); + pkg-configUpstream = lowPrio (pkg-config.override (old: { + pkg-config = old.pkg-config.override { + vanilla = true; + }; + })); pkgconfigUpstream = pkg-configUpstream; # added 2018-02-02 inherit (nodePackages) postcss-cli; From 78987e2af0346fd6d5abf9597102188e5d1cfedf Mon Sep 17 00:00:00 2001 From: Enno Lohmeier Date: Thu, 14 May 2020 08:39:53 +0200 Subject: [PATCH 28/80] ffmpeg: extend addOpenGLRunpath to handle libcuda referencing libraries --- pkgs/development/libraries/ffmpeg/generic.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index f56447668ea..500d99765ba 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -199,9 +199,10 @@ stdenv.mkDerivation rec { --replace "includedir=$out" "includedir=''${!outputInclude}" done '' + optionalString stdenv.isLinux '' - # Set RUNPATH so that libnvcuvid in /run/opengl-driver(-32)/lib can be found. + # Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found. # See the explanation in addOpenGLRunpath. - addOpenGLRunpath $out/lib/libavcodec.so* + addOpenGLRunpath $out/lib/libavcodec.so + addOpenGLRunpath $out/lib/libavutil.so ''; installFlags = [ "install-man" ]; From c9857dee7db3e77fbcee0eab8626d6b9ba100e25 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 17 May 2020 22:28:06 +0200 Subject: [PATCH 29/80] gobject-introspection: move build tools to nativeBuildInputs --- .../libraries/gobject-introspection/default.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 5c7ad4bbac7..03b0d1767d9 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -59,19 +59,22 @@ stdenv.mkDerivation rec { meson ninja pkg-config + flex + bison gtk-doc docbook-xsl-nons - docbook_xml_dtd_43 + docbook_xml_dtd_43 # FIXME: remove in next release docbook_xml_dtd_45 + python3 + setupHook # move .gir files ]; buildInputs = [ - flex - bison python3 - setupHook /*move .gir*/ - ] ++ stdenv.lib.optionals stdenv.isDarwin [ - cctools + ]; + + checkInputs = stdenv.lib.optionals stdenv.isDarwin [ + cctools # for otool ]; propagatedBuildInputs = [ From 54918d6366fd6b2946b869f2f5a0645e5477c859 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 4 May 2020 23:20:00 +0200 Subject: [PATCH 30/80] git: Add a doc output for the HTML and text files This will install the HTML and text documentation into a separate output so that users can install it without having to rebuild Git. Previously only `doc/git/git-subtree.html` was installed (which is now in $doc as well). The current output sizes are as follows: ``` $ du -sh $(nix-build -A git) 47M /nix/store/wyqgalp61kmavx06rams7z8jz177nd8y-git-2.26.2 $ du -sh $(nix-build -A git.doc) 14M /nix/store/6zi22fl5xc3sg23d9shsviinvwk89wvq-git-2.26.2-doc ``` Fixes #86022 (at least partly since the output has to be installed). --- .../version-management/git-and-tools/git/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix index 9c1a01f42ae..140a273e342 100644 --- a/pkgs/applications/version-management/git-and-tools/git/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation { sha256 = "0j685w6pzkn926z5nf5r8fij4ziipvw4c9yb0wc577nzf4j16rbd"; }; - outputs = [ "out" ]; + outputs = [ "out" "doc" ]; hardeningDisable = [ "format" ]; @@ -234,7 +234,7 @@ stdenv.mkDerivation { '') + stdenv.lib.optionalString withManual ''# Install man pages and Info manual - make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES PERL_PATH="${buildPackages.perl}/bin/perl" cmd-list.made install install-info \ + make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES PERL_PATH="${buildPackages.perl}/bin/perl" cmd-list.made install install-html install-info \ -C Documentation '' + (if guiSupport then '' From 9f2faa1f6f14b977e4b91523b6c2621bb77f7b62 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 18 May 2020 16:50:14 +0200 Subject: [PATCH 31/80] git-doc: init --- nixos/doc/manual/release-notes/rl-2009.xml | 5 +++++ .../version-management/git-and-tools/default.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 0ed440d79c6..a6c3c2033c3 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -391,6 +391,11 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ]; This matches the autotools convention for env vars which standard for these things, making interfacing with other tools easier. + + + Additional Git documentation (HTML and text files) is now available via the git-doc package. + + diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix index c591ef554ee..48fa002463b 100644 --- a/pkgs/applications/version-management/git-and-tools/default.nix +++ b/pkgs/applications/version-management/git-and-tools/default.nix @@ -82,6 +82,14 @@ let inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; }; + git-doc = lib.addMetaAttrs { + description = "Additional documentation for Git"; + longDescription = '' + This package contains additional documentation (HTML and text files) that + is referenced in the man pages of Git. + ''; + } gitFull.doc; + git-extras = callPackage ./git-extras { }; git-fame = callPackage ./git-fame {}; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 680177a2610..7df73a2ec1c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19720,7 +19720,7 @@ in gitAndTools = recurseIntoAttrs (callPackage ../applications/version-management/git-and-tools {}); - inherit (gitAndTools) git gitFull gitSVN git-cola svn2git git-radar git-secret git-secrets transcrypt git-crypt ghq; + inherit (gitAndTools) git gitFull gitSVN git-cola git-doc svn2git git-radar git-secret git-secrets transcrypt git-crypt ghq; gitMinimal = git.override { withManual = false; From 5787e9a0352e2e200ee4c5de768813a3a41290a5 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 18 May 2020 20:26:28 +0200 Subject: [PATCH 32/80] gdk-pixbuf: clean up * format with nixpkgs-fmt * reorder the attributes * replace aliases * inline pname & version * add GNOME maintainers * update homepage from devdocs to repo --- .../libraries/gdk-pixbuf/default.nix | 78 ++++++++++++++----- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index 82fbbc967ef..64a1adef0c4 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -1,23 +1,44 @@ -{ stdenv, fetchurl, nixosTests, fixDarwinDylibNames, meson, ninja, pkgconfig, gettext, python3, libxml2, libxslt, docbook_xsl -, docbook_xml_dtd_43, gtk-doc, glib, libtiff, libjpeg, libpng, libX11, gnome3 -, gobject-introspection, doCheck ? false, makeWrapper +{ stdenv +, fetchurl +, nixosTests +, fixDarwinDylibNames +, meson +, ninja +, pkg-config +, gettext +, python3 +, libxml2 +, libxslt +, docbook-xsl-nons +, docbook_xml_dtd_43 +, gtk-doc +, glib +, libtiff +, libjpeg +, libpng +, libX11 +, gnome3 +, gobject-introspection +, doCheck ? false +, makeWrapper , fetchpatch }: -let +stdenv.mkDerivation rec { pname = "gdk-pixbuf"; version = "2.40.0"; -in stdenv.mkDerivation rec { - name = "${pname}-${version}"; + + outputs = [ "out" "dev" "man" "devdoc" "installedTests" ]; src = fetchurl { - url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz"; + url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; sha256 = "1rnlx9yfw970maxi2x6niaxmih5la11q1ilr7gzshz2kk585k0hm"; }; patches = [ # Move installed tests to a separate output ./installed-tests-path.patch + # Temporary until the fix is released. (fetchpatch { name = "tests-circular-table.patch"; @@ -26,20 +47,35 @@ in stdenv.mkDerivation rec { }) ]; - outputs = [ "out" "dev" "man" "devdoc" "installedTests" ]; - - setupHook = ./setup-hook.sh; + nativeBuildInputs = [ + meson + ninja + pkg-config + gettext + python3 + libxml2 + libxslt + docbook-xsl-nons + docbook_xml_dtd_43 + gtk-doc + gobject-introspection + makeWrapper + glib + ] ++ stdenv.lib.optional stdenv.isDarwin [ + fixDarwinDylibNames + ]; # !!! We might want to factor out the gdk-pixbuf-xlib subpackage. - buildInputs = [ libX11 ]; + buildInputs = [ + libX11 + ]; - nativeBuildInputs = [ - meson ninja pkgconfig gettext python3 libxml2 libxslt docbook_xsl docbook_xml_dtd_43 - gtk-doc gobject-introspection makeWrapper glib - ] - ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; - - propagatedBuildInputs = [ glib libtiff libjpeg libpng ]; + propagatedBuildInputs = [ + glib + libtiff + libjpeg + libpng + ]; mesonFlags = [ "-Ddocs=true" @@ -87,6 +123,8 @@ in stdenv.mkDerivation rec { # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB). inherit doCheck; + setupHook = ./setup-hook.sh; + passthru = { updateScript = gnome3.updateScript { packageName = pname; @@ -102,8 +140,8 @@ in stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "A library for image loading and manipulation"; - homepage = "http://library.gnome.org/devel/gdk-pixbuf/"; - maintainers = [ maintainers.eelco ]; + homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf"; + maintainers = [ maintainers.eelco ] ++ teams.gnome.members; license = licenses.lgpl21; platforms = platforms.unix; }; From 6323002aac02cb9e0c2da30873195b3e2e110334 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 18 May 2020 21:03:24 +0200 Subject: [PATCH 33/80] gdk-pixbuf-xlib: init at 2019-10-19-unstable https://mail.gnome.org/archives/desktop-devel-list/2019-November/msg00009.html --- .../development/libraries/gdk-pixbuf/xlib.nix | 55 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 57 insertions(+) create mode 100644 pkgs/development/libraries/gdk-pixbuf/xlib.nix diff --git a/pkgs/development/libraries/gdk-pixbuf/xlib.nix b/pkgs/development/libraries/gdk-pixbuf/xlib.nix new file mode 100644 index 00000000000..e5f1718f075 --- /dev/null +++ b/pkgs/development/libraries/gdk-pixbuf/xlib.nix @@ -0,0 +1,55 @@ +{ stdenv +, fetchFromGitLab +, meson +, ninja +, pkg-config +, docbook-xsl-nons +, docbook_xml_dtd_43 +, gtk-doc +, gdk-pixbuf +, libX11 +}: + +stdenv.mkDerivation rec { + pname = "gdk-pixbuf-xlib"; + version = "2019-10-19-unstable"; + + outputs = [ "out" "dev" "devdoc" ]; + + src = fetchFromGitLab { + domain = "gitlab.gnome.org"; + owner = "Archive"; + repo = "gdk-pixbuf-xlib"; + rev = "dc22ea36f69755007c66877284596df270532cc1"; + sha256 = "XhBQ4wano+MtGaqF6JNKoWgYQN6eBW+b8ZCGEBGt8IM="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + docbook-xsl-nons + docbook_xml_dtd_43 + gtk-doc + ]; + + buildInputs = [ + libX11 + ]; + + propagatedBuildInputs = [ + gdk-pixbuf + ]; + + mesonFlags = [ + "-Dgtk_doc=true" + ]; + + meta = with stdenv.lib; { + description = "Deprecated API for integrating GdkPixbuf with Xlib data types"; + homepage = "https://gitlab.gnome.org/Archive/gdk-pixbuf-xlib"; + maintainers = teams.gnome.members; + license = licenses.lgpl21Plus; + platforms = platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7e32522158c..0e6b92476a1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12089,6 +12089,8 @@ in gdk-pixbuf = callPackage ../development/libraries/gdk-pixbuf { }; + gdk-pixbuf-xlib = callPackage ../development/libraries/gdk-pixbuf/xlib.nix { }; + gnome-sharp = callPackage ../development/libraries/gnome-sharp { }; gnome-menus = callPackage ../development/libraries/gnome-menus { }; From 80a89002f1ad1d89f8fe926b6ac6aefae169d5b4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 18 May 2020 21:03:59 +0200 Subject: [PATCH 34/80] gdk-pixbuf: do not build deprecated xlib library It is deprecated and will be removed: https://mail.gnome.org/archives/desktop-devel-list/2019-November/msg00009.html Until then, you can use gdk-pixbuf-xlib package. --- pkgs/development/libraries/gdk-pixbuf/default.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index 64a1adef0c4..08b8f70b2d9 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -16,7 +16,6 @@ , libtiff , libjpeg , libpng -, libX11 , gnome3 , gobject-introspection , doCheck ? false @@ -65,11 +64,6 @@ stdenv.mkDerivation rec { fixDarwinDylibNames ]; - # !!! We might want to factor out the gdk-pixbuf-xlib subpackage. - buildInputs = [ - libX11 - ]; - propagatedBuildInputs = [ glib libtiff @@ -79,7 +73,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Ddocs=true" - "-Dx11=true" + "-Dx11=false" # use gdk-pixbuf-xlib "-Dgir=${if gobject-introspection != null then "true" else "false"}" "-Dgio_sniffing=false" ]; From f2406c602a4f267672b161a908e3370fcc76956c Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 27 Apr 2020 12:48:18 -0700 Subject: [PATCH 35/80] qemu: 4.2.0 -> 5.0.0 --- .../virtualization/qemu/default.nix | 46 ++----------------- .../virtualization/qemu/fix-qemu-ga.patch | 30 ++++++++---- 2 files changed, 27 insertions(+), 49 deletions(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index d6611e20a9c..6498f720463 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -35,15 +35,15 @@ let in stdenv.mkDerivation rec { - version = "4.2.0"; + version = "5.0.0"; pname = "qemu" + stdenv.lib.optionalString xenSupport "-xen" + stdenv.lib.optionalString hostCpuOnly "-host-cpu-only" + stdenv.lib.optionalString nixosTestRunner "-for-vm-tests"; src = fetchurl { - url = "https://wiki.qemu.org/download/qemu-${version}.tar.bz2"; - sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w"; + url= "https://download.qemu.org/qemu-${version}.tar.xz"; + sha256 = "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg"; }; nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]; @@ -77,44 +77,6 @@ stdenv.mkDerivation rec { ./no-etc-install.patch ./fix-qemu-ga.patch ./9p-ignore-noatime.patch - (fetchpatch { - name = "CVE-2019-15890.patch"; - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=c59279437eda91841b9d26079c70b8a540d41204"; - sha256 = "1q2rc67mfdz034mk81z9bw105x9zad7n954sy3kq068b1svrf7iy"; - stripLen = 1; - extraPrefix = "slirp/"; - }) - # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7039 - (fetchpatch { - name = "CVE-2020-7039-1.patch"; - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=2655fffed7a9e765bcb4701dd876e9dab975f289"; - sha256 = "1jh0k3lg3553c2x1kq1kl3967jabhba5gm584wjpmr5mjqk3lnz1"; - stripLen = 1; - extraPrefix = "slirp/"; - excludes = ["slirp/CHANGELOG.md"]; - }) - (fetchpatch { - name = "CVE-2020-7039-2.patch"; - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=82ebe9c370a0e2970fb5695aa19aa5214a6a1c80"; - sha256 = "08ccxcmrhzknnzd1a1q2brszv3a7h02n26r73kpli10b0hn12r2l"; - stripLen = 1; - extraPrefix = "slirp/"; - }) - (fetchpatch { - name = "CVE-2020-7039-3.patch"; - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=ce131029d6d4a405cb7d3ac6716d03e58fb4a5d9"; - sha256 = "18ypj9an2jmsmdn58853rbz42r10587h7cz5fdws2x4635778ibd"; - stripLen = 1; - extraPrefix = "slirp/"; - }) - # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7211 - (fetchpatch { - name = "CVE-2020-7211.patch"; - url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=14ec36e107a8c9af7d0a80c3571fe39b291ff1d4"; - sha256 = "1lc8zabqs580iqrsr5k7zwgkx6qjmja7apwfbc36lkvnrxwfzmrc"; - stripLen = 1; - extraPrefix = "slirp/"; - }) ] ++ optional nixosTestRunner ./force-uid0-on-9p.patch ++ optionals stdenv.hostPlatform.isMusl [ (fetchpatch { @@ -145,6 +107,8 @@ stdenv.mkDerivation rec { "--sysconfdir=/etc" "--localstatedir=/var" "--enable-docs" + "--enable-tools" + "--enable-guest-agent" ] # disable sysctl check on darwin. ++ optional stdenv.isDarwin "--cpu=x86_64" diff --git a/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch b/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch index c2f051e2b94..0b2dd0ee5ec 100644 --- a/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch +++ b/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch @@ -1,22 +1,36 @@ -diff --git a/qga/commands-posix.c b/qga/commands-posix.c -index 0dc219d..9d020d3 100644 +diff -Naur a/qga/commands-posix.c b/qga/commands-posix.c --- a/qga/commands-posix.c +++ b/qga/commands-posix.c -@@ -102,6 +102,8 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) +@@ -109,6 +109,8 @@ reopen_fd_to_null(1); reopen_fd_to_null(2); - + + execle("/run/current-system/sw/bin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + "hypervisor initiated shutdown", (char*)NULL, environ); execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", "hypervisor initiated shutdown", (char*)NULL, environ); _exit(EXIT_FAILURE); -@@ -189,6 +191,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) - +@@ -157,11 +159,13 @@ + pid_t pid; + Error *local_err = NULL; + struct timeval tv; ++ static const char hwclock_path_nix[] = "/run/current-system/sw/bin/hwclock"; + static const char hwclock_path[] = "/sbin/hwclock"; + static int hwclock_available = -1; + + if (hwclock_available < 0) { +- hwclock_available = (access(hwclock_path, X_OK) == 0); ++ hwclock_available = (access(hwclock_path_nix, X_OK) == 0) || ++ (access(hwclock_path, X_OK) == 0); + } + + if (!hwclock_available) { +@@ -207,6 +211,8 @@ + /* Use '/sbin/hwclock -w' to set RTC from the system time, * or '/sbin/hwclock -s' to set the system time from RTC. */ -+ execle("/run/current-system/sw/bin/hwclock", "hwclock", has_time ? "-w" : "-s", ++ execle(hwclock_path_nix, "hwclock", has_time ? "-w" : "-s", + NULL, environ); - execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", + execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL, environ); _exit(EXIT_FAILURE); From 6af533e456c6c4297c23aaae75048e6174bea574 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Wed, 20 May 2020 04:58:42 +0000 Subject: [PATCH 36/80] bison: 3.5.4 -> 3.6.2 --- pkgs/development/tools/parsing/bison/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/parsing/bison/default.nix b/pkgs/development/tools/parsing/bison/default.nix index c9758fe21e3..5302f7ca644 100644 --- a/pkgs/development/tools/parsing/bison/default.nix +++ b/pkgs/development/tools/parsing/bison/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "bison"; - version = "3.5.4"; + version = "3.6.2"; src = fetchurl { url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; - sha256 = "0a2cbrqh7mgx2dwf5qm10v68iakv1i0dqh9di4x5aqxsz96ibpf0"; + sha256 = "16h8panwpljwdq902v9x7inpnks51fn0kqlbyqfjvpilv6md73p2"; }; nativeBuildInputs = [ m4 perl ] ++ stdenv.lib.optional stdenv.isSunOS help2man; From f6373d28e15e5405989cb80a826eea0e4184bf98 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Wed, 20 May 2020 16:32:23 +0200 Subject: [PATCH 37/80] libaom: 1.0.0-errata1 -> 2.0.0 --- pkgs/development/libraries/libaom/default.nix | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix index 04b1c810c08..edc9df71815 100644 --- a/pkgs/development/libraries/libaom/default.nix +++ b/pkgs/development/libraries/libaom/default.nix @@ -2,12 +2,12 @@ stdenv.mkDerivation rec { pname = "libaom"; - version = "1.0.0-errata1"; + version = "2.0.0"; src = fetchgit { url = "https://aomedia.googlesource.com/aom"; rev = "v${version}"; - sha256 = "090phh4jl9z6m2pwpfpwcjh6iyw0byngb2n112qxkg6a3gsaa62f"; + sha256 = "1616xjhj6770ykn82ml741h8hx44v507iky3s9h7a5lnk9d4cxzy"; }; nativeBuildInputs = [ @@ -24,10 +24,26 @@ stdenv.mkDerivation rec { export PATH=$NIX_BUILD_TOP:$PATH ''; + # Configuration options: + # https://aomedia.googlesource.com/aom/+/refs/heads/master/build/cmake/aom_config_defaults.cmake + + cmakeFlags = [ + # For libaom these must be relative instead of absolute paths: + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_INSTALL_LIBDIR=lib" + ]; + meta = with stdenv.lib; { - description = "AV1 Bitstream and Decoding Library"; + description = "Alliance for Open Media AV1 codec library"; + longDescription = '' + Libaom is the reference implementation of the AV1 codec from the Alliance + for Open Media. It contains an AV1 library as well as applications like + an encoder (aomenc) and a decoder (aomdec). + ''; homepage = "https://aomedia.org/av1-features/get-started/"; - maintainers = with maintainers; [ kiloreux ]; + changelog = "https://aomedia.googlesource.com/aom/+/refs/tags/v${version}/CHANGELOG"; + maintainers = with maintainers; [ primeos kiloreux ]; platforms = platforms.all; license = licenses.bsd2; }; From d54bfa2a932b81594c967e2c8a1fcf444bf66644 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Sun, 10 May 2020 20:58:27 +0200 Subject: [PATCH 38/80] compiler-rt{6..10}: fix compilation on Darwin addendum to https://github.com/NixOS/nixpkgs/pull/85945 --- pkgs/development/compilers/llvm/10/compiler-rt.nix | 2 +- pkgs/development/compilers/llvm/6/compiler-rt.nix | 2 +- pkgs/development/compilers/llvm/7/compiler-rt.nix | 2 +- pkgs/development/compilers/llvm/8/compiler-rt.nix | 2 +- pkgs/development/compilers/llvm/9/compiler-rt.nix | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/llvm/10/compiler-rt.nix b/pkgs/development/compilers/llvm/10/compiler-rt.nix index 68f64ef4256..00c4f0677eb 100644 --- a/pkgs/development/compilers/llvm/10/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/10/compiler-rt.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # a flag and turn the flag off during the stdenv build. - postPatch = '' + postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' '' + stdenv.lib.optionalString stdenv.isDarwin '' diff --git a/pkgs/development/compilers/llvm/6/compiler-rt.nix b/pkgs/development/compilers/llvm/6/compiler-rt.nix index 5ae8bb01f05..13abf6d9561 100644 --- a/pkgs/development/compilers/llvm/6/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/6/compiler-rt.nix @@ -55,7 +55,7 @@ stdenv.mkDerivation { # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # a flag and turn the flag off during the stdenv build. - postPatch = '' + postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' '' + stdenv.lib.optionalString stdenv.isDarwin '' diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix index e9853c58ca5..84ca6af3b36 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation { # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # a flag and turn the flag off during the stdenv build. - postPatch = '' + postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' '' + stdenv.lib.optionalString stdenv.isDarwin '' diff --git a/pkgs/development/compilers/llvm/8/compiler-rt.nix b/pkgs/development/compilers/llvm/8/compiler-rt.nix index 1f58cb98e3d..15e55800dc8 100644 --- a/pkgs/development/compilers/llvm/8/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/8/compiler-rt.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation { # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # a flag and turn the flag off during the stdenv build. - postPatch = '' + postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' '' + stdenv.lib.optionalString stdenv.isDarwin '' diff --git a/pkgs/development/compilers/llvm/9/compiler-rt.nix b/pkgs/development/compilers/llvm/9/compiler-rt.nix index 3b92264ad69..0183754a2fd 100644 --- a/pkgs/development/compilers/llvm/9/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/9/compiler-rt.nix @@ -55,7 +55,7 @@ stdenv.mkDerivation rec { # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # a flag and turn the flag off during the stdenv build. - postPatch = '' + postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' substituteInPlace cmake/builtin-config-ix.cmake \ --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' '' + stdenv.lib.optionalString stdenv.isDarwin '' From 52ed8e3bf234786ed4c2c1e341399e0f4ed7569c Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Wed, 20 May 2020 18:57:34 +0000 Subject: [PATCH 39/80] libarchive: 3.4.2 -> 3.4.3 --- pkgs/development/libraries/libarchive/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix index 0f6b196d150..118adc61623 100644 --- a/pkgs/development/libraries/libarchive/default.nix +++ b/pkgs/development/libraries/libarchive/default.nix @@ -10,13 +10,13 @@ assert xarSupport -> libxml2 != null; stdenv.mkDerivation rec { pname = "libarchive"; - version = "3.4.2"; + version = "3.4.3"; src = fetchFromGitHub { owner = "libarchive"; repo = "libarchive"; rev = "v${version}"; - sha256 = "0mjm77wbqs8sbn9j44lj39nwbg6anmgz6pkyfxsww54a4rs0p3iz"; + sha256 = "1y0v03p6zyv6plr2p0pid1qfgmk8hd427spj8xa93mcdmq5yc3s0"; }; outputs = [ "out" "lib" "dev" ]; From 0fd395b3800165dd657513a04cee41d063d62428 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Thu, 21 May 2020 12:31:02 +0000 Subject: [PATCH 40/80] freetype: 2.10.1 -> 2.10.2 --- pkgs/development/libraries/freetype/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 408578d9c93..24757af09e3 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -14,7 +14,7 @@ let in stdenv.mkDerivation rec { pname = "freetype"; - version = "2.10.1"; + version = "2.10.2"; meta = with stdenv.lib; { description = "A font rendering engine"; @@ -33,7 +33,7 @@ in stdenv.mkDerivation rec { src = fetchurl { url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz"; - sha256 = "0vx2dg1jh5kq34dd6ifpjywkpapp8a7p1bvyq9yq5zi1i94gmnqn"; + sha256 = "12rd181yzz6952cyjqaa4253f5szam93cmhw18p33rnj4l8dchqm"; }; propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype From 26f635d39aa69b740c938349f8034b281a6663ca Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 08:49:21 -0400 Subject: [PATCH 41/80] pkg-config: Document new location of bug --- pkgs/development/tools/misc/pkg-config/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix index d5e766283ce..ceca1cf590c 100644 --- a/pkgs/development/tools/misc/pkg-config/default.nix +++ b/pkgs/development/tools/misc/pkg-config/default.nix @@ -12,7 +12,8 @@ stdenv.mkDerivation rec { }; # Process Requires.private properly, see - # http://bugs.freedesktop.org/show_bug.cgi?id=4738. + # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to + # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28 patches = optional (!vanilla) ./requires-private.patch ++ optional stdenv.isCygwin ./2.36.3-not-win32.patch; From 42b203573072bc0df6285c1a3dd458eaaffd84dd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 08:52:20 -0400 Subject: [PATCH 42/80] pkg-config: If building vanilla version, can run original tests --- pkgs/development/tools/misc/pkg-config/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix index ceca1cf590c..2cecb25eeee 100644 --- a/pkgs/development/tools/misc/pkg-config/default.nix +++ b/pkgs/development/tools/misc/pkg-config/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { ++ optional stdenv.isCygwin ./2.36.3-not-win32.patch; # These three tests fail due to a (desired) behavior change from our ./requires-private.patch - postPatch = '' + postPatch = if vanilla then null else '' rm -f check/check-requires-private check/check-gtk check/missing ''; From f29919da616a51d805ef1cf3800d023d9d00e2dc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 08:52:41 -0400 Subject: [PATCH 43/80] pkg-config: Multiple outputs This is good practice, and will help with tests. Wrapper adjust to match bintools-wrapper re these new outputs. --- pkgs/build-support/pkg-config-wrapper/default.nix | 10 ++++++---- pkgs/development/tools/misc/pkg-config/default.nix | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index 87efc3b18aa..75390ab4b6f 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation { inherit targetPrefix suffixSalt; - outputs = [ "out" ] ++ optionals propagateDoc [ "man" ]; + outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc"); passthru = { inherit pkg-config; @@ -87,13 +87,15 @@ stdenv.mkDerivation { printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages '' - + optionalString propagateDoc '' + + optionalString propagateDoc ('' ## - ## Man page and info support + ## Man page and doc support ## ln -s ${pkg-config.man} $man - '' + '' + optionalString (pkg-config ? doc) '' + ln -s ${pkg-config.doc} $doc + '') + '' substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix index 2cecb25eeee..84f6c330f8c 100644 --- a/pkgs/development/tools/misc/pkg-config/default.nix +++ b/pkgs/development/tools/misc/pkg-config/default.nix @@ -11,6 +11,8 @@ stdenv.mkDerivation rec { sha256 = "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"; }; + outputs = [ "out" "man" "doc" ]; + # Process Requires.private properly, see # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28 From 4b2ab665fbeb28b9837e920841ca81c570dfbdd4 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 09:16:34 -0400 Subject: [PATCH 44/80] pkg-config-wrapper: Provide autoconf macros This fixes libarchive, and probably numerous other builds. --- pkgs/build-support/pkg-config-wrapper/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index 75390ab4b6f..3e5785d2398 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -64,6 +64,15 @@ stdenv.mkDerivation { echo $pkg-config > $out/nix-support/orig-pkg-config wrap ${targetPrefix}pkg-config ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/pkg-config" + '' + # symlink in share for autoconf to find macros + + # TODO(@Ericson2314): in the future just make the unwrapped pkg-config a + # propagated dep once we can rely on downstream deps comming first in + # search paths. (https://github.com/NixOS/nixpkgs/pull/31414 took a crack + # at this.) + + '' + ln -s ${pkg-config}/share $out/share ''; strictDeps = true; From 23490e3f50bf663971528c2aa2a8b1f496d3d128 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 11:03:57 -0400 Subject: [PATCH 45/80] pkgconf: Multiple outputs --- .../tools/misc/pkgconf/default.nix | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/pkgconf/default.nix b/pkgs/development/tools/misc/pkgconf/default.nix index 02b7ff5fcd3..fb8281ff98c 100644 --- a/pkgs/development/tools/misc/pkgconf/default.nix +++ b/pkgs/development/tools/misc/pkgconf/default.nix @@ -1,14 +1,41 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, removeReferencesTo }: stdenv.mkDerivation rec { pname = "pkgconf"; version = "1.6.3"; + nativeBuildInputs = [ removeReferencesTo ]; + + outputs = [ "out" "lib" "dev" "man" "doc" ]; + + enableParallelBuilding = true; + src = fetchurl { url = "https://distfiles.dereferenced.org/${pname}/${pname}-${version}.tar.xz"; sha256 = "04525vv0y849vvc2pi60g5wd9fjp1wbhra2lniifi82y1ldv7w31"; }; + # Debian has outputs like these too: + # https://packages.debian.org/source/buster/pkgconf, so take it this + # reference removing is safe. + postFixup = '' + remove-references-to \ + -t "${placeholder "dev"}" \ + "${placeholder "lib"}"/lib/* \ + "${placeholder "out"}"/bin/* + remove-references-to \ + -t "${placeholder "out"}" \ + "${placeholder "lib"}"/lib/* + '' + # Move back share/aclocal. Yes, this normally goes in the dev output for good + # reason, but in this case the dev output is for the `libpkgconf` library, + # while the aclocal stuff is for the tool. The tool is already for use during + # development, so there is no reason to have separate "dev-bin" and "dev-lib" + # outputs or someting. + + '' + mv ${placeholder "dev"}/share ${placeholder "out"} + ''; + meta = with stdenv.lib; { description = "Package compiler and linker metadata toolkit"; homepage = "https://git.dereferenced.org/pkgconf/pkgconf"; From 95080ea90ba705f2a17e48b7cd824f2d0d2c44a3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 11:13:27 -0400 Subject: [PATCH 46/80] pkgconf: Wrap with pkg-config-wrapper --- pkgs/build-support/pkg-config-wrapper/default.nix | 5 +++-- pkgs/build-support/pkg-config-wrapper/setup-hook.sh | 2 +- pkgs/top-level/all-packages.nix | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index 3e5785d2398..f1bc5da5481 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -4,6 +4,7 @@ { stdenvNoCC , buildPackages , pkg-config +, baseBinName ? "pkg-config" , propagateDoc ? pkg-config != null && pkg-config ? man , extraPackages ? [], extraBuildCommands ? "" }: @@ -34,7 +35,7 @@ stdenv.mkDerivation { shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or ""; - inherit targetPrefix suffixSalt; + inherit targetPrefix suffixSalt baseBinName; outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc"); @@ -63,7 +64,7 @@ stdenv.mkDerivation { echo $pkg-config > $out/nix-support/orig-pkg-config - wrap ${targetPrefix}pkg-config ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/pkg-config" + wrap ${targetPrefix}${baseBinName} ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/${baseBinName}" '' # symlink in share for autoconf to find macros diff --git a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh index 12b9af5e583..34f1a999a82 100644 --- a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh +++ b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh @@ -23,7 +23,7 @@ getTargetRoleWrapper addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath -export PKG_CONFIG${role_post}=@targetPrefix@pkg-config +export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@ # No local scope in sourced file unset -v role_post diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 680177a2610..228af7e55a5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10739,7 +10739,11 @@ in pmccabe = callPackage ../development/tools/misc/pmccabe { }; - pkgconf = callPackage ../development/tools/misc/pkgconf {}; + pkgconf-unwrapped = callPackage ../development/tools/misc/pkgconf {}; + pkgconf = callPackage ../build-support/pkg-config-wrapper { + pkg-config = pkgconf-unwrapped; + baseBinName = "pkgconf"; + }; pkg-config-unwrapped = callPackage ../development/tools/misc/pkg-config { }; pkg-config = callPackage ../build-support/pkg-config-wrapper { From 7e9d807f2cfbf4645ac9dab97e895435c3f6fe7b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 21 May 2020 11:15:15 -0400 Subject: [PATCH 47/80] pkg-config-wrapper: Move comments outside of strings This is much better because then we can freely keep the comments up to date without causing mass rebuilds. Someday, somebody should make the same change with `cc-wrapper` and `bintools-wrapper`. --- .../pkg-config-wrapper/default.nix | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index f1bc5da5481..e01df107dd1 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -86,22 +86,20 @@ stdenv.mkDerivation { ]; postFixup = + ## + ## User env support + ## + + # Propagate the underling unwrapped pkg-config so that if you + # install the wrapper, you get anything else it might provide. '' - - ## - ## User env support - ## - - # Propagate the underling unwrapped pkg-config so that if you - # install the wrapper, you get anything else it might provide. printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages '' + ## + ## Man page and doc support + ## + optionalString propagateDoc ('' - ## - ## Man page and doc support - ## - ln -s ${pkg-config.man} $man '' + optionalString (pkg-config ? doc) '' ln -s ${pkg-config.doc} $doc @@ -110,12 +108,11 @@ stdenv.mkDerivation { + '' substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash - - ## - ## Extra custom steps - ## '' + ## + ## Extra custom steps + ## + extraBuildCommands; meta = From c174be1005acb065579930ec7db8629159690e21 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Thu, 21 May 2020 18:02:56 +0000 Subject: [PATCH 48/80] glib: 2.64.1 -> 2.64.3 --- pkgs/development/libraries/glib/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index d74bd0c4067..47e372cf9a3 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -48,11 +48,11 @@ in stdenv.mkDerivation rec { pname = "glib"; - version = "2.64.1"; + version = "2.64.3"; src = fetchurl { url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; - sha256 = "1ixvjmsrj45xq9bq3chhj98jhgcsqa08v627mjx6sjxlph1pd5hp"; + sha256 = "08pbgiv5m3rica4ydvwvpq5mrxbyswx7l1jzjc2ch52xjabvr77y"; }; patches = optionals stdenv.isDarwin [ From 53ae029435036cc9b9d6596319d1e21e80da0a4a Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Thu, 21 May 2020 19:52:11 +0000 Subject: [PATCH 49/80] isocodes: 4.4 -> 4.5.0 --- pkgs/development/libraries/iso-codes/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/iso-codes/default.nix b/pkgs/development/libraries/iso-codes/default.nix index 9ab25b410b4..8ba9ea31b80 100644 --- a/pkgs/development/libraries/iso-codes/default.nix +++ b/pkgs/development/libraries/iso-codes/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "iso-codes"; - version = "4.4"; + version = "4.5.0"; src = fetchurl { url = "https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/${pname}-${version}/${pname}-${pname}-${version}.tar.bz2"; - sha256 = "02x0wcz783ammkdrmrh31wsmww481xbkbz70vf766ivbnn5sfxn6"; + sha256 = "17nnyx07q8vbyqsxbvp4m5s2nrc4fxl3dvgbgmkqww2wl4x1fv9y"; }; patchPhase = '' From 84b6ace626eef8275b3cb07b1e9a3614281b44d5 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Fri, 22 May 2020 00:21:15 +0000 Subject: [PATCH 50/80] jansson: 2.12 -> 2.13.1 --- pkgs/development/libraries/jansson/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/jansson/default.nix b/pkgs/development/libraries/jansson/default.nix index c1653ea5d1b..7ecf7579a30 100644 --- a/pkgs/development/libraries/jansson/default.nix +++ b/pkgs/development/libraries/jansson/default.nix @@ -1,11 +1,11 @@ {stdenv, fetchurl}: stdenv.mkDerivation rec { - name = "jansson-2.12"; + name = "jansson-2.13.1"; src = fetchurl { url = "http://www.digip.org/jansson/releases/${name}.tar.gz"; - sha256 = "1jfj4xq3rdgnkxval1x2gqwhaam34qdxbplsj5fsrvs8a1vfr3az"; + sha256 = "0ks7gbs0j8p4dmmi2sq129mxy5gfg0z6220i1jk020mi2zd7gwzl"; }; meta = with stdenv.lib; { From 8c52a817130417c6d76cef049cad8670e46e717d Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Fri, 22 May 2020 02:37:10 +0000 Subject: [PATCH 51/80] lilv: 0.24.6 -> 0.24.8 --- pkgs/development/libraries/audio/lilv/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/audio/lilv/default.nix b/pkgs/development/libraries/audio/lilv/default.nix index 831cd8c2054..124828b0ff5 100644 --- a/pkgs/development/libraries/audio/lilv/default.nix +++ b/pkgs/development/libraries/audio/lilv/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "lilv"; - version = "0.24.6"; + version = "0.24.8"; src = fetchurl { url = "https://download.drobilla.net/${pname}-${version}.tar.bz2"; - sha256 = "1p3hafsxgs5d4za7n66lf5nz74qssfqpmk520cm7iq2njvvlqm2z"; + sha256 = "0063i5zgf3d3accwmyx651hw0wh5ik7kji2hvfkcdbl1qia3dp6a"; }; patches = [ ./lilv-pkgconfig.patch ]; From a1416e63ddde7e1f4e848b995331c9716de1d5a5 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Fri, 22 May 2020 03:00:15 +0000 Subject: [PATCH 52/80] libuv: 1.37.0 -> 1.38.0 --- pkgs/development/libraries/libuv/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix index 9f6adeb65b0..e22bcdd86b4 100644 --- a/pkgs/development/libraries/libuv/default.nix +++ b/pkgs/development/libraries/libuv/default.nix @@ -1,14 +1,14 @@ { stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, ApplicationServices, CoreServices }: stdenv.mkDerivation rec { - version = "1.37.0"; + version = "1.38.0"; pname = "libuv"; src = fetchFromGitHub { owner = pname; repo = pname; rev = "v${version}"; - sha256 = "0iy25w4wy9f5y7i7aqidhqz93qi00lv7vhx6s521n0kphvaj8ijz"; + sha256 = "04598jglikma5plfiprnw4pcxwp7b6aqxphxs65pdd5xira6dz0s"; }; postPatch = let From c5239058fba5439459c17cfe6e177c4c76bc6fd3 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Fri, 22 May 2020 06:00:55 +0000 Subject: [PATCH 53/80] libqmi: 1.24.10 -> 1.24.12 --- pkgs/development/libraries/libqmi/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libqmi/default.nix b/pkgs/development/libraries/libqmi/default.nix index 33b4983b015..ec72578ba27 100644 --- a/pkgs/development/libraries/libqmi/default.nix +++ b/pkgs/development/libraries/libqmi/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "libqmi"; - version = "1.24.10"; + version = "1.24.12"; src = fetchurl { url = "https://www.freedesktop.org/software/libqmi/${pname}-${version}.tar.xz"; - sha256 = "1rzxapr6hb18ccvqh5fizx7zk63l47bs0p3gizycz2ysnm1i44n2"; + sha256 = "0scb8a2kh0vnzx6kxanfy2s2slnfppvrwg202rxv30m8p2i92frd"; }; outputs = [ "out" "dev" "devdoc" ]; From e0becdb1dc04cf656e0228f051989a37bc4a5161 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Fri, 22 May 2020 07:28:43 +0000 Subject: [PATCH 54/80] modemmanager: 1.12.8 -> 1.12.10 --- pkgs/tools/networking/modem-manager/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/modem-manager/default.nix b/pkgs/tools/networking/modem-manager/default.nix index 7329d78c2c8..c3981b902f2 100644 --- a/pkgs/tools/networking/modem-manager/default.nix +++ b/pkgs/tools/networking/modem-manager/default.nix @@ -3,12 +3,12 @@ stdenv.mkDerivation rec { pname = "modem-manager"; - version = "1.12.8"; + version = "1.12.10"; package = "ModemManager"; src = fetchurl { url = "https://www.freedesktop.org/software/${package}/${package}-${version}.tar.xz"; - sha256 = "1zrsf57bn9rmaa2qvavr1aisci76vwlx0viqpwmkw3ds2l33vdb8"; + sha256 = "1apq9camys2gaw6y6ic1ld20cncfwpmxnzvh4j5zkbbjpf5hbcxj"; }; nativeBuildInputs = [ vala gobject-introspection gettext pkgconfig ]; From 9836d06e3d15495efd06717e1ad9c5bf7ed8f6e7 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Fri, 22 May 2020 09:17:18 +0000 Subject: [PATCH 55/80] libaom: enable shared, split outputs --- pkgs/development/libraries/libaom/default.nix | 14 ++++-- .../libraries/libaom/outputs.patch | 45 +++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/libaom/outputs.patch diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix index edc9df71815..2c67e6ac158 100644 --- a/pkgs/development/libraries/libaom/default.nix +++ b/pkgs/development/libraries/libaom/default.nix @@ -10,6 +10,8 @@ stdenv.mkDerivation rec { sha256 = "1616xjhj6770ykn82ml741h8hx44v507iky3s9h7a5lnk9d4cxzy"; }; + patches = [ ./outputs.patch ]; + nativeBuildInputs = [ yasm perl cmake pkgconfig python3 ]; @@ -28,12 +30,16 @@ stdenv.mkDerivation rec { # https://aomedia.googlesource.com/aom/+/refs/heads/master/build/cmake/aom_config_defaults.cmake cmakeFlags = [ - # For libaom these must be relative instead of absolute paths: - "-DCMAKE_INSTALL_BINDIR=bin" - "-DCMAKE_INSTALL_INCLUDEDIR=include" - "-DCMAKE_INSTALL_LIBDIR=lib" + "-DBUILD_SHARED_LIBS=ON" + "-DENABLE_TESTS=OFF" ]; + postFixup = '' + moveToOutput lib/libaom.a "$static" + ''; + + outputs = [ "out" "bin" "dev" "static" ]; + meta = with stdenv.lib; { description = "Alliance for Open Media AV1 codec library"; longDescription = '' diff --git a/pkgs/development/libraries/libaom/outputs.patch b/pkgs/development/libraries/libaom/outputs.patch new file mode 100644 index 00000000000..7c0ff397dfe --- /dev/null +++ b/pkgs/development/libraries/libaom/outputs.patch @@ -0,0 +1,45 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -45,2 +45,2 @@ macro(setup_aom_install_targets) +- -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} +- -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} ++ -DCMAKE_INSTALL_FULL_INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR} ++ -DCMAKE_INSTALL_FULL_LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR} +@@ -82,14 +82,14 @@ macro(setup_aom_install_targets) + install( + FILES ${AOM_INSTALL_INCS} +- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/aom") ++ DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/aom") + install( + FILES "${AOM_PKG_CONFIG_FILE}" +- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++ DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") + install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ++ "${CMAKE_INSTALL_FULL_LIBDIR}") + + if(ENABLE_EXAMPLES) + install(TARGETS ${AOM_INSTALL_BINS} DESTINATION +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") ++ "${CMAKE_INSTALL_FULL_BINDIR}") + endif() + endif() +--- a/build/cmake/pkg_config.cmake ++++ b/build/cmake/pkg_config.cmake +@@ -14,2 +14,2 @@ +- "CMAKE_INSTALL_BINDIR" "CMAKE_INSTALL_INCLUDEDIR" +- "CMAKE_INSTALL_LIBDIR" "CMAKE_PROJECT_NAME" ++ "CMAKE_INSTALL_BINDIR" "CMAKE_INSTALL_FULL_INCLUDEDIR" ++ "CMAKE_INSTALL_FULL_LIBDIR" "CMAKE_PROJECT_NAME" +@@ -38,4 +38,4 @@ endif() +-set(prefix "${CMAKE_INSTALL_PREFIX}") +-set(bindir "${CMAKE_INSTALL_BINDIR}") +-set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") +-set(libdir "${CMAKE_INSTALL_LIBDIR}") ++get_filename_component(prefix "${CMAKE_INSTALL_FULL_INCLUDEDIR}" DIRECTORY) ++get_filename_component(exec_prefix "${CMAKE_INSTALL_FULL_LIBDIR}" DIRECTORY) ++get_filename_component(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}" NAME) ++get_filename_component(libdir "${CMAKE_INSTALL_FULL_LIBDIR}" NAME) +@@ -46 +46 @@ file(APPEND "${pkgconfig_file}" "prefix=${prefix}\n") +-file(APPEND "${pkgconfig_file}" "exec_prefix=\${prefix}\n") ++file(APPEND "${pkgconfig_file}" "exec_prefix=${exec_prefix}\n") From aa44ca368a09bf6c487216cb2987d5ddd8d5fece Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sat, 23 May 2020 19:39:02 +0000 Subject: [PATCH 56/80] ffmpeg: add libaom to build inputs only if enabled --- pkgs/development/libraries/ffmpeg/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index fecffe889f1..5b98884c1fc 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -173,7 +173,7 @@ stdenv.mkDerivation rec { libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex nv-codec-headers ] ++ optionals openglSupport [ libGL libGLU ] ++ optional libmfxSupport intel-media-sdk - ++ optional vpxSupport libaom + ++ optional libaomSupport libaom ++ optional vpxSupport libvpx ++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM ++ optional ((isLinux || isFreeBSD) && !isAarch32) libva From 98bcf5d8da5ba8dde94d6cacfdbb034cba01b3d5 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 24 May 2020 09:08:42 +0200 Subject: [PATCH 57/80] Python tests: fix use of is_virtualenv Too many tests set it. --- pkgs/development/interpreters/python/tests.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/tests.nix b/pkgs/development/interpreters/python/tests.nix index 6c4a6ae8e21..35da373e79c 100644 --- a/pkgs/development/interpreters/python/tests.nix +++ b/pkgs/development/interpreters/python/tests.nix @@ -39,7 +39,7 @@ let interpreter = env.interpreter; is_venv = "False"; is_nixenv = "True"; - is_virtualenv = "True"; + is_virtualenv = "False"; }; } // lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec { # Venv built using plain Python @@ -52,7 +52,7 @@ let interpreter = "${env}/bin/${python.executable}"; is_venv = "True"; is_nixenv = "False"; - is_virtualenv = "True"; + is_virtualenv = "False"; }; } // lib.optionalAttrs (python.pythonAtLeast "3.8") { @@ -66,7 +66,7 @@ let interpreter = "${env}/bin/${pythonEnv.executable}"; is_venv = "True"; is_nixenv = "True"; - is_virtualenv = "True"; + is_virtualenv = "False"; }; }; From f17001afd855262cf8e2e809fbcc3799492e77bd Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 24 May 2020 09:35:45 +0200 Subject: [PATCH 58/80] Python: fix virtualenv with Python 2 --- .../interpreters/python/sitecustomize.py | 12 +++--- .../development/interpreters/python/tests.nix | 4 +- .../interpreters/python/tests/test_python.py | 4 ++ ...ix-and-base_exec_prefix-for-Python-2.patch | 37 +++++++++++++++++++ .../python-modules/virtualenv/default.nix | 4 ++ 5 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 pkgs/development/python-modules/virtualenv/0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch diff --git a/pkgs/development/interpreters/python/sitecustomize.py b/pkgs/development/interpreters/python/sitecustomize.py index 72ce951328f..d79a4696d8e 100644 --- a/pkgs/development/interpreters/python/sitecustomize.py +++ b/pkgs/development/interpreters/python/sitecustomize.py @@ -21,9 +21,11 @@ paths = os.environ.pop('NIX_PYTHONPATH', None) if paths: functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo()) -# Check whether we are in a venv. -# Note Python 2 does not support base_prefix so we assume we are not in a venv. -in_venv = sys.version_info.major == 3 and sys.prefix != sys.base_prefix +# Check whether we are in a venv or virtualenv. +# For Python 3 we check whether our `base_prefix` is different from our current `prefix`. +# For Python 2 we check whether the non-standard `real_prefix` is set. +# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv +in_venv = (sys.version_info.major == 3 and sys.prefix != sys.base_prefix) or (sys.version_info.major == 2 and hasattr(sys, "real_prefix")) if not in_venv: executable = os.environ.pop('NIX_PYTHONEXECUTABLE', None) @@ -32,8 +34,6 @@ if not in_venv: if 'PYTHONEXECUTABLE' not in os.environ and executable is not None: sys.executable = executable if prefix is not None: - # Because we cannot check with Python 2 whether we are in a venv, - # creating a venv from a Nix env won't work as well with Python 2. - # Also, note that sysconfig does not like it when sys.prefix is set to None + # Sysconfig does not like it when sys.prefix is set to None sys.prefix = sys.exec_prefix = prefix site.PREFIXES.insert(0, prefix) diff --git a/pkgs/development/interpreters/python/tests.nix b/pkgs/development/interpreters/python/tests.nix index 35da373e79c..03a3b953709 100644 --- a/pkgs/development/interpreters/python/tests.nix +++ b/pkgs/development/interpreters/python/tests.nix @@ -19,10 +19,8 @@ let is_nixenv = "False"; is_virtualenv = "False"; }; - } // lib.optionalAttrs (python.isPy3k && !python.isPyPy) { + } // lib.optionalAttrs (!python.isPyPy) { # Use virtualenv from a Nix env. - # Does not function with Python 2 - # ValueError: source and destination is the same /nix/store/38kz3j1a87cq5y59k5w7k9yk4cqgc5b2-python-2.7.18/lib/python2.7/os.py nixenv-virtualenv = rec { env = runCommand "${python.name}-virtualenv" {} '' ${pythonVirtualEnv.interpreter} -m virtualenv $out diff --git a/pkgs/development/interpreters/python/tests/test_python.py b/pkgs/development/interpreters/python/tests/test_python.py index 41a7e687d26..0fc4b8a9e91 100644 --- a/pkgs/development/interpreters/python/tests/test_python.py +++ b/pkgs/development/interpreters/python/tests/test_python.py @@ -43,6 +43,10 @@ class TestCasePython(unittest.TestCase): else: self.assertEqual(sys.prefix, sys.base_prefix) + @unittest.skipIf(sys.version_info.major==3, "sys.real_prefix is only set by virtualenv in case of Python 2.") + def test_real_prefix(self): + self.assertTrue(hasattr(sys, "real_prefix") == IS_VIRTUALENV) + def test_python_version(self): self.assertTrue(platform.python_version().startswith(PYTHON_VERSION)) diff --git a/pkgs/development/python-modules/virtualenv/0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch b/pkgs/development/python-modules/virtualenv/0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch new file mode 100644 index 00000000000..2b34da289e2 --- /dev/null +++ b/pkgs/development/python-modules/virtualenv/0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch @@ -0,0 +1,37 @@ +From 21563405d6e2348ee457187f7fb61beb102bb367 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk +Date: Sun, 24 May 2020 09:33:13 +0200 +Subject: [PATCH] Check base_prefix and base_exec_prefix for Python 2 + +This is a Nixpkgs-specific change so it can support virtualenvs from Nix envs. +--- + src/virtualenv/discovery/py_info.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py +index 6f12128..74e9218 100644 +--- a/src/virtualenv/discovery/py_info.py ++++ b/src/virtualenv/discovery/py_info.py +@@ -51,13 +51,17 @@ class PythonInfo(object): + self.version = u(sys.version) + self.os = u(os.name) + ++ config_vars = {} if sys.version_info.major is not 2 else sysconfig._CONFIG_VARS ++ base_prefix = config_vars.get("prefix") ++ base_exec_prefix = config_vars.get("exec_prefix") ++ + # information about the prefix - determines python home + self.prefix = u(abs_path(getattr(sys, "prefix", None))) # prefix we think +- self.base_prefix = u(abs_path(getattr(sys, "base_prefix", None))) # venv ++ self.base_prefix = u(abs_path(getattr(sys, "base_prefix", base_prefix))) # venv + self.real_prefix = u(abs_path(getattr(sys, "real_prefix", None))) # old virtualenv + + # information about the exec prefix - dynamic stdlib modules +- self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", None))) ++ self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", base_exec_prefix))) + self.exec_prefix = u(abs_path(getattr(sys, "exec_prefix", None))) + + self.executable = u(abs_path(sys.executable)) # the executable we were invoked via +-- +2.25.1 + diff --git a/pkgs/development/python-modules/virtualenv/default.nix b/pkgs/development/python-modules/virtualenv/default.nix index ff5172d415f..5ca27330103 100644 --- a/pkgs/development/python-modules/virtualenv/default.nix +++ b/pkgs/development/python-modules/virtualenv/default.nix @@ -43,6 +43,10 @@ buildPythonPackage rec { importlib-metadata ]; + patches = lib.optionals (isPy27) [ + ./0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch + ]; + meta = { description = "A tool to create isolated Python environments"; homepage = "http://www.virtualenv.org"; From 3151144388d40e2d6ffdb39c637dafb52f3be329 Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 24 May 2020 22:33:29 +0000 Subject: [PATCH 59/80] libbytesize: 2.2 -> 2.3 --- pkgs/development/libraries/libbytesize/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libbytesize/default.nix b/pkgs/development/libraries/libbytesize/default.nix index 5e293c163a9..ec14b2a6091 100644 --- a/pkgs/development/libraries/libbytesize/default.nix +++ b/pkgs/development/libraries/libbytesize/default.nix @@ -4,7 +4,7 @@ }: let - version = "2.2"; + version = "2.3"; in stdenv.mkDerivation rec { pname = "libbytesize"; inherit version; @@ -13,7 +13,7 @@ in stdenv.mkDerivation rec { owner = "storaged-project"; repo = "libbytesize"; rev = version; - sha256 = "0n4gmn68ypsk3gcw6akcghlgk3aj3wskwg3mlg93cw5y3a33nbhm"; + sha256 = "1nrlmn63k0ix1yzn8v4lni5n5b4c0b6w9f33p1ig113ymmdvcc0h"; }; outputs = [ "out" "dev" "devdoc" ]; From 0367fa630d59673624d6742e2758b87eb12fff4c Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Thu, 14 May 2020 13:35:11 +0200 Subject: [PATCH 60/80] python38: 3.8.2 -> 3.8.3 --- pkgs/development/interpreters/python/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 2def54de12d..a3ba72a27b2 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -107,10 +107,10 @@ in { sourceVersion = { major = "3"; minor = "8"; - patch = "2"; + patch = "3"; suffix = ""; }; - sha256 = "1ps5v323cp5czfshqjmbsqw7nvrdpcbk06f62jbzaqik4gfffii6"; + sha256 = "0r2qg4pdvv52ld5dd95fl6lzzsxxxhbsxmymwcphh6624g3mxayz"; inherit (darwin) configd; inherit passthruFun; }; From 162c0c3e6100461b5ed59144e6a69c179dfde84a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 27 May 2020 16:07:58 +0000 Subject: [PATCH 61/80] mkDerivation: Don't need to specify pkg-config for meson any more Env var will work fine. --- pkgs/stdenv/generic/make-derivation.nix | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 09879451d8e..993ae68e9e8 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -262,7 +262,7 @@ in rec { else if isx86_32 then "x86" else if isx86_64 then "x86_64" else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits; - crossFile = builtins.toFile "cross-file.conf" ('' + crossFile = builtins.toFile "cross-file.conf" '' [properties] needs_exe_wrapper = true @@ -271,13 +271,7 @@ in rec { cpu_family = '${cpuFamily stdenv.targetPlatform}' cpu = '${stdenv.targetPlatform.parsed.cpu.name}' endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"} - '' - # TODO should have target prefix too, issue #86077 - + '' - - [binaries] - pkgconfig = 'pkg-config' - ''); + ''; in [ "--cross-file=${crossFile}" ] ++ mesonFlags; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; From ffe57c4e3e5cb535dff2da7ab311444a37ce390a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 27 May 2020 18:34:38 +0200 Subject: [PATCH 62/80] lazarus: Fix eval Unclean merge between d201270d0f2eb42181560949704d620d3679c1fa and 1ac5398589916a6a433e845342c9b85c4c52f5dc. --- pkgs/development/compilers/fpc/lazarus.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/fpc/lazarus.nix b/pkgs/development/compilers/fpc/lazarus.nix index 701dcae2fcf..31a0727da90 100644 --- a/pkgs/development/compilers/fpc/lazarus.nix +++ b/pkgs/development/compilers/fpc/lazarus.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { postInstall = '' wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' \ "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ - --prefix NIX_${binutils.infixSalt}_LDFLAGS ' ' \ + --prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' \ "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ --prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \ --prefix PATH ':' "${fpc}/bin:${gdb}/bin:${gnumake}/bin:${binutils}/bin" From f005272623abfb9eb470b0317a9d18250daa3526 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 27 May 2020 17:12:43 +0000 Subject: [PATCH 63/80] wayland: Simplify cross build Now that we have a pkg-config wrapper, we can get build-time deps via pkg-config. --- pkgs/development/libraries/wayland/default.nix | 7 ++++--- .../wayland/fix-wayland-cross-compilation.patch | 14 -------------- 2 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix index e3b2941e8ee..402177b899c 100644 --- a/pkgs/development/libraries/wayland/default.nix +++ b/pkgs/development/libraries/wayland/default.nix @@ -23,16 +23,17 @@ in stdenv.mkDerivation rec { mesonFlags = [ "-Ddocumentation=${lib.boolToString withDocumentation}" ]; - patches = lib.optional isCross ./fix-wayland-cross-compilation.patch; - postPatch = lib.optionalString withDocumentation '' patchShebangs doc/doxygen/gen-doxygen.py - '' + lib.optionalString isCross '' substituteInPlace egl/meson.build --replace \ "find_program('nm').path()" \ "find_program('${stdenv.cc.targetPrefix}nm').path()" ''; + depsBuildBuild = [ + pkgconfig + ]; + nativeBuildInputs = [ meson pkgconfig ninja ] ++ lib.optionals isCross [ diff --git a/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch b/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch deleted file mode 100644 index 77639acb653..00000000000 --- a/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/meson.build b/src/meson.build -index 3e8c9bf..75241cb 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -55,8 +55,7 @@ pkgconfig.generate( - ) - - if meson.is_cross_build() -- scanner_dep = dependency('wayland-scanner', native: true, version: '>=1.14.0') -- wayland_scanner_for_build = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner')) -+ wayland_scanner_for_build = find_program('wayland-scanner', native: true, version: '>=1.14.0') - else - wayland_scanner_for_build = wayland_scanner - endif From 62e6d73a09870174a891d2a8d29a38e62b05efd5 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Wed, 27 May 2020 17:41:25 +0300 Subject: [PATCH 64/80] mesa: Fix cross build --- pkgs/development/libraries/mesa/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 7eb18dd31c1..aa70e9e5a54 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, fetchpatch +{ stdenv, lib, fetchurl, fetchpatch, buildPackages , pkgconfig, intltool, ninja, meson , file, flex, bison, expat, libdrm, xorg, wayland, wayland-protocols, openssl , llvmPackages, libffi, libomxil-bellagio, libva-minimal @@ -73,6 +73,12 @@ stdenv.mkDerivation { }) ]; + postPatch = '' + substituteInPlace meson.build --replace \ + "find_program('pkg-config')" \ + "find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')" + ''; + outputs = [ "out" "dev" "drivers" "osmesa" ]; # TODO: Figure out how to enable opencl without having a runtime dependency on clang @@ -112,10 +118,14 @@ stdenv.mkDerivation { ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optional withValgrind valgrind-light; + depsBuildBuild = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig meson ninja intltool bison flex file python3Packages.python python3Packages.Mako + ] ++ lib.optionals (elem "wayland" eglPlatforms) [ + wayland # For wayland-scanner during the build ]; propagatedBuildInputs = with xorg; [ From 3a4fec82326f53fd14721aa3c4fd8560752f8982 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Wed, 6 May 2020 10:23:32 -0700 Subject: [PATCH 65/80] mxnet: use blas.provider, fix build --- pkgs/applications/science/math/mxnet/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index b006a9dd18d..3d74421669e 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake perl ]; - buildInputs = [ opencv3 gtest blas ] + buildInputs = [ opencv3 gtest blas.provider ] ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ] ++ lib.optional cudnnSupport cudnn; From 7f76daacdb0190ce91c95111cc3eba49cea41fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 29 May 2020 15:29:20 +0200 Subject: [PATCH 66/80] zstd: get rid of static libs if enableShared --- pkgs/tools/compression/zstd/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix index a7ae4d0b3ba..ee006a55ea3 100644 --- a/pkgs/tools/compression/zstd/default.nix +++ b/pkgs/tools/compression/zstd/default.nix @@ -30,6 +30,7 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DZSTD_BUILD_SHARED:BOOL=${if enableShared then "ON" else "OFF"}" + # They require STATIC for bin/zstd and tests. "-DZSTD_LEGACY_SUPPORT:BOOL=${if legacySupport then "ON" else "OFF"}" "-DZSTD_BUILD_TESTS:BOOL=ON" ]; @@ -54,6 +55,8 @@ stdenv.mkDerivation rec { substituteInPlace ../programs/zstdless \ --replace "zstdcat" "$bin/bin/zstdcat" ''; + # Don't duplicate the library code in runtime closures. + postInstall = stdenv.lib.optionalString enableShared ''rm "$out"/lib/libzstd.a''; outputs = [ "bin" "dev" "man" "out" ]; From 81b204e8a126a9c3c5de51cc23f0233c842de429 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 29 May 2020 20:21:04 +0200 Subject: [PATCH 67/80] python.pkgs.cython: use pkg-config instead of python.pkgs.pkgconfig It does not need the Python interface to pkg-config. Note I think the majority of Python packages that use pkgconfig should actually use pkg-config. --- pkgs/development/python-modules/Cython/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/Cython/default.nix b/pkgs/development/python-modules/Cython/default.nix index 2d987abb3e4..f0b8a5dd560 100644 --- a/pkgs/development/python-modules/Cython/default.nix +++ b/pkgs/development/python-modules/Cython/default.nix @@ -5,7 +5,7 @@ , fetchpatch , python , glibcLocales -, pkgconfig +, pkg-config , gdb , numpy , ncurses @@ -34,7 +34,7 @@ in buildPythonPackage rec { }; nativeBuildInputs = [ - pkgconfig + pkg-config ]; checkInputs = [ numpy ncurses From 7fe783903e0345c76a75c41d1ceabc8265184be5 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 29 May 2020 20:41:49 +0200 Subject: [PATCH 68/80] python.pkgs.pkgconfig: fix setup hook after regression caused by https://github.com/NixOS/nixpkgs/pull/87705 --- pkgs/development/python-modules/pkgconfig/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/pkgconfig/default.nix b/pkgs/development/python-modules/pkgconfig/default.nix index ff9e3cc39aa..05f13e8878a 100644 --- a/pkgs/development/python-modules/pkgconfig/default.nix +++ b/pkgs/development/python-modules/pkgconfig/default.nix @@ -4,7 +4,13 @@ buildPythonPackage rec { pname = "pkgconfig"; version = "1.5.1"; - setupHooks = pkgconfig.setupHooks; + inherit (pkgconfig) + setupHooks + wrapperName + suffixSalt + targetPrefix + baseBinName + ; src = fetchPypi { inherit pname version; From 20aa1cc95c5fc67919a5a178933681eee4b8355a Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Fri, 29 May 2020 20:42:11 +0200 Subject: [PATCH 69/80] python.pkgs.python-lz4: buildInputs are nativeBuildInputs --- pkgs/development/python-modules/python-lz4/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/python-lz4/default.nix b/pkgs/development/python-modules/python-lz4/default.nix index 4c66ed02cfc..e9317d3f7c6 100644 --- a/pkgs/development/python-modules/python-lz4/default.nix +++ b/pkgs/development/python-modules/python-lz4/default.nix @@ -23,7 +23,7 @@ buildPythonPackage rec { sha256 = "02cadqfdmw4vc94px18dh4hcybpsa2lr6jz6j5phwc0jjaavh3wr"; }; - buildInputs = [ setuptools_scm pkgconfig pytestrunner ]; + nativeBuildInputs = [ setuptools_scm pkgconfig pytestrunner ]; checkInputs = [ pytest pytestcov psutil ]; propagatedBuildInputs = lib.optionals (!isPy3k) [ future ]; From 9ab24ec76b7b950d48814ac51e54bd93ea187a0a Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 23 May 2020 14:53:23 +0200 Subject: [PATCH 70/80] libva-utils: refactor Note: This doesn't affect the result. --- pkgs/development/libraries/libva-utils/default.nix | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pkgs/development/libraries/libva-utils/default.nix b/pkgs/development/libraries/libva-utils/default.nix index a4de995ada8..90f1849aee0 100644 --- a/pkgs/development/libraries/libva-utils/default.nix +++ b/pkgs/development/libraries/libva-utils/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchFromGitHub, pkgconfig -, libdrm, libva, libX11, libXext, libXfixes, wayland, meson, ninja +{ stdenv, fetchFromGitHub, meson, ninja, pkg-config +, libdrm, libva, libX11, libXext, libXfixes, wayland }: stdenv.mkDerivation rec { @@ -13,18 +13,10 @@ stdenv.mkDerivation rec { sha256 = "13a0dccphi4cpr2cx45kg4djxsssi3d1fcjrkx27b16xiayp5lx9"; }; - nativeBuildInputs = [ meson ninja pkgconfig ]; + nativeBuildInputs = [ meson ninja pkg-config ]; buildInputs = [ libdrm libva libX11 libXext libXfixes wayland ]; - mesonFlags = [ - "-Ddrm=true" - "-Dx11=true" - "-Dwayland=true" - ]; - - enableParallelBuilding = true; - meta = with stdenv.lib; { description = "A collection of utilities and examples for VA-API"; longDescription = '' From a668f6a58ae9ede86b602cd4bfff9e9a69287497 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 23 May 2020 18:55:54 +0200 Subject: [PATCH 71/80] libva: Switch from GNU Autotools to Meson --- pkgs/development/libraries/libva/default.nix | 36 ++++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pkgs/development/libraries/libva/default.nix b/pkgs/development/libraries/libva/default.nix index 86c6a88b1ef..d0bd2ecc009 100644 --- a/pkgs/development/libraries/libva/default.nix +++ b/pkgs/development/libraries/libva/default.nix @@ -1,8 +1,8 @@ -{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig -, libXext, libdrm, libXfixes, wayland, libffi, libX11 -, libGL, mesa +{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, pkg-config, ninja, wayland +, libdrm , minimal ? false, libva-minimal -, buildPackages +, libX11, libXext, libXfixes, libffi, libGL +, mesa }: stdenv.mkDerivation rec { @@ -17,24 +17,30 @@ stdenv.mkDerivation rec { sha256 = "0ywasac7z3hwggj8szp83sbxi2naa0a3amblx64y7i1hyyrn0csq"; }; + patches = [ + (fetchpatch { # meson: Allow for libdir and includedir to be absolute paths + url = "https://github.com/intel/libva/commit/de902e2905abff635f3bb151718cc52caa3f669c.patch"; + sha256 = "1lpc8qzvsxnlsh9g0ab5lja204zxz8rr2p973pfihcw7dcxc3gia"; + }) + ]; + + postPatch = '' + # Remove the execute bit from all source code files + # https://github.com/intel/libva/commit/dbd2cd635f33af1422cbc2079af0a7e68671c102 + chmod -x va/va{,_dec_av1,_trace,_vpp}.h + ''; + outputs = [ "dev" "out" ]; - nativeBuildInputs = [ autoreconfHook pkgconfig wayland ]; + nativeBuildInputs = [ meson pkg-config ninja wayland ]; buildInputs = [ libdrm ] ++ lib.optionals (!minimal) [ libva-minimal libX11 libXext libXfixes wayland libffi libGL ]; # TODO: share libs between minimal and !minimal - perhaps just symlink them - enableParallelBuilding = true; - - configureFlags = [ - # Add FHS paths for non-NixOS applications. - "--with-drivers-path=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri" - "ac_cv_path_WAYLAND_SCANNER=${buildPackages.wayland}/bin/wayland-scanner" - ] ++ lib.optionals (!minimal) [ "--enable-glx" ]; - - installFlags = [ - "dummy_drv_video_ladir=$(out)/lib/dri" + mesonFlags = [ + # Add FHS paths for non-NixOS applications: + "-Ddriverdir=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri" ]; meta = with stdenv.lib; { From 458b2cb7d67561c796c6f0660a97eea9b685fc65 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Thu, 4 Jun 2020 15:24:25 +0200 Subject: [PATCH 72/80] bison_3_5: init at 3.5.4, for ruby Ruby does not build with 3.6. To unblock staging-next, let it use the previous bison version. --- pkgs/top-level/all-packages.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 092b44bf984..f8b7b6d4a61 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9794,6 +9794,7 @@ in inherit (callPackage ../development/interpreters/ruby { inherit (darwin) libiconv libobjc libunwind; inherit (darwin.apple_sdk.frameworks) Foundation; + bison = bison_3_5; }) ruby_2_5 ruby_2_6 @@ -10124,6 +10125,15 @@ in bison = callPackage ../development/tools/parsing/bison { }; yacc = bison; # TODO: move to aliases.nix + # Ruby fails to build with current bison + bison_3_5 = pkgs.bison.overrideAttrs (oldAttrs: rec { + version = "3.5.4"; + src = fetchurl { + url = "mirror://gnu/${oldAttrs.pname}/${oldAttrs.pname}-${version}.tar.gz"; + sha256 = "0a2cbrqh7mgx2dwf5qm10v68iakv1i0dqh9di4x5aqxsz96ibpf0"; + }; + }); + black = with python3Packages; toPythonApplication black; blackmagic = callPackage ../development/tools/misc/blackmagic { }; From f9af74e75a27fac3bb50a43fce0c72c9b6ac24ed Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Thu, 4 Jun 2020 17:53:31 +0200 Subject: [PATCH 73/80] meson: fix hash after incorrect merge --- pkgs/development/tools/build-managers/meson/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index f7468bf7f0c..5b1266da382 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -12,7 +12,7 @@ python3Packages.buildPythonApplication rec { src = python3Packages.fetchPypi { inherit pname version; - sha256 = "1p4n0b6jn8pyj6rwxg48ayphji8v1482cabrwhzf2avnf92znxig"; + sha256 = "0m84zb0q67vnxmd6ldz477w6yjdnk9c44xhlwh1g1pzqx3m6wwd7"; }; postFixup = '' From b78c6d47eecb0641a4f1eb0a9a77fbaa9fa2d975 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 6 Jun 2020 21:53:52 +0000 Subject: [PATCH 74/80] autogen: More normal formatting --- pkgs/development/tools/misc/autogen/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix index 6b9e8db2f2a..17aa6e5fdf9 100644 --- a/pkgs/development/tools/misc/autogen/default.nix +++ b/pkgs/development/tools/misc/autogen/default.nix @@ -11,10 +11,12 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "lib" "out" "man" "info" ]; - nativeBuildInputs = [ which pkgconfig perl ] + nativeBuildInputs = [ + which pkgconfig perl + ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # autogen needs a build autogen when cross-compiling - ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - buildPackages.buildPackages.autogen buildPackages.texinfo ]; + buildPackages.buildPackages.autogen buildPackages.texinfo + ]; buildInputs = [ guile libxml2 ]; From 87e86b457467e09a1e26a48b7b4abc223a4d7d3f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 7 Jun 2020 15:36:28 +0000 Subject: [PATCH 75/80] autoen: Fix cross build See comments for details. Patch can be removed whend version is bumped. --- pkgs/development/tools/misc/autogen/default.nix | 16 ++++++++++++++++ .../tools/misc/autogen/pkg-config-use-var.patch | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/development/tools/misc/autogen/pkg-config-use-var.patch diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix index 17aa6e5fdf9..65c4f317405 100644 --- a/pkgs/development/tools/misc/autogen/default.nix +++ b/pkgs/development/tools/misc/autogen/default.nix @@ -11,6 +11,22 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "lib" "out" "man" "info" ]; + patches = [ + # Temporary, so builds with a prefixed pkg-config (like cross builds) work. + # + # https://savannah.gnu.org/support/?109050 was supposed to fix this, but + # the generated configure script mysteriously still contained hard-coded + # pkg-config. I tried regenerating it, but that didn't help. Only + # https://git.savannah.gnu.org/cgit/autogen.git/commit/?h=5cbe233387d7f7b36752736338d1cd4f71287daa, + # in the next release, finally fixes this, by getting rid of some + # metaprogramming of the autoconf m4 metaprogram! There evidentally was + # some sort escaping error such that the `PKG_CONFIG` check got evaluated + # before `configure` was generated. + # + # Remove this when the version is bumped + ./pkg-config-use-var.patch + ]; + nativeBuildInputs = [ which pkgconfig perl ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ diff --git a/pkgs/development/tools/misc/autogen/pkg-config-use-var.patch b/pkgs/development/tools/misc/autogen/pkg-config-use-var.patch new file mode 100644 index 00000000000..69476f62c6d --- /dev/null +++ b/pkgs/development/tools/misc/autogen/pkg-config-use-var.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index c3f761d1c3f..14b101f67c1 +--- a/configure ++++ b/configure +@@ -16683,7 +16683,7 @@ fi + + + +- ag_gv=`gdir=\`pkg-config --cflags-only-I \ ++ ag_gv=`gdir=\`${PKG_CONFIG} --cflags-only-I \ + guile-${GUILE_EFFECTIVE_VERSION} | \ + sed 's/\(^\| \)-I/\1/g'\` + for d in $gdir From a239864fc610ff7738c5a8af2a7be25a0af4a28b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 8 Jun 2020 00:25:01 +0000 Subject: [PATCH 76/80] systemd: Fix cross build This was very similar to the Mesa issues fixed in 62e6d73a09870174a891d2a8d29a38e62b05efd5: the user-written code is looking up an unprefixed binutils program. [I think we should have a way in Meson of specifying a program prefix in the cross / native files, as a fallback for any program that isn't explicitly specified. This could both be availible for user written rules, and help with the default rules.] Fixes https://github.com/NixOS/mobile-nixos/issues/161 --- pkgs/os-specific/linux/systemd/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 00a545ed3f5..3235fb3b95c 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -66,6 +66,13 @@ in stdenv.mkDerivation { postPatch = '' substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/" + substituteInPlace src/boot/efi/meson.build \ + --replace \ + "find_program('ld'" \ + "find_program('${stdenv.cc.bintools.targetPrefix}ld'" \ + --replace \ + "find_program('objcopy'" \ + "find_program('${stdenv.cc.bintools.targetPrefix}objcopy'" ''; outputs = [ "out" "lib" "man" "dev" ]; From b59847b848079ba872e18b5f0683c1bff7e924ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 8 Jun 2020 06:27:16 +0200 Subject: [PATCH 77/80] systemd: avoid rebuild from the parent commit for now Otherwise we'd be delaying this staging-next cycle noticeably. --- pkgs/os-specific/linux/systemd/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 3235fb3b95c..722b4db9a80 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -66,6 +66,9 @@ in stdenv.mkDerivation { postPatch = '' substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/" + '' + # TODO: unconditionalize on the next rebuild + + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' substituteInPlace src/boot/efi/meson.build \ --replace \ "find_program('ld'" \ From 0b4afef84a37c47bd6a5319513db6279fc4bc4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 9 Jun 2020 09:26:10 +0200 Subject: [PATCH 78/80] gitMinimal: fix build after PR #86848 In that case it specified $doc output but didn't even create it. I expect it's better to do it this way instead of creating it as an empty directory. (Only the failed builds get rebuilt by this commit.) --- .../version-management/git-and-tools/git/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix index 140a273e342..78981ef9ad0 100644 --- a/pkgs/applications/version-management/git-and-tools/git/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation { sha256 = "0j685w6pzkn926z5nf5r8fij4ziipvw4c9yb0wc577nzf4j16rbd"; }; - outputs = [ "out" "doc" ]; + outputs = [ "out" ] ++ stdenv.lib.optional withManual "doc"; hardeningDisable = [ "format" ]; From 9dd9bc7bcc2a54f7dc0cb23cef701439dfb9d0ca Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Tue, 26 May 2020 14:09:20 +0200 Subject: [PATCH 79/80] linux: fix kernel config options Some of the options didn't have correct kernel version constraints, others had been removed or made optional unnecessarily in #84032. --- .../linux/kernel/common-config.nix | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index d239455ad34..59056ef338c 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -63,7 +63,7 @@ let PM_WAKELOCKS = yes; # Power-capping framework and support for INTEL RAPL POWERCAP = yes; - INTEL_RAPL = module; + INTEL_RAPL = whenAtLeast "5.3" module; }; external-firmware = { @@ -120,7 +120,7 @@ let HAVE_EBPF_JIT = whenPlatformHasEBPFJit yes; BPF_STREAM_PARSER = whenAtLeast "4.19" yes; XDP_SOCKETS = whenAtLeast "4.19" yes; - XDP_SOCKETS_DIAG = whenAtLeast "4.19" yes; + XDP_SOCKETS_DIAG = whenAtLeast "5.1" yes; WAN = yes; TCP_CONG_CUBIC = yes; # This is the default congestion control algorithm since 2.6.19 # Required by systemd per-cgroup firewalling @@ -167,13 +167,18 @@ let NF_CONNTRACK_TIMEOUT = yes; NF_CONNTRACK_TIMESTAMP = yes; NETFILTER_NETLINK_GLUE_CT = yes; - NF_TABLES_INET = whenAtLeast "4.19" yes; - NF_TABLES_NETDEV = whenAtLeast "4.19" yes; + NF_TABLES_INET = mkMerge [ (whenOlder "4.17" module) + (whenAtLeast "4.17" yes) ]; + NF_TABLES_NETDEV = mkMerge [ (whenOlder "4.17" module) + (whenAtLeast "4.17" yes) ]; # IP: Netfilter Configuration - NF_TABLES_IPV4 = yes; - NF_TABLES_ARP = whenAtLeast "4.19" yes; + NF_TABLES_IPV4 = mkMerge [ (whenOlder "4.17" module) + (whenAtLeast "4.17" yes) ]; + NF_TABLES_ARP = mkMerge [ (whenOlder "4.17" module) + (whenAtLeast "4.17" yes) ]; # IPv6: Netfilter Configuration - NF_TABLES_IPV6 = yes; + NF_TABLES_IPV6 = mkMerge [ (whenOlder "4.17" module) + (whenAtLeast "4.17" yes) ]; # Bridge Netfilter Configuration NF_TABLES_BRIDGE = mkMerge [ (whenBetween "4.19" "5.3" yes) (whenAtLeast "5.3" module) ]; @@ -183,7 +188,8 @@ let NET_DROP_MONITOR = yes; # needed for ss - INET_DIAG = yes; + INET_DIAG = module; + INET_TCP_DIAG = module; INET_UDP_DIAG = module; INET_RAW_DIAG = whenAtLeast "4.14" module; INET_DIAG_DESTROY = whenAtLeast "4.9" yes; @@ -364,7 +370,7 @@ let CIFS_STATS = whenOlder "4.19" yes; CIFS_WEAK_PW_HASH = yes; CIFS_UPCALL = yes; - CIFS_ACL = option yes; + CIFS_ACL = whenOlder "5.3" yes; CIFS_DFS_UPCALL = yes; CIFS_SMB2 = whenOlder "4.13" yes; @@ -395,7 +401,7 @@ let DEBUG_SET_MODULE_RONX = { optional = true; tristate = whenOlder "4.11" "y"; }; RANDOMIZE_BASE = option yes; STRICT_DEVMEM = option yes; # Filter access to /dev/mem - SECURITY_SELINUX_BOOTPARAM_VALUE = option (freeform "0"); # Disable SELinux by default + SECURITY_SELINUX_BOOTPARAM_VALUE = whenOlder "5.1" (freeform "0"); # Disable SELinux by default # Prevent processes from ptracing non-children processes SECURITY_YAMA = option yes; DEVKMEM = mkIf (!features.grsecurity) no; # Disable /dev/kmem @@ -707,8 +713,9 @@ let KEXEC_FILE = option yes; KEXEC_JUMP = option yes; + PARTITION_ADVANCED = yes; # Needed for LDM_PARTITION # Windows Logical Disk Manager (Dynamic Disk) support - LDM_PARTITION = option yes; + LDM_PARTITION = yes; LOGIRUMBLEPAD2_FF = yes; # Logitech Rumblepad 2 force feedback LOGO = no; # not needed MEDIA_ATTACH = yes; @@ -793,7 +800,7 @@ let SUN8I_DE2_CCU = whenAtLeast "4.13" yes; # See comments on https://github.com/NixOS/nixpkgs/commit/9b67ea9106102d882f53d62890468071900b9647 - CRYPTO_AEGIS128_SIMD = no; + CRYPTO_AEGIS128_SIMD = whenAtLeast "5.4" no; }; }; in From bbe71613b6e656e707acdf9c279736c900bf4e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 10 Jun 2020 14:07:15 +0200 Subject: [PATCH 80/80] linux: fix kernel config options for 5.7 --- pkgs/os-specific/linux/kernel/common-config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index 59056ef338c..06ed2cf1559 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -274,7 +274,7 @@ let SND_SOC_SOF_ELKHARTLAKE_SUPPORT = yes; SND_SOC_SOF_GEMINILAKE_SUPPORT = yes; SND_SOC_SOF_HDA_AUDIO_CODEC = yes; - SND_SOC_SOF_HDA_COMMON_HDMI_CODEC = yes; + SND_SOC_SOF_HDA_COMMON_HDMI_CODEC = whenOlder "5.7" yes; SND_SOC_SOF_HDA_LINK = yes; SND_SOC_SOF_ICELAKE_SUPPORT = yes; SND_SOC_SOF_INTEL_TOPLEVEL = yes;