ZeroTierOne/ci/scripts/build.sh

50 lines
1.2 KiB
Bash
Raw Normal View History

2022-02-03 13:19:06 +00:00
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
2023-03-31 14:29:18 +00:00
ZT_NAME="$1" ; shift
DISTRO="$1" ; shift
ZT_ISA="$1" ; shift
VERSION="$1" ; shift
BUILD_EVENT="$1" ; shift
2022-02-03 13:19:06 +00:00
2023-03-31 14:29:18 +00:00
source "$(dirname $0)/lib.sh"
2022-05-14 08:08:22 +00:00
2023-03-31 14:29:18 +00:00
if [ -f "ci/Dockerfile-build.${ZT_NAME}" ]; then
DOCKERFILE="ci/Dockerfile-build.${ZT_NAME}"
2022-11-30 09:29:33 +00:00
else
2023-03-31 14:29:18 +00:00
DOCKERFILE="ci/Dockerfile-build.${PKGFMT}"
2022-11-30 09:29:33 +00:00
fi
2022-05-14 08:08:22 +00:00
echo "#~~~~~~~~~~~~~~~~~~~~"
echo "$0 variables:"
echo "nproc: $(nproc)"
2023-03-31 14:29:18 +00:00
echo "ZT_NAME: ${ZT_NAME}"
echo "DISTRO: ${DISTRO}"
2022-05-14 08:08:22 +00:00
echo "ZT_ISA: ${ZT_ISA}"
2023-03-31 14:29:18 +00:00
echo "VERSION: ${VERSION}"
echo "BUILD_EVENT: ${BUILD_EVENT}"
2022-05-14 08:08:22 +00:00
echo "DOCKER_ARCH: ${DOCKER_ARCH}"
2023-03-31 14:29:18 +00:00
echo "DNF_ARCH: ${DNF_ARCH}"
2022-05-14 08:08:22 +00:00
echo "RUST_TRIPLET: ${RUST_TRIPLET}"
echo "PKGFMT: ${PKGFMT}"
echo "PWD: ${PWD}"
echo "DOCKERFILE: ${DOCKERFILE}"
echo "#~~~~~~~~~~~~~~~~~~~~"
2023-03-31 14:29:18 +00:00
make munge_rpm zerotier-one.spec VERSION=${VERSION}
make munge_deb debian/changelog VERSION=${VERSION}
docker buildx build \
--no-cache=true \
--build-arg ZT_NAME="${ZT_NAME}" \
--build-arg RUST_TRIPLET="${RUST_TRIPLET}" \
--build-arg DOCKER_ARCH="${DOCKER_ARCH}" \
--build-arg DNF_ARCH="${DNF_ARCH}" \
--platform linux/${DOCKER_ARCH} \
-f ${DOCKERFILE} \
-t build \
. \
--output type=local,dest=. \
--target export