[Libreoffice-commits] core.git: 3 commits - config_host.mk.in configure.ac solenv/gbuild

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu May 9 09:04:36 UTC 2019


 config_host.mk.in                       |    1 +
 configure.ac                            |   26 +++++++++++++-------------
 solenv/gbuild/TargetLocations.mk        |    4 ++--
 solenv/gbuild/platform/com_GCC_class.mk |    2 ++
 solenv/gbuild/platform/com_GCC_defs.mk  |   28 ++++++++++++++++++++++++----
 solenv/gbuild/platform/com_MSC_class.mk |    2 ++
 6 files changed, 44 insertions(+), 19 deletions(-)

New commits:
commit 689829db6a3628d2c7c09b8046c24cbae8c98d94
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 1 20:37:46 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 9 11:03:15 2019 +0200

    if ccache is enabled, by default also enable CCACHE_DEPEND
    
    This avoids the preprocessing step normally done by ccache (see
    ccache docs), which speeds up the build.
    This way there may be incorrect ccache hits if a system header
    (found using -isystem) changes, but that should be rare and such
    headers generally should be backwards compatible, so the chance
    of an actual breakage should be very low.
    The patch also adds --enable-ccache=nodepend to allow enabling ccache
    without the depend mode.
    
    https://lists.freedesktop.org/archives/libreoffice/2019-May/082684.html
    
    Change-Id: Id69ca43988a016a917beb75927b39d8bde719aa7
    Reviewed-on: https://gerrit.libreoffice.org/71629
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/config_host.mk.in b/config_host.mk.in
index 84c75e5e5954..90bb4e37c891 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -58,6 +58,7 @@ export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
 export CAIRO_CFLAGS=$(gb_SPACE)@CAIRO_CFLAGS@
 export CAIRO_LIBS=$(gb_SPACE)@CAIRO_LIBS@
 export CC=@CC@
+export CCACHE_DEPEND_MODE=@CCACHE_DEPEND_MODE@
 export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@
 export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@
 @x_CFLAGS@ export CFLAGS=@CFLAGS@
diff --git a/configure.ac b/configure.ac
index 6a7e7b4734d8..3a2b3c4c1b12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1370,6 +1370,8 @@ AC_ARG_ENABLE(ccache,
          By default, unless on Windows, we will try to detect if ccache is available; in that case if
          CC/CXX are not yet set, and --enable-icecream is not given, we
          attempt to use ccache. --disable-ccache disables ccache completely.
+         Additionally ccache's depend mode is enabled if possible,
+         use --enable-ccache=nodepend to enable ccache without depend mode.
 ]),
 ,)
 
@@ -2573,21 +2575,26 @@ AC_SUBST(WITH_GALLERY_BUILD)
 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" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
+elif test "$enable_ccache" = "no"; then
+    CCACHE=""
+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),
     # assume that's good then
     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
+        CCACHE_DEPEND_MODE=1
         ;;
     *)
         AC_PATH_PROG([CCACHE],[ccache],[not found])
         if test "$CCACHE" = "not found"; then
             CCACHE=""
         else
+            CCACHE_DEPEND_MODE=1
             # Need to check for ccache version: otherwise prevents
             # caching of the results (like "-x objective-c++" for Mac)
             if test $_os = Darwin -o $_os = iOS; then
@@ -2600,6 +2607,7 @@ elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecr
                 else
                     AC_MSG_RESULT([no, $CCACHE_VERSION])
                     CCACHE=""
+                    CCACHE_DEPEND_MODE=
                 fi
             fi
         fi
@@ -2608,6 +2616,10 @@ elif test "$enable_ccache" = "yes" -o \( "$enable_ccache" = "" -a "$enable_icecr
 else
     CCACHE=""
 fi
+if test "$enable_ccache" = "nodepend"; then
+    CCACHE_DEPEND_MODE=""
+fi
+AC_SUBST(CCACHE_DEPEND_MODE)
 
 if test "$CCACHE" != ""; then
     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 88d1613574d8..e0862b7fedca 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -302,4 +302,8 @@ endif
 gb_COMPILER_SETUP += $(gb_CCACHE_SLOPPINESS)
 endif
 
+ifneq ($(CCACHE_DEPEND_MODE),)
+gb_COMPILER_SETUP += CCACHE_DEPEND=1
+endif
+
 # vim: set noet sw=4:
commit 7f992595a4f4bed38f67c2fa34ffafecb082753a
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 1 19:57:39 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 9 11:02:52 2019 +0200

    simply set ccache env.vars instead of just warning about them
    
    So that it works out of the box automagically.
    
    Change-Id: I0a6c93824233eef6ce25c44762ec40770ec5110f
    Reviewed-on: https://gerrit.libreoffice.org/71628
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/configure.ac b/configure.ac
index 8ed51262b391..6a7e7b4734d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5075,18 +5075,6 @@ elif test "$enable_pch" = "no"; then
 else
     AC_MSG_ERROR([Unknown value for --enable-pch])
 fi
-if test -n "$ENABLE_PCH"; then
-    if test -n "$CCACHE"; then
-        if ! echo "$CCACHE_SLOPPINESS" | grep -q pch_defines | grep -q time_macros; then
-            AC_MSG_WARN([PCH with ccache requires CCACHE_SLOPPINESS to include 'pch_defines,time_macros'])
-            add_warning "PCH with ccache requires CCACHE_SLOPPINESS to include 'pch_defines,time_macros'"
-        fi
-        if test -z "$CCACHE_PCH_EXTSUM"; then
-            AC_MSG_WARN([It is recommended to set CCACHE_PCH_EXTSUM=1 for PCH with ccache.])
-            add_warning "It is recommended to set CCACHE_PCH_EXTSUM=1 for PCH with ccache."
-        fi
-    fi
-fi
 AC_SUBST(ENABLE_PCH)
 
 TAB=`printf '\t'`
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 5d5c69ddeb9c..88d1613574d8 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -35,6 +35,9 @@ else
 gb_AR := $(shell $(CC) -print-prog-name=ar)
 endif
 
+# shell setup (env.vars) for the compiler
+gb_COMPILER_SETUP :=
+
 ifneq ($(USE_LD),)
 gb_LinkTarget_LDFLAGS += -fuse-ld=$(USE_LD)
 endif
@@ -234,7 +237,7 @@ ifeq ($(COMPILER_PLUGINS_DEBUG),TRUE)
 gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --debug
 endif
 # set CCACHE_CPP2=1 to prevent clang generating spurious warnings
-gb_COMPILER_SETUP := CCACHE_CPP2=1
+gb_COMPILER_SETUP += CCACHE_CPP2=1
 gb_COMPILER_PLUGINS_SETUP := ICECC_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox CCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox
 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := \
     -Xclang -plugin-arg-loplugin -Xclang --warnings-as-errors
@@ -242,9 +245,7 @@ else
 # Set CCACHE_CPP2 to prevent GCC -Werror=implicit-fallthrough= when ccache strips comments from C
 # code (which still needs /*fallthrough*/-style comments to silence that warning):
 ifeq ($(ENABLE_WERROR),TRUE)
-gb_COMPILER_SETUP := CCACHE_CPP2=1
-else
-gb_COMPILER_SETUP :=
+gb_COMPILER_SETUP += CCACHE_CPP2=1
 endif
 gb_COMPILER_TEST_FLAGS :=
 gb_COMPILER_PLUGINS :=
@@ -286,4 +287,19 @@ endef
 
 gb_Helper_get_rcfile = $(1)rc
 
+ifneq ($(ENABLE_PCH),)
+# Enable use of .sum files for PCHs.
+gb_COMPILER_SETUP += CCACHE_PCH_EXTSUM=1
+# CCACHE_SLOPPINESS should contain pch_defines,time_macros for PCHs.
+gb_CCACHE_SLOPPINESS :=
+ifeq ($(shell test -z "$$CCACHE_SLOPPINESS" && echo 1),1)
+gb_CCACHE_SLOPPINESS := CCACHE_SLOPPINESS=pch_defines,time_macros
+else
+ifeq ($(shell echo "$$CCACHE_SLOPPINESS" | grep -q pch_defines | grep -q time_macros && echo 1),1)
+gb_CCACHE_SLOPPINESS := CCACHE_SLOPPINESS=$CCACHE_SLOPPINESS:pch_defines,time_macros
+endif
+endif
+gb_COMPILER_SETUP += $(gb_CCACHE_SLOPPINESS)
+endif
+
 # vim: set noet sw=4:
commit 18bda6827521fae6916f55be73cb1b68bb39a6c5
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Apr 30 14:11:40 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 9 11:02:25 2019 +0200

    use .gch only for gcc's PCH files
    
    It a) looked a bit silly to use .gch even with MSVC, b) allows to build
    something with Clang and GCC without them trying to use each other's PCH
    file, c) is nitpicking, yeah.
    
    Change-Id: I478beeb6aab6378cbdcc6ea75aa2e3ff2bcf6f87
    Reviewed-on: https://gerrit.libreoffice.org/71582
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 02df6229a541..27bc9ae189e2 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -146,9 +146,9 @@ gb_Package_get_target_for_build = $(WORKDIR_FOR_BUILD)/Package/$(1).filelist
 gb_PackageSet_get_target = $(WORKDIR)/PackageSet/$(1).filelist
 gb_PackageInfo_get_target = $(WORKDIR)/PackageInfo
 gb_Postprocess_get_target = $(WORKDIR)/Postprocess/$(1)
-gb_PrecompiledHeader_get_dep_target = $(WORKDIR)/Dep/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(2))/$(1).hxx.gch.d
+gb_PrecompiledHeader_get_dep_target = $(WORKDIR)/Dep/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(2))/$(1).hxx$(gb_PrecompiledHeader_EXT).d
 gb_PrecompiledHeader_get_dep_target_tmp = $(call gb_PrecompiledHeader_get_dep_target,$(1),$(2)).tmp
-gb_PrecompiledHeader_get_target = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(2))/$(1).hxx.gch
+gb_PrecompiledHeader_get_target = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(2))/$(1).hxx$(gb_PrecompiledHeader_EXT)
 gb_PrecompiledHeader_get_timestamp = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(1))/Timestamps/$(1)
 gb_PropertiesTranslateTarget_get_target = $(WORKDIR)/PropertiesTranslateTarget/$(1).properties
 gb_Pyuno_get_final_target = $(WORKDIR)/Pyuno/$(1).final
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index cad6db124f17..bdd1412aea75 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -80,9 +80,11 @@ endef
 
 ifeq ($(COM_IS_CLANG),TRUE)
 gb_PrecompiledHeader_get_enableflags = -include-pch $(call gb_PrecompiledHeader_get_target,$(1),$(2))
+gb_PrecompiledHeader_EXT := .pch
 else
 gb_PrecompiledHeader_get_enableflags = -include $(notdir $(subst .gch,,$(call gb_PrecompiledHeader_get_target,$(1),$(2)))) \
 				       -I $(dir $(call gb_PrecompiledHeader_get_target,$(1),$(2)))
+gb_PrecompiledHeader_EXT := .gch
 endif
 
 # Clang and gcc do not need any extra .o file for PCH
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 4d7fb0b5d40e..5904579a3e2b 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -71,6 +71,8 @@ gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
 	-Fp$(call gb_PrecompiledHeader_get_target,$(1),$(2)) \
 	$(gb_PCHWARNINGS)
 
+gb_PrecompiledHeader_EXT := .pch
+
 # MSVC PCH needs extra .obj created during the creation of the PCH file
 gb_PrecompiledHeader_get_objectfile = $(1).obj
 


More information about the Libreoffice-commits mailing list