odin: clean up apple_sdk stubs

Also, patched out all impure paths in the linker.cpp file for darwin.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-04-17 21:47:47 -04:00
parent cc1d31dab2
commit 84b5f48c2b
3 changed files with 26 additions and 20 deletions

View File

@ -0,0 +1,23 @@
diff --git a/src/linker.cpp b/src/linker.cpp
index ec165ef7d..91a28b8fc 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -769,18 +769,6 @@ try_cross_linking:;
gbString platform_lib_str = gb_string_make(heap_allocator(), "");
defer (gb_string_free(platform_lib_str));
if (build_context.metrics.os == TargetOs_darwin) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib ");
-
- // Homebrew's default library path, checking if it exists to avoid linking warnings.
- if (gb_file_exists("/opt/homebrew/lib")) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/homebrew/lib ");
- }
-
- // MacPort's default library path, checking if it exists to avoid linking warnings.
- if (gb_file_exists("/opt/local/lib")) {
- platform_lib_str = gb_string_appendc(platform_lib_str, "-L/opt/local/lib ");
- }
-
// Only specify this flag if the user has given a minimum version to target.
// This will cause warnings to show up for mismatched libraries.
if (build_context.minimum_os_version_string_given) {

View File

@ -1,12 +1,9 @@
{
fetchFromGitHub,
lib,
libiconv,
llvmPackages,
MacOSX-SDK,
makeBinaryWrapper,
nix-update-script,
Security,
which,
}:
@ -24,16 +21,9 @@ stdenv.mkDerivation {
hash = "sha256-GXea4+OIFyAhTqmDh2q+ewTUqI92ikOsa2s83UH2r58=";
};
postPatch =
lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/linker.cpp \
--replace-fail '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' ${MacOSX-SDK}
''
+ ''
substituteInPlace build_odin.sh \
--replace-fail '-framework System' '-lSystem'
patchShebangs build_odin.sh
'';
patches = [
./darwin-remove-impure-links.patch
];
LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";
@ -46,11 +36,6 @@ stdenv.mkDerivation {
which
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
Security
];
installPhase = ''
runHook preInstall

View File

@ -13109,8 +13109,6 @@ with pkgs;
};
odin = callPackage ../by-name/od/odin/package.nix {
inherit (pkgs.darwin.apple_sdk_11_0) MacOSX-SDK;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) Security;
llvmPackages = llvmPackages_18;
};