summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-07-22 10:54:11 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-07-23 10:44:51 -0500
commit95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd (patch)
tree40a21df41d94bd3bf8eca5e6069f6a309d50cac0 /pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
parent753e80125fd071f6d4cd3ea9988c3c4da86f6cba (diff)
downloadnixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar.gz
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar.bz2
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar.lz
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar.xz
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.tar.zst
nixpkgs-95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd.zip
xcode/sdk-pkgs.nix: set -platform_version in addition to -miphoneos-version-min
The App Store looks at LC_VERSION_MIN_IPHONEOS to verify you have a
new enough SDK version. This is not just the minimum version, but also
the sdk version used. When the linker can’t figure it out, it tries to
infer it from the sdk path[1]. When no sdk version is found, it
defaults to just using the -miphoneos-version-min value[2]. So, to make
sure we don’t rely on inference (which doesn’t work in the current
directory structure), we have to specify -platform_version.

[1]:
https://github.com/tpoechtrager/cctools-port/blob/43f32a4c61b5ba7fde011e816136c550b1b3146f/cctools/ld64/src/ld/Options.cpp#L5355-L5376
[2]: https://github.com/tpoechtrager/cctools-port/blob/43f32a4c61b5ba7fde011e816136c550b1b3146f/cctools/ld64/src/ld/ld.hpp#L58
Diffstat (limited to 'pkgs/os-specific/darwin/xcode/sdk-pkgs.nix')
-rw-r--r--pkgs/os-specific/darwin/xcode/sdk-pkgs.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
index e8302a82555..45e1f1eab4f 100644
--- a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
+++ b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
@@ -12,7 +12,7 @@
 
 let
 
-minSdkVersion = "9.0";
+minSdkVersion = targetPlatform.minSdkVersion or "9.0";
 
 iosPlatformArch = { parsed, ... }: {
   armv7a  = "armv7";
@@ -37,6 +37,10 @@ rec {
     bintools = binutils-unwrapped;
     extraBuildCommands = ''
       echo "-arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/libc-ldflags
+    '' + stdenv.lib.optionalString (sdk.platform == "iPhoneSimulator") ''
+      echo "-platform_version ios-sim ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
+    '' + stdenv.lib.optionalString (sdk.platform == "iPhoneOS") ''
+      echo "-platform_version ios ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
     '';
   };