2020-10-15 12:19:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd /home/user/nimbus-eth2
|
2020-11-07 07:46:53 +00:00
|
|
|
git config --global core.abbrev 8
|
2020-10-15 12:19:41 +00:00
|
|
|
|
2021-01-07 09:19:29 +00:00
|
|
|
if [[ -z "${1}" ]]; then
|
|
|
|
echo "Usage: $(basename ${0}) PLATFORM"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
PLATFORM="${1}"
|
2020-11-20 13:49:49 +00:00
|
|
|
BINARIES="nimbus_beacon_node nimbus_signing_process"
|
2020-11-06 16:26:03 +00:00
|
|
|
|
|
|
|
# we need to build everything against libraries available inside this container, including the Nim compiler
|
|
|
|
make clean
|
2021-01-07 09:19:29 +00:00
|
|
|
make \
|
|
|
|
-j$(nproc) \
|
|
|
|
LOG_LEVEL="TRACE" \
|
|
|
|
NIMFLAGS="-d:disableMarchNative" \
|
|
|
|
PARTIAL_STATIC_LINKING=1 \
|
|
|
|
${BINARIES}
|
2020-11-06 16:26:03 +00:00
|
|
|
|
|
|
|
# archive directory (we need the Nim compiler in here)
|
2021-01-07 09:19:29 +00:00
|
|
|
PREFIX="nimbus-eth2_${PLATFORM}_"
|
2020-10-15 12:19:41 +00:00
|
|
|
GIT_COMMIT="$(git rev-parse --short HEAD)"
|
2020-11-06 16:26:03 +00:00
|
|
|
VERSION="$(./env.sh nim --verbosity:0 --hints:off --warnings:off scripts/print_version.nims)"
|
2020-11-07 07:46:53 +00:00
|
|
|
DIR="${PREFIX}${VERSION}_${GIT_COMMIT}"
|
2020-10-15 12:19:41 +00:00
|
|
|
DIST_PATH="dist/${DIR}"
|
|
|
|
# delete old artefacts
|
2020-11-05 19:51:35 +00:00
|
|
|
rm -rf "dist/${PREFIX}"*.tar.gz
|
2020-11-07 07:46:53 +00:00
|
|
|
if [[ -d "${DIST_PATH}" ]]; then
|
|
|
|
rm -rf "${DIST_PATH}"
|
|
|
|
fi
|
2020-11-09 08:12:48 +00:00
|
|
|
|
2020-10-15 12:19:41 +00:00
|
|
|
mkdir -p "${DIST_PATH}"
|
2020-11-07 18:00:31 +00:00
|
|
|
mkdir "${DIST_PATH}/scripts"
|
|
|
|
mkdir "${DIST_PATH}/build"
|
2020-10-15 12:19:41 +00:00
|
|
|
|
2020-11-06 16:26:03 +00:00
|
|
|
# copy and checksum binaries, copy scripts and docs
|
2020-10-15 12:19:41 +00:00
|
|
|
for BINARY in ${BINARIES}; do
|
2020-11-07 18:00:31 +00:00
|
|
|
cp -a ./build/${BINARY} "${DIST_PATH}/build/"
|
|
|
|
cd "${DIST_PATH}/build"
|
2020-10-15 12:19:41 +00:00
|
|
|
sha512sum ${BINARY} > ${BINARY}.sha512sum
|
|
|
|
cd - >/dev/null
|
|
|
|
done
|
|
|
|
sed -e "s/GIT_COMMIT/${GIT_COMMIT}/" docker/dist/README.md > "${DIST_PATH}/README.md"
|
2020-11-09 08:12:48 +00:00
|
|
|
cp -a scripts/run-beacon-node.sh "${DIST_PATH}/scripts"
|
2020-11-07 18:00:31 +00:00
|
|
|
cp -a ./run-*-beacon-node.sh "${DIST_PATH}/"
|
2020-10-15 12:19:41 +00:00
|
|
|
|
|
|
|
# create the tarball
|
|
|
|
cd dist
|
|
|
|
tar czf "${DIR}.tar.gz" "${DIR}"
|
|
|
|
# don't leave the directory hanging around
|
|
|
|
rm -rf "${DIR}"
|
|
|
|
cd - >/dev/null
|
|
|
|
|