[PATCH] WiP: Remove the need to manually register libs in scp2

Björn Michaelsen (via_Code_Review) gerrit at gerrit.libreoffice.org
Wed Feb 13 14:51:43 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2144

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/44/2144/1

WiP: Remove the need to manually register libs in scp2

- we have all the needed information in gbuild
- reduce the amount of double and triple bookkeeping
- hopefully the generated files for scp2 are only a intermediate step
  and we can do whatever perl voodoo scp2 does directly in gbuild
- currently using basctl as an example
- this also means we have to me more strict in Repository.mk with what
  we register:
  - if we dont build a libs, it shouldnt be registered (otherwise scp2
    will want the nonexisting lib)
  - in the end, this is a Good Thing(tm): we dont want anyone trying to
    e.g. link against a lib we dont build

- TODO: the OOOLIBSINSTALLED group is currently only added on unxgcc,
  needs to be done for other platforms too (and probably be renamed)
- TODO: the same can likely be done for other stuff: executables,
  other files ...

Change-Id: I241ca67edbfabae83859274f9aa35d2d26165ef6
---
M Repository.mk
A scp2/AutoInstallLibs_ooolibs.mk
M scp2/Module_scp2.mk
M scp2/source/ooo/file_library_ooo.scp
M scp2/source/ooo/module_hidden_ooo.scp
A solenv/gbuild/AutoInstallLibs.mk
M solenv/gbuild/Helper.mk
M solenv/gbuild/InstallModuleTarget.mk
M solenv/gbuild/TargetLocations.mk
M solenv/gbuild/gbuild.mk
M solenv/gbuild/platform/unxgcc.mk
11 files changed, 71 insertions(+), 4 deletions(-)



diff --git a/Repository.mk b/Repository.mk
index 6f62ae2..3f15847 100755
--- a/Repository.mk
+++ b/Repository.mk
@@ -218,6 +218,12 @@
 
 endif
 
+ifeq ($(DISABLE_SCRIPTING),)
+$(eval $(call gb_Helper_register_libraries,OOOLIBSINSTALLED, \
+    basctl \
+))
+endif
+
 $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
     abp \
     acc \
@@ -227,7 +233,6 @@
     agg \
     analysis \
     animcore \
-    basctl \
     $(if $(filter $(OS),ANDROID),, \
 		basebmp \
     ) \
diff --git a/scp2/AutoInstallLibs_ooolibs.mk b/scp2/AutoInstallLibs_ooolibs.mk
new file mode 100644
index 0000000..6dd6372
--- /dev/null
+++ b/scp2/AutoInstallLibs_ooolibs.mk
@@ -0,0 +1,12 @@
+# -*- 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_AutoInstallLibs_AutoInstallLibs,ooolibs,OOOLIBSINSTALLED,STD_LIB_FILE(gid_File_Lib_$$(1),$$(1))))
+
+# vim: set noet sw=4 ts=4:
diff --git a/scp2/Module_scp2.mk b/scp2/Module_scp2.mk
index c4f8145..62dcc14 100644
--- a/scp2/Module_scp2.mk
+++ b/scp2/Module_scp2.mk
@@ -28,6 +28,7 @@
 $(eval $(call gb_Module_Module,scp2))
 
 $(eval $(call gb_Module_add_targets,scp2,\
+	AutoInstallLibs_ooolibs \
 	CustomTarget_langmacros \
 	InstallModule_accessories \
 	InstallModule_base \
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index a804041..39e6ebf 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -25,6 +25,7 @@
  *
  ************************************************************************/
 #include "macros.inc"
+#include "AutoInstallLibs/ooolibs"
 
 #if defined SOLAR_JAVA && defined WNT
 File gid_File_Lib_Accessbridge
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index 13bb7b7..6cab9a4 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -204,6 +204,7 @@
 	gid_File_Filter_Ira,
 	gid_File_Filter_Itg,
 	gid_File_Filter_Iti,
+	gid_File_Lib_basctl,
 	gid_File_Lib_Bib,
 	gid_File_Lib_Chartcore,
 	gid_File_Lib_Chartcontroller,
@@ -284,7 +285,6 @@
 	gid_File_Lib_Vclplug_Kde,
 	gid_File_Lib_Vclplug_Kde4,
 	gid_File_Lib_Vclplug_Svp,
-	gid_File_Lib_Basctl,
 	gid_File_Lib_CanvasTools,
 	gid_File_Lib_CppCanvas,
 	gid_File_Lib_Agg,
diff --git a/solenv/gbuild/AutoInstallLibs.mk b/solenv/gbuild/AutoInstallLibs.mk
new file mode 100644
index 0000000..02b54ca
--- /dev/null
+++ b/solenv/gbuild/AutoInstallLibs.mk
@@ -0,0 +1,38 @@
+# -*- 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/.
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+
+# AutoInstallLibs class
+
+$(dir $(call gb_AutoInstallLibs_get_target,%)).dir :
+	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_AutoInstallLibs_get_target,%) :
+	$(call gb_Output_announce,$*,$(true),AIL,3)
+	echo "/* autogenerated library installs for group $(GROUP) */" > $@
+	echo "group: $(GROUP) contents: $(gb_Library_$(GROUP)) template: $(SCP2TEMPLATE)"
+	$(foreach lib,$(gb_Library_$(GROUP)),\
+		echo "$(call SCP2TEMPLATE,$(lib))" >> $@)
+
+
+$(call gb_AutoInstallLibs_get_clean_target,%) :
+	$(call gb_Output_announce,$*,$(false),AIL,3)
+	rm -f $(call gb_AutoInstallLibs_get_target,$*)
+
+define gb_AutoInstallLibs_AutoInstallLibs
+$(call gb_AutoInstallLibs_get_target,$(1)) : $(gb_Helper_PHONY) | $(dir $(call gb_AutoInstallLibs_get_target,$(1))).dir
+$(call gb_AutoInstallLibs_get_target,$(1)) : GROUP = $(2)
+$(call gb_AutoInstallLibs_get_target,$(1)) : SCP2TEMPLATE = $(3)
+
+$$(eval $$(call gb_Module_register_target,$(call gb_AutoInstallLibs_get_target,$(1)),$(call gb_AutoInstallLibs_get_clean_target,$(1))))
+$(call gb_Helper_make_userfriendly_targets,$(1),AutoInstallLibs)
+
+endef
+
+# vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/solenv/gbuild/Helper.mk b/solenv/gbuild/Helper.mk
index f81a6b4d..9693830 100644
--- a/solenv/gbuild/Helper.mk
+++ b/solenv/gbuild/Helper.mk
@@ -104,7 +104,7 @@
 
 define gb_Helper_init_registries
 gb_Executable_VALIDGROUPS := UREBIN SDK OOO NONE
-gb_Library_VALIDGROUPS := OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS EXTENSIONLIBS
+gb_Library_VALIDGROUPS := OOOLIBSINSTALLED OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS EXTENSIONLIBS
 gb_StaticLibrary_VALIDGROUPS := PLAINLIBS
 gb_Jar_VALIDGROUPS := URE OOO OXT
 
diff --git a/solenv/gbuild/InstallModuleTarget.mk b/solenv/gbuild/InstallModuleTarget.mk
index a150f26..717752f 100644
--- a/solenv/gbuild/InstallModuleTarget.mk
+++ b/solenv/gbuild/InstallModuleTarget.mk
@@ -282,7 +282,7 @@
 
 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_FILES :=
 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_DEFS :=
-$(call gb_InstallModuleTarget_get_target,$(1)) : SCP_INCLUDE := -I$(SRCDIR)/scp2/inc
+$(call gb_InstallModuleTarget_get_target,$(1)) : SCP_INCLUDE := -I$(SRCDIR)/scp2/inc -I$(WORKDIR)
 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_TEMPLATE_INCLUDE :=
 $(call gb_InstallModuleTarget_use_custom_headers,$(1),scp2/macros)
 
@@ -316,6 +316,11 @@
 
 endef
 
+define gb_InstallModuleTarget_use_auto_install_libs
+$(call gb_InstallModuleTarget_get_external_target,$(1)) : $(call gb_AutoInstallLibs_get_target,$(2))
+
+endef
+
 define gb_InstallModuleTarget_use_custom_header
 $(call gb_InstallModuleTarget_get_external_target,$(1)) :| $(call gb_CustomTarget_get_target,$(2))
 $(call gb_InstallModuleTarget_get_target,$(1)) : SCP_INCLUDE += -I$(call gb_CustomTarget_get_workdir,$(2)) \
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index a32c997..9d72082 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -78,6 +78,7 @@
 
 # workdir target patterns
 
+gb_AutoInstallLibs_get_target = $(WORKDIR)/AutoInstallLibs/$(1)
 gb_AllLangResTarget_get_target = $(WORKDIR)/AllLangRes/$(1)
 gb_AllLangZip_get_target = $(WORKDIR)/AllLangZip/$(1)
 gb_AsmObject_get_target = $(WORKDIR)/AsmObject/$(1).o
@@ -230,6 +231,7 @@
 endef
 
 $(eval $(call gb_Helper_make_clean_targets,\
+	AutoInstallLibs \
 	AllLangResTarget \
 	AllLangZip \
 	CliAssembly \
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 9e621cd..7e3feae 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -336,6 +336,7 @@
 	InstallModuleTarget \
 	InstallModule \
 	InstallScript \
+	AutoInstallLibs \
 ,$(GBUILDDIR)/$(class).mk)
 
 # optional extensions that should never be essential
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index d6b67be..2391c78 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -244,6 +244,7 @@
 gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
 
 gb_Library_FILENAMES := \
+	$(foreach lib,$(gb_Library_OOOLIBSINSTALLED),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
 	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
 	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
 	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
@@ -257,6 +258,7 @@
 
 
 gb_Library_LAYER := \
+	$(foreach lib,$(gb_Library_OOOLIBSINSTALLED),$(lib):OOO) \
 	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
 	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
 	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \

-- 
To view, visit https://gerrit.libreoffice.org/2144
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I241ca67edbfabae83859274f9aa35d2d26165ef6
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Björn Michaelsen <bjoern.michaelsen at canonical.com>


More information about the LibreOffice mailing list