zed-editor: shrink darwin closure (#369399)

authored by Gaétan Lepage and committed by GitHub 8da05cf3 6b0d9cd7

+32 -29
+17 -15
pkgs/by-name/li/livekit-libwebrtc/package.nix
··· 147 147 substituteInPlace build/toolchain/apple/toolchain.gni --replace-fail "/bin/cp -Rc" "cp -a" 148 148 ''; 149 149 150 + outputs = [ 151 + "dev" 152 + "out" 153 + ]; 154 + 150 155 nativeBuildInputs = 151 156 (builtins.concatLists ( 152 157 lib.mapAttrsToList ( ··· 249 254 '' 250 255 runHook preInstall 251 256 252 - mkdir -p $out/{lib,include} 253 - cp obj/webrtc.ninja $out/ 254 - cp args.gn $out/ 255 - cp LICENSE.md $out/ 257 + mkdir -p $out/lib 258 + mkdir -p $dev/include 259 + 260 + install -m0644 obj/webrtc.ninja args.gn LICENSE.md $dev 261 + 262 + pushd ../.. 263 + find . -name "*.h" -print | cpio -pd $dev/include 264 + popd 256 265 '' 257 266 + lib.optionalString stdenv.hostPlatform.isLinux '' 258 - cp libwebrtc.so $out/lib/ 259 - cp libthird_party_boringssl.so $out/lib/ 267 + install -m0644 libwebrtc.so libthird_party_boringssl.so $out/lib 260 268 '' 261 269 + lib.optionalString stdenv.hostPlatform.isDarwin '' 262 - mkdir -p $out/Library/Frameworks 263 - cp -r WebRTC.framework $out/Library/Frameworks 264 - cp libwebrtc.dylib $out/lib 265 - cp libthird_party_boringssl.dylib $out/lib/ 270 + install -m0644 WebRTC.framework/Versions/A/WebRTC $out/lib/libwebrtc.dylib 271 + install -m0644 libthird_party_boringssl.dylib $out/lib 266 272 '' 267 273 + '' 268 - cd ../.. 269 - find . -name "*.h" -print | cpio -pd $out/include 274 + ln -s $out/lib $dev/lib 270 275 271 276 runHook postInstall 272 277 ''; ··· 274 279 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' 275 280 boringssl="$out/lib/libthird_party_boringssl.dylib" 276 281 webrtc="$out/lib/libwebrtc.dylib" 277 - framework="$out/Library/Frameworks/WebRTC.framework/Versions/A/WebRTC" 278 282 279 283 install_name_tool -id "$boringssl" "$boringssl" 280 284 install_name_tool -id "$webrtc" "$webrtc" 281 285 install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$webrtc" 282 - install_name_tool -id "$framework" "$framework" 283 - install_name_tool -change @rpath/libthird_party_boringssl.dylib "$boringssl" "$framework" 284 286 ''; 285 287 286 288 passthru.updateScript = writeShellScript "update-livekit-libwebrtc" ''
+15 -14
pkgs/by-name/ze/zed-editor/package.nix
··· 112 112 "script/patches/use-cross-platform-livekit.patch" 113 113 ]; 114 114 115 - postPatch = 116 - lib.optionalString stdenv.hostPlatform.isLinux '' 117 - # Dynamically link WebRTC instead of static 118 - substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ 119 - --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc" 120 - '' 121 - + lib.optionalString stdenv.hostPlatform.isDarwin '' 122 - # On Darwin, linking against the dylib results in Rust linker errors, while 123 - # linking against the framework works fine. 124 - substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ 125 - --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=framework=webrtc" \ 126 - --replace-fail 'println!("cargo:rustc-link-search=native={}", webrtc_lib.to_str().unwrap());' \ 127 - 'println!("cargo:rustc-link-search=framework={}/Library/Frameworks", webrtc_dir.to_str().unwrap());' 128 - ''; 115 + # Dynamically link WebRTC instead of static 116 + postPatch = '' 117 + substituteInPlace ../${pname}-${version}-vendor/webrtc-sys-*/build.rs \ 118 + --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc" 119 + ''; 129 120 130 121 useFetchCargoVendor = true; 131 122 cargoHash = "sha256-J5vJ/KV94a+9AqGbNZx6sCzWflOZsyUj3NcqnfaexGE="; ··· 296 287 versionCheckProgram = "${placeholder "out"}/bin/zeditor"; 297 288 versionCheckProgramArg = [ "--version" ]; 298 289 doInstallCheck = true; 290 + 291 + # The darwin Applications directory is not stripped by default, see 292 + # https://github.com/NixOS/nixpkgs/issues/367169 293 + # This setting is not platform-guarded as it doesn't do any harm on Linux, 294 + # where this directory simply does not exist. 295 + stripDebugList = [ 296 + "bin" 297 + "libexec" 298 + "Applications" 299 + ]; 299 300 300 301 passthru = { 301 302 updateScript = gitUpdater {