nix: enforce xcode only for status-go for ios

According to gomobile docs Xcode is only necessary for iOS:

>For -target ios, gomobile must be run on an OS X machine with Xcode installed.

https://godoc.org/golang.org/x/mobile/cmd/gomobile

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-05-19 15:35:56 +02:00
parent 7731839693
commit d494f3b267
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@
, outputFileName ? "status-go-${source.shortRev}-${platform}.aar" }: , outputFileName ? "status-go-${source.shortRev}-${platform}.aar" }:
let let
inherit (stdenv) isDarwin;
inherit (lib) inherit (lib)
concatStrings concatStringsSep concatMapStrings optionalString concatStrings concatStringsSep concatMapStrings optionalString
getAttr attrValues makeBinPath optional; getAttr attrValues makeBinPath optional;
@ -28,13 +29,13 @@ in buildGoPackage {
nativeBuildInputs = [ gomobile ] nativeBuildInputs = [ gomobile ]
++ optional (platform == "android") openjdk ++ optional (platform == "android") openjdk
++ optional stdenv.isDarwin xcodeWrapper; ++ optional isDarwin xcodeWrapper;
# Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 ) # Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 )
hardeningDisable = [ "fortify" ]; hardeningDisable = [ "fortify" ];
# Ensure XCode is present, instead of failing at the end of the build # Ensure XCode is present for iOS build, instead of failing at the end of the build
preConfigure = optionalString stdenv.isDarwin utils.enforceXCodeAvailable; preConfigure = optionalString (isDarwin && platform == "ios") utils.enforceXCodeAvailable;
# Build mobile libraries # Build mobile libraries
preBuild = let preBuild = let