sentry-cli: fix build on Darwin (#452812)
This commit is contained in:
40
pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch
Normal file
40
pkgs/by-name/se/sentry-cli/fix-swift-lib-path.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
diff --git a/apple-catalog-parsing/build.rs b/apple-catalog-parsing/build.rs
|
||||
index 2ab4c71b59..6bcf003c0a 100644
|
||||
--- a/apple-catalog-parsing/build.rs
|
||||
+++ b/apple-catalog-parsing/build.rs
|
||||
@@ -30,7 +30,7 @@
|
||||
// Add necessary libraries to the linker search path. Without this line, compiling fails
|
||||
// on systems without Xcode installed (xcode-select is still required).
|
||||
println!(
|
||||
- "cargo:rustc-link-search=native=/Library/Developer/CommandLineTools/usr/lib/swift/macosx"
|
||||
+ "cargo:rustc-link-search=native=/usr/lib/swift/macosx"
|
||||
);
|
||||
|
||||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR is set for build scripts");
|
||||
@@ -87,17 +87,14 @@
|
||||
println!("cargo:rustc-link-search=framework=/System/Library/PrivateFrameworks");
|
||||
println!("cargo:rustc-link-lib=framework=CoreUI");
|
||||
|
||||
- // Link to swift macOS support libraries for Swift runtime support on older macOS versions
|
||||
- let developer_dir = Command::new("xcode-select")
|
||||
- .args(["-p"])
|
||||
- .output()
|
||||
- .expect("Failed to get developer directory, please ensure Xcode is installed.");
|
||||
- let developer_dir_path = String::from_utf8(developer_dir.stdout)
|
||||
- .expect("Failed to convert developer directory to UTF-8")
|
||||
- .trim()
|
||||
- .to_owned();
|
||||
-
|
||||
- println!(
|
||||
- "cargo:rustc-link-search={developer_dir_path}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx"
|
||||
+ // Link libobjc to avoid the following error: ld: can't find ordinal for imported symbol '___objc_personality_v0'
|
||||
+ println!("cargo:rustc-link-lib=objc");
|
||||
+
|
||||
+ println!(
|
||||
+ "cargo:rustc-link-search=/usr/lib/swift"
|
||||
+ );
|
||||
+
|
||||
+ println!(
|
||||
+ "cargo:rustc-link-search=@swiftLib@/lib/swift/macosx"
|
||||
);
|
||||
}
|
||||
@@ -6,6 +6,9 @@
|
||||
openssl,
|
||||
pkg-config,
|
||||
stdenv,
|
||||
swift,
|
||||
swiftpm,
|
||||
replaceVars,
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "sentry-cli";
|
||||
@@ -22,11 +25,24 @@ rustPlatform.buildRustPackage rec {
|
||||
# Needed to get openssl-sys to use pkgconfig.
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
|
||||
patches = [
|
||||
(replaceVars ./fix-swift-lib-path.patch {
|
||||
swiftLib = lib.getLib swift;
|
||||
})
|
||||
];
|
||||
|
||||
buildInputs = [ openssl ];
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
pkg-config
|
||||
];
|
||||
]
|
||||
++ (lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
swift
|
||||
swiftpm
|
||||
]);
|
||||
|
||||
# By default including `swiftpm` in `nativeBuildInputs` will take over `buildPhase`
|
||||
dontUseSwiftpmBuild = true;
|
||||
|
||||
cargoHash = "sha256-S+A6v4rva8c7QuWP/5dRzUtJDdWryb8Jmu2J4JurNMM=";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user