summaryrefslogtreecommitdiffstats
path: root/solenv/gbuild/CliAssembly.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /solenv/gbuild/CliAssembly.mk
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'solenv/gbuild/CliAssembly.mk')
-rw-r--r--solenv/gbuild/CliAssembly.mk209
1 files changed, 209 insertions, 0 deletions
diff --git a/solenv/gbuild/CliAssembly.mk b/solenv/gbuild/CliAssembly.mk
new file mode 100644
index 000000000..9c97e036f
--- /dev/null
+++ b/solenv/gbuild/CliAssembly.mk
@@ -0,0 +1,209 @@
+# -*- 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/.
+#
+
+# CliConfigTarget class
+
+gb_CliConfigTarget_TARGET := $(SRCDIR)/solenv/bin/clipatchconfig.pl
+gb_CliConfigTarget_COMMAND := $(PERL) -w $(gb_CliConfigTarget_TARGET)
+
+define gb_CliConfigTarget__command
+$(call gb_Helper_abbreviate_dirs,\
+ $(gb_CliConfigTarget_COMMAND) $(3) $(CLI_CONFIG_VERSIONFILE) $(1) \
+)
+endef
+
+$(dir $(call gb_CliConfigTarget_get_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_CliConfigTarget_get_target,%) :
+ $(call gb_Output_announce,$*,$(true),CPA,1)
+ $(call gb_Trace_StartRange,$*,CPA)
+ $(call gb_CliConfigTarget__command,$@,$*,$<)
+ $(call gb_Trace_EndRange,$*,CPA)
+
+$(call gb_CliConfigTarget_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),CPA,1)
+ rm -f $(call gb_CliConfigTarget_get_target,$*)
+
+# Subst. variables in a config file
+#
+# gb_CliConfigTarget_CliConfigTarget target source
+define gb_CliConfigTarget_CliConfigTarget
+$(call gb_CliConfigTarget_get_target,$(1)) : CLI_CONFIG_VERSIONFILE := $(3)
+
+$(call gb_CliConfigTarget_get_target,$(1)) : $(2)
+$(call gb_CliConfigTarget_get_target,$(1)) : $(gb_CliConfigTarget_TARGET)
+$(call gb_CliConfigTarget_get_target,$(1)) : $(3)
+$(call gb_CliConfigTarget_get_target,$(1)) :| $(dir $(call gb_CliConfigTarget_get_target,$(1))).dir
+
+endef
+
+# CliAssemblyTarget class
+
+# platform:
+# CliAssemblyTarget_POLICYEXT
+# CliAssemblyTarget_get_dll
+
+gb_CliAssemblyTarget_KEYFILE_DEFAULT := $(SRCDIR)/cli_ure/source/cliuno.snk
+
+define gb_CliAssemblyTarget__command
+$(call gb_Helper_abbreviate_dirs,\
+ $(GNUCOPY) $(CLI_ASSEMBLY_KEYFILE) $(1).tmp.snk && \
+ al \
+ -nologo \
+ -out:$(CLI_ASSEMBLY_OUTFILE) \
+ -version:$(CLI_ASSEMBLY_VERSION) \
+ -keyfile:$(1).tmp.snk \
+ -link:$(CLI_ASSEMBLY_CONFIGFILE) \
+ $(if $(CLI_ASSEMBLY_PLATFORM),-platform:$(CLI_ASSEMBLY_PLATFORM)) && \
+ rm -f $(1).tmp.snk && \
+ touch $(1) \
+)
+endef
+
+$(dir $(call gb_CliAssemblyTarget_get_target,%)).dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(dir $(call gb_CliAssemblyTarget_get_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_CliAssemblyTarget_get_target,%) :
+ $(if $(strip $(CLI_ASSEMBLY_VERSION)),,$(call gb_Output_error,assembly version not set))
+ $(if $(strip $(CLI_ASSEMBLY_CONFIGFILE)),,$(call gb_Output_error,assembly configuration file not set))
+ $(if $(strip $(CLI_ASSEMBLY_OUTFILE)),,$(call gb_Output_error,assembly name not set))
+ $(call gb_Output_announce,$*,$(true),AL ,2)
+ $(call gb_Trace_StartRange,$*,AL )
+ $(call gb_CliAssemblyTarget__command,$@,$*,$<)
+ $(call gb_Trace_EndRange,$*,AL )
+
+$(call gb_CliAssemblyTarget_get_assembly_target,%) :
+ touch $@
+
+.PHONY : $(call gb_CliAssemblyTarget_get_clean_target,%)
+$(call gb_CliAssemblyTarget_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),AL ,2)
+ $(call gb_Helper_abbreviate_dirs,\
+ rm -f $(call gb_CliAssemblyTarget_get_target,$*) $(CLI_ASSEMBLY_OUTFILE) \
+ )
+
+# Create a CLI assembly
+define gb_CliAssemblyTarget_CliAssemblyTarget
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_CONFIGFILE :=
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_KEYFILE := $(gb_CliAssemblyTarget_KEYFILE_DEFAULT)
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_OUTFILE :=
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_PLATFORM :=
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_VERSION :=
+
+$(call gb_CliAssemblyTarget_get_clean_target,$(1)) : CLI_ASSEMBLY_OUTFILE :=
+
+$(call gb_CliAssemblyTarget_get_target,$(1)) :| $(dir $(call gb_CliAssemblyTarget_get_target,$(1))).dir
+
+endef
+
+define gb_CliAssemblyTarget_set_configfile
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_CONFIGFILE := $(2)
+$(call gb_CliAssemblyTarget_get_target,$(1)) : $(2)
+$(call gb_CliAssemblyTarget_get_clean_target,$(1)) : $(3)
+
+endef
+
+define gb_CliAssemblyTarget_set_keyfile
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_KEYFILE := $(2)
+$(call gb_CliAssemblyTarget_get_target,$(1)) : $(2)
+
+endef
+
+define gb_CliAssemblyTarget_set_name
+$(call gb_CliAssemblyTarget_get_target,$(1)) \
+$(call gb_CliAssemblyTarget_get_clean_target,$(1)) : \
+ CLI_ASSEMBLY_OUTFILE := $(call gb_CliAssemblyTarget_get_assembly_target,$(2))
+$(call gb_CliAssemblyTarget_get_assembly_target,$(2)) : $(call gb_CliAssemblyTarget_get_target,$(1))
+
+endef
+
+define gb_CliAssemblyTarget_set_platform
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_PLATFORM := $(2)
+
+endef
+
+define gb_CliAssemblyTarget_set_version
+$(call gb_CliAssemblyTarget_get_target,$(1)) : CLI_ASSEMBLY_VERSION := $(2)
+
+endef
+
+# CliAssembly class
+
+gb_CliAssembly_KEYFILE_DEFAULT := $(gb_CliAssemblyTarget_KEYFILE_DEFAULT)
+gb_CliAssembly_POLICYEXT := $(gb_CliAssemblyTarget_POLICYEXT)
+
+gb_CliAssembly_get_dll = $(call gb_CliAssemblyTarget_get_dll,$(1))
+
+$(call gb_CliAssembly_get_target,%) :
+ $(call gb_Output_announce,$*,$(true),CLA,3)
+ $(call gb_Trace_MakeMark,$*,CLA)
+ mkdir -p $(dir $@) && touch $@
+
+.PHONY : $(call gb_CliAssembly_get_clean_target,%)
+$(call gb_CliAssembly_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),CLA,3)
+ rm -f $(call gb_CliAssembly_get_target,$*)
+
+# call gb_CliAssembly_CliAssembly,dllname,dlltarget
+define gb_CliAssembly_CliAssembly
+$(call gb_CliAssemblyTarget_CliAssemblyTarget,$(1))
+$(call gb_Package_Package_internal,$(1)_assembly,$(WORKDIR))
+$(call gb_Package_set_outdir,$(1)_assembly,$(dir $(2)))
+
+$(call gb_CliAssembly_get_target,$(1)) : $(call gb_CliAssemblyTarget_get_target,$(1))
+$(call gb_CliAssembly_get_target,$(1)) :| $(call gb_Package_get_target,$(1)_assembly)
+$(call gb_CliAssembly_get_clean_target,$(1)) : $(call gb_CliAssemblyTarget_get_clean_target,$(1))
+$(call gb_CliAssembly_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(1)_assembly)
+
+endef
+
+define gb_CliAssembly__add_file
+$(call gb_Package_add_file,$(1)_assembly,$(notdir $(2)),$(subst $(WORKDIR)/,,$(2)))
+
+endef
+
+define gb_CliAssembly__set_configfile_impl
+$(call gb_CliAssemblyTarget_set_configfile,$(1),$(2),$(3))
+$(call gb_CliAssembly__add_file,$(1),$(2))
+
+endef
+
+define gb_CliAssembly__set_configfile
+$(call gb_CliConfigTarget_CliConfigTarget,$(2),$(3),$(4))
+$(call gb_CliAssembly__set_configfile_impl,$(1),$(call gb_CliConfigTarget_get_target,$(2)),$(call gb_CliConfigTarget_get_clean_target,$(2)))
+
+endef
+
+define gb_CliAssembly_set_configfile
+$(call gb_CliAssembly__set_configfile,$(1),$(patsubst %_config,%,$(2)),$(SRCDIR)/$(2),$(SRCDIR)/$(3))
+
+endef
+
+define gb_CliAssembly_set_keyfile
+$(call gb_CliAssemblyTarget_set_keyfile,$(1),$(2))
+
+endef
+
+define gb_CliAssembly_set_platform
+$(call gb_CliAssemblyTarget_set_platform,$(1),$(2))
+
+endef
+
+define gb_CliAssembly_set_policy
+$(call gb_CliAssemblyTarget_set_version,$(1),$(3))
+$(call gb_CliAssemblyTarget_set_name,$(1),$(2))
+$(call gb_CliAssembly__add_file,$(1),$(call gb_CliAssemblyTarget_get_assembly_target,$(2)))
+
+endef
+
+# vim: set noet sw=4 ts=4: