Files
p2pool-salvium/scripts/release/macos_aarch64/build.sh
2025-12-09 23:32:11 +01:00

35 lines
941 B
Bash
Executable File

#!/bin/sh
set -eu
# Example usage: ./build.sh v4.9
cd "$(dirname "$0")"
repo_root="$(cd ../../.. && pwd)"
if [ "${2:-}" ]; then
cpu_set="--cpuset-cpus $2"
else
cpu_set=""
fi
cache_args=""
if [ -n "${P2POOL_BUILD_CACHE:-}" ]; then
cache_dir="${P2POOL_BUILD_CACHE%/}/macos_aarch64"
mkdir -p "$cache_dir"
export DOCKER_BUILDKIT=1
cache_args="--build-arg BUILDKIT_INLINE_CACHE=1 --cache-from type=local,src=$cache_dir --cache-to type=local,dest=$cache_dir,mode=max"
fi
docker build $cpu_set \
--build-arg P2POOL_VERSION=$1 \
$cache_args \
-t p2pool_macos_aarch64_build_$1 \
-f Dockerfile "$repo_root"
docker create --name p2pool_macos_aarch64_build_$1_container p2pool_macos_aarch64_build_$1:latest
docker cp p2pool_macos_aarch64_build_$1_container:/p2pool/build/p2pool-$1-macos-aarch64.tar.gz ../p2pool-$1-macos-aarch64.tar.gz
docker rm p2pool_macos_aarch64_build_$1_container
docker image rm -f p2pool_macos_aarch64_build_$1