From cb3f54502f9c88d5ec0f6c5d31018ba929a1699d Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 3 Jan 2023 00:29:48 +0000 Subject: [PATCH 1/2] Move rust-toolchain file from the core repository This way updating the core does not automatically update toolchain version and any toolchain can be used as long as it can build the core. --- DcCore/DcCore.xcodeproj/project.pbxproj | 2 +- README.md | 2 +- rust-toolchain | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 rust-toolchain diff --git a/DcCore/DcCore.xcodeproj/project.pbxproj b/DcCore/DcCore.xcodeproj/project.pbxproj index 1a8b776c4..f73758133 100644 --- a/DcCore/DcCore.xcodeproj/project.pbxproj +++ b/DcCore/DcCore.xcodeproj/project.pbxproj @@ -300,7 +300,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# The $PATH used by XCode likely won't contain Cargo, fix that.\n# This assumes a default `rustup` setup.\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nexport CFLAGS_x86_64_apple_darwin=\"-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\"\n\n# new location for system libraries on macOS 11\nos_ver=$(sw_vers -productVersion)\n \nif [[ \"$os_ver\" == 11.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# the same on macOS 12, TODO: is there a less duplicate way to do this check?\nif [[ \"$os_ver\" == 12.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# ensure all targets are installed\nrustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../deltachat-ios/libraries/deltachat-core-rust/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\" \\\ncargo +`cat ../deltachat-ios/libraries/deltachat-core-rust/rust-toolchain` lipo --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml\n"; + shellScript = "# The $PATH used by XCode likely won't contain Cargo, fix that.\n# This assumes a default `rustup` setup.\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nexport CFLAGS_x86_64_apple_darwin=\"-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\"\n\n# new location for system libraries on macOS 11\nos_ver=$(sw_vers -productVersion)\n \nif [[ \"$os_ver\" == 11.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# the same on macOS 12, TODO: is there a less duplicate way to do this check?\nif [[ \"$os_ver\" == 12.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# ensure all targets are installed\nrustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../deltachat-ios/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\" \\\ncargo +`cat ../deltachat-ios/rust-toolchain` lipo --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/README.md b/README.md index 8e5bd5182..55cc9e0e3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ git clone git@github.com:deltachat/deltachat-ios.git cd deltachat-ios git submodule update --init --recursive # Make sure the correct rust version is installed -rustup toolchain install `cat deltachat-ios/libraries/deltachat-core-rust/rust-toolchain` +rustup toolchain install `cat deltachat-ios/rust-toolchain` ``` To run the project, open `deltachat-ios.xcworkspace` (**not** the 'xcodeproj' file). diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 000000000..940573042 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.64.0 From fd51090a32c0defa10f1ced9af35a288c4acd944 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 3 Jan 2023 13:35:36 +0100 Subject: [PATCH 2/2] adapt path to `rust-toolchain` `rust-toolchain` is accessed from `DcCore` subdirectory, therefore, just `../rust-toolchain` does the job. --- DcCore/DcCore.xcodeproj/project.pbxproj | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DcCore/DcCore.xcodeproj/project.pbxproj b/DcCore/DcCore.xcodeproj/project.pbxproj index f73758133..94e080b5d 100644 --- a/DcCore/DcCore.xcodeproj/project.pbxproj +++ b/DcCore/DcCore.xcodeproj/project.pbxproj @@ -300,7 +300,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# The $PATH used by XCode likely won't contain Cargo, fix that.\n# This assumes a default `rustup` setup.\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nexport CFLAGS_x86_64_apple_darwin=\"-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\"\n\n# new location for system libraries on macOS 11\nos_ver=$(sw_vers -productVersion)\n \nif [[ \"$os_ver\" == 11.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# the same on macOS 12, TODO: is there a less duplicate way to do this check?\nif [[ \"$os_ver\" == 12.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# ensure all targets are installed\nrustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../deltachat-ios/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\" \\\ncargo +`cat ../deltachat-ios/rust-toolchain` lipo --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml\n"; + shellScript = "# The $PATH used by XCode likely won't contain Cargo, fix that.\n# This assumes a default `rustup` setup.\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\nexport CFLAGS_x86_64_apple_darwin=\"-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\"\n\n# new location for system libraries on macOS 11\nos_ver=$(sw_vers -productVersion)\n \nif [[ \"$os_ver\" == 11.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\n\n# the same on macOS 12, TODO: is there a less duplicate way to do this check?\nif [[ \"$os_ver\" == 12.* ]]; then\n export LIBRARY_PATH=\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib\"\nfi\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\" \\\ncargo +`cat ../deltachat-ios/rust-toolchain` lipo --release --manifest-path ../deltachat-ios/libraries/deltachat-core-rust/deltachat-ffi/Cargo.toml\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/README.md b/README.md index 55cc9e0e3..c5cd1702f 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ git clone git@github.com:deltachat/deltachat-ios.git cd deltachat-ios git submodule update --init --recursive # Make sure the correct rust version is installed -rustup toolchain install `cat deltachat-ios/rust-toolchain` +rustup toolchain install `cat rust-toolchain` ``` To run the project, open `deltachat-ios.xcworkspace` (**not** the 'xcodeproj' file).