1 Star 0 Fork 0

Hyperledger/aries-askar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-universal.sh 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
# NOTE:
# MacOS universal build currently requires MacOS 11 (Big Sur) for the appropriate SDK,
# and `sudo xcode-select --install` must be run to install the command line utilities.
# Rust's `beta` channel must be installed because aarch64 is still a tier-2 target:
# `rustup toolchain install beta`.
RUSTUP=${RUSTUP:-`command -v rustup`}
PROJECT=aries-askar
if [ ! -x "$RUSTUP" ]; then
echo "rustup command not found: it can be obtained from https://rustup.rs/"
exit 1
fi
TOOLCHAIN=`$RUSTUP default`
TARGET_DIR="${TARGET_DIR-./target/darwin-universal}"
if [ -z "$BUILD_TOOLCHAIN" ]; then
BUILD_TOOLCHAIN=${TOOLCHAIN%%-*}
if [ -z "$BUILD_TOOLCHAIN" ]; then
echo "Error: Could not determine default Rust toolchain"
exit 1
fi
fi
MACOS_UNIVERSAL_TARGETS="aarch64-apple-darwin x86_64-apple-darwin"
# Fail on any execution errors
set -e
INSTALLED_TARGETS=`$RUSTUP +$BUILD_TOOLCHAIN target list --installed`
# Install target(s) as needed
echo "Checking install targets for MacOS universal build .."
for target in $MACOS_UNIVERSAL_TARGETS; do
if ! `echo "$INSTALLED_TARGETS" | grep -q $target`; then
$RUSTUP +$BUILD_TOOLCHAIN target add $target
fi
done
MAJOR_VER=`sw_vers | grep ProductVersion | cut -f 2 | cut -f 1 -d .`
if [ "$MAJOR_VER" -lt 11 ]; then
echo "MacOS universal build requires OS 11 (Big Sur) or newer"
TARGET=
fi
# Build both targets and combine them into a universal library with `lipo`
TARGET_LIBS=
for target in $MACOS_UNIVERSAL_TARGETS; do
echo "Building $PROJECT for toolchain '$BUILD_TOOLCHAIN', target '$target'.."
$RUSTUP run $BUILD_TOOLCHAIN cargo build --lib --release --target $target
TARGET_LIBS="./target/$target/release/libaries_askar.dylib $TARGET_LIBS"
done
mkdir -p "${TARGET_DIR}/release" ./target/release
OUTPUT="${TARGET_DIR}/release/libaries_askar.dylib"
echo "Combining targets into universal library"
lipo -create -output $OUTPUT $TARGET_LIBS
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hyperledger/aries-askar.git
[email protected]:hyperledger/aries-askar.git
hyperledger
aries-askar
aries-askar
main

搜索帮助