Properly handle language-specific parts of --with-help=html media/ sub-tree

...that previously ended up in language-independent parts of installation sets.

The structure of that media/ tree doesn't allow to directly mis-use the existing
AllLangPackage machinery (which expects the language to be encoded in the first
pathname segment within the tree; and which is already mis-used for the
helpcontent2/AllLangPackage_html_lang.mk parts).

So introduce gb_AllLangPackage_add_files_for_lang that allows to specify the
language explicitly, independent of where it is encoded in the pathname (if at
all).  The underlying gb_AllLangPackage_add_file sets a
gb_AllLangPackage_ALLDIRS that is used by `make packageinfo`, which may need
further fixing by anybody actually using that target; see the mail thread
starting at
<https://lists.freedesktop.org/archives/libreoffice/2018-May/080242.html>
"Broken --with-help=html `make packageinfo`".

All files in $(SRCDIR)/helpcontent2/source/media/ must now explicitly be listed
in either helpcontent2/Package_html_media.mk (for the language-independent
files) or helpcontent2/AllLangPackage_html_media_lang.mk (for the language-
specific files).  Also note the two TODOs in
helpcontent2/AllLangPackage_html_media_lang.mk.

What is not quite right yet is that content from
helpcontent2/AllLangPackage_html_lang.mk and
helpcontent2/AllLangPackage_html_media_lang.mk is ending up in both per-language
helpcontent installation sets (as intended, via the instructions in
helpcontent2/CustomTarget_html.mk) and per-language languagepack installation
sets (which is unintended).  This needs to be fixed with a follow-up commit.

This is the core part of a commit spanning core and helpcontent2.

Change-Id: Ib29e52cf8a3ca7bcd234a8f6919c8eac6157cdbf
This commit is contained in:
Stephan Bergmann 2018-05-24 10:46:43 +02:00
parent 9146dc8850
commit 4a89e3fec3
2 changed files with 11 additions and 3 deletions

View file

@ -961,6 +961,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
$(if $(ENABLE_HTMLHELP),\
helpcontent2_html_dynamic \
helpcontent2_html_media \
helpcontent2_html_icon-themes \
helpcontent2_html_static \
) \
))

View file

@ -63,15 +63,15 @@ endef
# Add a file to one of the child packages.
#
# The language is taken from the first component of the file name. The
# If 'lang' is empty, the language is taken from the first component of the 'source' file name. The
# file is only added if there is a package defined for the language
# (i.e., if we are building with the language).
#
# gb_AllLangPackage_add_file target destination source
# gb_AllLangPackage_add_file target destination source lang
gb_AllLangPackage_ALLDIRS :=
define gb_AllLangPackage_add_file
gb_AllLangPackage_ALLDIRS := $(sort $(gb_AllLangPackage_ALLDIRS) $(patsubst %$(3),%,$(2)))
$(call gb_AllLangPackage__add_file,$(1),$(2),$(3),$(firstword $(subst /, ,$(3))))
$(call gb_AllLangPackage__add_file,$(1),$(2),$(3),$(or $(4),$(firstword $(subst /, ,$(3)))))
endef
@ -84,6 +84,13 @@ $(foreach file,$(3),$(call gb_AllLangPackage_add_file,$(1),$(2)/$(file),$(file))
endef
# gb_AllLangPackage_add_files_for_lang target lang destination-dir file(s)
define gb_AllLangPackage_add_files_for_lang
$(if $(strip $(3)),,$(call gb_Output_error,gb_AllLangPackage_add_files: destination dir cannot be empty))
$(foreach file,$(4),$(call gb_AllLangPackage_add_file,$(1),$(3)/$(file),$(file),$(2)))
endef
# Add several files to the child packages at once.
#
# The files are placed into subdir under the language-dependent path.