From d0b54f13c6d66599a660283712031f4faaf58c01 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Mon, 1 Feb 2021 19:45:47 +0100 Subject: [PATCH] Dockerfile: multistage build for Tor --- Dockerfile | 121 +++++++++++++++++++++++---------------- src/libwalletqt/Wallet.h | 6 +- 2 files changed, 75 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2655db..04ef927 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,71 @@ -FROM ubuntu:18.04 +FROM ubuntu:18.04 AS tor + +ENV CFLAGS="-fPIC" +ENV CPPFLAGS="-fPIC" +ENV CXXFLAGS="-fPIC" +ENV SOURCE_DATE_EPOCH=1397818193 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y build-essential wget git automake pkg-config python python3 && \ + rm -rf /var/lib/apt/lists/* + +RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \ + echo "e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242 openssl-1.1.1i.tar.gz" | sha256sum -c && \ + tar -xzf openssl-1.1.1i.tar.gz && \ + rm openssl-1.1.1i.tar.gz && \ + cd openssl-1.1.1i && \ + ./config no-shared no-dso --prefix=/usr/local/openssl && \ + make -j$THREADS && \ + make test && \ + make -j$THREADS install_sw && \ + rm -rf $(pwd) + +RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz && \ + echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb libevent-2.1.12-stable.tar.gz" | sha256sum -c && \ + tar -zxvf libevent-2.1.12-stable.tar.gz && \ + cd libevent-2.1.12-stable && \ + PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig/ \ + ./configure --prefix=/usr/local/libevent \ + --disable-shared \ + --enable-static \ + --with-pic && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \ + cd zlib && \ + git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \ + ./configure --static --prefix=/usr/local/zlib && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git && \ + cd tor && \ + git reset --hard 9e26a9399fe2422475406d6ee3cb29b2924f3274 && \ + ./autogen.sh && \ + ./configure \ + --disable-asciidoc \ + --disable-manpage \ + --disable-html-manual \ + --disable-system-torrc \ + --disable-module-relay \ + --disable-lzma \ + --disable-zstd \ + --enable-static-tor \ + --with-libevent-dir=/usr/local/libevent \ + --with-openssl-dir=/usr/local/openssl-1.0.2u \ + --with-zlib-dir=/usr/local/zlib \ + --disable-tool-name-check \ + --enable-fatal-warnings \ + --prefix=/usr/local/tor && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +FROM ubuntu:16.04 ARG THREADS=1 ARG QT_VERSION=5.15.2 @@ -8,6 +75,8 @@ ENV CPPFLAGS="-fPIC" ENV CXXFLAGS="-fPIC" ENV SOURCE_DATE_EPOCH=1397818193 +COPY --from=tor /usr/local/tor/bin/tor /usr/local/tor/bin/tor + RUN apt-get update && \ apt-get install -y \ # dev tools @@ -22,7 +91,7 @@ RUN apt-get update && \ # libusb libudev-dev \ # fontconfig - autopoint gettext gperf libpng-dev \ + autopoint gettext gperf libpng12-dev \ # libxcb libpthread-stubs0-dev \ # xorgproto @@ -319,54 +388,6 @@ RUN git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git && make -j$THREADS install && \ rm -rf $(pwd) -RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz && \ - echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb libevent-2.1.12-stable.tar.gz" | sha256sum -c && \ - tar -zxvf libevent-2.1.12-stable.tar.gz && \ - cd libevent-2.1.12-stable && \ - PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig/ \ - ./configure --prefix=/usr/local/libevent \ - --disable-shared \ - --enable-static \ - --with-pic && \ - make -j$THREADS && \ - make -j$THREADS install && \ - rm -rf $(pwd) - -# Todo: Tor will not static link with 1.1.1i -RUN wget https://www.openssl.org/source/openssl-1.0.2u.tar.gz && \ - echo "ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 openssl-1.0.2u.tar.gz" | sha256sum -c && \ - tar -xzf openssl-1.0.2u.tar.gz && \ - rm openssl-1.0.2u.tar.gz && \ - cd openssl-1.0.2u && \ - ./config no-shared no-dso --prefix=/usr/local/openssl-1.0.2u && \ - make -j$THREADS && \ - make test && \ - make -j$THREADS install_sw && \ - rm -rf $(pwd) - -RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git && \ - cd tor && \ - git reset --hard 9e26a9399fe2422475406d6ee3cb29b2924f3274 && \ - ./autogen.sh && \ - ./configure \ - --disable-asciidoc \ - --disable-manpage \ - --disable-html-manual \ - --disable-system-torrc \ - --disable-module-relay \ - --disable-lzma \ - --disable-zstd \ - --enable-static-tor \ - --with-libevent-dir=/usr/local/libevent \ - --with-openssl-dir=/usr/local/openssl-1.0.2u \ - --with-zlib-dir=/usr/local/zlib \ - --disable-tool-name-check \ - --enable-fatal-warnings \ - --prefix=/usr/local/tor && \ - make -j$THREADS && \ - make -j$THREADS install && \ - rm -rf $(pwd) - RUN git clone https://git.wownero.com/feather/monero-seed.git && \ cd monero-seed && \ git reset --hard 4674ef09b6faa6fe602ab5ae0b9ca8e1fd7d5e1b && \ diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 5c5c9a1..d48f0b4 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -31,8 +31,10 @@ struct TxProof { }; struct SubaddressIndex { - SubaddressIndex(int major, int minor) - : major(major), minor(minor) {} + SubaddressIndex(int major, int minor) { + this->major = major; + this->minor = minor; + } bool isValid() const { return major >= 0 && minor >= 0;