Build secure Rust watchOS TOTP core (#56)
This commit is contained in:
@@ -11,28 +11,42 @@ else
|
||||
profile=release
|
||||
fi
|
||||
|
||||
if [[ "${PLATFORM_NAME:-}" == watch* ]]; then
|
||||
package=ironstorage-watch-apple
|
||||
library=ironstorage_watch
|
||||
else
|
||||
package=ironstorage-apple
|
||||
library=ironstorage_apple
|
||||
fi
|
||||
|
||||
libraries=()
|
||||
for arch in $ARCHS; do
|
||||
if [[ "$arch" == "arm64" && "${LLVM_TARGET_TRIPLE_SUFFIX:-}" == "-simulator" ]]; then
|
||||
if [[ "$package" == "ironstorage-watch-apple" && "$arch" == "arm64" && "${LLVM_TARGET_TRIPLE_SUFFIX:-}" == "-simulator" ]]; then
|
||||
target=aarch64-apple-watchos-sim
|
||||
elif [[ "$package" == "ironstorage-watch-apple" && "$arch" == "arm64" ]]; then
|
||||
target=aarch64-apple-watchos
|
||||
elif [[ "$package" == "ironstorage-watch-apple" && "$arch" == "x86_64" ]]; then
|
||||
target=x86_64-apple-watchos-sim
|
||||
elif [[ "$arch" == "arm64" && "${LLVM_TARGET_TRIPLE_SUFFIX:-}" == "-simulator" ]]; then
|
||||
target=aarch64-apple-ios-sim
|
||||
elif [[ "$arch" == "arm64" ]]; then
|
||||
target=aarch64-apple-ios
|
||||
elif [[ "$arch" == "x86_64" ]]; then
|
||||
target=x86_64-apple-ios
|
||||
else
|
||||
echo "Unsupported iOS architecture: $arch" >&2
|
||||
echo "Unsupported ${PLATFORM_NAME:-Apple} architecture: $arch" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$profile" == "debug" ]]; then
|
||||
rustup run stable cargo build --locked \
|
||||
--target "$target" --package ironstorage-apple --lib
|
||||
--target "$target" --package "$package" --lib
|
||||
else
|
||||
rustup run stable cargo build --locked --release \
|
||||
--target "$target" --package ironstorage-apple --lib
|
||||
--target "$target" --package "$package" --lib
|
||||
fi
|
||||
libraries+=("$CARGO_TARGET_DIR/$target/$profile/libironstorage_apple.a")
|
||||
libraries+=("$CARGO_TARGET_DIR/$target/$profile/lib$library.a")
|
||||
done
|
||||
|
||||
mkdir -p "$DERIVED_FILE_DIR/rust"
|
||||
lipo -create -output "$DERIVED_FILE_DIR/rust/libironstorage_apple.a" "${libraries[@]}"
|
||||
lipo -create -output "$DERIVED_FILE_DIR/rust/lib$library.a" "${libraries[@]}"
|
||||
|
||||
Reference in New Issue
Block a user