diff options
Diffstat (limited to 'solenv')
-rwxr-xr-x | solenv/bin/native-code.py | 217 | ||||
-rw-r--r-- | solenv/gbuild/CppunitTest.mk | 10 | ||||
-rw-r--r-- | solenv/gbuild/ExternalProject.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/Library.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 151 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 23 | ||||
-rw-r--r-- | solenv/gbuild/extensions/post_SpeedUpTargets.mk | 3 | ||||
-rw-r--r-- | solenv/gbuild/partial_build.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/platform/linux.mk | 12 | ||||
-rw-r--r-- | solenv/gbuild/platform/macosx.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 38 | ||||
-rw-r--r-- | solenv/gbuild/static.mk | 253 |
12 files changed, 666 insertions, 53 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 4189b25eabb3..32288b4e529d 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -344,18 +344,6 @@ core_constructor_list = [ "com_sun_star_comp_uri_UriReferenceFactory_get_implementation", "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation", "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation", -# starmath/util/sm.component - "Math_FormulaDocument_get_implementation", - "Math_XMLContentExporter_get_implementation", - "Math_XMLExporter_get_implementation", - "Math_XMLImporter_get_implementation", - "Math_XMLMetaExporter_get_implementation", - "Math_XMLOasisMetaExporter_get_implementation", - "Math_XMLOasisMetaImporter_get_implementation", - "Math_XMLOasisSettingsExporter_get_implementation", - "Math_XMLOasisSettingsImporter_get_implementation", - "Math_XMLSettingsExporter_get_implementation", - "com_sun_star_comp_Math_MathTypeFilter_get_implementation", # svl/source/fsstor/fsstorage.component "svl_FSStorageFactory_get_implementation", # vcl/vcl.android.component @@ -592,6 +580,17 @@ math_constructor_list = [ # starmath/util/sm.component "Math_XMLOasisMetaExporter_get_implementation", "Math_XMLOasisSettingsExporter_get_implementation", + "Math_FormulaDocument_get_implementation", + "Math_XMLContentExporter_get_implementation", + "Math_XMLExporter_get_implementation", + "Math_XMLImporter_get_implementation", + "Math_XMLMetaExporter_get_implementation", + "Math_XMLOasisMetaExporter_get_implementation", + "Math_XMLOasisMetaImporter_get_implementation", + "Math_XMLOasisSettingsExporter_get_implementation", + "Math_XMLOasisSettingsImporter_get_implementation", + "Math_XMLSettingsExporter_get_implementation", + "com_sun_star_comp_Math_MathTypeFilter_get_implementation", ] calc_factory_list = [ @@ -736,6 +735,198 @@ writer_constructor_list = [ "com_sun_star_comp_Writer_EPUBExportFilter_get_implementation", ] +desktop_factory_list = [ + ] + +desktop_constructor_list = [ + "com_sun_star_comp_bridge_BridgeFactory_get_implementation", + "com_sun_star_comp_bridge_BridgeFactory_get_implementation", + "com_sun_star_comp_configuration_ConfigurationProvider_get_implementation", + "com_sun_star_comp_configuration_ConfigurationRegistry_get_implementation", + "com_sun_star_comp_configuration_DefaultProvider_get_implementation", + "com_sun_star_comp_configuration_ReadOnlyAccess_get_implementation", + "com_sun_star_comp_configuration_ReadWriteAccess_get_implementation", + "com_sun_star_comp_deployment_component_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_deployment_configuration_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_deployment_executable_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_deployment_ExtensionManager_get_implementation", + "com_sun_star_comp_deployment_ExtensionManager_get_implementation", + "com_sun_star_comp_deployment_help_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_deployment_PackageManagerFactory_get_implementation", + "com_sun_star_comp_deployment_PackageManagerFactory_get_implementation", + "com_sun_star_comp_deployment_ProgressLog_get_implementation", + "com_sun_star_comp_deployment_script_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_deployment_sfwk_PackageRegistryBackend_get_implementation", + "com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation", + "com_sun_star_comp_frame_SessionListener_get_implementation", + "com_sun_star_comp_framework_AddonsToolBarFactory_get_implementation", + "com_sun_star_comp_framework_Desktop_get_implementation", + "com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation", + "com_sun_star_comp_framework_Frame_get_implementation", + "com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation", + "com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation", + "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation", + "com_sun_star_comp_framework_JobExecutor_get_implementation", + "com_sun_star_comp_framework_LangSelectionStatusbarController_get_implementation", + "com_sun_star_comp_framework_LayoutManager_get_implementation", + "com_sun_star_comp_framework_MenuBarFactory_get_implementation", + "com_sun_star_comp_framework_MenuBarFactory_get_implementation", + "com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation", + "com_sun_star_comp_framework_ModuleManager_get_implementation", + "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation", + "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation", + "com_sun_star_comp_framework_ObjectMenuController_get_implementation", + "com_sun_star_comp_framework_PathSettings_get_implementation", + "com_sun_star_comp_framework_PathSubstitution_get_implementation", + "com_sun_star_comp_framework_PopupMenuControllerFactory_get_implementation", + "com_sun_star_comp_framework_RecentFilesMenuController_get_implementation", + "com_sun_star_comp_framework_RecentFilesMenuController_get_implementation", + "com_sun_star_comp_framework_ResourceMenuController_get_implementation", + "com_sun_star_comp_framework_SaveToolbarController_get_implementation", + "com_sun_star_comp_framework_SaveToolbarController_get_implementation", + "com_sun_star_comp_framework_StatusBarControllerFactory_get_implementation", + "com_sun_star_comp_framework_StatusBarFactory_get_implementation", + "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation", + "com_sun_star_comp_framework_SubToolBarController_get_implementation", + "com_sun_star_comp_framework_SubToolBarController_get_implementation", + "com_sun_star_comp_framework_TaskCreator_get_implementation", + "com_sun_star_comp_framework_ToolbarAsMenuController_get_implementation", + "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation", + "com_sun_star_comp_framework_ToolBarFactory_get_implementation", + "com_sun_star_comp_framework_ToolBarFactory_get_implementation", + "com_sun_star_comp_framework_UICommandDescription_get_implementation", + "com_sun_star_comp_framework_UICommandDescription_get_implementation", + "com_sun_star_comp_framework_UIConfigurationManager_get_implementation", + "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation", + "com_sun_star_comp_framework_URLTransformer_get_implementation", + "com_sun_star_comp_framework_WindowListMenuController_get_implementation", + "com_sun_star_comp_framework_WindowListMenuController_get_implementation", + "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation", + "com_sun_star_comp_graphic_GraphicProvider_get_implementation", + "com_sun_star_comp_office_FrameLoader_get_implementation", + "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation", + "com_sun_star_comp_sfx2_BackingComp_get_implementation", + "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation", + "com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation", + "com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation", + "com_sun_star_comp_stoc_CoreReflection_get_implementation", + "com_sun_star_comp_stoc_Introspection_get_implementation", + "com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation", + "com_sun_star_comp_svx_ColorToolBoxControl_get_implementation", + "com_sun_star_comp_svx_CTLToolBoxControl_get_implementation", + "com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation", + "com_sun_star_comp_svx_Impl_FindbarDispatcher_get_implementation", + "com_sun_star_comp_svx_Impl_FindbarDispatcher_get_implementation", + "com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation", + "com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation", + "com_sun_star_comp_svx_RecoveryUI_get_implementation", + "com_sun_star_comp_svx_StyleToolBoxControl_get_implementation", + "com_sun_star_comp_svx_TableToolBoxControl_get_implementation", + "com_sun_star_comp_svx_TableToolBoxControl_get_implementation", + "com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation", + "com_sun_star_comp_svx_UndoRedoToolBoxControl_get_implementation", + "com_sun_star_comp_svx_UndoRedoToolBoxControl_get_implementation", + "com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation", + "com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation", + "com_sun_star_comp_uri_ExternalUriReferenceTranslator_get_implementation", + "com_sun_star_comp_uri_UriReferenceFactory_get_implementation", + "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation", + "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation", + "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", + "com_sun_star_extensions_xml_sax_Writer_get_implementation", + "com_sun_star_frame_VCLSessionManagerClient_get_implementation", + "com_sun_star_i18n_BreakIterator_get_implementation", + "com_sun_star_i18n_BreakIterator_Unicode_get_implementation", + "com_sun_star_i18n_CharacterClassification_get_implementation", + "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation", + "com_sun_star_i18n_Collator_get_implementation", + "com_sun_star_i18n_LocaleDataImpl_get_implementation", + "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation", + "com_sun_star_i18n_Transliteration_get_implementation", + "com_sun_star_i18n_Transliteration_IGNORE_CASE_get_implementation", + "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation", + "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation", + "com_sun_star_svx_DownSearchToolboxController_get_implementation", + "com_sun_star_svx_ExitFindbarToolboxController_get_implementation", + "com_sun_star_svx_FindAllToolboxController_get_implementation", + "com_sun_star_svx_FindTextToolboxController_get_implementation", + "com_sun_star_svx_FontHeightToolBoxController_get_implementation", + "com_sun_star_svx_MatchCaseToolboxController_get_implementation", + "com_sun_star_svx_SearchLabelToolboxController_get_implementation", + "com_sun_star_svx_UpSearchToolboxController_get_implementation", + "com_sun_star_text_DefaultNumberingProvider_get_implementation", + "dtrans_CMimeContentTypeFactory_get_implementation", + "filter_ConfigFlush_get_implementation", + "filter_ContentHandlerFactory_get_implementation", + "filter_FilterFactory_get_implementation", + "filter_FrameLoaderFactory_get_implementation", + "filter_TypeDetection_get_implementation", + "framework_FooterMenuController_get_implementation", + "framework_FooterMenuController_get_implementation", + "framework_HeaderMenuController_get_implementation", + "framework_HeaderMenuController_get_implementation", + "framework_LanguageSelectionMenuController_get_implementation", + "framework_LanguageSelectionMenuController_get_implementation", + "framework_MacrosMenuController_get_implementation", + "framework_MacrosMenuController_get_implementation", + "framework_NewMenuController_get_implementation", + "framework_NewMenuController_get_implementation", + "framework_ServiceHandler_get_implementation", + "framework_ServiceHandler_get_implementation", + "framework_ToolbarsMenuController_get_implementation", + "framework_ToolbarsMenuController_get_implementation", + "i18npool_Collator_Unicode_get_implementation", + "IndexedPropertyValuesContainer_get_implementation", + "lingucomponent_Hyphenator_get_implementation", + "lingucomponent_LangGuess_get_implementation", + "lingucomponent_SpellChecker_get_implementation", + "lingucomponent_Thesaurus_get_implementation", + "linguistic_DicList_get_implementation", + "linguistic_GrammarCheckingIterator_get_implementation", + "linguistic_LinguProps_get_implementation", + "linguistic_LngSvcMgr_get_implementation", + "lo_writer_NavElementToolBoxController_get_implementation", + "lo_writer_NextScrollToolboxController_get_implementation", + "lo_writer_PreviousScrollToolboxController_get_implementation", + "org_apache_openoffice_comp_framework_ContextChangeEventMultiplexer_get_implementation", + "org_apache_openoffice_comp_framework_NewToolbarController_get_implementation", + "org_apache_openoffice_comp_framework_NewToolbarController_get_implementation", + "org_apache_openoffice_comp_svx_sidebar_PanelFactory_get_implementation", + "package_ManifestReader_get_implementation", + "package_OStorageFactory_get_implementation", + "package_OZipFileAccess_get_implementation", + "package_ZipPackage_get_implementation", + "SfxDocumentMetaData_get_implementation", + "shell_DesktopBackend_get_implementation", + "shell_LocaleBackend_get_implementation", + "stardiv_Toolkit_VCLXPopupMenu_get_implementation", + "stardiv_Toolkit_VCLXToolkit_get_implementation", + "stoc_FactoryImpl_get_implementation", + "svl_FSStorageFactory_get_implementation", + "ucb_expand_ExpandContentProviderImpl_get_implementation", + "ucb_file_FileProvider_get_implementation", + "ucb_OFileAccess_get_implementation", + "ucb_tdoc_ContentProvider_get_implementation", + "ucb_tdoc_DocumentContentFactory_get_implementation", + "ucb_UcbContentProviderProxyFactory_get_implementation", + "ucb_UcbStore_get_implementation", + "ucb_UniversalContentBroker_get_implementation", + "unotools_OTempFileService_get_implementation", + "unoxml_CDocumentBuilder_get_implementation", + "unoxml_CURI_get_implementation", + "unoxml_CXPathAPI_get_implementation", + "unoxml_rdfRepository_get_implementation", + "vcl_SystemClipboard_get_implementation", + "Writer_SwTextDocument_get_implementation", + "com_sun_star_comp_svx_FrameToolBoxControl_get_implementation", + "com_sun_star_i18n_InputSequenceChecker_get_implementation", + "com_sun_star_comp_extensions_SimpleTextFormatter", + "com_sun_star_comp_extensions_LoggerPool", + "com_sun_star_comp_extensions_FileHandler", + "com_sun_star_comp_extensions_PlainTextFormatter", + "desktop_SplashScreen_get_implementation", + ] + factory_map = { 'core' : core_factory_list, 'edit' : edit_factory_list, @@ -743,6 +934,7 @@ factory_map = { 'calc' : calc_factory_list, 'draw' : draw_factory_list, 'writer' : writer_factory_list, + 'desktop' : desktop_factory_list, } constructor_map = { @@ -752,6 +944,7 @@ constructor_map = { 'calc' : calc_constructor_list, 'draw' : draw_constructor_list, 'writer' : writer_constructor_list, + 'desktop' : desktop_constructor_list, } custom_widgets = [ diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index ce6437bf07bd..115e53c75085 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -74,8 +74,13 @@ endif # defined by platform # gb_CppunitTest_get_filename +ifeq (,$(DISABLE_DYNLOADING)) gb_CppunitTest_RUNTIMEDEPS := $(call gb_Executable_get_runtime_dependencies,cppunittester) gb_CppunitTest_CPPTESTCOMMAND := $(call gb_Executable_get_target_for_build,cppunittester) +else +gb_CppunitTest_RUNTIMEDEPS := +gb_CppunitTest_CPPTESTCOMMAND := +endif # i18npool dlopens localedata_* libraries. gb_CppunitTest_RUNTIMEDEPS += \ @@ -205,6 +210,11 @@ $(call gb_CppunitTest_get_target,$(1)) : HEADLESS := --headless $(call gb_CppunitTest_get_target,$(1)) : EXTRA_ENV_VARS := $$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1)))) $(call gb_Helper_make_userfriendly_targets,$(1),CppunitTest) +ifeq ($(DISABLE_DYNLOADING),TRUE) +$$(eval $$(call gb_CppunitTest_use_libraries,$(1),cppunitmain)) +$$(eval $$(call gb_CppunitTest_add_defs,$(1),-D__EMSCRIPTEN__)) +endif +$(if $(filter $(1),$(gb_CppunitTest_KNOWN)),,gb_CppunitTest_KNOWN += $(1)) endef diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk index afb76c3a19d8..8474cf22a38f 100644 --- a/solenv/gbuild/ExternalProject.mk +++ b/solenv/gbuild/ExternalProject.mk @@ -184,9 +184,9 @@ endef # # gb_ExternalProject_use_libraries external libraries define gb_ExternalProject_use_libraries -ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2))) +ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))) $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) -$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk)) +$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk)) endif ifneq (,$$(filter $$(gb_MERGEDLIBS),$(2))) $$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter $$(gb_MERGEDLIBS),$(2)) because they are merged.)) diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index cb8dc6031518..76757bbbeaa3 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -128,6 +128,9 @@ $(if $(3),$(call gb_Output_error,gb_Library_set_soversion_script: too many argum $(call gb_Library__set_soversion_script_platform,$(1),$(2)) endef +gb_Library__get_component_var = $(call gb_Library__get_workdir_linktargetname,$(1))<>COMPONENTFILE +gb_Library__get_component = $($(call gb_Library__get_component_var,$(1))) + # The dependency from workdir component target to outdir library should ensure # that gb_CppunitTest_use_component can transitively depend on the library. # But the component target also must be delivered; use the target @@ -145,6 +148,7 @@ $(call gb_ComponentTarget_get_target,$(2)) :| \ $(call gb_Library_get_target,$(gb_Library__get_name)) $(call gb_Library_get_clean_target,$(gb_Library__get_name)) : \ $(call gb_ComponentTarget_get_clean_target,$(2)) +$(eval $(call gb_Library__get_component_var,$(1)) += $(2)) endef # call gb_Library_set_componentfiles,library,componentfiles diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index cf5bb81e6077..79f51b107dd9 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -36,6 +36,12 @@ # gb_LinkTarget_INCLUDE # gb_YaccTarget__command(grammar-file, stem-for-message, source-target, include-target) +# For the static build on Windows we have to track system libraries from gb_Library_use_system_win32_libs. +# Instead of yet an other tracking dep file, this flags these libraries (and some linker parameters) with +# an @ postfix. But now these must be filtered out, so this defines that filter, just in case we need to +# change the filter, because it conflicts. +gb_LinkTarget__syslib = %@ + # Detect whether symbols should be enabled for the given gbuild target. # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined] gb_LinkTarget__symbols_enabled = \ @@ -45,16 +51,20 @@ gb_LinkTarget__symbols_enabled = \ # debug flags, if the LinkTarget is named in the list of libraries of ENABLE_SYMBOLS_FOR gb_LinkTarget__get_debugflags= \ -$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \ -$(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS), \ -$(gb_COMPILERNOOPTFLAGS))) \ -$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS)) + $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \ + $(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS),$(gb_COMPILERNOOPTFLAGS))) \ + $(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS)) +# T_LDFLAGS is just expanded once. Override the flags here, so that the linker and compiler use the same. +ifeq (EMSCRIPTEN,$(OS)) +gb_LinkTarget__get_debugldflags=$(call gb_LinkTarget__get_debugflags,$1) +else # similar for LDFLAGS, use linker optimization flags in non-debug case, # but moreover strip debug from libraries for which debuginfo is not wanted # (some libraries reuse .o files from other libraries, notably unittests) gb_LinkTarget__get_stripldflags=$(if $(strip $(CFLAGS)$(CXXFLAGS)$(OBJCFLAGS)$(OBJCXXFLAGS)$(LDFLAGS)),,$(gb_LINKERSTRIPDEBUGFLAGS)) gb_LinkTarget__get_debugldflags=$(if $(call gb_LinkTarget__symbols_enabled,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS),$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1))) +endif # generic cflags/cxxflags to use (optimization flags, debug flags) # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags @@ -597,6 +607,11 @@ $(WORKDIR)/Clean/LinkTarget/% : $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \ $(call gb_LinkTarget_get_target,$(LINKTARGET)) \ $(call gb_LinkTarget_get_dep_target,$(LINKTARGET)) \ + $(if $(gb_PARTIAL_BUILD),, \ + $(call gb_LinkTarget_get_dep_libraries_target,$(LINKTARGET)) \ + $(call gb_LinkTarget_get_dep_externals_target,$(LINKTARGET)) \ + $(call gb_LinkTarget_get_dep_statics_target,$(LINKTARGET)) \ + ) \ $(call gb_LinkTarget_get_headers_target,$(LINKTARGET)) \ $(call gb_LinkTarget_get_objects_list,$(LINKTARGET)) \ $(call gb_LinkTarget_get_pch_timestamp,$(LINKTARGETMAKEFILENAME)) \ @@ -610,7 +625,7 @@ $(WORKDIR)/Clean/LinkTarget/% : # cat the deps of all objects in one file, then we need only open that one file # call gb_LinkTarget__command_dep,dep_target,linktargetname define gb_LinkTarget__command_dep -$(call gb_Output_announce,LNK:$(2),$(true),DEP,1) +$(call gb_Output_announce,LNK:$(2).d,$(true),DEP,1) $(call gb_Trace_StartRange,LNK:$(2),DEP) $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) && \ @@ -673,12 +688,24 @@ $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_headers_target, endef +define gb_LinkTarget__add_linked_libs +$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2) + +endef + # it's not possible to use a pattern rule for files in INSTDIR because # it would inevitably conflict with the pattern rule for Package # (especially since external libraries are delivered via Package) # call gb_LinkTarget__command_impl,linktargettarget,linktargetname define gb_LinkTarget__command_impl $(if $(gb_FULLDEPS), + $(if $(DISABLE_DYNLOADING),$(if $(gb_PARTIAL_BUILD),, + $(call gb_LinkTarget__command_dep_libraries,$(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp,$(2)) + mv $(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp $(call gb_LinkTarget_get_dep_libraries_target,$(2)) + $(call gb_LinkTarget__command_dep_externals,$(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp,$(2)) + mv $(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp $(call gb_LinkTarget_get_dep_externals_target,$(2)) + $(call gb_LinkTarget__command_dep_statics,$(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp,$(2)) + mv $(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp $(call gb_LinkTarget_get_dep_statics_target,$(2)))) $(if $(findstring concat-deps,$(2)),, $(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$(2)).tmp,$(2)) mv $(call gb_LinkTarget_get_dep_target,$(2)).tmp $(call gb_LinkTarget_get_dep_target,$(2)))) @@ -695,7 +722,36 @@ endef ifeq ($(gb_FULLDEPS),$(true)) $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps) $(call gb_LinkTarget__command_dep,$@,$*) + +$(dir $(call gb_LinkTarget_get_dep_target,%))/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +ifeq ($(DISABLE_DYNLOADING),TRUE) +ifeq (,$(gb_PARTIAL_BUILD)) + +define gb_LinkTarget__static_dep_x_template + +define gb_LinkTarget__command_dep_$(1) +$$(call gb_Output_announce,LNK:$$(2).d.$(1),$$(true),DEP,1) +mkdir -p $$(dir $$(1)) && \ +TEMPFILE=$$(call var2file,$$(shell $$(gb_MKTEMP)),200,\ + $$(call gb_LinkTarget__get_all_$(1),$$(2))) && \ + $$(call gb_Helper_replace_if_different_and_touch,$$$${TEMPFILE},$$(1)) + +endef + +$$(call gb_LinkTarget_get_dep_$(1)_target,%) : ; + $$(call gb_LinkTarget__command_dep_$(1),$$@,$$*) + +endef # gb_LinkTarget__static_dep_x_template + +$(eval $(call gb_LinkTarget__static_dep_x_template,libraries)) +$(eval $(call gb_LinkTarget__static_dep_x_template,externals)) +$(eval $(call gb_LinkTarget__static_dep_x_template,statics)) + endif +endif +endif # gb_FULLDEPS # Ok, this is some dark voodoo: When declaring a linktarget with # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the @@ -851,7 +907,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS := -endif +endif # gb_FULLDEPS gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := cxx @@ -860,7 +916,7 @@ $(if $(findstring $(INSTDIR),$(1)),$(call gb_LinkTarget__make_installed_rule,$(1 $(call gb_PrecompiledHeader_generate_timestamp_rule,$(2)) -endef +endef # gb_LinkTarget_LinkTarget # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript define gb_LinkTarget_set_soversion_script @@ -1022,6 +1078,32 @@ $(call gb_Library_get_target,$(1)) :| $(call gb_Library_get_headers_target,$(1)) endef +define gb_LinkTarget__generate_all_x_accessors +gb_LinkTarget__get_all_$(1)_var = $$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))<>ALL_$(2) +gb_LinkTarget__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(1))) +gb_Library__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Library_get_linktarget,$$(1)))) +gb_Executable__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Executable_get_linktarget,$$(1)))) +gb_ExternalProject__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_ExternalProject__get_workdir_linktargetname,$$(1)))) +gb_CppunitTest__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_CppunitTest__get_workdir_linktargetname,$$(1)))) + +endef + +$(eval $(call gb_LinkTarget__generate_all_x_accessors,libraries,LIBRARIES)) +gb_LinkTarget__filter_lo_libraries = $(filter-out $(gb_LinkTarget__syslib),$(1)) +gb_LinkTarget__get_all_lo_libraries = $(call gb_LinkTarget__filter_lo_libraries,$(call gb_LinkTarget__get_all_libraries,$(1))) +gb_LinkTarget__filter_sys_libraries = $(patsubst $(gb_LinkTarget__syslib),%,$(filter $(gb_LinkTarget__syslib),$(1))) +gb_LinkTarget__get_all_sys_libraries = $(call gb_LinkTarget__filter_sys_libraries,$(call gb_LinkTarget__get_all_libraries,$(1))) +$(eval $(call gb_LinkTarget__generate_all_x_accessors,externals,EXTERNALS)) +$(eval $(call gb_LinkTarget__generate_all_x_accessors,statics,STATICS)) + +# call gb_LinkTarget__register_type,type,linktarget,type list +define gb_LinkTarget__register_type +$(foreach type,$(3),$(if $(filter $(type),$(call gb_LinkTarget__get_all_$(1),$(2))),, \ + $(if $(gb_DEBUG_STATIC),$$(info $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type))) \ + $$(eval $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type)) \ +)) +endef + # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename define gb_LinkTarget__use_libraries @@ -1035,16 +1117,31 @@ endif $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3) +$(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(2)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \ + $(eval $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_Library_get_headers_target,$(lib))) \ + $(call gb_LinkTarget__lib_dummy_depend,$(lib)) \ +)) + +ifeq (,$(DISABLE_DYNLOADING)) # depend on the exports of the library, not on the library itself # for faster incremental builds when the ABI is unchanged -ifeq ($(DISABLE_DYNLOADING),) -$(call gb_LinkTarget_get_target,$(1)) : \ - $(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib))) +$(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \ + $(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_exports_target,$(lib))) \ +)) + +else # DISABLE_DYNLOADING +ifeq (,$(gb_PARTIAL_BUILD)) +$(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(call gb_LinkTarget__filter_sys_libraries,$(3)) +endif +ifneq (,$(filter Library StaticLibrary,$(call gb_LinkTarget__get_workdir_linktargetclass,$(1)))) +$(if $(filter-out Library,gb_LinkTarget__get_workdir_linktargetclass,$(1)), \ + $(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \ + $(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_target,$(lib))) \ + ))) endif -$(call gb_LinkTarget_get_headers_target,$(1)) : \ - $(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib))) -$(foreach lib,$(2),$(call gb_LinkTarget__lib_dummy_depend,$(lib))) +$(call gb_LinkTarget__register_type,libraries,$(1),$(3)) +endif # DISABLE_DYNLOADING endef @@ -1088,9 +1185,9 @@ endef # call gb_LinkTarget_use_libraries,linktarget,libs define gb_LinkTarget_use_libraries -ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2))) +ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))) $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) -$$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk)) +$$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk)) endif ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS))) ifneq (,$$(filter $(1),$$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library__get_workdir_linktargetname,$(plugin))))) @@ -1128,13 +1225,18 @@ $(if $(call gb_LinkTarget__is_merged,$(1)),\ $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : \ LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2))) -ifeq ($(DISABLE_DYNLOADING),) -$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib))) -endif $(call gb_LinkTarget_get_headers_target,$(1)) : \ $(foreach lib,$(2),$(call gb_StaticLibrary_get_headers_target,$(lib))) $(foreach lib,$(2),$(call gb_LinkTarget__static_lib_dummy_depend,$(lib))) +ifeq ($(DISABLE_DYNLOADING),TRUE) +$(foreach lib,$(2), \ + $$(eval $(call gb_LinkTarget_get_target,$(1)): $(call gb_StaticLibrary_get_target,$(lib)))) +$(call gb_LinkTarget__register_type,statics,$(1),$(2)) +else # DISABLE_DYNLOADING +$(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib))) +endif + endef # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename @@ -1513,8 +1615,10 @@ endef # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename define gb_LinkTarget_set_ilibtarget +ifeq (,$(DISABLE_DYNLOADING)) $(call gb_LinkTarget_get_clean_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET := $(2) +endif endef @@ -1531,7 +1635,7 @@ $(2) : $(call gb_LinkTarget_get_target,$(1)) touch -r $$< $$@; \ else \ rm -f $$<; \ - echo "ERROR: aux-target missing, library deleted, please try running make again"; \ + echo "ERROR: aux-target $$@ missing, library deleted, please try running make again"; \ false; \ fi @@ -1741,6 +1845,10 @@ $(if $(filter undefined,$(origin gb_LinkTarget__use_$(2))),\ $(if $(call gb_LinkTarget__is_merged,$(1)),$(call gb_LinkTarget__use_$(2),$(call gb_Library_get_linktarget,merged))) \ $(call gb_LinkTarget__use_$(2),$(1)) \ ) +ifeq ($(DISABLE_DYNLOADING),TRUE) +$(call gb_LinkTarget__register_type,externals,$(1),$(2)) +endif + endef # $(call gb_LinkTarget_use_externals,library,externals) @@ -1832,9 +1940,9 @@ endef # # call gb_LinkTarget__set_plugin_for,linktarget,loader,nodep define gb_LinkTarget__set_plugin_for -ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2))) +ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))) $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) -$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk)) +$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk)) endif ifeq (,$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin))))) $$(eval $$(call gb_Output_error,Unknown plugin(s) '$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin))))'. Plugins must be registered in Repository.mk or RepositoryExternal.mk)) @@ -1846,6 +1954,7 @@ ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true)) $$(eval $$(call gb_Output_error,Plugin support for build tools not implemented)) endif +$(if $(filter $(2),$(gb_Library_KNOWNLOADERS)),,gb_Library_KNOWNLOADERS += $(2)) $(if $(3),,$(call gb_LinkTarget__use_libraries,$(1),$(2),$(2))) endef diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 46e875d6d227..40360a296b73 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -111,16 +111,30 @@ gb_JunitTest_get_classsetname = JunitTest/$(1) gb_JunitTest_get_target = $(WORKDIR)/JunitTest/$(1)/done gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user gb_PythonTest_get_target = $(WORKDIR)/PythonTest/$(1)/done + +# linktarget = class/object<>some_optional_target, like Library/libswlo.so<>/.../instdir/program/libswlo.so +# while the target is optional, the workdir functions will always work correctly gb_LinkTarget__get_workdir_linktargetname = $(firstword $(subst <>, ,$(1))) +gb_LinkTarget__get_workdir_linktargetclass = $(firstword $(subst /, ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))) +gb_LinkTarget__get_workdir_linktargetobject = $(lastword $(subst /, ,$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))) +gb_LinkTarget_get_target = $(lastword $(subst <>, ,$(1))) +gb_Executable_get_linktargetfile = $(call gb_LinkTarget_get_target,$(call gb_Executable_get_linktarget,$1)) +gb_CppunitTest_get_linktargetfile = $(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$1)) + gb_LinkTarget_get_headers_target = \ $(WORKDIR)/Headers/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) gb_LinkTarget_get_objects_list = \ $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objectlist gb_LinkTarget_get_dep_target = \ $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d +gb_LinkTarget_get_dep_libraries_target = \ + $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.libraries +gb_LinkTarget_get_dep_externals_target = \ + $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.externals +gb_LinkTarget_get_dep_statics_target = \ + $(WORKDIR)/Dep/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).d.statics gb_LinkTarget_get_clean_target = \ $(WORKDIR)/Clean/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) -gb_LinkTarget_get_target = $(lastword $(subst <>, ,$(1))) gb_LinkTarget_get_pch_timestamp = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(1))/Timestamps/$(1) gb_LinkTarget_get_pch_reuse_timestamp = $(WORKDIR)/PrecompiledHeader/$(call gb_PrecompiledHeader__get_debugdir,$(1))/Timestamps/$(1)_reuse gb_Module_get_nonl10n_target = $(WORKDIR)/Module/nonl10n/$(1) @@ -391,6 +405,10 @@ define gb_Executable_get_linktarget $(call gb_Executable__get_workdir_linktargetname,$(1))<>$(call gb_Executable_get_target,$(1)) endef +define gb_ExternalProject__get_workdir_linktargetname +ExternalProject/$(1) +endef + define gb_Library__get_workdir_linktargetname Library/$(call gb_Library_get_filename,$(1)) endef @@ -408,6 +426,9 @@ endif # CROSS_COMPILING define gb_Library_get_linktarget $(call gb_Library__get_workdir_linktargetname,$(1))<>$(call gb_Library_get_target,$(1)) endef +define gb_Library_get_dep_libraries_target +$(call gb_LinkTarget_get_dep_libraries_target,$(call gb_Library_get_linktarget,$(1))) +endef define gb_StaticLibrary__get_workdir_linktargetname StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1)) diff --git a/solenv/gbuild/extensions/post_SpeedUpTargets.mk b/solenv/gbuild/extensions/post_SpeedUpTargets.mk index 3db6355ab90d..cd475133a82c 100644 --- a/solenv/gbuild/extensions/post_SpeedUpTargets.mk +++ b/solenv/gbuild/extensions/post_SpeedUpTargets.mk @@ -9,7 +9,7 @@ ifneq ($(CROSS_COMPILING),) gb_Module_add_targets_for_build := -gb_Module_SKIPTARGETS := check slowcheck screenshot subsequentcheck uicheck +gb_Module_SKIPTARGETS := slowcheck screenshot subsequentcheck uicheck endif ifeq ($(gb_Side),build) @@ -52,7 +52,6 @@ endif endif - ifneq (,$(filter build,$(gb_Module_SKIPTARGETS))) gb_Module_add_target = endif diff --git a/solenv/gbuild/partial_build.mk b/solenv/gbuild/partial_build.mk index bc0e4a261b7b..a2e96f47e9a9 100644 --- a/solenv/gbuild/partial_build.mk +++ b/solenv/gbuild/partial_build.mk @@ -39,6 +39,8 @@ $(eval $(call gb_Module_make_global_targets,$(wildcard $(module_directory)Module ifeq ($(DISABLE_DYNLOADING),TRUE) $(if $(gb_LinkTarget__Lock),$(shell rm -f $(gb_LinkTarget__Lock))) +include $(SRCDIR)/solenv/gbuild/static.mk +$(if $(filter a,$(gb_DEBUG_STATIC)),$(error Abort after static.mk)) endif # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk index ece7a88bd71f..823190490589 100644 --- a/solenv/gbuild/platform/linux.mk +++ b/solenv/gbuild/platform/linux.mk @@ -17,12 +17,20 @@ gb_LinkTarget_LDFLAGS += $(gb__LinkTarget_LDFLAGS_zdefs) include $(GBUILDDIR)/platform/unxgcc.mk +gb_STDLIBS := + ifeq ($(DISABLE_DYNLOADING),TRUE) -gb_STDLIBS := -ldl +gb_STDLIBS += -ldl -lm endif +gb_STDLIBS_CXX := + ifneq ($(ATOMIC_LIB),) -gb_STDLIBS_CXX := $(ATOMIC_LIB) +gb_STDLIBS_CXX += $(ATOMIC_LIB) +endif + +ifeq ($(DISABLE_DYNLOADING),TRUE) +gb_STDLIBS_CXX += -lstdc++ endif # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index a24cefe1080e..fc484e981bce 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -342,7 +342,7 @@ gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION) # UnoApiHeadersTarget class -ifneq ($(filter TRUE,$(DISABLE_DYNLOADING)),) +ifeq ($(DISABLE_DYNLOADING),TRUE) gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2)) else gb_UnoApiHeadersTarget_select_variant = $(2) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index a117020d91d1..bd61d1f1c348 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -72,10 +72,13 @@ gb_LinkTarget_LDFLAGS += \ -Wl,--sysroot=$(SYSBASE) endif +ifeq (,$(DISABLE_DYNLOADING)) gb_LinkTarget_LDFLAGS += \ -Wl,-rpath-link,$(SYSBASE)/lib:$(SYSBASE)/usr/lib \ -Wl,-z,combreloc \ +endif + ifeq ($(HAVE_LD_HASH_STYLE),TRUE) gb_LinkTarget_LDFLAGS += \ -Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \ @@ -109,6 +112,8 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) gb_LinkTarget__cmd_lockfile = $(call gb_Executable_get_command,lockfile) gb_LinkTarget__Lock := $(WORKDIR)/LinkTarget/link.lock gb_LinkTarget__WantLock = $(if $(and $(filter TRUE,$(DISABLE_DYNLOADING)),$(CROSS_COMPILING),$(filter CppunitTest Executable,$(TARGETTYPE))),$(true)) +# In theory would would need to track, if any of the linked objects is C++ code, so for the static build we assume yes :-( +gb_LinkTarget__NeedsCxxLinker = $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)$(DISABLE_DYNLOADING)),$(true)) # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 # we want to use @$(extraobjectlist) in the long run @@ -120,7 +125,7 @@ gb_LinkTarget__WantLock = $(if $(and $(filter TRUE,$(DISABLE_DYNLOADING)),$(CROS define gb_LinkTarget__command_dynamiclink $(if $(gb_LinkTarget__WantLock),$(gb_LinkTarget__cmd_lockfile) -r -1 $(gb_LinkTarget__Lock)) $(call gb_Helper_abbreviate_dirs,\ - $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \ $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ $(gb_LTOFLAGS) \ $(if $(SOVERSIONSCRIPT),-Wl$(COMMA)--soname=$(notdir $(1)) \ @@ -138,13 +143,13 @@ $(call gb_Helper_abbreviate_dirs,\ $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ $(T_LIBS) \ - $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \ -Wl$(COMMA)--end-group \ - , \ + , \ -Wl$(COMMA)--start-group \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ $(T_LIBS) \ - $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(T_STDLIBS_CXX)) \ + $(if $(call gb_LinkTarget__NeedsCxxLinker),$(T_STDLIBS_CXX)) \ -Wl$(COMMA)--end-group \ -Wl$(COMMA)--no-as-needed \ $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \ @@ -152,13 +157,16 @@ $(call gb_Helper_abbreviate_dirs,\ -o $(1) \ $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)) \ $(if $(gb_LinkTarget__WantLock),; RC=$$? ; rm -f $(gb_LinkTarget__Lock); if test $$RC -ne 0; then exit $$RC; fi)) - $(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\ - $(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \ - $(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \ - | cut -d' ' -f1-2 \ - >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ - $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \ - $(WORKDIR)/LinkTarget/$(2).exports,$(1)))) +$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\ + $(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \ + $(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \ + | cut -d' ' -f1-2 \ + >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \ + $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \ + $(WORKDIR)/LinkTarget/$(2).exports,$(1)))) +$(if $(and $(filter CppunitTest Executable,$(TARGETTYPE)),$(filter EMSCRIPTEN,$(OS)),$(filter TRUE,$(ENABLE_QT5))), \ + cp $(QT5_PLATFORMS_SRCDIR)/qtlogo.svg $(QT5_PLATFORMS_SRCDIR)/qtloader.js $(dir $(1)) ; \ + sed -e 's/@APPNAME@/$(subst $(gb_Executable_EXT),,$(notdir $(1)))/' $(QT5_PLATFORMS_SRCDIR)/wasm_shell.html > $(dir $(1))qt_$(notdir $(1))) endef define gb_LinkTarget__command_staticlink @@ -294,12 +302,18 @@ endef gb_CppunitTest_CPPTESTPRECOMMAND := \ $(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs) -gb_CppunitTest_get_filename = libtest_$(1).so +ifeq (,$(DISABLE_DYNLOADING)) +gb_CppunitTest_get_filename = libtest_$(1)$(gb_Library_PLAINEXT) +else +gb_CppunitTest_get_filename = test_$(1)$(gb_Executable_EXT) +endif gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename) gb_CppunitTest_malloc_check := -ex 'set environment MALLOC_CHECK_=2; set environment MALLOC_PERTURB_=153' define gb_CppunitTest_CppunitTest_platform +ifeq (,$(DISABLE_DYNLOADING)) $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE)) +endif endef diff --git a/solenv/gbuild/static.mk b/solenv/gbuild/static.mk new file mode 100644 index 000000000000..872cb22c4ea3 --- /dev/null +++ b/solenv/gbuild/static.mk @@ -0,0 +1,253 @@ +# -*- 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 variuos 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 then 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 build +# 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). + +ifeq ($(true),$(gb_FULLDEPS)) + +ifeq (,$(gb_PARTIAL_BUILD)) + +$(foreach lib,$(gb_Library_KNOWNLIBS),$(if $(call gb_Library__get_component,$(lib)), \ + $(eval $(call gb_Library_use_libraries,components,$(lib))))) + +define gb_LinkTarget__add_x_template + +# call gb_LinkTarget__add_$(1),linktarget,objects +define gb_LinkTarget__add_$(1) +$$(foreach item,$$(2),$$(if $$(filter $$(item),GBUILD_TOUCHED $$(call gb_LinkTarget__get_all_$(1),$$(1))),, + $$(if $(gb_DEBUG_STATIC),$$(info $$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))) += $$(item))) + $$(eval $$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))) += $$(item)) +)) +endef + +endef # gb_LinkTarget__add_x_template + +ifneq (,$(gb_DEBUG_STATIC)) +$(info $(call gb_LinkTarget__add_x_template,libraries)) +$(info $(call gb_LinkTarget__add_x_template,externals)) +$(info $(call gb_LinkTarget__add_x_template,statics)) +endif +$(eval $(call gb_LinkTarget__add_x_template,libraries)) +$(eval $(call gb_LinkTarget__add_x_template,externals)) +$(eval $(call gb_LinkTarget__add_x_template,statics)) + +# call gb_LinkTarget__add_linktargets,linktarget,class,func,objects +define gb_LinkTarget__add_linktargets +$(call gb_LinkTarget__add_$(3),$(1),$(4)) +$(foreach item,$(foreach mapped,$(4),$(call gb_$(2)__get_workdir_linktargetname,$(mapped))), + $(call gb_LinkTarget__add_libraries,$(1),$(call gb_LinkTarget__get_all_libraries,$(item))) + $(call gb_LinkTarget__add_externals,$(1),$(call gb_LinkTarget__get_all_externals,$(item))) + $(call gb_LinkTarget__add_statics,$(1),$(call gb_LinkTarget__get_all_statics,$(item))) +) +endef + +# contains the list of all touched workdir_linktargetname(s) +gb_LinkTarget__ALL_TOUCHED = + +define gb_LinkTarget__add_touch +$(eval $(call gb_LinkTarget__get_all_libraries_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED) +$(eval $(call gb_LinkTarget__get_all_externals_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED) +$(eval $(call gb_LinkTarget__get_all_statics_var,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) += GBUILD_TOUCHED) +gb_LinkTarget__ALL_TOUCHED += $(1) + +endef + +define gb_LinkTarget__remove_touch +$(call gb_LinkTarget__get_all_libraries_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1))) +$(call gb_LinkTarget__get_all_externals_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))) +$(call gb_LinkTarget__get_all_statics_var,$(1)) := $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))) + +endef + +# call gb_LinkTarget__fill_all_deps.linktargetname +define gb_LinkTarget__fill_all_deps +$(if $(filter GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_lo_libraries,$(1))),, + + # LO has quite a few dependency loops, so touch first to break them + $(call gb_LinkTarget__add_touch,$(1)) + + # Add lo libraries + $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_lo_libraries,$(1))), + $(call gb_LinkTarget__fill_all_deps,$(call gb_Library_get_linktarget,$(item))) + $(call gb_LinkTarget__add_libraries,$(1),$(call gb_Library__get_all_libraries,$(item))) + $(call gb_LinkTarget__add_externals,$(1),$(call gb_Library__get_all_externals,$(item))) + $(call gb_LinkTarget__add_statics,$(1),$(call gb_Library__get_all_statics,$(item))) + ) + + # Add (win32) system libraries + $(call gb_LinkTarget__add_libraries,$(1),$(call gb_LinkTarget__get_all_sys_libraries,$(1))) + + # Add externals + $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))), + $(call gb_LinkTarget__fill_all_deps,$(call gb_ExternalProject__get_workdir_linktargetname,$(item))) + $(call gb_LinkTarget__add_libraries,$(1),$(call gb_ExternalProject__get_all_libraries,$(item))) + $(call gb_LinkTarget__add_externals,$(1),$(call gb_ExternalProject__get_all_externals,$(item))) + $(call gb_LinkTarget__add_statics,$(1),$(call gb_ExternalProject__get_all_statics,$(item))) + ) + + # Add statics + $(foreach item,$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))), + $(call gb_LinkTarget__fill_all_deps,$(call gb_StaticLibrary_get_linktarget,$(item))) + $(call gb_LinkTarget__add_libraries,$(1),$(call gb_StaticLibrary__get_all_libraries,$(item))) + $(call gb_LinkTarget__add_externals,$(1),$(call gb_StaticLibrary__get_all_externals,$(item))) + $(call gb_LinkTarget__add_statics,$(1),$(call gb_StaticLibrary__get_all_statics,$(item))) + ) + + $(if $(gb_DEBUG_STATIC), + $(info gb_LinkTarget__fill_all_deps libraries for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_libraries,$(1))) + $(info gb_LinkTarget__fill_all_deps externals for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_externals,$(1))) + $(info gb_LinkTarget__fill_all_deps statics for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)) out: $(call gb_LinkTarget__get_all_statics,$(1))) + ) +) + +endef + + +# call gb_LinkTarget__expand_executable,linktarget +define gb_LinkTarget__expand_executable +$(call gb_LinkTarget__fill_all_deps,$(1)) + +# 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)))) + +$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1))), + $(eval $(call gb_LinkTarget_use_libraries,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_libraries,$(1)))))) + +$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1))), + $(eval $(call gb_LinkTarget_use_externals,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_externals,$(1)))))) + +$(if $(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1))), + $(eval $(call gb_LinkTarget_use_static_libraries,$(1),$(filter-out GBUILD_TOUCHED,$(call gb_LinkTarget__get_all_statics,$(1)))))) + +# Some fixes for the _use_external_project(s) mess +$(if $(filter icui28n icuuc,$(call gb_LinkTarget__get_all_externals,$(1))), + $(call gb_LinkTarget_use_externals,$(1),icudata)) +$(if $(filter orcus-parser,$(call gb_LinkTarget__get_all_externals,$(1))), + $(call gb_LinkTarget_use_static_libraries,$(1),boost_filesystem)) + +$(if $(gb_DEBUG_STATIC), + $(info gb_LinkTarget__expand_executable libraries for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_libraries,$(1))) + $(info gb_LinkTarget__expand_executable externals for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_externals,$(1))) + $(info gb_LinkTarget__expand_executable statics for $(call gb_LinkTarget__get_workdir_linktargetname,$(1)): $(call gb_LinkTarget__get_all_statics,$(1))) +) + +endef + +$(foreach lib,$(gb_Library_KNOWNLIBS), \ + $(eval $(call gb_LinkTarget__fill_all_deps,$(call gb_Library_get_linktarget,$(lib))))) +$(foreach exec,$(gb_Executable_KNOWN), \ + $(eval $(call gb_LinkTarget__expand_executable,$(call gb_Executable_get_linktarget,$(exec))))) +$(foreach cppunit,$(gb_CppunitTest_KNOWN), \ + $(eval $(call gb_LinkTarget__expand_executable,$(call gb_CppunitTest_get_linktarget,$(cppunit))))) +$(foreach workdir_linktargetname,$(gb_LinkTarget__ALL_TOUCHED), \ + $(eval $(call gb_LinkTarget__remove_touch,$(workdir_linktargetname)))) + +else # gb_PARTIAL_BUILD + +# call gb_LinkTarget__expand_executable_template,class +define gb_LinkTarget__expand_executable_template + +gb_$(1)__get_dep_libraries_target = $$(call gb_LinkTarget_get_dep_libraries_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1))) +gb_$(1)__get_dep_externals_target = $$(call gb_LinkTarget_get_dep_externals_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1))) +gb_$(1)__get_dep_statics_target = $$(call gb_LinkTarget_get_dep_statics_target,$$(call gb_$(1)__get_workdir_linktargetname,$$(1))) + +# call gb_$(1)__has_any_dependencies,item +define gb_$(1)__has_any_dependencies +$$(if $$(strip $$(filter-out GBUILD_TOUCHED, + $$(call gb_$(1)__get_all_libraries,$$(1)) + $$(call gb_$(1)__get_all_externals,$$(1)) + $$(call gb_$(1)__get_all_statics,$$(1)))),$$(1)) + +endef + +# call gb_$(1)__expand_deps,item +define gb_$(1)__expand_deps +$$(if $$(call gb_$(1)__has_any_dependencies,$$(1)), + $$(if $$(shell cat $$(call gb_$(1)__get_dep_libraries_target,$$(1)) 2>/dev/null), + $$(eval $$(call gb_$(1)_use_libraries,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_libraries_target,$$(1)))))) + $$(if $$(shell cat $$(call gb_$(1)__get_dep_externals_target,$$(1)) 2>/dev/null), + $$(eval $$(call gb_$(1)_use_externals,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_externals_target,$$(1)))))) + $$(if $$(shell cat $$(call gb_$(1)__get_dep_statics_target,$$(1)) 2>/dev/null), \ + $$(eval $$(call gb_$(1)_use_static_libraries,$$(1),$$(shell cat $$(call gb_$(1)__get_dep_statics_target,$$(1)))))) +) + +endef + +endef # gb_LinkTarget__expand_executable_template + +ifneq (,$(gb_DEBUG_STATIC)) +$(info $(call gb_LinkTarget__expand_executable_template,Executable)) +$(info $(call gb_LinkTarget__expand_executable_template,CppunitTest)) +endif +$(eval $(call gb_LinkTarget__expand_executable_template,Executable)) +$(eval $(call gb_LinkTarget__expand_executable_template,CppunitTest)) + +$(foreach exec,$(gb_Executable_KNOWN),$(eval $(call gb_Executable__expand_deps,$(exec)))) +$(foreach cppunit,$(gb_CppunitTest_KNOWN),$(eval $(call gb_CppunitTest__expand_deps,$(cppunit)))) + +endif # gb_PARTIAL_BUILD +endif # gb_FULLDEPS + +# vim: set noet sw=4 ts=4: |