office-gobmx/Makefile.gbuild
Jan-Marek Glogowski dc9ccf3d8f gbuild: build static LO / link static executables
This allows to build a complete static LibreOffice on Linux,
except for linked externals. Since LO's static build implies
disabled dynamic loading, one must select one VCL backend to
be compiled in.

See the (large) comment in solenv/gbuild/static.mk trying to
explain, why this implementation was chosen (spoiler: seems
there is no other way) and what is actually implemented.

This will collect all libraries, statics and externals of
executables. If the executable uses components, it will get
linked to all static components. While it works with any
Executable, it just makes sense for soffice.bin, because the
static component map sucks every dependency in, bloating most
other binaries.

In theory on could generate the dependencies based on the list
of used components (see gb_CppunitTest_use_components), then
generate a specific static constructor map, directly include it
in the exe's cxx code and then link the minimal dependencies.

The static LO should build on Linux with:
--enable-customtarget-components
--disable-dynamic-loading

Tested VCL plugin config is:
--disable-gtk3
--disable-gen
--enable-qt5

The partial build support is split into a 2nd patch.

Change-Id: Iafc95752fae9e88095f54a21f1e30a4f080815e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126790
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-01-12 11:12:46 +01:00

65 lines
3.2 KiB
Text

# -*- 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/.
#
ifeq (,$(gb_Side))
gb_Side := host
endif
ifeq (,$(BUILDDIR))
BUILDDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
endif
include $(BUILDDIR)/config_$(gb_Side).mk
include $(SRCDIR)/solenv/gbuild/gbuild.mk
$(eval $(call gb_Module_make_global_targets,$(SRCDIR)/RepositoryModule_$(gb_Side).mk))
ifeq ($(DISABLE_DYNLOADING),TRUE)
$(if $(gb_LinkTarget__Lock),$(shell rm -f $(gb_LinkTarget__Lock)))
ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS),TRUE)
include $(SRCDIR)/solenv/gbuild/static.mk
$(if $(filter a,$(gb_DEBUG_STATIC)),$(error Abort after static.mk))
endif
endif
upload-symbols:
bin/upload_symbols.py $(WORKDIR)/symbols.zip $(BREAKPAD_SYMBOL_CONFIG) "$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)"
create-update-info:
$(eval BUILDID := $(shell git -C $(SRCDIR) log -1 --format=%H))
$(eval VERSION := $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX))
$(eval PLATFORM := $(RTL_OS)_$(RTL_ARCH))
$(eval MAR_NAME_PREFIX := $(PRODUCTNAME)_$(VERSION)_$(PLATFORM)_$(BUILDID))
$(eval UPDATE_DIR := $(WORKDIR)/update-info)
$(eval MAR_DIR := $(WORKDIR)/mar)
rm -rf $(MAR_DIR) || true
rm -rf $(UPDATE_DIR) || true
mkdir -p $(MAR_DIR)/language
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)"
$(if $(filter WNT,$(OS)),, \
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_full_mar_for_languages.py "$(PRODUCTNAME)" "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)" \
)
upload-update-info:
$(eval BUILDID := $(shell git -C $(SRCDIR) log -1 --format=%H))
$(eval PLATFORM := $(RTL_OS)_$(RTL_ARCH))
$(eval UPDATE_DIR := $(WORKDIR)/update-info)
$(eval VERSION := $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX))
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_build_config.py "$(PRODUCTNAME)" "$(VERSION)" "$(BUILDID)" "$(PLATFORM)" "$(UPDATE_DIR)" "$(UPDATE_CONFIG)"
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/upload_builds.py "$(PRODUCTNAME)" "$(BUILDID)" "$(PLATFORM)" "$(UPDATE_DIR)" "$(UPDATE_CONFIG)"
MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/upload_build_config.py "$(UPDATE_DIR)" "$(UPDATE_CONFIG)"
create-partial-info:
$(eval BUILDID := $(shell git -C $(SRCDIR) log -1 --format=%H))
$(eval VERSION := $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX))
$(eval PLATFORM := $(RTL_OS)_$(RTL_ARCH))
$(eval MAR_NAME_PREFIX := $(PRODUCTNAME)_$(VERSION)_$(PLATFORM)_$(BUILDID))
MBSDIFF=$(WORKDIR)/LinkTarget/Executable/mbsdiff MAR=$(INSTDIR)/program/mar $(SRCDIR)/bin/update/create_partial_update.py "$(WORKDIR)" "$(MAR_NAME_PREFIX)" "$(UPDATE_CONFIG)" "$(PLATFORM)" "$(BUILDID)"
# vim: set noet sw=4 ts=4: