build(core): package deterministic arm64 framework
Verify Data Plane / gateway (push) Failing after 1m1s
Verify Data Plane / gateway (push) Failing after 1m1s
This commit is contained in:
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 --output ABSOLUTE_DIR --target-dir ABSOLUTE_DIR" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
output=
|
||||
target_dir=
|
||||
while test "$#" -gt 0; do
|
||||
case "$1" in
|
||||
--output)
|
||||
test "$#" -ge 2 || usage
|
||||
output=$2
|
||||
shift 2
|
||||
;;
|
||||
--target-dir)
|
||||
test "$#" -ge 2 || usage
|
||||
target_dir=$2
|
||||
shift 2
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -n "$output" || usage
|
||||
test -n "$target_dir" || usage
|
||||
case "$output:$target_dir" in
|
||||
/*:/*) ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
case "$output/:$target_dir/" in
|
||||
"$target_dir/"*:*|*:"$output/"*)
|
||||
echo "output and target directory must be separate" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
ROOT=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)
|
||||
case "$output" in
|
||||
"$ROOT"|"$ROOT"/*)
|
||||
echo "output must be outside the repository" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
case "$target_dir" in
|
||||
"$ROOT"|"$ROOT"/*)
|
||||
echo "target directory must be outside the repository" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
test ! -e "$output" || {
|
||||
echo "output already exists: $output" >&2
|
||||
exit 2
|
||||
}
|
||||
test ! -e "$target_dir" || {
|
||||
echo "target directory already exists: $target_dir" >&2
|
||||
exit 2
|
||||
}
|
||||
test "$(uname -s)" = Darwin || {
|
||||
echo "XCFramework packaging requires macOS" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
source_epoch=$(git -C "$ROOT" show -s --format=%ct HEAD)
|
||||
export CARGO_INCREMENTAL=0
|
||||
export CARGO_TARGET_DIR="$target_dir"
|
||||
export MACOSX_DEPLOYMENT_TARGET=14.0
|
||||
export RUSTFLAGS="--remap-path-prefix=$ROOT=."
|
||||
export SOURCE_DATE_EPOCH="$source_epoch"
|
||||
export ZERO_AR_DATE=1
|
||||
|
||||
cargo build \
|
||||
--manifest-path "$ROOT/core/Cargo.toml" \
|
||||
--target aarch64-apple-darwin \
|
||||
--release \
|
||||
--locked
|
||||
|
||||
headers="$target_dir/xcframework-headers"
|
||||
mkdir -p "$headers" "$output"
|
||||
cp "$ROOT/core/include/versevdi_core.h" "$headers/"
|
||||
cp "$ROOT/core/include/module.modulemap" "$headers/"
|
||||
|
||||
xcodebuild -create-xcframework \
|
||||
-library "$target_dir/aarch64-apple-darwin/release/libversevdi_core.a" \
|
||||
-headers "$headers" \
|
||||
-output "$output/VerseVDICore.xcframework"
|
||||
|
||||
timestamp=$(date -r "$source_epoch" +%Y%m%d%H%M.%S)
|
||||
find "$output/VerseVDICore.xcframework" -exec touch -h -t "$timestamp" {} +
|
||||
Reference in New Issue
Block a user