1*58b9f456SAndroid Build Coastguard Worker#===- libcxx/utils/docker/debian9/Dockerfile -------------------------===// 2*58b9f456SAndroid Build Coastguard Worker# 3*58b9f456SAndroid Build Coastguard Worker# The LLVM Compiler Infrastructure 4*58b9f456SAndroid Build Coastguard Worker# 5*58b9f456SAndroid Build Coastguard Worker# This file is distributed under the University of Illinois Open Source 6*58b9f456SAndroid Build Coastguard Worker# License. See LICENSE.TXT for details. 7*58b9f456SAndroid Build Coastguard Worker# 8*58b9f456SAndroid Build Coastguard Worker#===----------------------------------------------------------------------===// 9*58b9f456SAndroid Build Coastguard Worker 10*58b9f456SAndroid Build Coastguard Worker# Setup the base builder image with the packages we'll need to build GCC and Clang from source. 11*58b9f456SAndroid Build Coastguard WorkerFROM launcher.gcr.io/google/debian9:latest as builder-base 12*58b9f456SAndroid Build Coastguard WorkerLABEL maintainer "libc++ Developers" 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard WorkerRUN apt-get update && \ 15*58b9f456SAndroid Build Coastguard Worker apt-get install -y --no-install-recommends \ 16*58b9f456SAndroid Build Coastguard Worker ca-certificates \ 17*58b9f456SAndroid Build Coastguard Worker gnupg \ 18*58b9f456SAndroid Build Coastguard Worker build-essential \ 19*58b9f456SAndroid Build Coastguard Worker wget \ 20*58b9f456SAndroid Build Coastguard Worker subversion \ 21*58b9f456SAndroid Build Coastguard Worker unzip \ 22*58b9f456SAndroid Build Coastguard Worker automake \ 23*58b9f456SAndroid Build Coastguard Worker python \ 24*58b9f456SAndroid Build Coastguard Worker cmake \ 25*58b9f456SAndroid Build Coastguard Worker ninja-build \ 26*58b9f456SAndroid Build Coastguard Worker curl \ 27*58b9f456SAndroid Build Coastguard Worker git \ 28*58b9f456SAndroid Build Coastguard Worker gcc-multilib \ 29*58b9f456SAndroid Build Coastguard Worker g++-multilib \ 30*58b9f456SAndroid Build Coastguard Worker libc6-dev \ 31*58b9f456SAndroid Build Coastguard Worker bison \ 32*58b9f456SAndroid Build Coastguard Worker flex \ 33*58b9f456SAndroid Build Coastguard Worker libtool \ 34*58b9f456SAndroid Build Coastguard Worker autoconf \ 35*58b9f456SAndroid Build Coastguard Worker binutils-dev \ 36*58b9f456SAndroid Build Coastguard Worker binutils-gold \ 37*58b9f456SAndroid Build Coastguard Worker software-properties-common && \ 38*58b9f456SAndroid Build Coastguard Worker update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \ 39*58b9f456SAndroid Build Coastguard Worker update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10 40*58b9f456SAndroid Build Coastguard Worker 41*58b9f456SAndroid Build Coastguard Worker# Build GCC 4.9 for testing our C++11 against 42*58b9f456SAndroid Build Coastguard WorkerFROM builder-base as gcc-49-builder 43*58b9f456SAndroid Build Coastguard WorkerLABEL maintainer "libc++ Developers" 44*58b9f456SAndroid Build Coastguard Worker 45*58b9f456SAndroid Build Coastguard WorkerADD scripts/build_gcc.sh /tmp/build_gcc.sh 46*58b9f456SAndroid Build Coastguard Worker 47*58b9f456SAndroid Build Coastguard WorkerRUN git clone --depth=1 --branch gcc-4_9_4-release git://gcc.gnu.org/git/gcc.git /tmp/gcc-4.9.4 48*58b9f456SAndroid Build Coastguard WorkerRUN cd /tmp/gcc-4.9.4/ && ./contrib/download_prerequisites 49*58b9f456SAndroid Build Coastguard WorkerRUN /tmp/build_gcc.sh --source /tmp/gcc-4.9.4 --to /opt/gcc-4.9.4 50*58b9f456SAndroid Build Coastguard Worker 51*58b9f456SAndroid Build Coastguard Worker# Build GCC ToT for testing in all dialects. 52*58b9f456SAndroid Build Coastguard WorkerFROM builder-base as gcc-tot-builder 53*58b9f456SAndroid Build Coastguard WorkerLABEL maintainer "libc++ Developers" 54*58b9f456SAndroid Build Coastguard Worker 55*58b9f456SAndroid Build Coastguard WorkerADD scripts/build_gcc.sh /tmp/build_gcc.sh 56*58b9f456SAndroid Build Coastguard Worker 57*58b9f456SAndroid Build Coastguard WorkerRUN git clone --depth=1 git://gcc.gnu.org/git/gcc.git /tmp/gcc-tot 58*58b9f456SAndroid Build Coastguard WorkerRUN cd /tmp/gcc-tot && ./contrib/download_prerequisites 59*58b9f456SAndroid Build Coastguard WorkerRUN /tmp/build_gcc.sh --source /tmp/gcc-tot --to /opt/gcc-tot 60*58b9f456SAndroid Build Coastguard Worker 61*58b9f456SAndroid Build Coastguard Worker# Build LLVM 4.0 which is used to test against a "legacy" compiler. 62*58b9f456SAndroid Build Coastguard WorkerFROM builder-base as llvm-4-builder 63*58b9f456SAndroid Build Coastguard WorkerLABEL maintainer "libc++ Developers" 64*58b9f456SAndroid Build Coastguard Worker 65*58b9f456SAndroid Build Coastguard WorkerADD scripts/checkout_git.sh /tmp/checkout_git.sh 66*58b9f456SAndroid Build Coastguard WorkerADD scripts/build_install_llvm.sh /tmp/build_install_llvm.sh 67*58b9f456SAndroid Build Coastguard Worker 68*58b9f456SAndroid Build Coastguard WorkerRUN /tmp/checkout_git.sh --to /tmp/llvm-4.0 -p clang -p compiler-rt --branch release_40 69*58b9f456SAndroid Build Coastguard WorkerRUN /tmp/build_install_llvm.sh \ 70*58b9f456SAndroid Build Coastguard Worker --install /opt/llvm-4.0 \ 71*58b9f456SAndroid Build Coastguard Worker --source /tmp/llvm-4.0 \ 72*58b9f456SAndroid Build Coastguard Worker --build /tmp/build-llvm-4.0 \ 73*58b9f456SAndroid Build Coastguard Worker -i install-clang -i install-clang-headers \ 74*58b9f456SAndroid Build Coastguard Worker -i install-compiler-rt \ 75*58b9f456SAndroid Build Coastguard Worker -- \ 76*58b9f456SAndroid Build Coastguard Worker -DCMAKE_BUILD_TYPE=RELEASE \ 77*58b9f456SAndroid Build Coastguard Worker -DLLVM_ENABLE_ASSERTIONS=ON 78*58b9f456SAndroid Build Coastguard Worker 79*58b9f456SAndroid Build Coastguard Worker# Stage 2. Produce a minimal release image with build results. 80*58b9f456SAndroid Build Coastguard WorkerFROM launcher.gcr.io/google/debian9:latest 81*58b9f456SAndroid Build Coastguard WorkerLABEL maintainer "libc++ Developers" 82*58b9f456SAndroid Build Coastguard Worker 83*58b9f456SAndroid Build Coastguard Worker# Copy over the GCC and Clang installations 84*58b9f456SAndroid Build Coastguard WorkerCOPY --from=gcc-49-builder /opt/gcc-4.9.4 /opt/gcc-4.9.4 85*58b9f456SAndroid Build Coastguard WorkerCOPY --from=gcc-tot-builder /opt/gcc-tot /opt/gcc-tot 86*58b9f456SAndroid Build Coastguard WorkerCOPY --from=llvm-4-builder /opt/llvm-4.0 /opt/llvm-4.0 87*58b9f456SAndroid Build Coastguard Worker 88*58b9f456SAndroid Build Coastguard WorkerRUN ln -s /opt/gcc-4.9.4/bin/gcc /usr/local/bin/gcc-4.9 && \ 89*58b9f456SAndroid Build Coastguard Worker ln -s /opt/gcc-4.9.4/bin/g++ /usr/local/bin/g++-4.9 90*58b9f456SAndroid Build Coastguard Worker 91*58b9f456SAndroid Build Coastguard WorkerRUN apt-get update && \ 92*58b9f456SAndroid Build Coastguard Worker apt-get install -y \ 93*58b9f456SAndroid Build Coastguard Worker ca-certificates \ 94*58b9f456SAndroid Build Coastguard Worker gnupg \ 95*58b9f456SAndroid Build Coastguard Worker build-essential \ 96*58b9f456SAndroid Build Coastguard Worker apt-transport-https \ 97*58b9f456SAndroid Build Coastguard Worker curl \ 98*58b9f456SAndroid Build Coastguard Worker software-properties-common 99*58b9f456SAndroid Build Coastguard Worker 100*58b9f456SAndroid Build Coastguard WorkerRUN apt-get install -y --no-install-recommends \ 101*58b9f456SAndroid Build Coastguard Worker systemd \ 102*58b9f456SAndroid Build Coastguard Worker sysvinit-utils \ 103*58b9f456SAndroid Build Coastguard Worker cmake \ 104*58b9f456SAndroid Build Coastguard Worker subversion \ 105*58b9f456SAndroid Build Coastguard Worker git \ 106*58b9f456SAndroid Build Coastguard Worker ninja-build \ 107*58b9f456SAndroid Build Coastguard Worker gcc-multilib \ 108*58b9f456SAndroid Build Coastguard Worker g++-multilib \ 109*58b9f456SAndroid Build Coastguard Worker python \ 110*58b9f456SAndroid Build Coastguard Worker buildbot-slave 111*58b9f456SAndroid Build Coastguard Worker 112*58b9f456SAndroid Build Coastguard WorkerADD scripts/install_clang_packages.sh /tmp/install_clang_packages.sh 113*58b9f456SAndroid Build Coastguard WorkerRUN /tmp/install_clang_packages.sh && rm /tmp/install_clang_packages.sh 114*58b9f456SAndroid Build Coastguard Worker 115*58b9f456SAndroid Build Coastguard WorkerRUN git clone https://git.llvm.org/git/libcxx.git /libcxx 116