• 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
49WORKDIR monero
50
51ENV CFLAGS="${CFLAGS} -fPIC -pthread"
52ENV CXXFLAGS="${CXXFLAGS} -fPIC -pthread"
53
54## Boost
55ARG BOOST_VERSION=1_70_0
56ARG BOOST_VERSION_DOT=1.70.0
57ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
58RUN set -ex \
59    && curl -s -L -o  boost_${BOOST_VERSION}.tar.bz2 https://downloads.getmonero.org/libs/boost_${BOOST_VERSION}.tar.bz2 \
60    && echo "${BOOST_HASH}  boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
61    && tar -xjf boost_${BOOST_VERSION}.tar.bz2 \
62    && cd boost_${BOOST_VERSION} \
63    && sed -i -e 's/use(* m_instance)/if (m_instance) use(* m_instance)/' boost/serialization/singleton.hpp \
64    && ./bootstrap.sh --with-toolset=clang \
65    && ./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
66ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION}
67
68# OpenSSL
69ARG OPENSSL_VERSION=1.1.1g
70ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
71RUN set -ex \
72    && curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
73    && echo "${OPENSSL_HASH}  openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
74    && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
75    && cd openssl-${OPENSSL_VERSION} \
76    && ./Configure linux-x86_64 no-shared --static "$CFLAGS" \
77    && make build_generated \
78    && make libcrypto.a \
79    && make install
80ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
81
82# ZMQ
83ARG ZMQ_VERSION=v4.3.2
84ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
85RUN set -ex \
86    && git clone --depth=1 https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
87    && cd libzmq \
88    && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
89    && sed -i -e 's/::~generic_mtrie_t /::~generic_mtrie_t<T> /' src/generic_mtrie_impl.hpp \
90    && ./autogen.sh \
91    && ./configure --enable-static --disable-shared --with-libsodium \
92    && make \
93    && make install \
94    && ldconfig
95
96# Libusb
97ARG USB_VERSION=v1.0.22
98ARG USB_HASH=0034b2afdcdb1614e78edaa2a9e22d5936aeae5d
99RUN set -ex \
100    && git clone --depth=1 https://github.com/libusb/libusb.git -b ${USB_VERSION} \
101    && cd libusb \
102    && test `git rev-parse HEAD` = ${USB_HASH} || exit 1 \
103    && ./autogen.sh \
104    && ./configure --disable-shared \
105    && make \
106    && make install
107
108# Hidapi
109ARG HIDAPI_VERSION=hidapi-0.8.0-rc1
110ARG HIDAPI_HASH=40cf516139b5b61e30d9403a48db23d8f915f52c
111RUN set -ex \
112    && git clone --depth=1 https://github.com/signal11/hidapi -b ${HIDAPI_VERSION} \
113    && cd hidapi \
114    && test `git rev-parse HEAD` = ${HIDAPI_HASH} || exit 1 \
115    && ./bootstrap \
116    && ./configure --enable-static --disable-shared \
117    && make \
118    && make install
119
120RUN git clone --depth 1 https://github.com/monero-project/monero.git monero
121COPY build.sh $SRC/
122