From 80a7fe5fa0644e48c2088f50ef7ed45878256d43 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sat, 24 May 2014 09:13:33 +0200 Subject: [PATCH 1/9] build libodfgen as shared lib Change-Id: I3a2c9f56e87ee6395bd3505a8fe372632e242312 --- RepositoryExternal.mk | 30 ++++- .../0001-properly-export-API-symbols.patch | 149 +++++++++++++++++++++ external/libodfgen/ExternalPackage_libodfgen.mk | 22 +++ external/libodfgen/ExternalProject_libodfgen.mk | 11 +- external/libodfgen/Library_odfgen.mk | 50 +++++++ external/libodfgen/Module_libodfgen.mk | 16 ++- external/libodfgen/UnpackedTarball_libodfgen.mk | 6 + 7 files changed, 276 insertions(+), 8 deletions(-) create mode 100644 external/libodfgen/0001-properly-export-API-symbols.patch create mode 100644 external/libodfgen/ExternalPackage_libodfgen.mk create mode 100644 external/libodfgen/Library_odfgen.mk diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 8b35b8c..52c4c6d 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -1720,18 +1720,44 @@ endef else # !SYSTEM_ODFGEN +ifeq ($(COM),MSC) + +$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo,\ + odfgen \ +)) + +define gb_LinkTarget__use_odfgen +$(call gb_LinkTarget_set_include,$(1),\ + -I$(call gb_UnpackedTarball_get_dir,libodfgen)/inc \ + $$(INCLUDE) \ +) +$(call gb_LinkTarget_use_libraries,$(1),\ + odfgen \ +) + +endef + +else # !MSC + +$(eval $(call gb_Helper_register_packages_for_install,ooo, \ + libodfgen \ +)) + define gb_LinkTarget__use_odfgen +$(call gb_LinkTarget_use_package,$(1),libodfgen) + $(call gb_LinkTarget_set_include,$(1),\ -I$(call gb_UnpackedTarball_get_dir,libodfgen)/inc \ $$(INCLUDE) \ ) $(call gb_LinkTarget_add_libs,$(1),\ - $(call gb_UnpackedTarball_get_dir,libodfgen)/src/.libs/libodfgen-0.0$(gb_StaticLibrary_PLAINEXT) \ + -L$(call gb_UnpackedTarball_get_dir,libodfgen)/src/.libs -lodfgen-0.0 \ ) -$(call gb_LinkTarget_use_external_project,$(1),libodfgen) endef +endif + endif # SYSTEM_ODFGEN diff --git a/external/libodfgen/0001-properly-export-API-symbols.patch b/external/libodfgen/0001-properly-export-API-symbols.patch new file mode 100644 index 0000000..3f488eb --- /dev/null +++ b/external/libodfgen/0001-properly-export-API-symbols.patch @@ -0,0 +1,149 @@ +From 431087afd938b0d9cea2f5c4b88da0746e3758a8 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Sat, 24 May 2014 20:19:17 +0200 +Subject: [PATCH] properly export API symbols + +--- + inc/libodfgen/Makefile.am | 1 + + inc/libodfgen/OdfDocumentHandler.hxx | 4 +++- + inc/libodfgen/OdgGenerator.hxx | 3 ++- + inc/libodfgen/OdpGenerator.hxx | 3 ++- + inc/libodfgen/OdsGenerator.hxx | 3 ++- + inc/libodfgen/OdtGenerator.hxx | 3 ++- + inc/libodfgen/libodfgen-api.hxx | 38 ++++++++++++++++++++++++++++++++++++ + src/Makefile.am | 5 +++-- + 8 files changed, 53 insertions(+), 7 deletions(-) + create mode 100644 inc/libodfgen/libodfgen-api.hxx + +diff --git a/inc/libodfgen/OdfDocumentHandler.hxx b/inc/libodfgen/OdfDocumentHandler.hxx +index 79c387b..19e04e3 100644 +--- a/inc/libodfgen/OdfDocumentHandler.hxx ++++ b/inc/libodfgen/OdfDocumentHandler.hxx +@@ -26,6 +26,8 @@ + #define _ODFDOCUMENTHANDLER_HXX_ + #include + ++#include "libodfgen-api.hxx" ++ + /** Type of ODF content a generator should produce. + * + * @sa OdgGenerator, OdpGenerator, OdtGenerator +@@ -57,7 +59,7 @@ typedef bool (*OdfEmbeddedImage)(const WPXBinaryData &input, librev + * saved to a file, printed to the standard output, saved to a file + * inside a package, or whatever else. + */ +-class OdfDocumentHandler ++class ODFGENAPI OdfDocumentHandler + { + public: + virtual ~OdfDocumentHandler() {} +diff --git a/inc/libodfgen/OdgGenerator.hxx b/inc/libodfgen/OdgGenerator.hxx +index f818e3e..24455d8 100644 +--- a/inc/libodfgen/OdgGenerator.hxx ++++ b/inc/libodfgen/OdgGenerator.hxx +@@ -27,6 +27,7 @@ + #include + #include + ++#include "libodfgen-api.hxx" + #include "OdfDocumentHandler.hxx" + + class OdgGeneratorPrivate; +@@ -37,7 +38,7 @@ class OdgGeneratorPrivate; + * See @c libwpg library for documentation of the + * libwpg::WPGPaintInterface interface. + */ +-class OdgGenerator : public libwpg::WPGPaintInterface ++class ODFGENAPI OdgGenerator : public libwpg::WPGPaintInterface + { + public: + OdgGenerator(OdfDocumentHandler *pHandler, const OdfStreamType streamType); +diff --git a/inc/libodfgen/OdpGenerator.hxx b/inc/libodfgen/OdpGenerator.hxx +index 71f2562..c61f5ad 100644 +--- a/inc/libodfgen/OdpGenerator.hxx ++++ b/inc/libodfgen/OdpGenerator.hxx +@@ -27,6 +27,7 @@ + + #include + ++#include "libodfgen-api.hxx" + #include "OdfDocumentHandler.hxx" + + class OdpGeneratorPrivate; +@@ -37,7 +38,7 @@ class OdpGeneratorPrivate; + * See @c libetonyek library for documentation of the + * libetonyek::KEYPresentationInterface interface. + */ +-class OdpGenerator : public libetonyek::KEYPresentationInterface ++class ODFGENAPI OdpGenerator : public libetonyek::KEYPresentationInterface + { + public: + OdpGenerator(OdfDocumentHandler *pHandler, const OdfStreamType streamType); +diff --git a/inc/libodfgen/OdtGenerator.hxx b/inc/libodfgen/OdtGenerator.hxx +index 9c3ff88..e11778c 100644 +--- a/inc/libodfgen/OdtGenerator.hxx ++++ b/inc/libodfgen/OdtGenerator.hxx +@@ -29,6 +29,7 @@ + + #include + ++#include "libodfgen-api.hxx" + #include "OdfDocumentHandler.hxx" + + /** Handler for embedded objects. +@@ -39,7 +40,7 @@ class OdfGenerator; + * See @c libwpd library for documentation of the ::WPXDocumentInterface + * interface. + */ +-class OdtGenerator : public WPXDocumentInterface ++class ODFGENAPI OdtGenerator : public WPXDocumentInterface + { + public: + OdtGenerator(OdfDocumentHandler *pHandler, const OdfStreamType streamType); +diff --git a/inc/libodfgen/libodfgen-api.hxx b/inc/libodfgen/libodfgen-api.hxx +new file mode 100644 +index 0000000..39ffd05 +--- /dev/null ++++ b/inc/libodfgen/libodfgen-api.hxx +@@ -0,0 +1,38 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ ++/* libodfgen ++ * Version: MPL 2.0 / LGPLv2.1+ ++ * ++ * 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/. ++ * ++ * Major Contributor(s): ++ * Copyright (C) 2013 Fridrich Strba ++ * Copyright (C) 2011 Eilidh McAdam ++ * ++ * For minor contributions see the git repository. ++ * ++ * Alternatively, the contents of this file may be used under the terms ++ * of the GNU Lesser General Public License Version 2.1 or later ++ * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are ++ * applicable instead of those above. ++ * ++ * For further information visit http://libwpd.sourceforge.net ++ */ ++ ++#ifndef INCLUDED_LIBODFGEN_LIBODFGEN_API_HXX ++#define INCLUDED_LIBODFGEN_LIBODFGEN_API_HXX ++ ++#ifdef DLL_EXPORT ++#ifdef LIBODFGEN_BUILD ++#define ODFGENAPI __declspec(dllexport) ++#else ++#define ODFGENAPI __declspec(dllimport) ++#endif ++#else ++#define ODFGENAPI ++#endif ++ ++#endif // INCLUDED_LIBODFGEN_LIBODFGEN_API_HXX ++ ++/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ +-- +1.9.0 + diff --git a/external/libodfgen/ExternalPackage_libodfgen.mk b/external/libodfgen/ExternalPackage_libodfgen.mk new file mode 100644 index 0000000..a0692ed --- /dev/null +++ b/external/libodfgen/ExternalPackage_libodfgen.mk @@ -0,0 +1,22 @@ +# -*- 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_ExternalPackage_ExternalPackage,libodfgen,libodfgen)) + +$(eval $(call gb_ExternalPackage_use_external_project,libodfgen,libodfgen)) + +ifeq ($(OS),MACOSX) +$(eval $(call gb_ExternalPackage_add_file,libodfgen,$(LIBO_LIB_FOLDER)/libodfgen-0.0.0.dylib,src/.libs/libodfgen-0.0.dylib)) +else ifeq ($(OS),WNT) +$(eval $(call gb_ExternalPackage_add_file,libodfgen,$(LIBO_LIB_FOLDER)/libodfgen-0.0.dll,src/.libs/libodfgen-0.0.dll)) +else ifeq ($(filter IOS ANDROID,$(OS)),) +$(eval $(call gb_ExternalPackage_add_file,libodfgen,$(LIBO_LIB_FOLDER)/libodfgen-0.0.so.0,src/.libs/libodfgen-0.0.so.0.0.4)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/libodfgen/ExternalProject_libodfgen.mk b/external/libodfgen/ExternalProject_libodfgen.mk index fc88a48..80cb2b0 100644 --- a/external/libodfgen/ExternalProject_libodfgen.mk +++ b/external/libodfgen/ExternalProject_libodfgen.mk @@ -27,16 +27,17 @@ $(call gb_ExternalProject_get_state_target,libodfgen,build) : export PKG_CONFIG="" \ && ./configure \ --with-pic \ - --enable-static \ - --disable-shared \ + --enable-shared \ + --disable-static \ --disable-debug \ --disable-werror \ --disable-weffc \ + --without-docs \ + $(if $(VERBOSE)$(verbose),--enable-silent-rules) \ CXXFLAGS="$(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS),-I$(call gb_UnpackedTarball_get_dir,boost) -I$(BUILDDIR)/config_$(gb_Side))" \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ - && (cd $(EXTERNAL_WORKDIR)/src && \ - $(if $(VERBOSE)$(verbose),V=1) \ - $(MAKE)) \ + $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \ + && $(MAKE) \ ) # vim: set noet sw=4 ts=4: diff --git a/external/libodfgen/Library_odfgen.mk b/external/libodfgen/Library_odfgen.mk new file mode 100644 index 0000000..ce18735 --- /dev/null +++ b/external/libodfgen/Library_odfgen.mk @@ -0,0 +1,50 @@ +# -*- 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_Library_Library,odfgen)) + +$(eval $(call gb_Library_use_unpacked,odfgen,libodfgen)) + +$(eval $(call gb_Library_use_externals,odfgen,\ + boost_headers \ + etonyek \ + wpd \ + wpg \ +)) + +$(eval $(call gb_Library_set_warnings_not_errors,odfgen)) + +$(eval $(call gb_Library_set_include,odfgen,\ + -I$(call gb_UnpackedTarball_get_dir,libodfgen)/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_add_defs,odfgen,\ + -DBOOST_ALL_NO_LIB \ + -DDLL_EXPORT \ + -DLIBODFGEN_BUILD \ + -DNDEBUG \ +)) + +$(eval $(call gb_Library_add_generated_exception_objects,odfgen,\ + UnpackedTarball/libodfgen/src/DocumentElement \ + UnpackedTarball/libodfgen/src/FontStyle \ + UnpackedTarball/libodfgen/src/GraphicFunctions \ + UnpackedTarball/libodfgen/src/InternalHandler \ + UnpackedTarball/libodfgen/src/ListStyle \ + UnpackedTarball/libodfgen/src/OdgGenerator \ + UnpackedTarball/libodfgen/src/OdpGenerator \ + UnpackedTarball/libodfgen/src/OdtGenerator \ + UnpackedTarball/libodfgen/src/PageSpan \ + UnpackedTarball/libodfgen/src/SectionStyle \ + UnpackedTarball/libodfgen/src/TableStyle \ + UnpackedTarball/libodfgen/src/TextRunStyle \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libodfgen/Module_libodfgen.mk b/external/libodfgen/Module_libodfgen.mk index d94d34f..c107274 100644 --- a/external/libodfgen/Module_libodfgen.mk +++ b/external/libodfgen/Module_libodfgen.mk @@ -10,8 +10,22 @@ $(eval $(call gb_Module_Module,libodfgen)) $(eval $(call gb_Module_add_targets,libodfgen,\ - ExternalProject_libodfgen \ UnpackedTarball_libodfgen \ )) +ifeq ($(COM),MSC) + +$(eval $(call gb_Module_add_targets,libodfgen,\ + Library_odfgen \ +)) + +else + +$(eval $(call gb_Module_add_targets,libodfgen,\ + ExternalPackage_libodfgen \ + ExternalProject_libodfgen \ +)) + +endif + # vim: set noet sw=4 ts=4: diff --git a/external/libodfgen/UnpackedTarball_libodfgen.mk b/external/libodfgen/UnpackedTarball_libodfgen.mk index 1a7f26c..fc8f6e2 100644 --- a/external/libodfgen/UnpackedTarball_libodfgen.mk +++ b/external/libodfgen/UnpackedTarball_libodfgen.mk @@ -11,4 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libodfgen)) $(eval $(call gb_UnpackedTarball_set_tarball,libodfgen,$(ODFGEN_TARBALL))) +$(eval $(call gb_UnpackedTarball_set_patchlevel,libodfgen,1)) + +$(eval $(call gb_UnpackedTarball_add_patches,libodfgen,\ + external/libodfgen/0001-properly-export-API-symbols.patch \ +)) + # vim: set noet sw=4 ts=4: -- 1.9.3