office-gobmx/external/libmspub/ExternalProject_libmspub.mk
Stephan Bergmann 7e30d78402 Adapt to LLVM 15 trunk libc++ dropping std::unary_/binary_function
...for C++17 and beyond with
<681cde7dd8>
"[libc++] Complete the implementation of N4190".  (Unless explicitly opted-in
with _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION.  This is similar to the
MSVC standard library needing _HAS_AUTO_PTR_ETC=1 to enable those zombie
functions for quite some time now.  Only libstdc++ still supports them
unconditionally.)

Most uses of those zombie functions across LibreOffice itself and the bundled
external/* are indirectly within Boost include files.  And many (but not all) of
those Boost include files only use those zombie functions conditionally, based
on BOOST_NO_CXX98_FUNCTION_BASE.  For the (Dinkumware-derived) MSVC standard
library, workdir/UnpackedTarball/boost/boost/config/stdlib/dinkumware.hpp
already defined BOOST_NO_CXX98_FUNCTION_BASE.  So add a patch to define that
also in workdir/UnpackedTarball/boost/boost/config/stdlib/libcpp.hpp (for all of
C++11 and beyond, even if those functions were still available as deprecated in
C++11 and C++14, but which shouldn't make a difference with our C++17 baseline
anyway; only make sure that things still work if those Boost include files ever
get used by code built with gb_CXX03FLAGS).  (Patching our bundled
external/boost of course doesn't help when building with such a new libc++ and
--with-system-boost against an unpatched Boost, but lets consider that "not my
problem".  Also, one could always use a sledgehammer like passing
CPPFLAGS=-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION into gbuild in
such a case.)

Then there are two places that include boost/multi_array.hpp, which indirectly
includes workdir/UnpackedTarball/boost/boost/functional.hpp, which still uses
those zombie functions for non-MSVC builds (at least in the bundled
Boost 1.79.0).  Lets do a targeted
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION in those cases.
(Alternatively, we could patch
workdir/UnpackedTarball/boost/boost/functional.hpp.  Also, I decided to make
loplugin:reservedid support the new suppression mechanism, rather than extending
its existing ignorelist even further.)

And then there is external/clucene using those zombie functions even outside of
a Boost include file, so extend the existing hack there that was already needed
for MSVC.  (And adapt the accompanying comment:  For one, we are unconditionally
"in C++17 mode" by now.  And for another, the exact places where
external/clucene uses those functions have apparently changed over time.)

Change-Id: Id0eec3bedcfddae86b16d33c02c7b5d3b3f8a16f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136579
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-29 10:08:25 +02:00

55 lines
1.8 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalProject_ExternalProject,libmspub))
$(eval $(call gb_ExternalProject_use_autoconf,libmspub,build))
$(eval $(call gb_ExternalProject_register_targets,libmspub,\
build \
))
$(eval $(call gb_ExternalProject_use_externals,libmspub,\
boost_headers \
icu \
revenge \
zlib \
))
libmspub_CPPFLAGS := $(CPPFLAGS) $(ICU_UCHAR_TYPE) $(BOOST_CPPFLAGS)
# Needed when workdir/UnpackedTarball/libmspub/src/lib/MSPUBCollector.cpp includes Boost 1.79.0
# boost/multi_array.hpp, which indirectly includes
# workdir/UnpackedTarball/boost/boost/functional.hpp using std::unary_/binary_function:
ifeq ($(HAVE_LIBCPP),TRUE)
libmspub_CPPFLAGS += -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
endif
$(call gb_ExternalProject_get_state_target,libmspub,build) :
$(call gb_Trace_StartRange,libmspub,EXTERNAL)
$(call gb_ExternalProject_run,build,\
export PKG_CONFIG="" \
&& MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
--with-pic \
--enable-static \
--disable-shared \
--without-docs \
--disable-tools \
$(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
--disable-werror \
--disable-weffc \
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libmspub)" \
CPPFLAGS="$(libmspub_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libmspub)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)
$(call gb_Trace_EndRange,libmspub,EXTERNAL)
# vim: set noet sw=4 ts=4: