summary refs log tree commit diff
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-04-21 18:34:13 +0200
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-11-24 15:17:13 -0800
commit84454c32332e39bc84bab576e00c62ac88b3dbe3 (patch)
treeb1eead9f8f2d888a1830e06c1be6f7afb02a4c64
parente07eef85e85f359be86f9f1b3f09c642b641fdbb (diff)
downloadnixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar.gz
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar.bz2
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar.lz
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar.xz
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.tar.zst
nixpkgs-84454c32332e39bc84bab576e00c62ac88b3dbe3.zip
darwin.Libsystem: Patch TargetConditionals.h
`TargetConditionals.h` was missing several definitions, like
`TARGET_OS_TV` that are part of SDK 10.12 at least. And one that doesn't
seem to occur in any SDK afaict, `TARGET_OS_EMBEDDED_OTHER`.

I added the definitions from SDK 10.12 verbatim and defined
`TARGET_OS_EMBEDDED_OTHER` to be equal to `0`.

I think none of this works if `darwin.Libsystem` is used to build for
linux or iOS though so maybe this needs a more thorough fix?

This reverts 336d82617f1cdd2f5ae77e262afa3f88f5a5e578 because it's no
longer necessary.
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix30
-rw-r--r--pkgs/stdenv/darwin/make-bootstrap-tools.nix47
2 files changed, 19 insertions, 58 deletions
diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
index 66190b7b4e3..86c91e9b55c 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -63,20 +63,21 @@ appleDerivation' stdenv {
     cat <<EOF > $out/include/TargetConditionals.h
     #ifndef __TARGETCONDITIONALS__
     #define __TARGETCONDITIONALS__
-    #define TARGET_OS_MAC           1
-    #define TARGET_OS_OSX           1
-    #define TARGET_OS_WIN32         0
-    #define TARGET_OS_UNIX          0
-    #define TARGET_OS_EMBEDDED      0
-    #define TARGET_OS_IPHONE        0
-    #define TARGET_OS_IOS           0
-    #define TARGET_OS_WATCH         0
-    #define TARGET_OS_BRIDGE        0
-    #define TARGET_OS_TV            0
-    #define TARGET_OS_SIMULATOR     0
-    #define TARGET_IPHONE_SIMULATOR 0
-    #define TARGET_OS_NANO          0
-    #define TARGET_OS_LINUX         0
+    #define TARGET_OS_MAC               1
+    #define TARGET_OS_WIN32             0
+    #define TARGET_OS_UNIX              0
+    #define TARGET_OS_OSX               1
+    #define TARGET_OS_IPHONE            0
+    #define TARGET_OS_IOS               0
+    #define TARGET_OS_WATCH             0
+    #define TARGET_OS_BRIDGE            0
+    #define TARGET_OS_TV                0
+    #define TARGET_OS_SIMULATOR         0
+    #define TARGET_OS_EMBEDDED          0
+    #define TARGET_OS_EMBEDDED_OTHER    0 /* Used in configd */
+    #define TARGET_IPHONE_SIMULATOR     TARGET_OS_SIMULATOR /* deprecated */
+    #define TARGET_OS_NANO              TARGET_OS_WATCH /* deprecated */
+    #define TARGET_OS_LINUX             0
 
     #define TARGET_CPU_PPC          0
     #define TARGET_CPU_PPC64        0
@@ -84,6 +85,7 @@ appleDerivation' stdenv {
     #define TARGET_CPU_X86          0
     #define TARGET_CPU_X86_64       1
     #define TARGET_CPU_ARM          0
+    #define TARGET_CPU_ARM64        0
     #define TARGET_CPU_MIPS         0
     #define TARGET_CPU_SPARC        0
     #define TARGET_CPU_ALPHA        0
diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
index 536bf251a94..34578ecfba8 100644
--- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
@@ -32,47 +32,6 @@ in rec {
   # Avoid messing with libkrb5 and libnghttp2.
   curl_ = curlMinimal.override (args: { gssSupport = false; http2Support = false; });
 
-  # Avoid stdenv rebuild.
-  Libsystem_ = darwin.Libsystem.overrideAttrs (oldAttrs:
-    { installPhase = oldAttrs.installPhase + ''
-        cat <<EOF > $out/include/TargetConditionals.h
-        #ifndef __TARGETCONDITIONALS__
-        #define __TARGETCONDITIONALS__
-        #define TARGET_OS_MAC               1
-        #define TARGET_OS_WIN32             0
-        #define TARGET_OS_UNIX              0
-        #define TARGET_OS_OSX               1
-        #define TARGET_OS_IPHONE            0
-        #define TARGET_OS_IOS               0
-        #define TARGET_OS_WATCH             0
-        #define TARGET_OS_BRIDGE            0
-        #define TARGET_OS_TV                0
-        #define TARGET_OS_SIMULATOR         0
-        #define TARGET_OS_EMBEDDED          0
-        #define TARGET_OS_EMBEDDED_OTHER    0 /* Used in configd */
-        #define TARGET_IPHONE_SIMULATOR     TARGET_OS_SIMULATOR /* deprecated */
-        #define TARGET_OS_NANO              TARGET_OS_WATCH /* deprecated */
-
-        #define TARGET_CPU_PPC          0
-        #define TARGET_CPU_PPC64        0
-        #define TARGET_CPU_68K          0
-        #define TARGET_CPU_X86          0
-        #define TARGET_CPU_X86_64       1
-        #define TARGET_CPU_ARM          0
-        #define TARGET_CPU_ARM64        0
-        #define TARGET_CPU_MIPS         0
-        #define TARGET_CPU_SPARC        0
-        #define TARGET_CPU_ALPHA        0
-        #define TARGET_RT_MAC_CFM       0
-        #define TARGET_RT_MAC_MACHO     1
-        #define TARGET_RT_LITTLE_ENDIAN 1
-        #define TARGET_RT_BIG_ENDIAN    0
-        #define TARGET_RT_64_BIT        1
-        #endif  /* __TARGETCONDITIONALS__ */
-        EOF
-      '';
-    });
-
   build = stdenv.mkDerivation {
     name = "stdenv-bootstrap-tools";
 
@@ -84,12 +43,12 @@ in rec {
 
       ${lib.optionalString stdenv.targetPlatform.isx86_64 ''
         # Copy libSystem's .o files for various low-level boot stuff.
-        cp -d ${Libsystem_}/lib/*.o $out/lib
+        cp -d ${darwin.Libsystem}/lib/*.o $out/lib
 
         # Resolv is actually a link to another package, so let's copy it properly
-        cp -L ${Libsystem_}/lib/libresolv.9.dylib $out/lib
+        cp -L ${darwin.Libsystem}/lib/libresolv.9.dylib $out/lib
 
-        cp -rL ${Libsystem_}/include $out
+        cp -rL ${darwin.Libsystem}/include $out
         chmod -R u+w $out/include
         cp -rL ${darwin.ICU}/include*             $out/include
         cp -rL ${libiconv}/include/*       $out/include