about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-12-29 00:40:52 +0100
committerGitHub <noreply@github.com>2022-12-29 00:40:52 +0100
commit2898eea094c26089a285f03df9343e99b3d7a413 (patch)
tree8fe938ee222a98d6c3fd4854f4d54dd0aed61801
parent1bb598fb4588b8752674bfbddcf9403daf2d6e09 (diff)
parent7fb1be82f4e180da9b53fb06de4d91c43b605b0f (diff)
Merge pull request #205146 from rycee/libwebsockets/multi-outputs
-rw-r--r--pkgs/development/libraries/libwebsockets/default.nix19
1 files changed, 17 insertions, 2 deletions
diff --git a/pkgs/development/libraries/libwebsockets/default.nix b/pkgs/development/libraries/libwebsockets/default.nix
index 0b8d8d8e58176..a535763b8c196 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 ];
@@ -31,10 +33,23 @@ stdenv.mkDerivation rec {
     "-DDISABLE_WERROR=ON"
     "-DLWS_BUILD_HASH=no_hash"
   ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DLWS_WITHOUT_TESTAPPS=ON"
-  ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON";
+  ++ lib.optional withExternalPoll "-DLWS_WITH_EXTERNAL_POLL=ON"
+  ++ (
+    if stdenv.hostPlatform.isStatic then
+      [ "-DLWS_WITH_SHARED=OFF" ]
+    else
+      [ "-DLWS_WITH_STATIC=OFF" "-DLWS_LINK_TESTAPPS_DYNAMIC=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