diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-07-23 12:36:38 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-07-25 11:34:59 +0200 |
commit | 95a2d5b0449fcd38113c494fa8e7c4bbe7b24bf2 (patch) | |
tree | a799e769b92a57488e71ab124a204ad3293f17a4 /ci | |
parent | 0e0b396af4dcf739636995e7ece298597c219d2e (diff) | |
download | mpv-95a2d5b0449fcd38113c494fa8e7c4bbe7b24bf2.tar.bz2 mpv-95a2d5b0449fcd38113c494fa8e7c4bbe7b24bf2.tar.xz |
ci/mingw: use ccache
Can significantly reduce build time, most of dependencies have fixed
versions, so they can be cached fully. Others will be incrementally
build.
Cache is saved on every run and restored from the newest one. Size is
limited to 500M (compressed) to keep cache save/restore fast. Clean
cached build is little over 100M, so we have a headroom as things will
grow. ccache will automatically evict least recently used entries.
It is unlikely that clean build will exceed the limit anytime soon, but
it is something to keep in mind, as we do not want to evict cache
entries from current build, so the cache size need to be set correctly.
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/build-mingw64.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh index 97cd25ec36..fad99e5304 100755 --- a/ci/build-mingw64.sh +++ b/ci/build-mingw64.sh @@ -29,8 +29,8 @@ cat >"$prefix_dir/crossfile" <<EOF buildtype = 'release' wrap_mode = 'nodownload' [binaries] -c = '${CC}' -cpp = '${CXX}' +c = ['ccache', '${CC}'] +cpp = ['ccache', '${CXX}'] ar = '${AR}' strip = '${TARGET}-strip' pkgconfig = 'pkg-config' @@ -43,6 +43,9 @@ cpu = '${TARGET%%-*}' endian = 'little' EOF +export CC="ccache $CC" +export CXX="ccache $CXX" + function builddir () { [ -d "$1/builddir" ] && rm -rf "$1/builddir" mkdir -p "$1/builddir" @@ -82,7 +85,7 @@ if [ ! -e "$prefix_dir/lib/libz.dll.a" ]; then gettar "https://zlib.net/fossils/zlib-${ver}.tar.gz" pushd zlib-${ver} make -fwin32/Makefile.gcc clean - make -fwin32/Makefile.gcc PREFIX=$TARGET- SHARED_MODE=1 \ + make -fwin32/Makefile.gcc PREFIX=$TARGET- CC="$CC" SHARED_MODE=1 \ DESTDIR="$prefix_dir" install \ BINARY_PATH=/bin INCLUDE_PATH=/include LIBRARY_PATH=/lib popd @@ -94,7 +97,7 @@ if [ ! -e "$prefix_dir/lib/libavcodec.dll.a" ]; then builddir ffmpeg ../configure --pkg-config=pkg-config --target-os=mingw32 \ --enable-cross-compile --cross-prefix=$TARGET- --arch=${TARGET%%-*} \ - $commonflags \ + --cc="$CC" --cxx="$CXX" $commonflags \ --disable-{doc,programs,muxers,encoders,devices} makeplusinstall popd @@ -179,11 +182,11 @@ fi if [ ! -e "$prefix_dir/lib/libluajit-5.1.a" ]; then $gitclone https://github.com/LuaJIT/LuaJIT.git pushd LuaJIT - hostcc=cc + hostcc="ccache cc" flags= [[ "$TARGET" == "i686-"* ]] && { hostcc="$hostcc -m32"; flags=XCFLAGS=-DLUAJIT_NO_UNWIND; } make TARGET_SYS=Windows clean - make TARGET_SYS=Windows HOST_CC="$hostcc" CROSS=$TARGET- \ + make TARGET_SYS=Windows HOST_CC="$hostcc" CROSS="ccache $TARGET-" \ BUILDMODE=static $flags amalg make DESTDIR="$prefix_dir" INSTALL_DEP= FILE_T=luajit.exe install popd |