mirror of
https://github.com/alexgo-io/stacks-subnets.git
synced 2026-01-12 22:43:44 +08:00
feat: update macOS builds for multi-arch
This commit is contained in:
2
.github/workflows/stacks-blockchain.yml
vendored
2
.github/workflows/stacks-blockchain.yml
vendored
@@ -99,7 +99,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ windows-x64, macos-x64, linux-x64, linux-musl-x64, linux-armv7, linux-arm64 ]
|
||||
platform: [ windows-x64, macos-x64, macos-arm64, linux-x64, linux-musl-x64, linux-armv7, linux-arm64 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -10,28 +10,17 @@ COPY . .
|
||||
|
||||
RUN rustup target add aarch64-apple-darwin
|
||||
|
||||
RUN apt-get update && apt-get install -y git clang cmake
|
||||
RUN apt-get update && apt-get install -y clang zstd
|
||||
|
||||
RUN git clone --depth 1 https://github.com/tpoechtrager/osxcross /opt/osxcross
|
||||
RUN wget -nc -O /tmp/osxcross.tar.zst "https://github.com/hirosystems/docker-osxcross-rust/releases/download/MacOSX12.0.sdk/osxcross-d904031_MacOSX12.0.sdk.tar.zst"
|
||||
RUN mkdir /opt/osxcross && tar -xaf /tmp/osxcross.tar.zst -C /opt/osxcross
|
||||
|
||||
RUN cd /opt/osxcross/tarballs && wget -nc "http://192.168.1.76:3000/MacOSX12.0.sdk.tar.bz2"
|
||||
RUN . /opt/osxcross/env-macos-aarch64 && printenv
|
||||
|
||||
RUN cd /opt/osxcross && UNATTENDED=1 ./build.sh
|
||||
RUN cargo update --workspace=./
|
||||
RUN cargo fetch --target aarch64-apple-darwin
|
||||
#RUN ls /opt/osxcross/target/bin && exit 1
|
||||
#RUN ls /opt/osxcross/target/lib && exit 1
|
||||
RUN PATH="/opt/osxcross/target/bin:${PATH}" \
|
||||
TARGET_CC=aarch64-apple-darwin21.1-clang \
|
||||
LIBZ_SYS_STATIC=1 \
|
||||
LD_LIBRARY_PATH="/opt/osxcross/target/lib:$LD_LIBRARY_PATH" \
|
||||
CC=o64-clang \
|
||||
CC_aarch64_apple_darwin=aarch64-apple-darwin21.1-clang \
|
||||
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin21.1-clang \
|
||||
CARGO_TARGET_AARCH64_APPLE_DARWIN_AR=aarch64-apple-darwin21.1-ar \
|
||||
RUN . /opt/osxcross/env-macos-aarch64 && \
|
||||
cargo build --target aarch64-apple-darwin --release --workspace=./
|
||||
|
||||
RUN mkdir /out && cp -R /src/target/aarch64-apple-darwin/release/. /out
|
||||
|
||||
FROM scratch AS export-stage
|
||||
COPY --from=build /out/blockstack-core /out/blockstack-cli /out/clarity-cli /out/stacks-node /
|
||||
COPY --from=build /out/blockstack-core /out/blockstack-cli /out/clarity-cli /out/stacks-node /
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM rust:stretch as build
|
||||
FROM rust:bullseye as build
|
||||
|
||||
ARG STACKS_NODE_VERSION="No Version Info"
|
||||
ARG GIT_BRANCH='No Branch Info'
|
||||
@@ -10,18 +10,12 @@ COPY . .
|
||||
|
||||
RUN rustup target add x86_64-apple-darwin
|
||||
|
||||
RUN apt-get update && apt-get install -y git clang
|
||||
RUN apt-get update && apt-get install -y clang zstd
|
||||
|
||||
RUN wget -nc "https://github.com/hirosystems/osxcross/releases/download/v1/osxcross-e0a1718_xcode-v10.2.1.tar.xz" && \
|
||||
tar --checkpoint=25000 -xf "osxcross-e0a1718_xcode-v10.2.1.tar.xz" -C /tmp && \
|
||||
PATH="/tmp/osxcross/bin:$PATH" \
|
||||
LD_LIBRARY_PATH="/tmp/osxcross/lib:$LD_LIBRARY_PATH" \
|
||||
CC=o64-clang \
|
||||
CXX=o64-clang++ \
|
||||
LIBZ_SYS_STATIC=1 \
|
||||
CC_x86_64_apple_darwin=x86_64-apple-darwin18-clang \
|
||||
CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin18-clang \
|
||||
CARGO_TARGET_X86_64_APPLE_DARWIN_AR=x86_64-apple-darwin18-ar \
|
||||
RUN wget -nc -O /tmp/osxcross.tar.zst "https://github.com/hirosystems/docker-osxcross-rust/releases/download/MacOSX12.0.sdk/osxcross-d904031_MacOSX12.0.sdk.tar.zst"
|
||||
RUN mkdir /opt/osxcross && tar -xaf /tmp/osxcross.tar.zst -C /opt/osxcross
|
||||
|
||||
RUN . /opt/osxcross/env-macos-x86_64 && \
|
||||
cargo build --target x86_64-apple-darwin --release --workspace=./
|
||||
|
||||
RUN mkdir /out && cp -R /src/target/x86_64-apple-darwin/release/. /out
|
||||
|
||||
@@ -9,7 +9,7 @@ cd "$src_dir"
|
||||
build_platform () {
|
||||
echo "Building $1"
|
||||
rm -rf dist/$1
|
||||
DOCKER_BUILDKIT=1 docker build -o dist/$1 -f ./build-scripts/Dockerfile.$1 .
|
||||
DOCKER_BUILDKIT=1 docker build --progress=plain -o dist/$1 -f ./build-scripts/Dockerfile.$1 .
|
||||
}
|
||||
|
||||
case $DIST_TARGET_FILTER in
|
||||
@@ -21,6 +21,7 @@ case $DIST_TARGET_FILTER in
|
||||
linux-arm64) build_platform linux-arm64 ;;
|
||||
windows-x64) build_platform windows-x64 ;;
|
||||
macos-x64) build_platform macos-x64 ;;
|
||||
macos-arm64) build_platform macos-arm64 ;;
|
||||
*)
|
||||
echo "Invalid dist target filter '$DIST_TARGET_FILTER'"
|
||||
exit 1
|
||||
@@ -35,5 +36,6 @@ case $DIST_TARGET_FILTER in
|
||||
build_platform linux-arm64
|
||||
build_platform windows-x64
|
||||
build_platform macos-x64
|
||||
build_platform macos-arm64
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user