aboutsummaryrefslogtreecommitdiff
blob: 3f291d04cf5fd89fd0b069f84caff9f6b3efd895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#===- libcxx/utils/docker/debian9/Dockerfile -------------------------===//
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===//

# Setup the base builder image with the packages we'll need to build GCC and Clang from source.
FROM launcher.gcr.io/google/debian9:latest as builder-base
LABEL maintainer "libc++ Developers"

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      ca-certificates \
      gnupg \
      build-essential \
      wget \
      subversion \
      unzip \
      automake \
      python \
      cmake \
      ninja-build \
      curl \
      git \
      gcc-multilib \
      g++-multilib \
      libc6-dev \
      bison \
      flex \
      libtool \
      autoconf \
      binutils-dev \
      binutils-gold \
      software-properties-common && \
  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \
  update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10

# Build GCC 4.9 for testing our C++11 against
FROM builder-base as gcc-49-builder
LABEL maintainer "libc++ Developers"

ADD scripts/build_gcc.sh /tmp/build_gcc.sh

RUN git clone --depth=1 --branch gcc-4_9_4-release git://gcc.gnu.org/git/gcc.git /tmp/gcc-4.9.4
RUN cd /tmp/gcc-4.9.4/ && ./contrib/download_prerequisites
RUN /tmp/build_gcc.sh --source /tmp/gcc-4.9.4 --to /opt/gcc-4.9.4

# Build GCC ToT for testing in all dialects.
FROM builder-base as gcc-tot-builder
LABEL maintainer "libc++ Developers"

ADD scripts/build_gcc.sh /tmp/build_gcc.sh

RUN git clone --depth=1 git://gcc.gnu.org/git/gcc.git /tmp/gcc-tot
RUN cd /tmp/gcc-tot && ./contrib/download_prerequisites
RUN /tmp/build_gcc.sh --source /tmp/gcc-tot --to /opt/gcc-tot

# Build LLVM 4.0 which is used to test against a "legacy" compiler.
FROM builder-base as llvm-4-builder
LABEL maintainer "libc++ Developers"

ADD scripts/checkout_git.sh /tmp/checkout_git.sh
ADD scripts/build_install_llvm.sh /tmp/build_install_llvm.sh

RUN /tmp/checkout_git.sh --to /tmp/llvm-4.0 -p clang -p compiler-rt --branch release_40
RUN /tmp/build_install_llvm.sh \
    --install /opt/llvm-4.0 \
    --source /tmp/llvm-4.0 \
    --build /tmp/build-llvm-4.0 \
    -i install-clang -i install-clang-headers \
    -i install-compiler-rt \
    -- \
    -DCMAKE_BUILD_TYPE=RELEASE \
    -DLLVM_ENABLE_ASSERTIONS=ON

# Stage 2. Produce a minimal release image with build results.
FROM launcher.gcr.io/google/debian9:latest
LABEL maintainer "libc++ Developers"

# Copy over the GCC and Clang installations
COPY --from=gcc-49-builder /opt/gcc-4.9.4 /opt/gcc-4.9.4
COPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot
COPY --from=llvm-4-builder /opt/llvm-4.0 /opt/llvm-4.0

RUN ln -s /opt/gcc-4.9.4/bin/gcc /usr/local/bin/gcc-4.9 && \
    ln -s /opt/gcc-4.9.4/bin/g++ /usr/local/bin/g++-4.9

RUN apt-get update && \
    apt-get install -y \
      ca-certificates \
      gnupg \
      build-essential \
      apt-transport-https \
      curl \
      software-properties-common

RUN apt-get install -y --no-install-recommends \
    systemd \
    sysvinit-utils \
    cmake \
    subversion \
    git \
    ninja-build \
    gcc-multilib \
    g++-multilib \
    python \
    buildbot-slave

ADD scripts/install_clang_packages.sh /tmp/install_clang_packages.sh
RUN /tmp/install_clang_packages.sh && rm /tmp/install_clang_packages.sh

RUN git clone https://git.llvm.org/git/libcxx.git /libcxx