diff options
author | David Tardon <dtardon@redhat.com> | 2017-11-23 19:39:38 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-08-06 18:23:12 +0200 |
commit | 6cbf82e64224da0625a04e2772e11a1ce67e97dc (patch) | |
tree | b3481d6714468bcd81c5b797e33129d123590ee1 | |
parent | 1a6d999c6a166ca457e302224c1b3315e44d860b (diff) |
move generation of HTML help to gbuild
Change-Id: Ic38ee7b9a3ee4a45bede9d494f717d833e53d69f
-rw-r--r-- | CustomTarget_html.mk | 170 | ||||
-rw-r--r-- | GeneratedPackage_html.mk | 18 | ||||
-rw-r--r-- | GeneratedPackage_html_media.mk | 18 | ||||
-rw-r--r-- | Module_helpcontent2.mk | 10 | ||||
-rw-r--r-- | Package_html.mk | 25 | ||||
-rw-r--r-- | Package_html_static.mk | 26 | ||||
-rwxr-xr-x | help3xsl/get_hid2file.sh | 3 |
7 files changed, 268 insertions, 2 deletions
diff --git a/CustomTarget_html.mk b/CustomTarget_html.mk new file mode 100644 index 0000000000..4335e99498 --- /dev/null +++ b/CustomTarget_html.mk @@ -0,0 +1,170 @@ +# -*- 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/. +# + +$(eval $(call gb_CustomTarget_CustomTarget,helpcontent2/help3xsl)) + +# HACK!! +html_TREE_MODULES := sbasic scalc schart shared simpress smath swriter +html_TEXT_MODULES := $(html_TREE_MODULES) sdatabase sdraw +html_BMARK_MODULES := scalc:CALC schart:CHART swriter:WRITER sdraw:DRAW simpress:IMPRESS smath:MATH sbasic:BASIC shared:SHARED shared/explorer/database:BASE + +$(eval $(call gb_CustomTarget_register_targets,helpcontent2/help3xsl,\ + hid2file.js \ + $(foreach lang,$(gb_HELP_LANGS),\ + $(lang)/bookmarks.js \ + $(lang)/contents.js \ + $(lang)/html.text \ + $(foreach module,$(html_TREE_MODULES),$(module)/$(lang)/contents.part) \ + $(foreach module,$(html_BMARK_MODULES),$(firstword $(subst :, ,$(module)))/$(lang)/bookmarks.part) \ + ) \ +)) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/hid2file.js : \ + $(SRCDIR)/helpcontent2/help3xsl/get_url.xsl \ + $(call gb_ExternalExecutable_get_dependencies,xsltproc) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) + $(call gb_Helper_abbreviate_dirs,\ + ( \ + echo 'var map={' \ + && find $(SRCDIR)/helpcontent2/source/text -type f -name '*.xhp' \ + | while read xhp; do \ + $(call gb_ExternalExecutable_get_command,xsltproc) $< $$xhp \ + | $(gb_AWK) 'NF' \ + ; done \ + && echo '};' \ + ) > $@ \ + ) + +define html_gen_contents_html_dep +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/contents.part : $(call gb_HelpTarget__get_treefile,$(1),$(3)) +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/contents.part : TREE_FILE := $(call gb_HelpTarget__get_treefile,$(1),$(3)) +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/contents.part : LANG := $(2) + +endef + +define html_gen_contents_dep +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/contents.js : \ + $(foreach module,$(html_TREE_MODULES),\ + $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(module)/$(1)/contents.part) +$(foreach module,$(html_TREE_MODULES),$(call html_gen_contents_html_dep,$(module)/$(1),$(1),helpcontent2/source/auxiliary/$(module))) + +endef + +$(eval $(foreach lang,$(gb_HELP_LANGS),$(call html_gen_contents_dep,$(lang)))) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/contents.js : + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,2) + $(call gb_Helper_abbreviate_dirs,\ + ( \ + echo "document.getElementById(\"Contents\").innerHTML='\\" \ + && cat $(filter %.part,$^) | $(gb_AWK) 'NF' \ + && echo "';" \ + ) > $@ \ + ) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/contents.part : \ + $(SRCDIR)/helpcontent2/help3xsl/get_tree.xsl \ + $(call gb_ExternalExecutable_get_dependencies,xsltproc) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) + $(call gb_Helper_abbreviate_dirs,\ + $(call gb_ExternalExecutable_get_command,xsltproc) \ + --stringparam lang $(LANG) \ + --stringparam productversion $(PRODUCTVERSION) \ + -o $@ \ + $(SRCDIR)/helpcontent2/help3xsl/get_tree.xsl \ + $(TREE_FILE) \ + ) + +define html_gen_html_dep +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/html.text : \ + $(foreach module,$(html_TEXT_MODULES),$(call gb_HelpTranslateTarget_get_target,$(module)/$(1))) + +endef + +$(eval $(foreach lang,$(filter-out en-US,$(gb_HELP_LANGS)),$(call html_gen_html_dep,$(lang)))) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/html.text : \ + $(SRCDIR)/helpcontent2/help3xsl/online_transform.xsl \ + $(call gb_ExternalExecutable_get_dependencies,xsltproc) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) + $(call gb_Helper_abbreviate_dirs,\ + cd $(if $(filter en-US,$*),$(SRCDIR),$(call gb_HelpTranslatePartTarget_get_workdir,$*))/helpcontent2/source \ + && rm -rf $(dir $@)text \ + && find text -name "*.xhp" \ + | while read xhp; do \ + $(call gb_ExternalExecutable_get_command,xsltproc) \ + --stringparam fileTree '/' \ + --stringparam Language $* \ + --stringparam local 'yes' \ + --stringparam root `pwd`/ \ + --stringparam productversion $(PRODUCTVERSION) \ + -o $(dir $@)$${xhp%.xhp}.html \ + $(SRCDIR)/helpcontent2/help3xsl/online_transform.xsl \ + `pwd`/$$xhp \ + ; done \ + && touch $@ \ + ) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.js : + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CAT,2) + $(call gb_Helper_abbreviate_dirs,\ + cat $(filter %.part,$^) > $@ \ + ) + +define html__gen_bookmarks_lang_dep +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(2)/$(1)/bookmarks.part : \ + $(call gb_HelpTranslateTarget_get_target,$(firstword $(subst /, ,$(2)))/$(1)) + +endef + +define html__gen_bookmarks_lang_deps +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/bookmarks.js : \ + $(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(2)/$(1)/bookmarks.part +$(if $(filter-out en-US,$(1)),$(call html__gen_bookmarks_lang_dep,$(1),$(2))) +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(2)/$(1)/bookmarks.part : HELP_LANG := $(1) + +endef + +define html__gen_bookmarks_deps +$(foreach lang,$(gb_HELP_LANGS),$(call html__gen_bookmarks_lang_deps,$(lang),$(1))) +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/%/bookmarks.part : APP := $(2) +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/$(1)/%/bookmarks.part : APPDIR := $(1) + +endef + +define html_gen_bookmarks_deps +$(call html__gen_bookmarks_deps,$(firstword $(1)),$(lastword $(1))) + +endef + +$(eval $(foreach module,$(html_BMARK_MODULES),$(call html_gen_bookmarks_deps,$(subst :, ,$(module))))) + +$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl)/%/bookmarks.part : \ + $(SRCDIR)/helpcontent2/help3xsl/get_bookmark.xsl \ + $(call gb_ExternalExecutable_get_dependencies,xsltproc) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1) + $(call gb_Helper_abbreviate_dirs,\ + ( \ + echo "document.getElementById(\"bookmark$(APP)\").innerHTML='\\" \ + && find $(if $(filter en-US,$(HELP_LANG)),$(SRCDIR),$(call gb_HelpTranslatePartTarget_get_workdir,$(HELP_LANG)))/helpcontent2/source/text/$(APPDIR) -name "*.xhp" \ + | while read xhp; do \ + $(call gb_ExternalExecutable_get_command,xsltproc) \ + --stringparam app $(APP) \ + --stringparam Language $(HELP_LANG) \ + --stringparam productversion $(PRODUCTVERSION) \ + $(SRCDIR)/helpcontent2/help3xsl/get_bookmark.xsl \ + $$xhp \ + ; done \ + | sort -k3b -t\> -s \ + | awk 'NF' \ + && echo "'" \ + ) > $@ \ + ) + +# vim: set noet sw=4 ts=4: diff --git a/GeneratedPackage_html.mk b/GeneratedPackage_html.mk new file mode 100644 index 0000000000..9f7786e4c1 --- /dev/null +++ b/GeneratedPackage_html.mk @@ -0,0 +1,18 @@ +# -*- 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/. +# # +# +$(eval $(call gb_GeneratedPackage_GeneratedPackage,helpcontent2_html,$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl))) + +$(eval $(call gb_GeneratedPackage_use_customtarget,helpcontent2_html,helpcontent2/help3xsl)) + +$(eval $(foreach lang,$(gb_HELP_LANGS),\ + $(call gb_GeneratedPackage_add_dir,helpcontent2_html,$(INSTROOT)/$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/$(lang)/text,$(lang)/text) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/GeneratedPackage_html_media.mk b/GeneratedPackage_html_media.mk new file mode 100644 index 0000000000..bb40758518 --- /dev/null +++ b/GeneratedPackage_html_media.mk @@ -0,0 +1,18 @@ +# -*- 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/. +# # +# +$(eval $(call gb_GeneratedPackage_GeneratedPackage,helpcontent2_html_media,$(SRCDIR))) + +$(eval $(call gb_GeneratedPackage_add_dir,helpcontent2_html_media,$(INSTROOT)/$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/media/icon-themes,icon-themes/galaxy)) + +$(eval $(call gb_GeneratedPackage_add_dir,helpcontent2_html_media,$(INSTROOT)/$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/media/helpimg,helpcontent2/source/media/helpimg)) +$(eval $(call gb_GeneratedPackage_add_dir,helpcontent2_html_media,$(INSTROOT)/$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/media/navigation,helpcontent2/source/media/navigation)) +$(eval $(call gb_GeneratedPackage_add_dir,helpcontent2_html_media,$(INSTROOT)/$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/media/screenshots,helpcontent2/source/media/screenshots)) + +# vim: set noet sw=4 ts=4: diff --git a/Module_helpcontent2.mk b/Module_helpcontent2.mk index 2c423a6ee1..8ff89344fb 100644 --- a/Module_helpcontent2.mk +++ b/Module_helpcontent2.mk @@ -14,6 +14,16 @@ $(eval $(call gb_Module_add_targets,helpcontent2,\ Package_helpimages \ )) +ifeq ($(ENABLE_HTMLHELP),TRUE) +$(eval $(call gb_Module_add_targets,helpcontent2,\ + CustomTarget_html \ + GeneratedPackage_html_media \ + GeneratedPackage_html \ + Package_html_static \ + Package_html \ +)) +endif + $(eval $(call gb_Module_add_l10n_targets,helpcontent2,\ AllLangHelp_sbasic \ AllLangHelp_scalc \ diff --git a/Package_html.mk b/Package_html.mk new file mode 100644 index 0000000000..aed4b7674e --- /dev/null +++ b/Package_html.mk @@ -0,0 +1,25 @@ +# -*- 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/. +# # +# +$(eval $(call gb_Package_Package,helpcontent2_html,$(call gb_CustomTarget_get_workdir,helpcontent2/help3xsl))) + +$(eval $(call gb_Package_use_customtarget,helpcontent2_html,helpcontent2/help3xsl)) + +$(eval $(call gb_Package_add_files,helpcontent2_html,$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION),\ + hid2file.js \ +)) + +$(eval $(call gb_Package_add_files_with_dir,helpcontent2_html,$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION),\ + $(foreach lang,$(gb_HELP_LANGS),\ + $(lang)/bookmarks.js \ + $(lang)/contents.js \ + ) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/Package_html_static.mk b/Package_html_static.mk new file mode 100644 index 0000000000..e6767f6a6e --- /dev/null +++ b/Package_html_static.mk @@ -0,0 +1,26 @@ +# -*- 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/. +# # +# +$(eval $(call gb_Package_Package,helpcontent2_html_static,$(SRCDIR)/helpcontent2/help3xsl)) + +$(eval $(call gb_Package_add_files,helpcontent2_html_static,$(LIBO_SHARE_HELP_FOLDER),\ + index.html \ + help.html \ +)) + +$(eval $(call gb_Package_add_file,helpcontent2_html_static,$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION)/index.html,index2.html)) + +$(eval $(call gb_Package_add_files,helpcontent2_html_static,$(LIBO_SHARE_HELP_FOLDER)/$(PRODUCTVERSION),\ + help.js \ + jquery-3.1.1.min.js \ + normalize.css \ + default.css \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/help3xsl/get_hid2file.sh b/help3xsl/get_hid2file.sh index 480572ed66..bf201da37f 100755 --- a/help3xsl/get_hid2file.sh +++ b/help3xsl/get_hid2file.sh @@ -17,7 +17,7 @@ # ########################################### -workDir=$(realpath $2) +workDir=$2 productversion=$1 helpFiles=$(realpath $workDir/../helpcontent2/source/text) @@ -37,4 +37,3 @@ echo 'var map={' >> $bookmarkFile awk 'NF' $tempFile >> $bookmarkFile echo '};' >> $bookmarkFile rm -f $tempFile -exit |