Re: [Libreoffice] [GBUILD PATCH] merging libraries

2012-01-10 Thread Bjoern Michaelsen
Hi Matúš,

On Sun, Jan 08, 2012 at 09:27:26PM +0100, Matúš Kukan wrote:
> 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).

It looks to me like it does the right thing, so I'd think we should use it.
Possibly one could add a $(sort) to prevent "merged" to be added to the linked
libs multiple times.

Best,

Bjoern
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [GBUILD PATCH] merging libraries

2012-01-08 Thread Matúš Kukan
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?= 
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),