-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15fe377
commit 93e60ad
Showing
8 changed files
with
46 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/output | ||
/OuisyncLibFFI.xcframework | ||
/config.sh | ||
.DS_Store | ||
/.build | ||
/Packages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,28 @@ | ||
#!/usr/bin/env zsh | ||
# Command line tool which pulls all dependencies needed to build the rust core library. | ||
# | ||
# Assumes that `cargo` and `rustup` are installed and available in REAL_PATH and it is run with the | ||
# two plugin output paths (update and build) | ||
fatal() { echo "Error $@" >&2 && exit $1 } | ||
PROJECT_HOME=$(realpath "$(dirname "$0")/../../../../") | ||
PACKAGE_HOME=$(realpath "$PROJECT_HOME/bindings/swift/OuisyncLib") | ||
export CARGO_HOME="$1" | ||
export CARGO_HTTP_CHECK_REVOKE="false" # unclear why this fails, but it does | ||
export RUSTUP_USE_CURL=1 # https://github.com/rust-lang/rustup/issues/1856 | ||
|
||
# download all possible toolchains: they only take up about 100MiB in total | ||
mkdir -p .rustup | ||
export CARGO_HOME=$(realpath "$1") | ||
export PATH="$CARGO_HOME/bin:$PATH" | ||
export RUSTUP_HOME="$CARGO_HOME/.rustup" | ||
rustup default stable | ||
rustup target install aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim \ | ||
x86_64-apple-darwin x86_64-apple-ios | ||
|
||
cd "$PROJECT_HOME" | ||
cargo fetch --locked || exit 1 # this is currently only fixable by moving the plugin location | ||
cargo install cbindgen cross || exit 2 # build.sh also needs `cbindgen` and `cross` | ||
|
||
# as part of the updater, we also perform the xcode symlink hack: we replace the existing | ||
# $PACKAGE_HOME/output folder (either stub checked out by git or symlink to a previous build) with | ||
# a link to the $BUILD_OUTPUT/output folder which will eventually contain an actual framework | ||
BUILD_OUTPUT="$2" | ||
mkdir -p "$BUILD_OUTPUT" | ||
cd "$BUILD_OUTPUT" > /dev/null | ||
# if this is the first time we build at this location, generate a new stub library to keep xcode | ||
# happy in case the build process fails later down the line | ||
if ! [ -d "output/OuisyncLibFFI.xcframework" ]; then | ||
"$PACKAGE_HOME/reset-output.sh" | ||
# install rust or update to latest version | ||
export RUSTUP_USE_CURL=1 # https://github.com/rust-lang/rustup/issues/1856 | ||
if [ -f "$CARGO_HOME/bin/rustup" ]; then | ||
rustup update || fatal 1 "Unable to update rust" | ||
else | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path \ | ||
|| fatal 1 "Unable to install rust" | ||
fi | ||
|
||
# we can now replace the local stub (or prior link) with a link to the most recent build location | ||
rm -rf "$PACKAGE_HOME/output" | ||
ln -s "$BUILD_OUTPUT/output" "$PACKAGE_HOME/output" | ||
# also install all possible toolchains since they only take up about 100MiB in total | ||
export CARGO_HTTP_CHECK_REVOKE="false" # unclear it fails without this, but it does | ||
rustup target install aarch64-apple-darwin aarch64-apple-ios \ | ||
aarch64-apple-ios-sim x86_64-apple-darwin x86_64-apple-ios || fatal 2 "Unable to install rust via rustup" | ||
|
||
# build.sh needs `cbindgen` and `cross` to build as a multiplatform framework | ||
cargo install cbindgen cross || fatal 3 "Unable to install header generator or cross compiler" | ||
|
||
# unfortunately, we can't trigger a build from here because `build.sh` runs in a different sandbox | ||
# fetch all up to date package dependencies for the next build (which must run offline) | ||
cd "$PROJECT_HOME" | ||
cargo fetch --locked || fatal 4 "Unable to fetch library dependencies" |
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
bindings/swift/OuisyncLib/output/OuisyncLibFFI.xcframework/Info.plist.sample
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.