Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron Cash backports for the build scripts #230

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions contrib/build-linux/appimage/Dockerfile_ub1804
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN echo deb ${UBUNTU_MIRROR} bionic main restricted universe multiverse > /etc/
echo deb ${UBUNTU_MIRROR} bionic-security main restricted universe multiverse >> /etc/apt/sources.list && \
apt-get update -q && \
apt-get install -qy \
git=1:2.17.1-1ubuntu0.11 \
git=1:2.17.1-1ubuntu0.12 \
wget=1.19.4-1ubuntu2.2 \
make=4.1-9.1ubuntu1 \
autotools-dev=20180224.1 \
Expand Down Expand Up @@ -45,10 +45,11 @@ RUN echo deb ${UBUNTU_MIRROR} bionic main restricted universe multiverse > /etc/
libx11-xcb1=2:1.6.4-3ubuntu0.4 \
autopoint=0.19.8.1-6ubuntu0.3 \
zlib1g-dev=1:1.2.11.dfsg-0ubuntu2 \
libfreetype6=2.8.1-2ubuntu2.1 \
libfreetype6=2.8.1-2ubuntu2.2 \
libfontconfig1=2.12.6-0ubuntu2 \
libssl-dev=1.1.1-1ubuntu2.1~18.04.17 \
rustc=1.57.0+dfsg1+llvm-0ubuntu1~18.04.1 \
libssl-dev=1.1.1-1ubuntu2.1~18.04.20 \
rustc=1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~18.04.2 \
cargo=0.60.0ubuntu1-0ubuntu1~18.04.1 \
&& \
rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
Expand Down
24 changes: 8 additions & 16 deletions contrib/build-wine/_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@ prepare_wine() {
PYINSTALLER_COMMIT=d6f3d02365ba68ffc84169c56c292701f346110e # Version 4.2 + a patch to drop an unused .rc file

## These settings probably don't need change
export WINEPREFIX=$HOME/wine64
#export WINEARCH='win32'
export WINEDEBUG=-all

PYHOME=c:/python$PYTHON_VERSION
PYTHON="wine $PYHOME/python.exe -OO -B"

wine 'wineboot'

info "Cleaning tmp"
rm -rf $HOME/tmp
mkdir -p $HOME/tmp
Expand Down Expand Up @@ -178,10 +172,10 @@ EOF
) || fail "libusb build failed"

# libsecp256k1, libzbar & libusb
mkdir -p $WINEPREFIX/drive_c/tmp
cp "$here"/../../electroncash/*.dll $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libraries to their destination"
cp libusb/libusb/.libs/libusb-1.0.dll $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libusb to its destination"
cp "$here"/../../electroncash/tor/bin/tor.exe $WINEPREFIX/drive_c/tmp/ || fail "Could not copy tor.exe to its destination"
mkdir -p "$WINEPREFIX"/drive_c/tmp
cp "$here"/../../electroncash/*.dll "$WINEPREFIX"/drive_c/tmp/ || fail "Could not copy libraries to their destination"
cp libusb/libusb/.libs/libusb-1.0.dll "$WINEPREFIX"/drive_c/tmp/ || fail "Could not copy libusb to its destination"
cp "$here"/../../electroncash/tor/bin/tor.exe "$WINEPREFIX"/drive_c/tmp/ || fail "Could not copy tor.exe to its destination"

popd # out of homedir/tmp
popd # out of $here
Expand All @@ -201,8 +195,6 @@ build_the_app() {

NAME_ROOT=$PACKAGE # PACKAGE comes from ../base.sh
# These settings probably don't need any change
export WINEPREFIX=$HOME/wine64
export WINEDEBUG=-all
export PYTHONDONTWRITEBYTECODE=1

PYHOME=c:/python$PYTHON_VERSION
Expand All @@ -226,22 +218,22 @@ build_the_app() {
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
popd # go back to $here

cp -rv "$here"/../electrum-locale/locale $WINEPREFIX/drive_c/electrumabc/electroncash/
cp -rv "$here"/../electrum-locale/locale "$WINEPREFIX"/drive_c/electrumabc/electroncash/

# Install frozen dependencies
info "Installing frozen dependencies ..."
$PYTHON -m pip install --no-deps --no-warn-script-location -r "$here"/../deterministic-build/requirements.txt || fail "Failed to install requirements"
$PYTHON -m pip install --no-deps --no-warn-script-location -r "$here"/../deterministic-build/requirements-hw.txt || fail "Failed to install requirements-hw"

pushd $WINEPREFIX/drive_c/electrumabc
pushd "$WINEPREFIX"/drive_c/electrumabc
$PYTHON setup.py install || fail "Failed setup.py install"
popd

rm -rf dist/

info "Resetting modification time in C:\Python..."
# (Because we just installed a bunch of stuff)
pushd $HOME/wine64/drive_c/python$PYTHON_VERSION
pushd "$WINEPREFIX"/drive_c/python$PYTHON_VERSION
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
ls -l
popd
Expand All @@ -265,7 +257,7 @@ build_the_app() {
# build NSIS installer
info "Running makensis to build setup .exe version ..."
# $VERSION could be passed to the electrum-abc.nsi script, but this would require some rewriting in the script iself.
wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" /DPRODUCT_VERSION=$VERSION electrum-abc.nsi || fail "makensis failed"
wine "$WINEPREFIX/drive_c/Program Files/NSIS/makensis.exe" /DPRODUCT_VERSION=$VERSION electrum-abc.nsi || fail "makensis failed"

cd dist
mv $NAME_ROOT-setup.exe $NAME_ROOT-$VERSION-setup.exe || fail "Failed to move $NAME_ROOT-$VERSION-setup.exe to the output dist/ directory"
Expand Down
6 changes: 3 additions & 3 deletions contrib/build-wine/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $SUDO docker build -t $IMGNAME \
|| fail "Failed to create docker image"

# This is the place where we checkout and put the exact revision we want to work
# on. Docker will run mapping this directory to /homedir/wine64/drive_c/electrumabc
# on. Docker will run mapping this directory to /homedir/wine/drive_c/electrumabc
# which inside wine will look like c:\electrumabc.
FRESH_CLONE=`pwd`/contrib/build-wine/fresh_clone
FRESH_CLONE_DIR="$FRESH_CLONE/$GIT_DIR_NAME"
Expand All @@ -87,9 +87,9 @@ FRESH_CLONE_DIR="$FRESH_CLONE/$GIT_DIR_NAME"
-e BUILD_DEBUG="$BUILD_DEBUG" \
-e PYI_SKIP_TAG="$PYI_SKIP_TAG" \
--name ec-wine-builder-cont \
-v "$FRESH_CLONE_DIR":/homedir/wine64/drive_c/electrumabc:delegated \
-v "$FRESH_CLONE_DIR":/homedir/wine/drive_c/electrumabc:delegated \
--rm \
--workdir /homedir/wine64/drive_c/electrumabc/contrib/build-wine \
--workdir /homedir/wine/drive_c/electrumabc/contrib/build-wine \
$IMGNAME \
./_build.sh $REV
) || fail "Build inside docker container failed"
Expand Down
113 changes: 74 additions & 39 deletions contrib/build-wine/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,94 @@
FROM ubuntu:18.04@sha256:2aeed98f2fa91c365730dc5d70d18e95e8d53ad4f1bbf4269c3bb625060383f0
FROM ubuntu:22.04@sha256:42ba2dfce475de1113d55602d40af18415897167d47c2045ec7b6d9746ff148f

ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu/

ENV LC_ALL=C.UTF-8 LANG=C.UTF-8

ENV UBUNTUDIST=jammy

# This prevents questions during package installations
ENV DEBIAN_FRONTEND=noninteractive

RUN echo deb ${UBUNTU_MIRROR} ${UBUNTUDIST} main restricted universe multiverse > /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} ${UBUNTUDIST}-updates main restricted universe multiverse >> /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} ${UBUNTUDIST}-backports main restricted universe multiverse >> /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} ${UBUNTUDIST}-security main restricted universe multiverse >> /etc/apt/sources.list && \
dpkg --add-architecture i386 && \
apt-get update -q && \
apt-get install -qy \
gnupg2=2.2.27-3ubuntu2.1 \
ca-certificates=20211016 \
wget=1.21.2-2ubuntu1 \
git=1:2.34.1-1ubuntu1.4 \
p7zip-full=16.02+dfsg-8 \
make=4.3-4.1build1 \
autotools-dev=20220109.1 \
autoconf=2.71-2 \
libtool=2.4.6-15build2 \
gettext=0.21-4ubuntu4 \
autopoint=0.21-4ubuntu4 \
mingw-w64=8.0.0-1 \
mingw-w64-tools=8.0.0-1 \
win-iconv-mingw-w64-dev=0.0.8-4

# Official WineHQ signing key
# See https://wiki.winehq.org/Ubuntu
# From https://dl.winehq.org/wine-builds/winehq.key
COPY winehq.key /tmp

# Ubuntu 18.04 lacks libfaudio0 needed for Wine 6
# See https://forum.winehq.org/viewtopic.php?f=8&t=32192
# See also https://askubuntu.com/a/1205596
# From https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key
COPY opensuse.key /tmp
ENV WINEDIST=devel
ENV WINEVERSION=7.7~${UBUNTUDIST}-1

RUN echo deb ${UBUNTU_MIRROR} bionic main restricted universe multiverse > /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} bionic-updates main restricted universe multiverse >> /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} bionic-backports main restricted universe multiverse >> /etc/apt/sources.list && \
echo deb ${UBUNTU_MIRROR} bionic-security main restricted universe multiverse >> /etc/apt/sources.list && \
dpkg --add-architecture i386 && \
apt-get update -q && \
apt-get install -qy \
gnupg2=2.2.4-1ubuntu1.5 \
software-properties-common=0.96.24.32.14 \
python3-software-properties=0.96.24.32.14 && \
echo "78b185fabdb323971d13bd329fefc8038e08559aa51c4996de18db0639a51df6 /tmp/winehq.key" | sha256sum -c - && \
RUN echo "78b185fabdb323971d13bd329fefc8038e08559aa51c4996de18db0639a51df6 /tmp/winehq.key" | sha256sum -c - && \
apt-key add /tmp/winehq.key && \
echo "6e4ab6a3731a1f66dbdbe036968ccea64da0c423d312e35b9f8209bb1c82a0a7 /tmp/opensuse.key" | sha256sum -c - && \
apt-key add /tmp/opensuse.key && \
apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ && \
apt-add-repository 'deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./' && \
echo deb https://dl.winehq.org/wine-builds/ubuntu/ ${UBUNTUDIST} main >> /etc/apt/sources.list && \
apt-get update -q && \
apt-get install -qy \
wget=1.19.4-1ubuntu2.2 \
git=1:2.17.1-1ubuntu0.11 \
p7zip-full=16.02+dfsg-6 \
make=4.1-9.1ubuntu1 \
autotools-dev=20180224.1 \
autoconf=2.69-11 \
libtool=2.4.6-2 \
gettext=0.19.8.1-6ubuntu0.3 \
autopoint=0.19.8.1-6ubuntu0.3 \
mingw-w64=5.0.3-1 \
mingw-w64-tools=5.0.3-1 \
win-iconv-mingw-w64-dev=0.0.8-2 \
wine-stable-amd64:amd64=6.0.0~bionic-1 \
wine-stable-i386:i386=6.0.0~bionic-1 \
wine-stable:amd64=6.0.0~bionic-1 \
winehq-stable:amd64=6.0.0~bionic-1 && \
rm -rf /var/lib/apt/lists/* && \
wine-${WINEDIST}-amd64:amd64=${WINEVERSION} \
wine-${WINEDIST}-i386:i386=${WINEVERSION} \
wine-${WINEDIST}:amd64=${WINEVERSION} \
winehq-${WINEDIST}:amd64=${WINEVERSION} \
# cabextract is needed for winetricks to install the .NET framework
cabextract=1.9-3 \
# xvfb is needed to launch the Visual Studio installer
xvfb=2:21.1.3-2ubuntu2.1 \
# winbind is needed for the Visual Studio installer and cl.exe PDB generation
winbind=2:4.15.9+dfsg-0ubuntu0.2

RUN rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean

RUN wget -q -O /tmp/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/9c97d44b9b68a1b09e244e46f9ae0831ab35c315/src/winetricks && \
chmod +x /tmp/winetricks && \
echo "311c8c223bb83a7558b9e51197a9ccf7182bbd63849c64827b87bbc5f627f5cb /tmp/winetricks" | sha256sum -c -

ARG USER_ID
ARG GROUP_ID

RUN mkdir -p /homedir/wine64/drive_c/electrumabc ; chown -R ${USER_ID}:${GROUP_ID} /homedir && ls -al /homedir
ENV HOME=/homedir
ENV WINEARCH=win32
ENV WINEPREFIX=${HOME}/wine
ENV WINEDEBUG=-all

RUN mkdir -p ${WINEPREFIX}/drive_c/electrumabc ; chown -R ${USER_ID}:${GROUP_ID} ${HOME}

# Make our UID/GID have an actual user name, this is needed so wineboot creates the right folders and
# the Visual Studio installer does't fail in SHGetKnownFolderPath with error 0x80070003 (ERROR_PATH_NOT_FOUND).
RUN echo "user:x:${USER_ID}:${GROUP_ID}::${HOME}:/bin/sh" >> /etc/passwd
USER ${USER_ID}:${GROUP_ID}

WORKDIR ${HOME}

# wineboot needs to run after the user is added to /etc/passwd, otherwise it will assume the username is "wine"
RUN wineboot && \
/tmp/winetricks --optout -q dotnet472 && \
# Wait for the wine server to shutdown, needs to be done after wineboot to ensure the installation is good
wineserver -w

# DBUS_FATAL_WARNINGS=0 is needed because we don't have dbus in the container and Wine calls
# dbus_connection_send_with_reply_and_block with a NULL connection. The dbus client libraries are set to abort by
# default unless this variable is set.
ENV DBUS_FATAL_WARNINGS=0

USER ${USER_ID}:${GROUP_ID}