summaryrefslogtreecommitdiffstats
path: root/external/libmspub
diff options
context:
space:
mode:
Diffstat (limited to 'external/libmspub')
-rw-r--r--external/libmspub/ExternalProject_libmspub.mk55
-rw-r--r--external/libmspub/Makefile7
-rw-r--r--external/libmspub/Module_libmspub.mk17
-rw-r--r--external/libmspub/README3
-rw-r--r--external/libmspub/UnpackedTarball_libmspub.mk31
-rw-r--r--external/libmspub/libmspub_android_arm.patch.112
-rw-r--r--external/libmspub/stdint.patch10
-rw-r--r--external/libmspub/ubsan.patch12
8 files changed, 147 insertions, 0 deletions
diff --git a/external/libmspub/ExternalProject_libmspub.mk b/external/libmspub/ExternalProject_libmspub.mk
new file mode 100644
index 0000000000..b43fc8f199
--- /dev/null
+++ b/external/libmspub/ExternalProject_libmspub.mk
@@ -0,0 +1,55 @@
+# -*- 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) $(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:
diff --git a/external/libmspub/Makefile b/external/libmspub/Makefile
new file mode 100644
index 0000000000..e4968cf85f
--- /dev/null
+++ b/external/libmspub/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libmspub/Module_libmspub.mk b/external/libmspub/Module_libmspub.mk
new file mode 100644
index 0000000000..81ea7e91d5
--- /dev/null
+++ b/external/libmspub/Module_libmspub.mk
@@ -0,0 +1,17 @@
+# -*- 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_Module_Module,libmspub))
+
+$(eval $(call gb_Module_add_targets,libmspub,\
+ ExternalProject_libmspub \
+ UnpackedTarball_libmspub \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libmspub/README b/external/libmspub/README
new file mode 100644
index 0000000000..5a6625fffc
--- /dev/null
+++ b/external/libmspub/README
@@ -0,0 +1,3 @@
+Library parsing the Microsoft Publisher documents.
+
+[https://wiki.documentfoundation.org/DLP/Libraries/libmspub]
diff --git a/external/libmspub/UnpackedTarball_libmspub.mk b/external/libmspub/UnpackedTarball_libmspub.mk
new file mode 100644
index 0000000000..287be540de
--- /dev/null
+++ b/external/libmspub/UnpackedTarball_libmspub.mk
@@ -0,0 +1,31 @@
+# -*- 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_UnpackedTarball_UnpackedTarball,libmspub))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libmspub,$(MSPUB_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libmspub,0))
+
+# * external/libmspub/stdint.patch is upstream at <https://gerrit.libreoffice.org/#/c/73814/>
+# "missing include":
+$(eval $(call gb_UnpackedTarball_add_patches,libmspub,\
+ external/libmspub/ubsan.patch \
+ external/libmspub/stdint.patch \
+))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,libmspub))
+
+ifeq ($(ANDROID_APP_ABI),armeabi-v7a)
+$(eval $(call gb_UnpackedTarball_add_patches,libmspub, \
+ external/libmspub/libmspub_android_arm.patch.1 \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libmspub/libmspub_android_arm.patch.1 b/external/libmspub/libmspub_android_arm.patch.1
new file mode 100644
index 0000000000..2d7d0e12c0
--- /dev/null
+++ b/external/libmspub/libmspub_android_arm.patch.1
@@ -0,0 +1,12 @@
+diff -ur libmspub.org/src/lib/libmspub_utils.cpp libmspub/src/lib/libmspub_utils.cpp
+--- libmspub.org/src/lib/libmspub_utils.cpp 2018-04-07 15:13:32.041792236 +0200
++++ libmspub/src/lib/libmspub_utils.cpp 2018-04-07 15:14:08.547790739 +0200
+@@ -29,7 +29,7 @@
+ {
+ va_list args;
+ va_start(args, format);
+- std::vfprintf(stderr, format, args);
++ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+
diff --git a/external/libmspub/stdint.patch b/external/libmspub/stdint.patch
new file mode 100644
index 0000000000..61f1dd1229
--- /dev/null
+++ b/external/libmspub/stdint.patch
@@ -0,0 +1,10 @@
+--- src/lib/MSPUBMetaData.h
++++ src/lib/MSPUBMetaData.h
+@@ -13,6 +13,7 @@
+ #include <map>
+ #include <utility>
+ #include <vector>
++#include <stdint.h>
+
+ #include <librevenge/librevenge.h>
+
diff --git a/external/libmspub/ubsan.patch b/external/libmspub/ubsan.patch
new file mode 100644
index 0000000000..b58249e18e
--- /dev/null
+++ b/external/libmspub/ubsan.patch
@@ -0,0 +1,12 @@
+--- src/lib/MSPUBContentChunkType.h
++++ src/lib/MSPUBContentChunkType.h
+@@ -27,7 +27,8 @@
+ CELLS = 0x63,
+ FONT = 0x6C,
+ IMAGE_2K, //these don't exist in Pub 2k3 so their value in the enum is not used.
+- IMAGE_2K_DATA
++ IMAGE_2K_DATA,
++ MSPUBContentChunkType_dummy=0xFF // MSPUBParser.cpp:2359:9: runtime error: load of value 138, which is not a valid value for type 'libmspub::MSPUBContentChunkType'
+ };
+ } // namespace libmspub
+