2009-12-29 12:12:26 +00:00
|
|
|
#
|
2019-01-08 18:12:43 +00:00
|
|
|
# - Find XSLTPROC
|
2009-12-29 12:12:26 +00:00
|
|
|
# This module looks for some usual Unix commands.
|
|
|
|
#
|
|
|
|
|
2018-03-06 17:34:36 +00:00
|
|
|
include(FindChocolatey)
|
2009-12-29 12:12:26 +00:00
|
|
|
|
2018-02-14 20:01:35 +00:00
|
|
|
# Strawberry Perl ships with xsltproc but no DocBook XML files, which
|
2019-01-08 18:12:43 +00:00
|
|
|
# is detrimental to our interests. Search for the Chocolatey
|
2018-04-23 17:01:21 +00:00
|
|
|
# versions first, and un-find xsltproc if needed.
|
2015-01-14 23:13:40 +00:00
|
|
|
find_program(XSLTPROC_EXECUTABLE
|
2009-12-29 12:12:26 +00:00
|
|
|
NAMES
|
|
|
|
xsltproc
|
2018-02-14 20:01:35 +00:00
|
|
|
HINTS
|
2018-03-06 17:34:36 +00:00
|
|
|
${CHOCOLATEY_BIN_PATH}
|
2018-02-14 20:01:35 +00:00
|
|
|
PATHS
|
2009-12-29 12:12:26 +00:00
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2018-04-23 17:01:21 +00:00
|
|
|
string(TOLOWER ${XSLTPROC_EXECUTABLE} _xe_lower)
|
|
|
|
if(${_xe_lower} MATCHES "strawberry")
|
|
|
|
set(_ignore_reason "Strawberry xsltproc found at ${XSLTPROC_EXECUTABLE}. Ignoring.")
|
|
|
|
message(STATUS ${_ignore_reason})
|
|
|
|
set(XSLTPROC_EXECUTABLE XSLTPROC_EXECUTABLE-NOTFOUND CACHE FILEPATH ${_ignore_reason} FORCE)
|
|
|
|
endif()
|
|
|
|
|
2009-12-29 12:12:26 +00:00
|
|
|
# Handle the QUIETLY and REQUIRED arguments and set XSLTPROC_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs)
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XSLTPROC DEFAULT_MSG XSLTPROC_EXECUTABLE)
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(XSLTPROC_EXECUTABLE)
|
|
|
|
|
2015-01-07 00:59:32 +00:00
|
|
|
set (_common_xsltproc_args
|
|
|
|
--stringparam use.id.as.filename 1
|
|
|
|
--stringparam admon.graphics 1
|
|
|
|
--stringparam admon.graphics.extension .svg
|
|
|
|
--stringparam section.autolabel 1
|
|
|
|
--stringparam section.label.includes.component.label 1
|
|
|
|
--stringparam html.stylesheet ws.css
|
|
|
|
)
|
|
|
|
|
2019-01-08 18:12:43 +00:00
|
|
|
set(_xsltproc_path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src")
|
2015-01-07 00:59:32 +00:00
|
|
|
|
2017-03-31 16:14:38 +00:00
|
|
|
# Workaround for parallel build issue with msbuild.
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/16767
|
|
|
|
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
|
|
# msbuild (as used by the Visual Studio generators) must not depend on the XML
|
|
|
|
# file (otherwise the XML file will be generated multiple times, possibly in
|
|
|
|
# parallel, breaking the build). Workaround: add one dependency to generate
|
|
|
|
# the XML file when outdated, depend on the -stamp file to ensure that the
|
|
|
|
# target is rebuilt when the XML file is regenerated.
|
|
|
|
function(get_docbook_xml_depends varname _dbk_source)
|
|
|
|
set(${varname}
|
|
|
|
"generate_${_dbk_source}"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${_dbk_source}-stamp"
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
else()
|
|
|
|
# Unix Makefiles, Ninja, etc: first dependency enforces that the XML file is
|
|
|
|
# rebuilt when outdated, the second dependency ensures that the target is
|
|
|
|
# rebuilt when the XML file has changed.
|
|
|
|
function(get_docbook_xml_depends varname _dbk_source)
|
|
|
|
set(${varname}
|
|
|
|
"generate_${_dbk_source}"
|
|
|
|
"${_dbk_source}"
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
endif()
|
|
|
|
|
2015-01-07 00:59:32 +00:00
|
|
|
# Translate XML to HTML
|
2009-12-29 12:12:26 +00:00
|
|
|
#XML2HTML(
|
2014-08-23 23:09:58 +00:00
|
|
|
# wsug or wsdg
|
2010-02-25 12:30:44 +00:00
|
|
|
# single-page or chunked
|
|
|
|
# WSUG_FILES
|
|
|
|
# WSUG_GRAPHICS
|
2009-12-29 12:12:26 +00:00
|
|
|
#)
|
2015-08-08 01:17:04 +00:00
|
|
|
MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
|
|
|
|
# We depend on the docbook target to avoid parallel builds.
|
|
|
|
SET(_dbk_dep ${_target_dep}_docbook)
|
2010-02-25 12:30:44 +00:00
|
|
|
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
# We can pass chunker.xxx parameters to customize the chunked output.
|
|
|
|
# We have to use a custom layer to customize the single-page output.
|
|
|
|
# Set the output encoding for both to UTF-8. Indent the single-page
|
|
|
|
# output because we sometimes need to copy and paste the release
|
|
|
|
# note contents.
|
2009-12-29 12:12:26 +00:00
|
|
|
IF(${_mode} STREQUAL "chunked")
|
2015-08-08 01:17:04 +00:00
|
|
|
SET(_basedir ${_dir_pfx}_html_chunked)
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
SET(_stylesheet "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
|
2021-12-11 21:57:29 +00:00
|
|
|
SET(_modeparams --stringparam chunker.output.encoding UTF-8 --stringparam chunk.quietly 1)
|
2009-12-29 12:12:26 +00:00
|
|
|
ELSE() # single-page
|
2015-08-08 01:17:04 +00:00
|
|
|
SET(_basedir ${_dir_pfx}_html)
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
SET(_stylesheet custom_layer_single_html.xsl)
|
2015-01-14 23:13:40 +00:00
|
|
|
SET(_modeparams --output ${_basedir}/index.html)
|
2009-12-29 12:12:26 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2015-08-08 01:17:04 +00:00
|
|
|
SET(_out_dir ${CMAKE_CURRENT_BINARY_DIR}/${_basedir})
|
2014-08-23 23:09:58 +00:00
|
|
|
SET(_output ${_basedir}/index.html)
|
2017-03-31 16:14:38 +00:00
|
|
|
get_docbook_xml_depends(_dbk_xml_deps "${_dbk_source}")
|
2014-08-23 23:09:58 +00:00
|
|
|
|
2015-08-08 01:17:04 +00:00
|
|
|
FOREACH(_tmpgfx ${${_gfx_sources}})
|
|
|
|
set(_gfx_deps ${CMAKE_CURRENT_SOURCE_DIR}/${_tmpgfx})
|
|
|
|
ENDFOREACH()
|
|
|
|
|
|
|
|
SET(_gfx_dir ${_dir_pfx}_graphics)
|
2009-12-29 12:12:26 +00:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT
|
|
|
|
${_output}
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2015-08-08 01:17:04 +00:00
|
|
|
-E make_directory ${_out_dir}
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2015-08-08 01:17:04 +00:00
|
|
|
-E make_directory ${_out_dir}/${_gfx_dir}/toolbar
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2015-08-08 01:17:04 +00:00
|
|
|
-E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_dir} ${_out_dir}/${_gfx_dir}
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2015-08-08 01:17:04 +00:00
|
|
|
-E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/common_graphics ${_out_dir}/${_gfx_dir}
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2015-08-08 01:17:04 +00:00
|
|
|
-E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_dir}/toolbar ${_out_dir}/${_gfx_dir}/toolbar
|
2015-04-26 18:11:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2018-01-20 00:02:20 +00:00
|
|
|
-E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ws.css ${_out_dir}
|
2014-07-08 22:16:48 +00:00
|
|
|
COMMAND ${XSLTPROC_EXECUTABLE}
|
2015-01-09 00:55:26 +00:00
|
|
|
--path "${_xsltproc_path}"
|
2014-08-23 23:09:58 +00:00
|
|
|
--stringparam base.dir ${_basedir}/
|
2015-01-14 23:13:40 +00:00
|
|
|
${_common_xsltproc_args}
|
2015-08-08 01:17:04 +00:00
|
|
|
--stringparam admon.graphics.path ${_gfx_dir}/
|
2014-11-17 20:12:54 +00:00
|
|
|
${_modeparams}
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
--noout ${_stylesheet}
|
2015-08-08 01:17:04 +00:00
|
|
|
${_dbk_source}
|
2009-12-29 12:12:26 +00:00
|
|
|
DEPENDS
|
2017-03-31 16:14:38 +00:00
|
|
|
${_dbk_xml_deps}
|
2015-08-08 01:17:04 +00:00
|
|
|
${_dbk_dep}
|
|
|
|
${_gfx_deps}
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
custom_layer_single_html.xsl
|
2009-12-29 12:12:26 +00:00
|
|
|
)
|
2015-04-26 18:11:44 +00:00
|
|
|
IF(NOT WIN32)
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT
|
|
|
|
${_output}
|
|
|
|
COMMAND chmod
|
2015-08-08 01:17:04 +00:00
|
|
|
-R og+rX ${_out_dir}
|
2015-04-26 18:11:44 +00:00
|
|
|
APPEND
|
|
|
|
)
|
|
|
|
ENDIF()
|
2009-12-29 12:12:26 +00:00
|
|
|
ENDMACRO(XML2HTML)
|