-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): Rename MacOS artifacts correctly
- Loading branch information
1 parent
e8a8c2d
commit 7bc0cf5
Showing
3 changed files
with
20 additions
and
89 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
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,69 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
RUST_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
APP_NAME=libpact_ffi | ||
|
||
source "$RUST_DIR/scripts/gzip-and-sum.sh" | ||
ARTIFACTS_DIR=${ARTIFACTS_DIR:-"$RUST_DIR/release_artifacts"} | ||
mkdir -p "$ARTIFACTS_DIR" | ||
export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"$RUST_DIR/target"} | ||
|
||
# We target the oldest supported version of macOS. | ||
export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12} | ||
|
||
# All flags passed to this script are passed to cargo. | ||
case $1 in | ||
x86_64-apple-darwin) | ||
TARGET=$1 | ||
shift | ||
;; | ||
aarch64-apple-darwin) | ||
TARGET=$1 | ||
shift | ||
;; | ||
*) ;; | ||
esac | ||
cargo_flags=("$@") | ||
|
||
build_target() { | ||
TARGET=$1 | ||
|
||
case $TARGET in | ||
x86_64-apple-darwin) | ||
ARCH_SUFFIX=x86_64 | ||
;; | ||
aarch64-apple-darwin) | ||
ARCH_SUFFIX=aarch64 | ||
;; | ||
*) | ||
echo unknown target $TARGET | ||
exit 1 | ||
;; | ||
esac | ||
cargo build --target $TARGET "${cargo_flags[@]}" | ||
|
||
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then | ||
file "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" | ||
file "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" | ||
du -sh "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" | ||
du -sh "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" | ||
gzip_and_sum \ | ||
"$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" \ | ||
"$ARTIFACTS_DIR/$APP_NAME-macos-$ARCH_SUFFIX.a.gz" | ||
gzip_and_sum \ | ||
"$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" \ | ||
"$ARTIFACTS_DIR/$APP_NAME-macos-$ARCH_SUFFIX.dylib.gz" | ||
fi | ||
} | ||
|
||
if [ ! -z "$TARGET" ]; then | ||
echo building for target $TARGET | ||
build_target $TARGET | ||
else | ||
echo building for all targets | ||
build_target x86_64-apple-darwin | ||
build_target aarch64-apple-darwin | ||
fi | ||
#!/bin/bash -e | ||
|
||
cargo clean | ||
cargo build --release | ||
mkdir -p ../release_artifacts | ||
gzip -c ../target/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz | ||
openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz.sha256 | ||
gzip -c ../target/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz | ||
openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.a.gz > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz.sha256 | ||
|
||
# M1 | ||
export SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) | ||
export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) | ||
cargo build --target aarch64-apple-darwin --release | ||
|
||
gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz | ||
openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz.sha256 | ||
gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz | ||
openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz.sha256 |
This file was deleted.
Oops, something went wrong.