dist: build Windows binary with newer compiler (#3548)
We went from (Mingw-w64) GCC 5.5.0 to 11.2.0. Progress!
This commit is contained in:
parent
9b43a76f2f
commit
d7d7398fe6
|
@ -1,5 +1,5 @@
|
|||
# The build is reproducible only if this base image stays the same.
|
||||
FROM statusteam/nimbus_beacon_node:dist_base_20210202230118_win64@sha256:47b8ea60a35bd45355f0490677c04a9b42df56b5041cbf64da8ad233511a55d5
|
||||
FROM statusteam/nimbus_beacon_node:dist_base_20220327205458_win64_v2@sha256:a5bda8cbef9973c2feb94003d6812004bb9f6dfd6b0b817d85dfa1118034273a
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
|
|
|
@ -13,11 +13,39 @@ SHELL ["/bin/bash", "-c"]
|
|||
ENV DEBIAN_FRONTEND=noninteractive TZ="Etc/UTC"
|
||||
RUN \
|
||||
apt-get -qq update \
|
||||
&& apt-get -qq -y install git gnupg software-properties-common lsb &>/dev/null \
|
||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 \
|
||||
&& add-apt-repository "deb [arch=amd64] https://pkg.mxe.cc/repos/apt $(lsb_release -sc) main" \
|
||||
&& apt-get -qq update \
|
||||
&& apt-get -qq -y install mxe-x86-64-w64-mingw32.static-cc &>/dev/null \
|
||||
&& apt-get -qq -y install git gnupg software-properties-common lsb cmake &>/dev/null \
|
||||
&& apt-get -qq -y install \
|
||||
autoconf \
|
||||
automake \
|
||||
autopoint \
|
||||
bison \
|
||||
bzip2 \
|
||||
flex \
|
||||
g++ \
|
||||
g++-multilib \
|
||||
gettext \
|
||||
gperf \
|
||||
intltool \
|
||||
libc6-dev-i386 \
|
||||
libltdl-dev \
|
||||
libssl-dev \
|
||||
libtool-bin \
|
||||
lzip \
|
||||
make \
|
||||
openssl \
|
||||
p7zip-full \
|
||||
patch \
|
||||
perl \
|
||||
python \
|
||||
ruby \
|
||||
sed \
|
||||
unzip \
|
||||
wget \
|
||||
xz-utils &>/dev/null \
|
||||
&& apt-get -qq clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& git clone --depth 1 https://github.com/mxe/mxe.git /opt/mxe \
|
||||
&& cd /opt/mxe \
|
||||
&& make -j $(nproc) MXE_TARGETS='x86_64-w64-mingw32.static' MXE_USE_CCACHE='' DONT_CHECK_REQUIREMENTS=1 cc \
|
||||
&& rm -rf /opt/mxe/.log /opt/mxe/pkg
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ build-arm:
|
|||
$(CURDIR)/make_base_image.sh arm "$(IMAGE_NAME)_arm_v2"
|
||||
|
||||
build-win64:
|
||||
$(CURDIR)/make_base_image.sh win64 "$(IMAGE_NAME)_win64"
|
||||
$(CURDIR)/make_base_image.sh win64 "$(IMAGE_NAME)_win64_v2"
|
||||
|
||||
build-macos:
|
||||
$(CURDIR)/make_base_image.sh macos "$(IMAGE_NAME)_macos"
|
||||
|
@ -33,6 +33,9 @@ build-macos:
|
|||
# You probably don't want to recreate and push these base images to Docker Hub,
|
||||
# because when older images expire and get deleted, it will no longer be possible
|
||||
# to reproduce old releases.
|
||||
#
|
||||
# When you really have to, change the Docker tags by appending "_v2", "_v3", etc. to them.
|
||||
# This way you won't overwrite the old image.
|
||||
|
||||
#push-amd64: build-amd64
|
||||
# docker push $(IMAGE_NAME)
|
||||
|
@ -44,7 +47,7 @@ build-macos:
|
|||
# docker push $(IMAGE_NAME)_arm_v2
|
||||
|
||||
#push-win64: build-win64
|
||||
# docker push $(IMAGE_NAME)_win64
|
||||
# docker push $(IMAGE_NAME)_win64_v2
|
||||
|
||||
#push-macos: build-macos
|
||||
#docker push $(IMAGE_NAME)_macos
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2020-2021 Status Research & Development GmbH. Licensed under
|
||||
# Copyright (c) 2020-2022 Status Research & Development GmbH. Licensed under
|
||||
# either of:
|
||||
# - Apache License, version 2.0
|
||||
# - MIT license
|
||||
|
@ -19,14 +19,19 @@ fi
|
|||
PLATFORM="${1}"
|
||||
BINARIES="nimbus_beacon_node"
|
||||
|
||||
echo -e "\nPLATFORM=${PLATFORM}"
|
||||
|
||||
#- we need to build everything against libraries available inside this container, including the Nim compiler
|
||||
make clean
|
||||
NIMFLAGS_COMMON="-d:disableMarchNative --gcc.options.debug:'-g1' --clang.options.debug:'-gline-tables-only'"
|
||||
if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
|
||||
# Cross-compilation using the MXE distribution of Mingw-w64
|
||||
export PATH="/usr/lib/mxe/usr/bin:${PATH}"
|
||||
export PATH="/opt/mxe/usr/bin:${PATH}"
|
||||
CC=x86_64-w64-mingw32.static-gcc
|
||||
CXX=x86_64-w64-mingw32.static-g++
|
||||
${CC} --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
USE_LIBBACKTRACE=0 \
|
||||
|
@ -67,6 +72,9 @@ if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
|
|||
${BINARIES}
|
||||
elif [[ "${PLATFORM}" == "Linux_arm32v7" ]]; then
|
||||
CC="arm-linux-gnueabihf-gcc"
|
||||
${CC} --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
USE_LIBBACKTRACE=0 \
|
||||
|
@ -81,6 +89,9 @@ elif [[ "${PLATFORM}" == "Linux_arm32v7" ]]; then
|
|||
${BINARIES}
|
||||
elif [[ "${PLATFORM}" == "Linux_arm64v8" ]]; then
|
||||
CC="aarch64-linux-gnu-gcc"
|
||||
${CC} --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
USE_LIBBACKTRACE=0 \
|
||||
|
@ -99,6 +110,9 @@ elif [[ "${PLATFORM}" == "macOS_amd64" ]]; then
|
|||
export ZERO_AR_DATE=1 # avoid timestamps in binaries
|
||||
DARWIN_VER="20.4"
|
||||
CC="o64-clang"
|
||||
${CC} --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
USE_LIBBACKTRACE=0 \
|
||||
|
@ -129,6 +143,9 @@ elif [[ "${PLATFORM}" == "macOS_arm64" ]]; then
|
|||
export ZERO_AR_DATE=1 # avoid timestamps in binaries
|
||||
DARWIN_VER="20.4"
|
||||
CC="oa64-clang"
|
||||
${CC} --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
USE_LIBBACKTRACE=0 \
|
||||
|
@ -155,6 +172,9 @@ elif [[ "${PLATFORM}" == "macOS_arm64" ]]; then
|
|||
${BINARIES}
|
||||
else
|
||||
# Linux AMD64
|
||||
gcc --version
|
||||
echo
|
||||
|
||||
make \
|
||||
-j$(nproc) \
|
||||
LOG_LEVEL="TRACE" \
|
||||
|
@ -181,17 +201,18 @@ mkdir "${DIST_PATH}/scripts"
|
|||
mkdir "${DIST_PATH}/build"
|
||||
|
||||
# copy and checksum binaries, copy scripts and docs
|
||||
EXT=""
|
||||
if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
|
||||
EXT=".exe"
|
||||
fi
|
||||
for BINARY in ${BINARIES}; do
|
||||
cp -a "./build/${BINARY}" "${DIST_PATH}/build/"
|
||||
cp -a "./build/${BINARY}${EXT}" "${DIST_PATH}/build/"
|
||||
if [[ "${PLATFORM}" =~ macOS ]]; then
|
||||
# debug info
|
||||
cp -a "./build/${BINARY}.dSYM" "${DIST_PATH}/build/"
|
||||
fi
|
||||
cd "${DIST_PATH}/build"
|
||||
sha512sum "${BINARY}" > "${BINARY}.sha512sum"
|
||||
if [[ "${PLATFORM}" == "Windows_amd64" ]]; then
|
||||
mv "${BINARY}" "${BINARY}.exe"
|
||||
fi
|
||||
sha512sum "${BINARY}${EXT}" > "${BINARY}.sha512sum"
|
||||
cd - >/dev/null
|
||||
done
|
||||
sed -e "s/GIT_COMMIT/${GIT_COMMIT}/" docker/dist/README.md.tpl > "${DIST_PATH}/README.md"
|
||||
|
|
Loading…
Reference in New Issue