about summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2022-12-08 13:07:14 +0100
committerRobert Helgesson <robert@rycee.net>2022-12-28 16:37:07 +0100
commit7e74ec53da20c288f9a45047e67e8227d95b2a55 (patch)
tree51bf7e7f79ed7d63af06985e065f0ca9a03be704 /pkgs/development/libraries
parent0ad5b197653df0196872e735566ae354d65659f4 (diff)
libwebsockets: use multiple outputs
This considerably lowers the closure size of packages that just need
the libraries at runtime. The difference is roughly 60–70MiB.
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/libwebsockets/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix
index 0b8d8d8e58176..b2839de387a27 100644
--- a/pkgs/development/libraries/libwebsockets/default.nix
+++ b/pkgs/development/libraries/libwebsockets/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
     hash = "sha256-why8LAcc4XN0JdTJ1JoNWijKENL5mOHBsi9K4wpYr2c=";
   };
 
+  outputs = [ "out" "dev" ];
+
   buildInputs = [ openssl zlib libuv ];
 
   nativeBuildInputs = [ cmake ];
@@ -34,7 +36,14 @@ stdenv.mkDerivation rec {
   ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON";
 
   postInstall = ''
-    rm -r ${placeholder "out"}/share/libwebsockets-test-server
+    # Fix path that will be incorrect on move to "dev" output.
+    substituteInPlace "$out/lib/cmake/libwebsockets/LibwebsocketsTargets-release.cmake" \
+      --replace "\''${_IMPORT_PREFIX}" "$out"
+
+    # The package builds a few test programs that are not usually necessary.
+    # Move those to the dev output.
+    moveToOutput "bin/libwebsockets-test-*" "$dev"
+    moveToOutput "share/libwebsockets-test-*" "$dev"
   '';
 
   # $out/share/libwebsockets-test-server/plugins/libprotocol_*.so refers to crtbeginS.o