diff --git a/DcCore/DcCore.xcodeproj/project.pbxproj b/DcCore/DcCore.xcodeproj/project.pbxproj index ddd3fa174..58a39061f 100644 --- a/DcCore/DcCore.xcodeproj/project.pbxproj +++ b/DcCore/DcCore.xcodeproj/project.pbxproj @@ -284,7 +284,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export PATH=\"/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\"\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nFILENAME=\"libdeltachat.a\"\nDIR=\"../deltachat-ios/libraries\"\n\n# Delete old build, if any.\nrm -f \"${DIR}/${FILENAME}\"\n\nrustc `cat ../rust-toolchain` --version\n\n# ensure all targets are installed\nrustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../rust-toolchain`\n\n# --xcode-integ determines --release and --targets from Xcode's env vars.\n# Depending your setup, specify the rustup toolchain explicitly.\nRUSTFLAGS=\"-C lto=on -C embed-bitcode=yes\" \\\n cargo +`cat ../rust-toolchain` lipo --xcode-integ --manifest-path \"$DIR/deltachat-core-rust/deltachat-ffi/Cargo.toml\" --features jsonrpc\n\n# cargo-lipo drops result in different folder, depending on the config.\nif [[ $CONFIGURATION = \"Debug\" ]]; then\n SOURCE=\"$DIR/deltachat-core-rust/target/universal/debug/${FILENAME}\"\nelse\n SOURCE=\"$DIR/deltachat-core-rust/target/universal/release/${FILENAME}\"\nfi\n\n# Copy compiled library to DIR.\nif [ -e \"${SOURCE}\" ]; then\n cp -a \"${SOURCE}\" $DIR\nfi\n"; + shellScript = "../scripts/build-core.sh\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/scripts/build-core.sh b/scripts/build-core.sh new file mode 100755 index 000000000..68c2f7d26 --- /dev/null +++ b/scripts/build-core.sh @@ -0,0 +1,33 @@ +#!/bin/sh +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" +export PATH="$HOME/.cargo/bin:$PATH" + +FILENAME="libdeltachat.a" +DIR="../deltachat-ios/libraries" + +# Delete old build, if any. +rm -f "${DIR}/${FILENAME}" + +rustc `cat ../rust-toolchain` --version + +# ensure all targets are installed +rustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../rust-toolchain` + +# --xcode-integ determines --release and --targets from Xcode's env vars. +# Depending your setup, specify the rustup toolchain explicitly. +# +# --no-sanitize-env prevents removal of IPHONEOS_DEPLOYMENT_TARGET variable. +RUSTFLAGS="-C lto=on -C embed-bitcode=yes" \ + cargo +`cat ../rust-toolchain` lipo --xcode-integ --no-sanitize-env --manifest-path "$DIR/deltachat-core-rust/deltachat-ffi/Cargo.toml" --features jsonrpc + +# cargo-lipo drops result in different folder, depending on the config. +if [[ $CONFIGURATION = "Debug" ]]; then + SOURCE="$DIR/deltachat-core-rust/target/universal/debug/${FILENAME}" +else + SOURCE="$DIR/deltachat-core-rust/target/universal/release/${FILENAME}" +fi + +# Copy compiled library to DIR. +if [ -e "${SOURCE}" ]; then + cp -a "${SOURCE}" $DIR +fi