Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

could someone please review attached patch ?

Especially I did not know where to put gb_MERGEDLIBS (or you may come
up with better name) (until now it's gb_CORE_LIBS in LinkTarget.mk)
so I put it in solenv/gbuild/extensions/pre_MergedLibsList.mk.

And I'm not sure about gb_LINKED_LIBS in LinkTarget.mk.
The horrible expression could be correct,
but it's probably not nice to have variable used that way there (but it is now).

The rest should be ok.

Thanks,

Matus
From ec43c77ad73f9194676d921c1df615bcd8b04c07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= <matus.kukan@gmail.com>
Date: Fri, 6 Jan 2012 10:48:43 +0100
Subject: [PATCH] improve support for merging libraries

---
 Library_merged.mk                              |   32 ++-------------
 solenv/gbuild/Library.mk                       |    2 +-
 solenv/gbuild/LinkTarget.mk                    |   23 +++--------
 solenv/gbuild/extensions/pre_MergedLibsList.mk |   50 ++++++++++++++++++++++++
 4 files changed, 62 insertions(+), 45 deletions(-)
 create mode 100644 solenv/gbuild/extensions/pre_MergedLibsList.mk

diff --git a/Library_merged.mk b/Library_merged.mk
index 4a8ccaf..9fe9c2d 100644
--- a/Library_merged.mk
+++ b/Library_merged.mk
@@ -21,26 +21,16 @@
 # 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 \
+$(eval $(call gb_Library_add_linked_libs,merged,\
        basegfx \
-       canvastools \
        comphelper \
-       cppcanvas \
        cppu \
        cppuhelper \
-       drawinglayer \
-       editeng \
        fwe \
        i18nisolang1 \
        i18npaper \
-       i18nutil \
-       jvmfwk \
-       lng \
-       fwe \
        sal \
        salhelper \
        sax \
@@ -49,28 +39,24 @@ $(eval $(call gb_Library_add_linked_libs,merged,$(filter-out $(gb_MERGED_LIBS),\
        sot \
        svl \
        svt \
-       svx \
-       svxcore \
        tk \
        tl \
        ucbhelper \
        utl \
        vcl \
-       xo \
        xcr \
        $(gb_STDLIBS) \
-)))
+))
 
 $(eval $(call gb_Library_use_externals,merged,\
-       icui18n \
+       berkeleydb \
        icuuc \
-       jpeg \
-       libxml2 \
        zlib \
 ))
 
+# gb_MERGEDLIBS is defined in solenv/gbuild/extensions/pre_MergedLibsList.mk
 $(eval $(call gb_Library_add_library_objects,merged,\
-       $(gb_CORE_LIBS) \
+       $(gb_MERGEDLIBS) \
 ))
 
 ifeq ($(OS),WNT)
@@ -85,12 +71,4 @@ $(eval $(call gb_Library_add_linked_libs,merged,\
 ))
 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/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index b9173ea..13258b8 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -106,7 +106,7 @@ endef
 # gb_Library__get_final_target has been invented for that purpose...
 define gb_Library_set_componentfile
 $(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),\
-       $(call gb_Library_get_runtime_filename,$(if $(MERGELIBS),$(if $(filter 
$(gb_MERGED_LIBS),$(1)),merged,$(1)),$(1))))
+       $(call gb_Library_get_runtime_filename,$(if $(filter $(1),$(gb_MERGEDLIBS)),merged,$(1))))
 $(call gb_Library__get_final_target,$(1)) : \
        $(call gb_ComponentTarget_get_outdir_target,$(2))
 $(call gb_ComponentTarget_get_target,$(2)) :| $(call gb_Library_get_target,$(1))
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index e4dbd46..e8f9bab 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -46,17 +46,6 @@ CXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
 OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS)
 endif
 
-# if enabled we link all of these libraries into one larger, merged library
-# for which we can do a lot more optimisation, and which is faster to read
-# from disk.
-ifeq ($(MERGELIBS),TRUE)
-# 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
@@ -357,8 +346,10 @@ mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
 
 endef
 
+# If object files from this library are merged, create just empty file
 $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) 
$(gb_Helper_MISCDUMMY)
-       $(call gb_LinkTarget__command,$@,$*)
+       $(if $(filter $*,$(foreach lib,$(gb_MERGEDLIBS),$(call 
gb_Library_get_linktargetname,$(lib)))), \
+               touch $@, $(call gb_LinkTarget__command,$@,$*))
        $(call gb_LinkTarget__command_objectlist,$@,$*)
 
 ifeq ($(gb_FULLDEPS),$(true))
@@ -639,11 +630,9 @@ $$(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
 
-ifeq ($(MERGELIBS),TRUE)
-gb_LINKED_LIBS := $(if $(filter $(gb_CORE_LIBS),$(2)),merged $(filter-out 
$(gb_CORE_LIBS),$(2)),$(2))
-else
-gb_LINKED_LIBS := $(2)
-endif
+gb_LINKED_LIBS := $(if $(filter $(gb_MERGEDLIBS),$(2)), \
+       $(if $(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call 
gb_Library_get_linktargetname,$(lib)))),, merged)) \
+       $(filter-out $(gb_MERGEDLIBS),$(2))
 
 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $$(gb_LINKED_LIBS)
 
diff --git a/solenv/gbuild/extensions/pre_MergedLibsList.mk 
b/solenv/gbuild/extensions/pre_MergedLibsList.mk
new file mode 100644
index 0000000..e39e6f4
--- /dev/null
+++ b/solenv/gbuild/extensions/pre_MergedLibsList.mk
@@ -0,0 +1,50 @@
+# -*- 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 or as specified alternatively below. 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.
+#
+# Major Contributor(s):
+# Copyright (C) 2012 Matúš Kukan <matus.kukan@gmail.com> (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# 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.
+
+ifeq ($(MERGELIBS),TRUE)
+
+# we link all object files from these libraries into one, merged library
+gb_MERGEDLIBS := \
+       avmedia \
+       canvastools \
+       cppcanvas \
+       deploymentmisc \
+       drawinglayer \
+       editeng \
+       filterconfig \
+       lng \
+       package2 \
+       sofficeapp \
+       spl \
+       svx \
+       svxcore \
+       uui \
+       xo \
+
+endif
+
+# vim: set noet sw=4 ts=4:
-- 
1.7.1


Context


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.