Merge pull request #114817 from thefloweringash/darwin-arch
darwin: introduce darwinArch, apply in {cc,bintools}-wrappers
This commit is contained in:
commit
09d0e10e95
@ -107,6 +107,11 @@ rec {
|
|||||||
powerpc64le = "ppc64le";
|
powerpc64le = "ppc64le";
|
||||||
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
||||||
|
|
||||||
|
darwinArch = {
|
||||||
|
armv7a = "armv7";
|
||||||
|
aarch64 = "arm64";
|
||||||
|
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
|
||||||
|
|
||||||
emulator = pkgs: let
|
emulator = pkgs: let
|
||||||
qemu-user = pkgs.qemu.override {
|
qemu-user = pkgs.qemu.override {
|
||||||
smartcardSupport = false;
|
smartcardSupport = false;
|
||||||
|
@ -305,6 +305,10 @@ stdenv.mkDerivation {
|
|||||||
done
|
done
|
||||||
''
|
''
|
||||||
|
|
||||||
|
+ optionalString stdenv.targetPlatform.isDarwin ''
|
||||||
|
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
|
||||||
|
''
|
||||||
|
|
||||||
+ ''
|
+ ''
|
||||||
for flags in "$out/nix-support"/*flags*; do
|
for flags in "$out/nix-support"/*flags*; do
|
||||||
substituteInPlace "$flags" --replace $'\n' ' '
|
substituteInPlace "$flags" --replace $'\n' ' '
|
||||||
|
@ -481,6 +481,10 @@ stdenv.mkDerivation {
|
|||||||
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
||||||
''
|
''
|
||||||
|
|
||||||
|
+ optionalString stdenv.targetPlatform.isDarwin ''
|
||||||
|
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags
|
||||||
|
''
|
||||||
|
|
||||||
##
|
##
|
||||||
## Extra custom steps
|
## Extra custom steps
|
||||||
##
|
##
|
||||||
|
@ -50,9 +50,6 @@ cmakeConfigurePhase() {
|
|||||||
# because we usually do not package the framework
|
# because we usually do not package the framework
|
||||||
cmakeFlags="-DCMAKE_FIND_FRAMEWORK=LAST $cmakeFlags"
|
cmakeFlags="-DCMAKE_FIND_FRAMEWORK=LAST $cmakeFlags"
|
||||||
|
|
||||||
# on macOS i686 was only relevant for 10.5 or earlier.
|
|
||||||
cmakeFlags="-DCMAKE_OSX_ARCHITECTURES=x86_64 $cmakeFlags"
|
|
||||||
|
|
||||||
# we never want to use the global macOS SDK
|
# we never want to use the global macOS SDK
|
||||||
cmakeFlags="-DCMAKE_OSX_SYSROOT= $cmakeFlags"
|
cmakeFlags="-DCMAKE_OSX_SYSROOT= $cmakeFlags"
|
||||||
|
|
||||||
|
@ -14,12 +14,6 @@ let
|
|||||||
|
|
||||||
minSdkVersion = targetPlatform.minSdkVersion or "9.0";
|
minSdkVersion = targetPlatform.minSdkVersion or "9.0";
|
||||||
|
|
||||||
iosPlatformArch = { parsed, ... }: {
|
|
||||||
armv7a = "armv7";
|
|
||||||
aarch64 = "arm64";
|
|
||||||
x86_64 = "x86_64";
|
|
||||||
}.${parsed.cpu.name};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
@ -35,9 +29,7 @@ rec {
|
|||||||
binutils = wrapBintoolsWith {
|
binutils = wrapBintoolsWith {
|
||||||
libc = targetIosSdkPkgs.libraries;
|
libc = targetIosSdkPkgs.libraries;
|
||||||
bintools = binutils-unwrapped;
|
bintools = binutils-unwrapped;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = lib.optionalString (sdk.platform == "iPhoneSimulator") ''
|
||||||
echo "-arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/libc-ldflags
|
|
||||||
'' + lib.optionalString (sdk.platform == "iPhoneSimulator") ''
|
|
||||||
echo "-platform_version ios-sim ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
|
echo "-platform_version ios-sim ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
|
||||||
'' + lib.optionalString (sdk.platform == "iPhoneOS") ''
|
'' + lib.optionalString (sdk.platform == "iPhoneOS") ''
|
||||||
echo "-platform_version ios ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
|
echo "-platform_version ios ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
|
||||||
@ -52,7 +44,7 @@ rec {
|
|||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp
|
tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp
|
||||||
mv cc-cflags.tmp $out/nix-support/cc-cflags
|
mv cc-cflags.tmp $out/nix-support/cc-cflags
|
||||||
echo "-target ${targetPlatform.config} -arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/cc-cflags
|
echo "-target ${targetPlatform.config}" >> $out/nix-support/cc-cflags
|
||||||
echo "-isystem ${sdk}/usr/include${lib.optionalString (lib.versionAtLeast "10" sdk.version) " -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++"}" >> $out/nix-support/cc-cflags
|
echo "-isystem ${sdk}/usr/include${lib.optionalString (lib.versionAtLeast "10" sdk.version) " -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++"}" >> $out/nix-support/cc-cflags
|
||||||
'' + lib.optionalString (sdk.platform == "iPhoneSimulator") ''
|
'' + lib.optionalString (sdk.platform == "iPhoneSimulator") ''
|
||||||
echo "-mios-simulator-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags
|
echo "-mios-simulator-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags
|
||||||
|
@ -251,6 +251,7 @@ in rec {
|
|||||||
lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}"]
|
lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}"]
|
||||||
++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}"
|
++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}"
|
||||||
++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}"
|
++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}"
|
||||||
|
++ lib.optional (stdenv.hostPlatform.isDarwin) "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
|
||||||
++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}"
|
++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}"
|
||||||
++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}"
|
++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}"
|
||||||
++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}";
|
++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user