depot/third_party/nixpkgs/pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix

18 lines
660 B
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, sdkVersion }:
let
name = "MacOSX${lib.versions.majorMinor sdkVersion}.sdk";
in
self: super: {
# Rewrite the stubs to point to dylibs in the SDK instead of at system locations. This is needed for umbrella
# frameworks in older SDKs, which dont also embed their stubs.
buildPhase =
super.buildPhase or ""
+ ''
echo "Rewriting stubs to reference the SDK location in the store"
find . -name '*.tbd' -type f -exec sed -E \
-e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/usr/|\1$sdkpath/${name}/usr/|g" \
-e "/^install-name/n; s|( \\|'\\|\"\\|\\[)/System/|\1$sdkpath/${name}/System/|g" \
-i {} \;
'';
}