Hi,
Now sending patch for enabling bigger library in gbuild.
Unfortunately the modules have to be in tail_build and there is
nothing to merge now. Only uui.
Hopefully it will be soon better although I don't know who is/will be
working on gbuildification.
How to call it in configure? what should be foo in --enable-foo ?
The idea is to start LibreOffice, all versions (writer, calc, draw,
... what's the term for these? ) and look which libraries are loaded.
Then pick common libraries which are always loaded and link them
together. (I mean create one library from those object files).
These are now called gb_CORE_LIBS.
Then I had an idea if this could be interesting also for writer, .. separately ?
I mean look which libraries are loaded just in writer and merge also
these. (And create gb_WRITER_LIBS, ..)
This should be improvement as is alone but it's done for better
link-time optimization.
Best,
Matúš
From 6c8c1482007765eb27d389da1dc2f5ff501b1c1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@gmail.com>
Date: Thu, 18 Aug 2011 19:07:57 +0200
Subject: [PATCH] Add support for creating merged library.
This commit allows to set which libraries to merge
and creates merged library in tail_build if enabled.
This should save time when loading libraries in application
and also makes more sense for link-time optimization.
---
Library_merged.mk | 96 +++++++++++++++++++++++++++++++++
Module_tail_build.mk | 6 ++
Repository.mk | 1 +
configure.in | 17 ++++++
scp2/source/ooo/file_library_ooo.scp | 2 +
scp2/source/ooo/module_hidden_ooo.scp | 1 +
set_soenv.in | 1 +
solenv/gbuild/Library.mk | 4 +-
solenv/gbuild/LinkTarget.mk | 21 ++++++-
9 files changed, 145 insertions(+), 4 deletions(-)
create mode 100644 Library_merged.mk
diff --git a/Library_merged.mk b/Library_merged.mk
new file mode 100644
index 0000000..d23c82a
--- /dev/null
+++ b/Library_merged.mk
@@ -0,0 +1,96 @@
+# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*-
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+# Matúš Kukan <matus.kukan@gmail.com> (C) 2011, All Rights Reserved.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+
+$(eval $(call gb_Library_Library,merged))
+
+$(eval $(call gb_Library_add_linked_libs,merged,$(filter-out $(gb_MERGED_LIBS),\
+ avmedia \
+ basegfx \
+ canvastools \
+ comphelper \
+ cppcanvas \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ fwe \
+ i18nisolang1 \
+ i18npaper \
+ i18nutil \
+ jvmfwk \
+ lng \
+ fwe \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ xo \
+ xcr \
+ $(gb_STDLIBS) \
+)))
+
+$(eval $(call gb_Library_use_externals,merged,\
+ icui18n \
+ icuuc \
+ jpeg \
+ libxml2 \
+ zlib \
+))
+
+$(eval $(call gb_Library_add_library_objects,merged,\
+ $(gb_MERGED_LIBS) \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_Library_add_linked_libs,merged,\
+ advapi32 \
+ gdi32 \
+ ole32 \
+ oleaut32 \
+ shell32 \
+ user32 \
+ uuid \
+))
+endif
+
+# something is missing here for sure
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_Library_add_linked_libs,merged,\
+ objc \
+ Cocoa \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/Module_tail_build.mk b/Module_tail_build.mk
index 74e4b0f..b6f9c00 100644
--- a/Module_tail_build.mk
+++ b/Module_tail_build.mk
@@ -50,4 +50,10 @@ $(eval $(call gb_Module_add_moduledirs,tail_end,\
writerperfect \
))
+ifeq ($(BIGSVX),YES)
+$(eval $(call gb_Module_add_targets,tail_end,\
+ Library_merged \
+))
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/Repository.mk b/Repository.mk
index 381fd61..8d5f2d6 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -88,6 +88,7 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
i18nregexp \
lng \
lwpft \
+ merged \
msfilter \
msword \
msworks \
diff --git a/configure.in b/configure.in
index 782d4cc..f74c4b7 100755
--- a/configure.in
+++ b/configure.in
@@ -116,6 +116,11 @@ AC_ARG_ENABLE(ext-wiki-publisher,
dnl ---------- *** ----------
+AC_ARG_ENABLE(bigsvx,
+ AS_HELP_STRING([--enable-bigsvx],
+ [Enables linking of big merged library used for better performance.]),
+,)
+
AC_ARG_ENABLE(graphite,
AS_HELP_STRING([--enable-graphite],
[Enables the compilation of Graphite smart font rendering.]),
@@ -9081,6 +9086,18 @@ fi
AC_MSG_RESULT([$GMAKE_PARALLELISM])
AC_SUBST(GMAKE_PARALLELISM)
+# ===================================================================
+# Creating bigger shared library to link against
+# ===================================================================
+AC_MSG_CHECKING([whether to create a big library for better performance])
+if test "$enable_bigsvx" != "no"; then
+ BIGSVX="YES"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+AC_SUBST(BIGSVX)
+
dnl ===================================================================
dnl Setting up the environment.
dnl ===================================================================
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index b89deee..6e5b9a4 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1294,6 +1294,8 @@ STD_LIB_FILE( gid_File_Lib_Swui, swui)
STD_LIB_FILE( gid_File_Lib_Msword, msword )
+STD_LIB_FILE( gid_File_Lib_Merged, merged )
+
#if ! defined UNX
File gid_File_Lib_Sysdtrans
TXT_FILE_BODY;
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 62d49ad..0edfcc0 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -254,6 +254,7 @@ Module gid_Module_Root_Files_4
gid_File_Lib_AVMediaWin,
gid_File_Lib_AVMediaGStreamer,
gid_File_Lib_BaseGfx,
+ gid_File_Lib_Merged,
gid_File_Lib_Sysdtrans,
gid_File_Lib_Sw,
gid_File_Lib_TextConversionDlgs,
diff --git a/set_soenv.in b/set_soenv.in
index 7e4441f..2ce3bfa 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -2061,6 +2061,7 @@ ToFile( "SYSTEM_LIBTEXTCAT_DATA","@SYSTEM_LIBTEXTCAT_DATA@","e" );
ToFile( "XAU_LIBS", "@XAU_LIBS@", "e" );
ToFile( "GXX_INCLUDE_PATH", PathFormat("@GXX_INCLUDE_PATH@"), "e" );
ToFile( "COMMON_BUILD_TOOLS",$COMMON_BUILD_TOOLS, "e" );
+ToFile( "BIGSVX", "@BIGSVX@", "e" );
if ($platform !~ m/cygwin/) {
if ( !defined $ENV{"TMPDIR"} || $ENV{"TMPDIR"} eq "" ) {
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 022e82a..f5837f7 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -80,7 +80,8 @@ $(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_L
endef
define gb_Library_set_componentfile
-$(call gb_ComponentTarget_ComponentTarget,$(or $(strip $(3)),$(strip $(2))),$(call
gb_Library__get_componentprefix,$(1)),$(call gb_Library_get_runtime_filename,$(1)),$(2))
+$(call gb_ComponentTarget_ComponentTarget,$(or $(strip $(3)),$(strip $(2))),$(call
gb_Library__get_componentprefix,$(1)),\
+ $(call gb_Library_get_runtime_filename,$(if $(BIGSVX),$(if $(filter
$(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1))),$(2))
$(call gb_Library_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2)) $(call
gb_ComponentTarget_get_outdir_inbuild_target,$(2))
$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(or $(strip
$(3)),$(strip $(2))))
@@ -120,6 +121,7 @@ $(eval $(foreach method,\
add_generated_cobjects \
add_generated_cxxobjects \
add_generated_exception_objects \
+ add_library_objects \
add_cflags \
set_cflags \
add_cxxflags \
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 8ed772d..688be1b 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -44,6 +44,15 @@ CXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
endif
+# if enabled we can create one library instead of more smaller
+ifeq ($(BIGSVX),YES)
+# list of libraries which are always loaded, thus we can merge them into one
+# they have to be from tail_build, so we could link against merged library
+gb_CORE_LIBS := \
+ uui \
+
+endif
+
# Overview of dependencies and tasks of LinkTarget
#
# target task depends on
@@ -695,11 +704,17 @@ $$(eval $$(call gb_Output_info,currently known libraries are: $(sort
$(gb_Librar
$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out
$(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
endif
-$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
+ifeq ($(BIGSVX),YES)
+gb_LINKED_LIBS := $(if $(filter $(gb_CORE_LIBS),$(2)),merged $(filter-out
$(gb_CORE_LIBS),$(2)),$(2))
+else
+gb_LINKED_LIBS := $(2)
+endif
+
+$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $$(gb_LINKED_LIBS)
-$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_Library_get_target,$$(lib)))
+$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$$(gb_LINKED_LIBS),$$(call
gb_Library_get_target,$$(lib)))
$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
-$$(foreach lib,$(2),$$(call gb_Library_get_headers_target,$$(lib)))
+$$(foreach lib,$$(gb_LINKED_LIBS),$$(call gb_Library_get_headers_target,$$(lib)))
endef
--
1.7.1
Context
- [Libreoffice] [GSoC] bigger libraries · Matúš Kukan
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.