• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The Monero Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15################################################################################
16
17# Multistage docker build, requires docker 17.05
18
19# builder stage
20FROM gcr.io/oss-fuzz-base/base-builder
21
22RUN set -ex && \
23    apt-get update && \
24    apt-get --no-install-recommends --yes install \
25        ca-certificates \
26        cmake \
27        g++ \
28        make \
29        pkg-config \
30        graphviz \
31        doxygen \
32        git \
33        curl \
34        libtool-bin \
35        autoconf \
36        automake \
37        bzip2 \
38        xsltproc \
39        gperf \
40        unzip \
41        cmake \
42        ccache \
43        libsodium-dev \
44        libreadline-dev \
45        libudev-dev \
46        libprotobuf-dev \
47        protobuf-compiler \
48        libexpat-dev
49
50WORKDIR monero
51
52ENV CFLAGS="${CFLAGS} -fPIC -pthread"
53ENV CXXFLAGS="${CXXFLAGS} -fPIC -pthread"
54
55## Boost
56ARG BOOST_VERSION=1_70_0
57ARG BOOST_VERSION_DOT=1.70.0
58ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
59RUN set -ex \
60    && curl -s -L -o  boost_${BOOST_VERSION}.tar.bz2 https://downloads.getmonero.org/libs/boost_${BOOST_VERSION}.tar.bz2 \
61    && echo "${BOOST_HASH}  boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
62    && tar -xjf boost_${BOOST_VERSION}.tar.bz2 \
63    && cd boost_${BOOST_VERSION} \
64    && sed -i -e 's/use(* m_instance)/if (m_instance) use(* m_instance)/' boost/serialization/singleton.hpp \
65    && ./bootstrap.sh --with-toolset=clang \
66    && ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale threading=multi threadapi=pthread cflags="$CFLAGS" cxxflags="$CXXFLAGS" stage
67ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION}
68
69# OpenSSL
70ARG OPENSSL_VERSION=1.1.1g
71ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
72RUN set -ex \
73    && curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
74    && echo "${OPENSSL_HASH}  openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
75    && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
76    && cd openssl-${OPENSSL_VERSION} \
77    && ./Configure linux-x86_64 no-shared --static "$CFLAGS" \
78    && make build_generated \
79    && make libcrypto.a \
80    && make install
81ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
82
83# ZMQ
84ARG ZMQ_VERSION=v4.3.2
85ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
86RUN set -ex \
87    && git clone --depth=1 https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
88    && cd libzmq \
89    && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
90    && sed -i -e 's/::~generic_mtrie_t /::~generic_mtrie_t<T> /' src/generic_mtrie_impl.hpp \
91    && ./autogen.sh \
92    && ./configure --enable-static --disable-shared --with-libsodium \
93    && make \
94    && make install \
95    && ldconfig
96
97# Libusb
98ARG USB_VERSION=v1.0.22
99ARG USB_HASH=0034b2afdcdb1614e78edaa2a9e22d5936aeae5d
100RUN set -ex \
101    && git clone --depth=1 https://github.com/libusb/libusb.git -b ${USB_VERSION} \
102    && cd libusb \
103    && test `git rev-parse HEAD` = ${USB_HASH} || exit 1 \
104    && ./autogen.sh \
105    && ./configure --disable-shared \
106    && make \
107    && make install
108
109# Hidapi
110ARG HIDAPI_VERSION=hidapi-0.8.0-rc1
111ARG HIDAPI_HASH=40cf516139b5b61e30d9403a48db23d8f915f52c
112RUN set -ex \
113    && git clone --depth=1 https://github.com/signal11/hidapi -b ${HIDAPI_VERSION} \
114    && cd hidapi \
115    && test `git rev-parse HEAD` = ${HIDAPI_HASH} || exit 1 \
116    && ./bootstrap \
117    && ./configure --enable-static --disable-shared \
118    && make \
119    && make install
120
121RUN git clone https://github.com/NLnetLabs/unbound && \
122    cd unbound && ./configure && make && make install
123
124RUN git clone --depth 1 https://github.com/monero-project/monero.git monero
125COPY build.sh $SRC/
126