# -*- 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/. #
# "spezialgelagerter Sonderfall" :-( # # ******************************************* # Use gb_DEBUG_STATIC=t to dump various debug info for the static build preparation! # Use gb_DEBUG_STATIC=a to abort / error after the dump # ******************************************* # # "Generic" comment from the author: # My thought was: the dependency info is already there. Can't be too hard to use it for # correct static linkage... well it took more than two weeks to hopefully identify all # problems / edge cases. Now I can appreciate the usage bin/lo-all-static-libs even more. # # This code moved a few times to the various gbuild / make phases: Makefile / module # setup (in use_(libraries|externals)), post parsing (like now), make "dependency" tree # processing. It currently looks like this is the only working option. # # For static linking, we must collect all depending libraries, externals and statics to # be available at link time. And Libraries and externals can use each other. This could # be done "in-line", while make processes the dependency tree and would have the correct # order, so no separate tree-walking would be needed. # It can't be done while reading / processing the modules, as this happens in no order, so # depending modules will be missing. # # Then there is the (gbuild new) concept of plugin libraries. These depend on some loader # libraries, like vcl and vclplug_* or gie. For a shared library build, these plugins are # just dlopen'ed, but for a static build, any linked binary must also link the plugins, which # turns plugins + loaders into a dependency cycle. The implemented solution is to just add # plugins to executables, if these depend on a loader library. This results in the additional # rule: nothing non-plugin is allowed to depend on a plugins (see gb_Library_set_plugin_for). # # And we can't add these dependencies while make is already processing the Executables, # because these contain additional eval'ed targets, which we can't create in make recipes. # This is especially true for externals (see gb_LinkTarget__use_* in RepositoryExternal.mk). # We also can't add all plugins to all executables, as we have multiple helper # binaries, which are needed early and don't depend on plugins. # # So the only option left seems to be to walk the dependency tree ourself and expand all # the libraries and externals and then add the plugins to the executables. Statics are # handled after that, since these won't need extra dependencies not already known. # It's a bit fragile in theory, as you can add "gbuild-undetectable" dependencies to any # target in the modules, which would need some manual adjustment, but currently that # doesn't seem to happen in any breaking way and it works to link multiple Executable # with large and small expanded dependency lists. # # Then there is the special static "components" library, which simply depends on all built # components. In theory these could be limited per-module (Writer, Calc, etc.), but currently # this is not implemented and instead solenv/bin/native-code.py is used, so actually # everything is build and "cleaned up" at link time, which is especially expensive for WASM. # That library is currently just used for Emscripten, but could be used generally for # static builds. # # There is already a lot of $(info ...) protected by the already mentioned $(gb_DEBUG_STATIC).
# 1. Check if cppuhelper loader for components is requested and add the needed plugin dependences # This is a *HACK*, so we don't have to recursively check loader libraries # 2. Find any other loader libraries and add the needed plugin dependences
$(if $(filter cppuhelper,$(filter $(gb_Library_KNOWNLOADERS),$(call gb_LinkTarget__get_all_libraries,$(1)))),
$(call gb_LinkTarget__add_linktargets,$(1),Library,libraries,$(call gb_Library__get_plugins,cppuhelper)))
$(foreach loader,$(filter $(filter-out cppuhelper,$(gb_Library_KNOWNLOADERS)),$(call gb_LinkTarget__get_all_libraries,$(1))),
$(call gb_LinkTarget__add_linktargets,$(1),Library,libraries,$(call gb_Library__get_plugins,$(loader))))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.