summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-02 22:11:59 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-03 21:17:48 +0200
commit18cc01b63996f81b284e3bc827d1be7f3da8983a (patch)
tree0028a3fcd9d1ed12e131be93e6f740c7029c91ad
parentf1b55d3f8e963069fc798bcf559ae9af2bf18b64 (diff)
Add initial support for sccache builds on WNT
- gets auto-detected if an sccache binary is in the path - currently external projects using gcc-wrapper are _not_ cached - this needs fixing in the gcc-wrapper - current sccache versions won't work with -Fp (precompiled headers), so while sccache gets called, nothing really is cached. Best build with --enable-pch=no therefore. Change-Id: I78dd7e08ea20ae888236c8c8e8e7a25a405f23b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113530 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--config_host.mk.in2
-rw-r--r--configure.ac45
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk4
-rw-r--r--solenv/gbuild/platform/com_MSC_defs.mk2
4 files changed, 41 insertions, 12 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 705af6b42213..98995fd115e6 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -634,6 +634,8 @@ export TOUCH=@TOUCH@
export UCRTSDKDIR=@UCRTSDKDIR@
export UCRTVERSION=@UCRTVERSION@
export UCRT_REDISTDIR=@UCRT_REDISTDIR@
+export UNCACHED_CC=@UNCACHED_CC@
+export UNCACHED_CXX=@UNCACHED_CXX@
export USE_LD=@USE_LD@
export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
export USE_XINERAMA=@USE_XINERAMA@
diff --git a/configure.ac b/configure.ac
index d8d336860b29..3df488a662c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2939,11 +2939,28 @@ dnl ===================================================================
dnl Checks if ccache is available
dnl ===================================================================
CCACHE_DEPEND_MODE=
-if test "$_os" = "WINNT"; then
- # on windows/VC build do not use ccache
- CCACHE=""
-elif test "$enable_ccache" = "no"; then
+if test "$enable_ccache" = "no"; then
CCACHE=""
+elif test "$_os" = "WINNT"; then
+ # on windows/VC build do not use ccache - but perhaps sccache is around?
+ case "%$CC%$CXX%" in
+ # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
+ # assume that's good then
+ *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
+ AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
+ CCACHE_DEPEND_MODE=1
+ ;;
+ *)
+ # for sharing code below, reuse CCACHE env var
+ AC_PATH_PROG([CCACHE],[sccache],[not found])
+ if test "$CCACHE" = "not found"; then
+ CCACHE=""
+ else
+ CCACHE=`win_short_path_for_make "$CCACHE"`
+ CCACHE_DEPEND_MODE=1
+ fi
+ ;;
+ esac
elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
case "%$CC%$CXX%" in
# If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
@@ -2984,7 +3001,8 @@ if test "$enable_ccache" = "nodepend"; then
fi
AC_SUBST(CCACHE_DEPEND_MODE)
-if test "$CCACHE" != ""; then
+# skip on windows - sccache defaults are good enough
+if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
if test "$ccache_size" = ""; then
@@ -4141,6 +4159,7 @@ AC_SUBST(SHOWINCLUDES_PREFIX)
#
# prefix C with ccache if needed
#
+UNCACHED_CC="$CC"
if test "$CCACHE" != ""; then
AC_MSG_CHECKING([whether $CC_BASE is already ccached])
@@ -4151,7 +4170,7 @@ if test "$CCACHE" != ""; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[use_ccache=yes], [use_ccache=no])
CFLAGS=$save_CFLAGS
- if test $use_ccache = yes; then
+ if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
AC_MSG_RESULT([yes])
else
CC="$CCACHE $CC"
@@ -6584,6 +6603,7 @@ AC_SUBST(BOOST_CXXFLAGS)
#
# prefx CXX with ccache if needed
#
+UNCACHED_CXX="$CXX"
if test "$CCACHE" != ""; then
AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
AC_LANG_PUSH([C++])
@@ -6592,7 +6612,7 @@ if test "$CCACHE" != ""; then
dnl an empty program will do, we're checking the compiler flags
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[use_ccache=yes], [use_ccache=no])
- if test $use_ccache = yes; then
+ if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
AC_MSG_RESULT([yes])
else
CXX="$CCACHE $CXX"
@@ -8021,6 +8041,7 @@ AC_SUBST(MSVC_DLL_PATH)
AC_SUBST(MSVC_DLLS)
AC_SUBST(MSM_PATH)
+
dnl ===================================================================
dnl Checks for Java
dnl ===================================================================
@@ -11966,6 +11987,8 @@ fi
#
# prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
#
+UNCACHED_CLANG_CC="$LO_CLANG_CC"
+UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
AC_LANG_PUSH([C])
@@ -11978,7 +12001,7 @@ if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
[use_ccache=yes], [use_ccache=no])
CFLAGS=$save_CFLAGS
CC=$save_CC
- if test $use_ccache = yes; then
+ if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
AC_MSG_RESULT([yes])
else
LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
@@ -11995,7 +12018,7 @@ if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
dnl an empty program will do, we're checking the compiler flags
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[use_ccache=yes], [use_ccache=no])
- if test $use_ccache = yes; then
+ if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
AC_MSG_RESULT([yes])
else
LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
@@ -12006,8 +12029,12 @@ if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
AC_LANG_POP([C++])
fi
+AC_SUBST(UNCACHED_CC)
+AC_SUBST(UNCACHED_CXX)
AC_SUBST(LO_CLANG_CC)
AC_SUBST(LO_CLANG_CXX)
+AC_SUBST(UNCACHED_CLANG_CC)
+AC_SUBST(UNCACHED_CLANG_CXX)
AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 2f4e29c3ace1..3e2ea893ae08 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -612,10 +612,10 @@ endef
# /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe
gb_AUTOCONF_WRAPPERS = \
- REAL_CC="$(shell cygpath -w $(filter-out -%,$(CC)))" \
+ REAL_CC="$(shell cygpath -w $(filter-out -%,$(UNCACHED_CC)))" \
REAL_CC_FLAGS="$(filter -%,$(CC))" \
CC="$(call gb_Executable_get_target_for_build,gcc-wrapper)" \
- REAL_CXX="$(shell cygpath -w $(filter-out -%,$(CXX)))" \
+ REAL_CXX="$(shell cygpath -w $(filter-out -%,$(UNCACHED_CXX)))" \
REAL_CXX_FLAGS="$(filter -%,$(CXX))" \
CXX="$(call gb_Executable_get_target_for_build,g++-wrapper)" \
LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo"
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index e7ccb0107562..708d30f023c8 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -315,7 +315,7 @@ endef
# we explicitly have to replace cygwin with mingw32 for the host, but the build must stay cygwin, or cmd.exe processes will be spawned
gb_WIN_GPG_WINDRES_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
gb_WIN_GPG_platform_switches := --build=$(BUILD_PLATFORM) --host=$(subst cygwin,mingw32,$(HOST_PLATFORM))
-gb_WIN_GPG_cross_setup_exports = export REAL_BUILD_CC="$(filter-out -%,$(CC_FOR_BUILD))" REAL_BUILD_CC_FLAGS="$(filter -%,$(CC_FOR_BUILD))" \
+gb_WIN_GPG_cross_setup_exports = export REAL_BUILD_CC="$(filter-out -%,$(UNCACHED_CC))" REAL_BUILD_CC_FLAGS="$(filter -%,$(UNCACHED_CC))" \
&& export CC_FOR_BUILD="$(call gb_Executable_get_target_for_build,gcc-wrapper) --wrapper-env-prefix=REAL_BUILD_ $(SOLARINC) -L$(subst ;, -L,$(ILIB_FOR_BUILD))" \
&& export RC='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor='\''$(call gb_Executable_get_target_for_build,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\'