diff --git a/.ci/ccache.conf b/.ci/ccache.conf new file mode 100644 index 0000000000..e9913800ca --- /dev/null +++ b/.ci/ccache.conf @@ -0,0 +1,7 @@ +max_size = 500M +compression = true +compression_level = 1 +sloppiness = time_macros,include_file_mtime,include_file_ctime,file_macro +run_second_cpp = false +hash_dir = false + diff --git a/.ci/ci-ccache-stats.sh b/.ci/ci-ccache-stats.sh new file mode 100755 index 0000000000..76b270488c --- /dev/null +++ b/.ci/ci-ccache-stats.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +if [ "$DISTRO" != "" ] ; then + docker exec $(cat $HOME/cid) ccache -s +else + ccache -s +fi diff --git a/.ci/ci-configure.sh b/.ci/ci-configure.sh index 28897dafcc..86e280ec5f 100755 --- a/.ci/ci-configure.sh +++ b/.ci/ci-configure.sh @@ -49,7 +49,10 @@ if [ "$DISTRO" != "" ] ; then if [ "$1" = "release-ready" ]; then OPTS="$OPTS $RELEASE_READY_LINUX_COPTS" fi - docker run --env MAKEFLAGS="-j5" --env EIO_MONITOR_POLL=1 -v `pwd`:/src -w /src stefanschmidt1/ci-support-files:$DISTRO ./autogen.sh $OPTS + docker exec $(cat $HOME/cid) sh -c 'rm -f ~/.ccache/ccache.conf' + docker exec --env MAKEFLAGS="-j5" --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \ + --env CXX="ccache g++" --env CFLAGS="-fdirectives-only" --env CXXFLAGS="-fdirectives-only" \ + $(cat $HOME/cid) ./autogen.sh $OPTS else OSX_COPTS="--disable-cxx-bindings" @@ -57,11 +60,13 @@ else mkdir -p ~/Library/LaunchAgents ln -sfv /usr/local/opt/d-bus/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist - export PATH="$(brew --prefix gettext)/bin:$PATH" + export PATH="/usr/local/opt/ccache/libexec:$(brew --prefix gettext)/bin:$PATH" - export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS" + export CFLAGS="-I/usr/local/opt/openssl/include -frewrite-includes $CFLAGS" + export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS" export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS" # Normal build test of all targets + rm -f ~/.ccache/ccache.conf ./autogen.sh $OSX_COPTS fi diff --git a/.ci/ci-make-distcheck.sh b/.ci/ci-make-distcheck.sh index 144b95782e..a00de9911c 100755 --- a/.ci/ci-make-distcheck.sh +++ b/.ci/ci-make-distcheck.sh @@ -7,7 +7,10 @@ if [ "$1" != "release-ready" ] ; then fi if [ "$DISTRO" != "" ] ; then - docker exec --env MAKEFLAGS="-j5" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) make distcheck + docker exec --env MAKEFLAGS="-j5" --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \ + --env CXX="ccache g++" \ + --env CFLAGS="-fdirectives-only" --env CXXFLAGS="-fdirectives-only" \ + $(cat $HOME/cid) make distcheck else export PATH="/usr/local/opt/ccache/libexec:$(brew --prefix gettext)/bin:$PATH" make diff --git a/.ci/ci-osx-deps.sh b/.ci/ci-osx-deps.sh index 859842624e..95872f82f3 100755 --- a/.ci/ci-osx-deps.sh +++ b/.ci/ci-osx-deps.sh @@ -2,4 +2,4 @@ brew update brew unlink python -brew install gettext check bullet dbus fontconfig freetype fribidi gst-plugins-good gstreamer luajit openssl webp libsndfile glib libspectre libraw librsvg poppler lz4 pulseaudio +brew install gettext check bullet dbus fontconfig freetype fribidi gst-plugins-good gstreamer luajit openssl webp libsndfile glib libspectre libraw librsvg poppler lz4 pulseaudio ccache diff --git a/.ci/ci-setup-ccache.sh b/.ci/ci-setup-ccache.sh new file mode 100755 index 0000000000..0a5087883f --- /dev/null +++ b/.ci/ci-setup-ccache.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +if [ "$DISTRO" != "" ] ; then + docker exec $(cat $HOME/cid) sh -c ".ci/docker-ccache-setup.sh $1" + docker exec $(cat $HOME/cid) ccache -pz +else + cp .ci/ccache.conf ~/.ccache + ccache -o base_dir="$(pwd)" + ccache -pz +fi diff --git a/.ci/docker-ccache-setup.sh b/.ci/docker-ccache-setup.sh new file mode 100755 index 0000000000..748e743bf9 --- /dev/null +++ b/.ci/docker-ccache-setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +CI_BUILD_TYPE="$1" + +cp .ci/ccache.conf ~/.ccache + +if [ "$1" = "release-ready" ] ; then + ccache -o base_dir="$(pwd)/$(grep '^PACKAGE_STRING' config.log|cut -d\' -f2|tr ' ' -)" +else + ccache -o base_dir=$(pwd) +fi diff --git a/.travis.yml b/.travis.yml index 817e4f177f..f3ba713f01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: c - +cache: ccache sudo: required dist: trusty @@ -11,6 +11,8 @@ env: global: - MAKEFLAGS="-j5" - EIO_MONITOR_POLL=1 + - CC="ccache gcc" + - CXX="ccache g++" matrix: - - DISTRO=Ubuntu1804 @@ -70,12 +72,15 @@ before_script: - | if [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then docker version - docker run --cidfile $HOME/cid -t -d -v `pwd`:/src -w /src stefanschmidt1/ci-support-files:$DISTRO bash + docker run --cidfile $HOME/cid -t -d -v `pwd`:/src -v $HOME/.ccache:/root/.ccache -w /src stefanschmidt1/ci-support-files:$DISTRO bash cat $HOME/cid fi + - .ci/ci-ccache-stats.sh + script: - .ci/ci-configure.sh "$CI_BUILD_TYPE" + - .ci/ci-setup-ccache.sh "$CI_BUILD_TYPE" - .ci/ci-make.sh "$CI_BUILD_TYPE" - .ci/ci-make-checkbuild.sh "$CI_BUILD_TYPE" - .ci/ci-make-examples.sh "$CI_BUILD_TYPE" @@ -91,6 +96,13 @@ script: elif [[ "$CI_BUILD_TYPE" != "release-ready" ]] ; then docker exec --env MAKEFLAGS="-j5" --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) .ci/build-efl-app.sh fi +before_cache: + - .ci/ci-ccache-stats.sh + - | + if [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then + sudo chown travis:travis $HOME/.ccache + else + fi after_success: - |