forked from Nexus/nexus
Compare commits
4 changed files with 17 additions and 34 deletions
|
|
@ -28,7 +28,11 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
final iosConfig = codeConfig.iOS;
|
final iosConfig = codeConfig.iOS;
|
||||||
iosSdk = iosConfig.targetSdk;
|
iosSdk = iosConfig.targetSdk;
|
||||||
final minVersion = iosConfig.targetVersion;
|
final minVersion = iosConfig.targetVersion;
|
||||||
iosSdkPath = await getXCodeSDK(sdkType: iosSdk.type);
|
iosSdkPath = (await Process.run("xcrun", [
|
||||||
|
"--sdk",
|
||||||
|
iosSdk.type,
|
||||||
|
"--show-sdk-path",
|
||||||
|
])).stdout.toString().trim();
|
||||||
final archTriple = switch (targetArch) {
|
final archTriple = switch (targetArch) {
|
||||||
Architecture.arm64 => "arm64",
|
Architecture.arm64 => "arm64",
|
||||||
Architecture.x64 => "x86_64",
|
Architecture.x64 => "x86_64",
|
||||||
|
|
@ -41,7 +45,12 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
: "$archTriple-apple-ios$minVersion.0";
|
: "$archTriple-apple-ios$minVersion.0";
|
||||||
extraEnv = {
|
extraEnv = {
|
||||||
"GOOS": "ios",
|
"GOOS": "ios",
|
||||||
"CC": await getXCodeClang(sdkType: iosSdk.type),
|
"CC": (await Process.run("xcrun", [
|
||||||
|
"--sdk",
|
||||||
|
iosSdk.type,
|
||||||
|
"-f",
|
||||||
|
"clang",
|
||||||
|
])).stdout.toString().trim(),
|
||||||
"CGO_CFLAGS": "-isysroot $iosSdkPath -target $iosTargetTriple",
|
"CGO_CFLAGS": "-isysroot $iosSdkPath -target $iosTargetTriple",
|
||||||
"CGO_LDFLAGS": "-isysroot $iosSdkPath -target $iosTargetTriple",
|
"CGO_LDFLAGS": "-isysroot $iosSdkPath -target $iosTargetTriple",
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "export PATH=\"$PROJECT_DIR/scripts:$PATH\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||||
};
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
|
@ -351,7 +351,7 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "export PATH=\"$PROJECT_DIR/scripts:$PATH\"\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
};
|
};
|
||||||
EE82EC529EB6C0F1FA480659 /* [CP] Check Pods Manifest.lock */ = {
|
EE82EC529EB6C0F1FA480659 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Workaround for NixOS/nixpkgs#405066: frameworks copied from the Nix store
|
|
||||||
# stay read-only, so lipo can't write its temporary output file when Flutter
|
|
||||||
# thins them during the build. Make the framework writable before delegating
|
|
||||||
# to the real lipo.
|
|
||||||
for arg in "$@"; do
|
|
||||||
case "$arg" in
|
|
||||||
*/*.framework/*)
|
|
||||||
fw_dir="${arg%.framework/*}.framework"
|
|
||||||
chmod -R +w "$fw_dir" 2>/dev/null
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
exec /usr/bin/lipo "$@"
|
|
||||||
|
|
@ -1,22 +1,11 @@
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
|
|
||||||
Future<String> _runXcrun(List<String> args, String errorContext) async {
|
Future<String> getXCodeSDK() async {
|
||||||
final result = await Process.run("xcrun", args);
|
final result = await Process.run("xcrun", ["--show-sdk-path"]);
|
||||||
|
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
throw Exception("Failed to $errorContext\n${result.stderr}");
|
throw Exception("Failed to get XCode SDK\n${result.stderr}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.stdout.toString().trim();
|
return result.stdout.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getXCodeSDK({String? sdkType}) => _runXcrun([
|
|
||||||
if (sdkType != null) ...["--sdk", sdkType],
|
|
||||||
"--show-sdk-path",
|
|
||||||
], "get XCode SDK");
|
|
||||||
|
|
||||||
Future<String> getXCodeClang({String? sdkType}) => _runXcrun([
|
|
||||||
if (sdkType != null) ...["--sdk", sdkType],
|
|
||||||
"-f",
|
|
||||||
"clang",
|
|
||||||
], "get XCode clang");
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue