From f4608856947e483a0a28fda372a451b6681f20de Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 9 Apr 2023 09:44:55 +0100 Subject: [PATCH] SDL2: don't propagate headers-only packages via RUNPATH On `nixpkgs` SDL2 explicitly bulds RUNPATHs from it's subset of build inputs. As a result RUNPATH contains more than needed. This change repomed from RUNPATH packages that don't contain libraries but contain developer-only files: - wayland-protocols: xml files to describe protocols - xorgproto: header files for X11 The change moves them to buildInputs / propagatedBuildInputs. Before the change closure size is: $ nix path-info -rsSh $(nix-build -A SDL2) | nl 221 /nix/store/...-SDL2-2.26.4 2.5M 546.5M After the change: $ nix path-info -rsSh $(nix-build -A SDL2) | nl 219 /nix/store/...-SDL2-2.26.4 2.5M 544.4M --- pkgs/development/libraries/SDL2/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index 681dd6515cd13..afd22f36f5365 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -86,13 +86,14 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config ] ++ lib.optionals waylandSupport [ wayland wayland-scanner ]; - propagatedBuildInputs = dlopenPropagatedBuildInputs; - dlopenPropagatedBuildInputs = [ ] # Propagated for #include in SDL_opengles.h. ++ lib.optional openglSupport libGL # Propagated for #include and in SDL_syswm.h. - ++ lib.optionals x11Support [ libX11 xorgproto ]; + ++ lib.optionals x11Support [ libX11 ]; + + propagatedBuildInputs = lib.optionals x11Support [ xorgproto ] + ++ dlopenPropagatedBuildInputs; dlopenBuildInputs = lib.optionals alsaSupport [ alsa-lib audiofile ] ++ lib.optional dbusSupport dbus @@ -100,13 +101,14 @@ stdenv.mkDerivation rec { ++ lib.optional pipewireSupport pipewire ++ lib.optional pulseaudioSupport libpulseaudio ++ lib.optional udevSupport udev - ++ lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] + ++ lib.optionals waylandSupport [ wayland libxkbcommon ] ++ lib.optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ] ++ lib.optionals drmSupport [ libdrm mesa ]; buildInputs = [ libiconv ] ++ dlopenBuildInputs ++ lib.optional ibusSupport ibus + ++ lib.optionals waylandSupport [ wayland-protocols ] ++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ]; enableParallelBuilding = true;