Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass --no-sanitize-env to cargo-lipo #2143

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DcCore/DcCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
33 changes: 33 additions & 0 deletions scripts/build-core.sh
Original file line number Diff line number Diff line change
@@ -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