]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improve building via Docker
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 6 Aug 2020 14:21:52 +0000 (16:21 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 6 Aug 2020 14:23:15 +0000 (16:23 +0200)
- Simplified names (e.g. ubuntu-14-trusty -> ubuntu-14.04,
  debian-9-stretch -> debian-9).
- Enabled debian-9 in misc/test-all-systems since it works.
- Renamed centos to centos-7.
- Added centos-8 and fedora-32.
- Updated dockerfiles/README to match reality after the conversion to
  CMake.
- Cleaned up Dockerfiles.
- Improved misc/test-all-systems.
- Removed unsupported Clang build for alpine-3.4, centos-7 and
  ubuntu-14.04.

21 files changed:
CMakeLists.txt
dockerfiles/README
dockerfiles/alpine-3.12/Dockerfile
dockerfiles/alpine-3.4/Dockerfile
dockerfiles/centos-7/Dockerfile [new file with mode: 0644]
dockerfiles/centos-8/Dockerfile [new file with mode: 0644]
dockerfiles/centos/Dockerfile [deleted file]
dockerfiles/debian-10-buster/Dockerfile [deleted file]
dockerfiles/debian-10/Dockerfile [new file with mode: 0644]
dockerfiles/debian-9-stretch/Dockerfile [deleted file]
dockerfiles/debian-9/Dockerfile [new file with mode: 0644]
dockerfiles/fedora-32/Dockerfile [new file with mode: 0644]
dockerfiles/fedora/Dockerfile [deleted file]
dockerfiles/ubuntu-14-trusty/Dockerfile [deleted file]
dockerfiles/ubuntu-14.04/Dockerfile [new file with mode: 0644]
dockerfiles/ubuntu-16-xenial/Dockerfile [deleted file]
dockerfiles/ubuntu-16.04/Dockerfile [new file with mode: 0644]
dockerfiles/ubuntu-20-focal/Dockerfile [deleted file]
dockerfiles/ubuntu-20.04/Dockerfile [new file with mode: 0644]
misc/build-in-docker
misc/test-all-systems

index d5e02476e554b034bd1e0b5afc65635039310dcc..1f595083c05b281cfd6612c8976576b65f3ace21 100644 (file)
@@ -113,7 +113,7 @@ find_program(
 mark_as_advanced(CLANG_FORMAT_EXE) # Don't show in CMake UIs
 
 if(NOT CLANG_FORMAT_EXE)
-  message(WARNING "clang-format not found")
+  message(NOTICE "clang-format not found")
 else()
   add_custom_target(
     format
index 622be5c31ce4ce0b1bd46eba99c803a5910af061..c7923984d1ffcd148f4112ad611a0e9517a8b4cc 100644 (file)
@@ -1,14 +1,11 @@
 This directory contains Dockerfiles for building and testing ccache in
-different build environments. They have all the requirements needed as per
-doc/INSTALL.md.
+different build environments.
 
-For instance, run something like this to build ccache in Ubuntu:
+For instance, run something like this to build ccache in Ubuntu 20.04:
 
-    make docker BUILDENV=ubuntu
+    misc/build-in-docker ubuntu-20-focal
 
-The above command will first build the Ubuntu Docker image if needed and
+The above command will first build the Ubuntu 20.04 Docker image if needed and
 finally build ccache and run the ccache test suite.
 
-You can also download prebuilt Docker images like this:
-
-    docker pull ccache/build:$BUILDENV
+See also misc/test-all-systems.
index b90d7c2b9808af04fc7479124185eb8adf09ba89..324921a0de3a776ab2641fb70e76f8d856859773 100644 (file)
@@ -1,18 +1,17 @@
 FROM alpine:3.12
 
 RUN apk add --no-cache \
-                asciidoc \
-                bash \
-                ccache \
-                clang \
-                cmake \
-                elfutils \
-                g++ \
-                gcc \
-                libc-dev \
-                make \
-                perl \
-                zstd-dev
+        bash \
+        ccache \
+        clang \
+        cmake \
+        elfutils \
+        g++ \
+        gcc \
+        libc-dev \
+        make \
+        perl \
+        zstd-dev
 
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
index b178a08b4f546200150a8c8791a9a63096853b98..ad42a0042685b39df7f36f8e85ccc3fa7590f146 100644 (file)
@@ -3,17 +3,14 @@
 FROM alpine:3.4
 
 RUN apk add --no-cache \
-                asciidoc \
-                bash \
-                ccache \
-                # clang \
-                cmake \
-                # elfutils \ (available since Alpine 3.7)
-                g++ \
-                gcc \
-                libc-dev \
-                make \
-                perl
+        bash \
+        ccache \
+        cmake \
+        g++ \
+        gcc \
+        libc-dev \
+        make \
+        perl
 
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
diff --git a/dockerfiles/centos-7/Dockerfile b/dockerfiles/centos-7/Dockerfile
new file mode 100644 (file)
index 0000000..89a122f
--- /dev/null
@@ -0,0 +1,21 @@
+FROM centos:7
+
+RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
+ && yum install -y \
+        asciidoc \
+        autoconf \
+        bash \
+        ccache \
+        clang \
+        cmake3 \
+        elfutils \
+        gcc \
+        gcc-c++ \
+        libzstd-devel \
+        make \
+# Remove superfluous dependencies brought in by asciidoc:
+ && rpm -e --nodeps graphviz \
+ && yum autoremove -y \
+ && yum clean all \
+ && cp /usr/bin/cmake3 /usr/bin/cmake \
+ && cp /usr/bin/ctest3 /usr/bin/ctest
diff --git a/dockerfiles/centos-8/Dockerfile b/dockerfiles/centos-8/Dockerfile
new file mode 100644 (file)
index 0000000..b7ab38f
--- /dev/null
@@ -0,0 +1,17 @@
+FROM centos:8
+
+RUN dnf install -y epel-release \
+ && dnf install -y \
+        asciidoc \
+        autoconf \
+        bash \
+        ccache \
+        clang \
+        cmake \
+        diffutils \
+        elfutils \
+        gcc \
+        gcc-c++ \
+        libzstd-devel \
+        make \
+ && dnf clean all
diff --git a/dockerfiles/centos/Dockerfile b/dockerfiles/centos/Dockerfile
deleted file mode 100644 (file)
index 66e0694..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-FROM centos:latest
-
-# note: graphviz adds libX11... :'‑(
-RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
-        && yum install -y \
-                gcc \
-                make \
-                bash \
-                build-essential \
-                cmake \
-                asciidoc \
-                autoconf \
-                libzstd-devel \
-        && rpm -e --nodeps graphviz \
-        && yum autoremove -y \
-        && yum clean all
diff --git a/dockerfiles/debian-10-buster/Dockerfile b/dockerfiles/debian-10-buster/Dockerfile
deleted file mode 100644 (file)
index 7508ad5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM debian:10
-
-# Separate layer because this is required no matter what
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
-        && rm -rf /var/lib/apt/lists/*
-
-# All the rest
-RUN apt-get update && apt-get install -y --no-install-recommends \
-                asciidoc \
-                bash \
-                build-essential \
-                ccache \
-                clang \
-                cmake \
-                elfutils \
-                gcc-multilib \
-                libzstd-dev \
-                xsltproc \
-        && rm -rf /var/lib/apt/lists/*
-
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
diff --git a/dockerfiles/debian-10/Dockerfile b/dockerfiles/debian-10/Dockerfile
new file mode 100644 (file)
index 0000000..703bdc9
--- /dev/null
@@ -0,0 +1,17 @@
+FROM debian:10
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+        bash \
+        build-essential \
+        ccache \
+        clang \
+        cmake \
+        elfutils \
+        gcc-multilib \
+        libzstd-dev \
+        xsltproc \
+ && rm -rf /var/lib/apt/lists/*
+
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
diff --git a/dockerfiles/debian-9-stretch/Dockerfile b/dockerfiles/debian-9-stretch/Dockerfile
deleted file mode 100644 (file)
index 96d3cfd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM debian:9
-
-# Separate layer because this is required no matter what
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
-        && rm -rf /var/lib/apt/lists/*
-
-# All the rest
-RUN apt-get update && apt-get install -y --no-install-recommends \
-                asciidoc \
-                bash \
-                build-essential \
-                ccache \
-                clang \
-                cmake \
-                elfutils \
-                gcc-multilib \
-                libzstd-dev \
-                xsltproc \
-        && rm -rf /var/lib/apt/lists/*
-
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
diff --git a/dockerfiles/debian-9/Dockerfile b/dockerfiles/debian-9/Dockerfile
new file mode 100644 (file)
index 0000000..b4c6585
--- /dev/null
@@ -0,0 +1,17 @@
+FROM debian:9
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+        bash \
+        build-essential \
+        ccache \
+        clang \
+        cmake \
+        elfutils \
+        gcc-multilib \
+        libzstd-dev \
+        xsltproc \
+ && rm -rf /var/lib/apt/lists/*
+
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
diff --git a/dockerfiles/fedora-32/Dockerfile b/dockerfiles/fedora-32/Dockerfile
new file mode 100644 (file)
index 0000000..65c883d
--- /dev/null
@@ -0,0 +1,16 @@
+FROM fedora:32
+
+RUN dnf install -y \
+        autoconf \
+        bash \
+        ccache \
+        clang \
+        cmake \
+        diffutils \
+        elfutils \
+        findutils \
+        gcc \
+        gcc-c++ \
+        libzstd-devel \
+        make \
+ && dnf clean all
diff --git a/dockerfiles/fedora/Dockerfile b/dockerfiles/fedora/Dockerfile
deleted file mode 100644 (file)
index 037fb6a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM fedora:latest
-
-# note: graphviz adds libX11... :'‑(
-RUN dnf install -y \
-                gcc \
-                make findutils \
-                bash \
-                asciidoc \
-                autoconf \
-                build-essential \
-                cmake \
-                libzstd-devel \
-        && rpm -e --nodeps graphviz \
-        && dnf autoremove -y \
-        && dnf clean all
diff --git a/dockerfiles/ubuntu-14-trusty/Dockerfile b/dockerfiles/ubuntu-14-trusty/Dockerfile
deleted file mode 100644 (file)
index 57711f9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-FROM ubuntu:trusty
-
-# Separate layer because this is required no matter what
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
-        && rm -rf /var/lib/apt/lists/*
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-                asciidoc \
-                bash \
-                ccache \
-                clang \
-                curl \
-                elfutils \
-                gcc-multilib \
-                wget \
-                xsltproc \
-        && rm -rf /var/lib/apt/lists/*
-
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
-
-# Preinstalled cmake it too old (2.8.12.2)
-RUN curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | sudo tar -xzC /opt
-RUN cp -a /opt/cmake-3.5.2-Linux-x86_64/bin /usr/local
-RUN cp -a /opt/cmake-3.5.2-Linux-x86_64/share /usr/local
diff --git a/dockerfiles/ubuntu-14.04/Dockerfile b/dockerfiles/ubuntu-14.04/Dockerfile
new file mode 100644 (file)
index 0000000..2b2c297
--- /dev/null
@@ -0,0 +1,23 @@
+FROM ubuntu:14.04
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+        asciidoc \
+        bash \
+        build-essential \
+        ccache \
+        clang \
+        curl \
+        elfutils \
+        gcc-multilib \
+        wget \
+        xsltproc \
+ && rm -rf /var/lib/apt/lists/*
+
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
+
+# The distribution's CMake it too old (2.8.12.2).
+RUN curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | sudo tar -xzC /opt \
+ && cp -a /opt/cmake-3.5.2-Linux-x86_64/bin /usr/local \
+ && cp -a /opt/cmake-3.5.2-Linux-x86_64/share /usr/local
diff --git a/dockerfiles/ubuntu-16-xenial/Dockerfile b/dockerfiles/ubuntu-16-xenial/Dockerfile
deleted file mode 100644 (file)
index b149956..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-FROM ubuntu:xenial
-
-# Separate layer because this is required no matter what
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
-        && rm -rf /var/lib/apt/lists/*
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-                asciidoc \
-                bash \
-                ccache \
-                clang \
-                cmake \
-                elfutils \
-                gcc-multilib \
-                libzstd1-dev \
-                xsltproc \
-        && rm -rf /var/lib/apt/lists/*
-
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
diff --git a/dockerfiles/ubuntu-16.04/Dockerfile b/dockerfiles/ubuntu-16.04/Dockerfile
new file mode 100644 (file)
index 0000000..a7f096c
--- /dev/null
@@ -0,0 +1,18 @@
+FROM ubuntu:16.04
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+        asciidoc \
+        bash \
+        build-essential \
+        ccache \
+        clang \
+        cmake \
+        elfutils \
+        gcc-multilib \
+        libzstd1-dev \
+        xsltproc \
+ && rm -rf /var/lib/apt/lists/*
+
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
diff --git a/dockerfiles/ubuntu-20-focal/Dockerfile b/dockerfiles/ubuntu-20-focal/Dockerfile
deleted file mode 100644 (file)
index b9dcbc2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-FROM ubuntu:focal
-
-# Separate layer because this is required no matter what
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
-        && rm -rf /var/lib/apt/lists/*
-
-# noninteractive: do not set up timezone settings.
-RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
-                asciidoc \
-                bash \
-                ccache \
-                clang \
-                cmake \
-                elfutils \
-                gcc-multilib \
-                #libzstd1-dev \ not available?!
-                xsltproc \
-        && rm -rf /var/lib/apt/lists/*
-
-# redirect all compilers to ccache
-RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t;  done
diff --git a/dockerfiles/ubuntu-20.04/Dockerfile b/dockerfiles/ubuntu-20.04/Dockerfile
new file mode 100644 (file)
index 0000000..c5ec49c
--- /dev/null
@@ -0,0 +1,19 @@
+FROM ubuntu:20.04
+
+# Non-interactive: do not set up timezone settings.
+RUN apt-get update \
+ && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
+        asciidoc \
+        bash \
+        build-essential \
+        ccache \
+        clang \
+        cmake \
+        elfutils \
+        gcc-multilib \
+        libzstd-dev \
+        xsltproc \
+ && rm -rf /var/lib/apt/lists/*
+
+# Redirect all compilers to ccache.
+RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done
index 53a7a9b304f297a567c4535a9a3326809f04640b..ad30ea87877c66278f0ce2fd7ae8415b6c7fcf16 100755 (executable)
@@ -22,6 +22,8 @@ name=${1}
 shift
 
 tag="ccache-build:$name"
+command="${COMMAND:-/source/ci/build}"
+interactive="${INTERACTIVE:+--interactive --tty}"
 
 # Build (if not exists):
 docker build -t "$tag" "dockerfiles/$name"
@@ -30,7 +32,8 @@ docker build -t "$tag" "dockerfiles/$name"
 mkdir -p build-in-docker
 mkdir -p build-in-docker/docker-ccache
 
-docker run --rm \
+docker run \
+    --rm \
     --volume "$PWD:/source" \
     --volume "$PWD/build-in-docker/docker-ccache:/ccache" \
     --tmpfs /builddir:rw,exec \
@@ -49,5 +52,6 @@ docker run --rm \
     --env SCAN_BUILD="${SCAN_BUILD:-}" \
     --env SPECIAL="${SPECIAL:-}" \
     --env VERBOSE="${VERBOSE:-}" \
+    $interactive \
     "$tag" \
-    /source/ci/build "$@"
+    "$command" "$@"
index 131fee95cefb5d3259679d4b4b10c4cba34c8efe..2dc0da9e11f17f7701f4958d1d45db0035f958e2 100755 (executable)
@@ -1,52 +1,51 @@
 #!/bin/sh
-
-set -eu
-
+#
 # While it's obviously quite impossible to support and test every single
 # distribution, this script enables easy checking of the most common standard
 # distributions at least.
 
-# Note: Currently this is more a reference on how to run each instance, instead
-# of running this entire script at once. See next steps.
-
-# Next steps:
-# * Run compilation, tests and/or docker instances in parallel to improve
-#   runtime.
+set -eu
 
 build_in_docker=$(dirname $0)/build-in-docker
 
-# -------------------------------------------------------------------------------
-# Debian
+build() {
+    local name=$1
+    local cc=$2
+    local cxx=$3
+    local test_cc=$4
+    shift 4
+    echo "Build in Docker: $name CC=$cc CXX=$cxx TEST_CC=$test_cc CMAKE_PARAMS=\"$*\""
+    ASM=$cc CC=$cc CXX=$cxx TEST_CC=$test_cc CMAKE_PARAMS="$*" $build_in_docker $name
+}
+
+#     NAME         CC    CXX     TEST_CC CMAKE_PARAMS
+
+build debian-9     gcc   g++     gcc
+build debian-9     clang clang++ clang
 
-# See https://github.com/ccache/ccache/issues/602
-#CC=gcc   CXX=g++     $build_in_docker debian-9-stretch
-#CC=clang CXX=clang++ $build_in_docker debian-9-stretch
+build debian-10    gcc   g++     gcc
+build debian-10    clang clang++ clang
 
-CC=gcc   CXX=g++     $build_in_docker debian-10-buster
-CC=clang CXX=clang++ $build_in_docker debian-10-buster
+build ubuntu-14.04 gcc   g++     gcc     -DZSTD_FROM_INTERNET=ON
+build ubuntu-14.04 gcc   g++     clang   -DZSTD_FROM_INTERNET=ON
 
-# -------------------------------------------------------------------------------
-# Ubuntu (ancient, old and latest)
+build ubuntu-16.04 gcc   g++     gcc
+build ubuntu-16.04 clang clang++ clang
 
-# zstd not available for Ubuntu 14.
-CC=gcc   CXX=g++     CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker ubuntu-14-trusty
+build ubuntu-20.04 gcc   g++     gcc
+build ubuntu-20.04 clang clang++ clang
 
-# See https://github.com/ccache/ccache/issues/601
-#CC=clang CXX=clang++ CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker ubuntu-14-tusty
+build centos-7     gcc   g++     gcc     -DWARNINGS_AS_ERRORS=false
+build centos-7     gcc   g++     clang   -DWARNINGS_AS_ERRORS=false
 
-CC=gcc   CXX=g++     $build_in_docker ubuntu-16-xenial
-CC=clang CXX=clang++ $build_in_docker ubuntu-16-xenial
+build centos-8     gcc   g++     gcc
+build centos-8     clang clang++ clang
 
-CC=gcc   CXX=g++     CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker ubuntu-20-focal
-CC=clang CXX=clang++ CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker ubuntu-20-focal
+build fedora-32    gcc   g++     gcc
+build fedora-32    clang clang++ clang
 
-# -------------------------------------------------------------------------------
-# Alpine (old and latest)
+build alpine-3.4   gcc   g++     gcc     -DZSTD_FROM_INTERNET=ON
+build alpine-3.4   gcc   g++     clang   -DZSTD_FROM_INTERNET=ON
 
-CC=gcc   CXX=g++     CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker alpine-3.4
-# Clang is not capable to compile libzstd from internet before alpine 3.12 (some
-# SSE2 error regarding missing file emmintrin.h)
-#CC=clang CXX=clang++ CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker alpine-3.4
-CC=clang CXX=clang++ CMAKE_PARAMS="-DZSTD_FROM_INTERNET=ON" $build_in_docker alpine-3.12
-CC=gcc   CXX=g++     $build_in_docker alpine-3.12
-CC=clang CXX=clang++ $build_in_docker alpine-3.12
+build alpine-3.12  gcc   g++     gcc
+build alpine-3.12  clang clang++ clang