From 3ad87b4537301a5d834c5b06e7654cec14eed9dd Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Thu, 14 Jul 2022 16:32:45 -0400 Subject: [PATCH 1/2] zchunk: fix build on darwin --- .../0001-meson-fix-argp-standalone.patch | 18 ++++++++++++++++++ pkgs/development/libraries/zchunk/default.nix | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/zchunk/0001-meson-fix-argp-standalone.patch diff --git a/pkgs/development/libraries/zchunk/0001-meson-fix-argp-standalone.patch b/pkgs/development/libraries/zchunk/0001-meson-fix-argp-standalone.patch new file mode 100644 index 000000000000..cd51d17b1500 --- /dev/null +++ b/pkgs/development/libraries/zchunk/0001-meson-fix-argp-standalone.patch @@ -0,0 +1,18 @@ +diff --git a/meson.build b/meson.build +index 1c6b32d..aa7dd25 100644 +--- a/meson.build ++++ b/meson.build +@@ -58,10 +58,10 @@ endif + + # argp-standalone dependency (if required) + if build_machine.system() == 'windows' or build_machine.system() == 'darwin' or build_machine.system() == 'freebsd' or not cc.links('#include \nstatic error_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); return 0; }; void main() {}') +- if fs.is_dir(join_paths([get_option('prefix'), 'include'])) +- inc += include_directories(join_paths([get_option('prefix'), 'include'])) ++ argplib = cc.find_library('argp', has_headers : ['argp.h'], required: false) ++ if not argplib.found() ++ argplib = dependency('argp-standalone') + endif +- argplib = cc.find_library('argp', dirs : join_paths([get_option('prefix'), 'lib'])) + else + argplib = dependency('', required : false) + endif diff --git a/pkgs/development/libraries/zchunk/default.nix b/pkgs/development/libraries/zchunk/default.nix index c639eb7b30e9..50b23a1d99d5 100644 --- a/pkgs/development/libraries/zchunk/default.nix +++ b/pkgs/development/libraries/zchunk/default.nix @@ -20,6 +20,11 @@ stdenv.mkDerivation rec { hash = "sha256-7H1WF5VkpA65xCdEa0Sw4r4jj+kGhDVCMr5AeE+3Ii4="; }; + # unbreak on darwin by finding argp-standalone, based on the patch from + # buildroot: + # https://github.com/buildroot/buildroot/raw/master/package/zchunk/0001-meson-fix-argp-standalone-wrap-and-find_library.patch + patches = lib.optional stdenv.isDarwin ./0001-meson-fix-argp-standalone.patch; + nativeBuildInputs = [ meson ninja @@ -47,6 +52,5 @@ stdenv.mkDerivation rec { license = licenses.bsd2; maintainers = with maintainers; [ AndersonTorres ]; platforms = platforms.unix; - broken = stdenv.isDarwin; # does not find argp-standalone }; } From 686ac5bf4d0990121a665c930dba44ad15d015b0 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Fri, 15 Jul 2022 10:38:48 +0800 Subject: [PATCH 2/2] linuxPackages.nvidia_x11: fix build of versions without nvngx.dll --- pkgs/os-specific/linux/nvidia-x11/builder.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index 9d6916be58c0..a7746194570c 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -120,8 +120,9 @@ installPhase() { fi # Install libraries needed by Proton to support DLSS - install -Dm644 -t $i/lib/nvidia/wine/ nvngx.dll _nvngx.dll - + if [ -e nvngx.dll ] && [ -e _nvngx.dll ]; then + install -Dm644 -t $i/lib/nvidia/wine/ nvngx.dll _nvngx.dll + fi done if [ -n "$bin" ]; then