From 216acad07fd1ed20ffe00596f7404371059cc719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 12 Aug 2021 11:43:12 +0100 Subject: [PATCH] replace use of ucpp with gcc cpp --- ...pp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch | 111 ++++++++++++++++++ libreoffice.spec | 9 +- 2 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 0001-make-with-idlc-cpp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch diff --git a/0001-make-with-idlc-cpp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch b/0001-make-with-idlc-cpp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch new file mode 100644 index 0000000..9d4ed5c --- /dev/null +++ b/0001-make-with-idlc-cpp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch @@ -0,0 +1,111 @@ +From 748a9fd3a8e90e52a126190dbe0d97da6e0941ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Wed, 11 Aug 2021 20:55:14 +0100 +Subject: [PATCH] make --with-idlc-cpp=cpp work for gcc cpp as a ucpp + replacement + +e.g. the example of +https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1524638 +has the same output .urd using cpp with these flags as ucpp created + +Change-Id: Iadfd2deba7d365c66c3260fd6736c031987e107c +--- + config_host.mk.in | 1 + + configure.ac | 14 ++++++++++++++ + idlc/Executable_idlc.mk | 8 ++++++++ + idlc/source/idlccompile.cxx | 8 ++++++++ + 4 files changed, 31 insertions(+) + +diff --git a/config_host.mk.in b/config_host.mk.in +index 58ca1d1c14fb..6810660067b0 100644 +--- a/config_host.mk.in ++++ b/config_host.mk.in +@@ -635,6 +635,7 @@ export SYSTEM_RHINO=@SYSTEM_RHINO@ + export SYSTEM_SERF=@SYSTEM_SERF@ + export SYSTEM_STAROFFICE=@SYSTEM_STAROFFICE@ + export SYSTEM_UCPP=@SYSTEM_UCPP@ ++export SYSTEM_UCPP_IS_GCC=@SYSTEM_UCPP_IS_GCC@ + export SYSTEM_VISIO=@SYSTEM_VISIO@ + export SYSTEM_WPD=@SYSTEM_WPD@ + export SYSTEM_WPG=@SYSTEM_WPG@ +diff --git a/configure.ac b/configure.ac +index 3d2bf7e24555..ac226fd46ace 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8807,9 +8807,22 @@ dnl =================================================================== + dnl Check for C preprocessor to use + dnl =================================================================== + AC_MSG_CHECKING([which C preprocessor to use in idlc]) ++SYSTEM_UCPP_IS_GCC= + if test -n "$with_idlc_cpp"; then + AC_MSG_RESULT([$with_idlc_cpp]) + AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp) ++ AC_MSG_CHECKING([if $with_idlc_cpp is GCC CPP]) ++ # ucpp will accept -v (to output version), warn about the others as unknown ++ # and return 1 (due to -v) ++ # gcc will accept -v (as verbose), --version (to output version) and -nostdinc ++ # and return 0 (due to --version ) if all options are supported ++ $SYSTEM_UCPP -v --version -nostdinc >/dev/null 2>/dev/null ++ if test $? -eq 0; then ++ SYSTEM_UCPP_IS_GCC=TRUE ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++ fi + else + AC_MSG_RESULT([ucpp]) + AC_MSG_CHECKING([which ucpp tp use]) +@@ -8822,6 +8835,7 @@ else + fi + fi + AC_SUBST(SYSTEM_UCPP) ++AC_SUBST(SYSTEM_UCPP_IS_GCC) + + dnl =================================================================== + dnl Check for epm (not needed for Windows) +diff --git a/idlc/Executable_idlc.mk b/idlc/Executable_idlc.mk +index e194e9049c77..f2f79dcb8911 100644 +--- a/idlc/Executable_idlc.mk ++++ b/idlc/Executable_idlc.mk +@@ -35,10 +35,18 @@ $(eval $(call gb_Executable_add_scanners,idlc,\ + )) + + ifneq (,$(SYSTEM_UCPP)) ++ + $(eval $(call gb_Executable_add_defs,idlc,\ + -DSYSTEM_UCPP \ + -DUCPP=\"file://$(SYSTEM_UCPP)\" \ + )) ++ ++ifneq ($(SYSTEM_UCPP_IS_GCC),) ++$(eval $(call gb_Executable_add_defs,idlc,\ ++ -DSYSTEM_UCPP_IS_GCC \ ++)) ++endif ++ + endif + + $(eval $(call gb_Executable_add_exception_objects,idlc,\ +diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx +index bf3325d6821a..1902d63e0cad 100644 +--- a/idlc/source/idlccompile.cxx ++++ b/idlc/source/idlccompile.cxx +@@ -237,7 +237,15 @@ sal_Int32 compileFile(const OString * pathname) + ::std::vector< OUString> lCppArgs; + lCppArgs.emplace_back("-DIDL"); + lCppArgs.emplace_back("-C"); ++#ifdef SYSTEM_UCPP_IS_GCC ++ // -nostdinc Do not search the standard system directories for header files ++ lCppArgs.emplace_back("-nostdinc"); ++ // with gcc cpp, even when not explicitly including anything, /usr/include/stdc-predef.h ++ // gets inserted without -nostdinc ++#else ++ // -zI Do not use the standard (compile-time) include path. + lCppArgs.emplace_back("-zI"); ++#endif + + Options* pOptions = idlc()->getOptions(); + +-- +2.31.1 + diff --git a/libreoffice.spec b/libreoffice.spec index 3aff17c..26b5040 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -50,7 +50,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 4%{?libo_prerelease}%{?dist} +Release: 5%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0 URL: http://www.libreoffice.org/ @@ -116,7 +116,6 @@ BuildRequires: perl(base) BuildRequires: glibc-all-langpacks BuildRequires: libappstream-glib %endif -BuildRequires: ucpp BuildRequires: zip # libs / headers - common @@ -260,6 +259,7 @@ Patch8: 0001-Simplify-construction-of-a-hardcoded-IPv4-address.patch Patch9: 0001-Remove-unused-DOCTYPE-from-odk-examples-xcu-file.patch Patch10: 0001-math.desktop-include-Spreadsheet-category.patch Patch11: 0001-rhbz-1980800-allow-convert-to-csv-to-write-each-shee.patch +Patch12: 0001-make-with-idlc-cpp-cpp-work-for-gcc-cpp-as-a-ucpp-re.patch # not upstreamed Patch500: 0001-disable-libe-book-support.patch @@ -1125,7 +1125,7 @@ touch autogen.lastrun --with-gdrive-client-secret="GYWrDtzyZQZ0_g5YoBCC6F0I" \ --with-gdrive-client-id="457862564325.apps.googleusercontent.com" \ --enable-python=system \ - --with-system-ucpp \ + --with-idlc-cpp=cpp \ %{distrooptions} \ %{?bundling_options} \ %{?archoptions} \ @@ -2259,6 +2259,9 @@ gtk-update-icon-cache -q %{_datadir}/icons/hicolor &>/dev/null || : %{_includedir}/LibreOfficeKit %changelog +* Thu Aug 12 2021 Caolán McNamara - 1:7.1.5.2-5 +- replace use of ucpp with gcc cpp + * Sat Aug 07 2021 Jonathan Wakely - 1:7.1.5.2-4 - Rebuilt for Boost 1.76