single source file for licensing info with conditional text
... for easier maintenance. This commit only introduces the framework. Follow up commits will update the license file. Advantages: * single source, multiple outputs (html, txt) * conditional text, i.e. output will not include license terms of components that are not configured in the build Change-Id: I0ffad41119228a0a26fd1b6ce19930ca6085adb2 Reviewed-on: https://gerrit.libreoffice.org/69396 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
parent
37399c7100
commit
7a9f6df7fb
15 changed files with 6444 additions and 16123 deletions
|
@ -1030,7 +1030,7 @@ $(eval $(call gb_Helper_register_packages_for_install,brand,\
|
|||
) \
|
||||
) \
|
||||
readlicense_oo_files \
|
||||
$(if $(filter WNT,$(OS)),readlicense_oo_license) \
|
||||
readlicense_oo_license \
|
||||
$(call gb_Helper_optional,DESKTOP,setup_native_packinfo) \
|
||||
))
|
||||
|
||||
|
|
|
@ -7,17 +7,19 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_Package_Package,odk_share_readme,$(SRCDIR)))
|
||||
readlicense_oo_DIR := $(call gb_CustomTarget_get_workdir,readlicense_oo/license)
|
||||
$(eval $(call gb_Package_Package,odk_share_readme,$(readlicense_oo_DIR)))
|
||||
|
||||
$(eval $(call gb_Package_set_outdir,odk_share_readme,$(INSTDIR)))
|
||||
|
||||
$(eval $(call gb_Package_add_files,odk_share_readme,$(SDKDIRNAME)/share/readme,\
|
||||
readlicense_oo/license/LICENSE.html \
|
||||
license.html \
|
||||
))
|
||||
|
||||
# for WNT see Package_share_readme_generated.mk
|
||||
ifneq ($(OS),WNT)
|
||||
$(eval $(call gb_Package_add_file,odk_share_readme,$(SDKDIRNAME)/share/readme/LICENSE,readlicense_oo/license/LICENSE))
|
||||
readlicense_oo_DIR := $(call gb_CustomTarget_get_workdir,readlicense_oo/license)
|
||||
$(eval $(call gb_Package_add_file,odk_share_readme,$(SDKDIRNAME)/share/readme/LICENSE,LICENSE))
|
||||
endif
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
|
@ -10,15 +10,60 @@
|
|||
$(eval $(call gb_CustomTarget_CustomTarget,readlicense_oo/license))
|
||||
|
||||
readlicense_oo_DIR := $(call gb_CustomTarget_get_workdir,readlicense_oo/license)
|
||||
readlicense_oo_LICENSE_xml := $(SRCDIR)/readlicense_oo/license/license.xml
|
||||
|
||||
$(call gb_CustomTarget_get_target,readlicense_oo/license) : $(readlicense_oo_DIR)/license.html
|
||||
|
||||
ifeq ($(OS),WNT)
|
||||
$(call gb_CustomTarget_get_target,readlicense_oo/license) : $(readlicense_oo_DIR)/license.txt
|
||||
else
|
||||
$(call gb_CustomTarget_get_target,readlicense_oo/license) : $(readlicense_oo_DIR)/LICENSE
|
||||
endif
|
||||
|
||||
$(readlicense_oo_DIR)/license.html : \
|
||||
$(SRCDIR)/readlicense_oo/license/license_html.xsl \
|
||||
$(readlicense_oo_LICENSE_xml) \
|
||||
| $(readlicense_oo_DIR)/.dir \
|
||||
$(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) --nonet --novalid -o $@ \
|
||||
--stringparam build_type "$(BUILD_TYPE)" \
|
||||
--stringparam os "$(OS)" \
|
||||
--stringparam themes "$(WITH_THEMES)" \
|
||||
$(if $(MPL_SUBSET),,--stringparam no_mpl_subset no_mpl_subset) \
|
||||
$< \
|
||||
$(readlicense_oo_LICENSE_xml) \
|
||||
$(if $(filter WNT,$(OS)), \
|
||||
&& $(gb_AWK) 'sub("$$","\r")' $@ > $@.tmp \
|
||||
&& mv $@.tmp $@ \
|
||||
) \
|
||||
)
|
||||
|
||||
$(readlicense_oo_DIR)/LICENSE : \
|
||||
$(SRCDIR)/readlicense_oo/license/license_plain_text.xsl \
|
||||
$(readlicense_oo_LICENSE_xml) \
|
||||
| $(readlicense_oo_DIR)/.dir \
|
||||
$(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) --nonet --novalid -o $@ \
|
||||
--stringparam build_type "$(BUILD_TYPE)" \
|
||||
--stringparam os "$(OS)" \
|
||||
--stringparam themes "$(WITH_THEMES)" \
|
||||
$(if $(MPL_SUBSET),,--stringparam no_mpl_subset no_mpl_subset) \
|
||||
$< \
|
||||
$(readlicense_oo_LICENSE_xml) \
|
||||
)
|
||||
|
||||
ifeq ($(OS),WNT)
|
||||
$(readlicense_oo_DIR)/license.txt : \
|
||||
$(SRCDIR)/readlicense_oo/license/LICENSE \
|
||||
$(readlicense_oo_DIR)/LICENSE \
|
||||
| $(readlicense_oo_DIR)/.dir
|
||||
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),AWK,1)
|
||||
$(call gb_Helper_abbreviate_dirs, \
|
||||
$(gb_AWK) 'sub("$$","\r")' $< > $@.tmp && mv $@.tmp $@ \
|
||||
)
|
||||
endif
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 noexpandtab:
|
||||
|
|
|
@ -11,15 +11,10 @@ $(eval $(call gb_Module_Module,readlicense_oo))
|
|||
|
||||
$(eval $(call gb_Module_add_targets,readlicense_oo,\
|
||||
CustomTarget_readme \
|
||||
CustomTarget_license \
|
||||
Package_files \
|
||||
Package_license \
|
||||
Package_readlicense_oo_readmes \
|
||||
))
|
||||
|
||||
ifeq (WNT,$(OS))
|
||||
$(eval $(call gb_Module_add_targets,readlicense_oo,\
|
||||
CustomTarget_license \
|
||||
Package_license \
|
||||
))
|
||||
endif
|
||||
|
||||
# vim:set noet sw=4 ts=4:
|
||||
|
|
|
@ -9,26 +9,12 @@
|
|||
|
||||
$(eval $(call gb_Package_Package,readlicense_oo_files,$(SRCDIR)/readlicense_oo/license))
|
||||
|
||||
# LICENSE (upper case) is copied without EOL conversion
|
||||
# license.txt is converted, prior to copy, see Package_license.mk
|
||||
ifneq ($(OS),WNT)
|
||||
ifneq ($(OS),MACOSX)
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,LICENSE,LICENSE))
|
||||
else
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,Resources/LICENSE,LICENSE))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(OS),MACOSX)
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,NOTICE,NOTICE))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,LICENSE.fodt,LICENSE.fodt))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,CREDITS.fodt,CREDITS.fodt))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,LICENSE.html,LICENSE.html))
|
||||
else
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,Resources/NOTICE,NOTICE))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,Resources/LICENSE.fodt,LICENSE.fodt))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,Resources/CREDITS.fodt,CREDITS.fodt))
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_files,Resources/LICENSE.html,LICENSE.html))
|
||||
endif
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
|
@ -9,6 +9,18 @@
|
|||
|
||||
$(eval $(call gb_Package_Package,readlicense_oo_license,$(call gb_CustomTarget_get_workdir,readlicense_oo/license)))
|
||||
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_license,license.txt,license.txt))
|
||||
ifneq ($(OS),WNT)
|
||||
ifneq ($(OS),MACOSX)
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_license,LICENSE,LICENSE))
|
||||
else
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_license,Resources/LICENSE,LICENSE))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(OS),MACOSX)
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_license,LICENSE.html,license.html))
|
||||
else
|
||||
$(eval $(call gb_Package_add_file,readlicense_oo_license,Resources/LICENSE.html,license.html))
|
||||
endif
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
|
@ -1,2 +1,33 @@
|
|||
Contains the stock libreoffice licensing blurb, as distributed in the install
|
||||
directory, and also potentially at run-time.
|
||||
|
||||
Generating licence files
|
||||
------------------------
|
||||
|
||||
License files are generated from a single source file (licese/license.xml).
|
||||
Output file formats are plain text and html.
|
||||
|
||||
- The plain text and the html format is generated with xslt. There are two
|
||||
separate xsl files for plain text and html.
|
||||
|
||||
Conditional text
|
||||
----------------
|
||||
|
||||
The contents of the license file depends on the build configuration. Several
|
||||
externals may or may not be shipped with LibreOffice. Therefore, we need to pass
|
||||
information about build configuration to the xslt processor.
|
||||
|
||||
Variables used for conditional text:
|
||||
|
||||
- BUILD_TYPE: A space separated list of libraries/externals. If an external is
|
||||
present in that list, then the related license text should be included.
|
||||
|
||||
- MPL_SUBSET: If the variable is defined, then GPL and LGPL license text will not
|
||||
be included, because none of the built-in code need it.
|
||||
|
||||
- OS: The target platform. E.g. MSVC Runtime is packaged and used only on Windows.
|
||||
|
||||
- WITH_THEMES: A space separated list of icon sets that are used in the build.
|
||||
|
||||
Conditional text are surrounded by and extra <div> tag. The class attribute of
|
||||
that <div> tag decides which parameter values are taken into consideration.
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6250
readlicense_oo/license/license.xml
Normal file
6250
readlicense_oo/license/license.xml
Normal file
File diff suppressed because it is too large
Load diff
32
readlicense_oo/license/license_html.xsl
Normal file
32
readlicense_oo/license/license_html.xsl
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0">
|
||||
|
||||
<xsl:output method="xml"/>
|
||||
|
||||
<xsl:param name="build_type" />
|
||||
<xsl:param name="no_mpl_subset" />
|
||||
<xsl:param name="os" />
|
||||
<xsl:param name="themes" />
|
||||
|
||||
<xsl:template match="x:div">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(
|
||||
not(contains($build_type,@class)) and
|
||||
not(contains($no_mpl_subset,@class)) and
|
||||
not(contains($os,@class)) and
|
||||
not(contains($themes,@class)) and @class)">
|
||||
<!-- do not write out license text for these externals -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@* | node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@* | node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
62
readlicense_oo/license/license_plain_text.xsl
Normal file
62
readlicense_oo/license/license_plain_text.xsl
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0">
|
||||
|
||||
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
|
||||
|
||||
<xsl:param name="build_type" />
|
||||
<xsl:param name="no_mpl_subset" />
|
||||
<xsl:param name="os" />
|
||||
<xsl:param name="themes" />
|
||||
|
||||
<xsl:strip-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="x:html/x:body"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:body">
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:div">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(
|
||||
not(contains($build_type,@class)) and
|
||||
not(contains($no_mpl_subset,@class)) and
|
||||
not(contains($os,@class)) and
|
||||
not(contains($themes,@class)) and @class)">
|
||||
<!-- do not write out license text for these externals -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:p|x:li">
|
||||
<xsl:value-of select="concat(.,' ')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:h1">
|
||||
<xsl:text># </xsl:text>
|
||||
<xsl:value-of select="concat(.,' ')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:h2">
|
||||
<xsl:text>## </xsl:text>
|
||||
<xsl:value-of select="concat(.,' ')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="x:h3">
|
||||
<xsl:text>### </xsl:text>
|
||||
<xsl:value-of select="concat(.,' ')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()|@*"></xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -235,7 +235,7 @@ namespace
|
|||
}
|
||||
}
|
||||
}
|
||||
/// Find the correct location of the document (LICENSE.fodt, etc.), and return
|
||||
/// Find the correct location of the document (CREDITS.fodt, etc.), and return
|
||||
/// it in rURL if found.
|
||||
static bool checkURL( const char *pName, const char *pExt, OUString &rURL )
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ sub create_pathvariables
|
|||
my $filelistpath = $environment->{'WORKDIR'};
|
||||
$variables{'filelistpath'} = $filelistpath;
|
||||
|
||||
my $licensepath = $environment->{'SRCDIR'} . $installer::globals::separator . "readlicense_oo/license";
|
||||
my $licensepath = $environment->{'WORKDIR'} . $installer::globals::separator . "CustomTarget/readlicense_oo/license";
|
||||
$variables{'licensepath'} = $licensepath;
|
||||
|
||||
my $packinfopath = $environment->{'SRCDIR'} . $installer::globals::separator . "setup_native/source/packinfo";
|
||||
|
|
Loading…
Reference in a new issue