diff --git a/MSVC_NMake/detectenv-msvc.mak b/MSVC_NMake/detectenv-msvc.mak
index c408714b..d40b1b18 100644
--- a/MSVC_NMake/detectenv-msvc.mak
+++ b/MSVC_NMake/detectenv-msvc.mak
@@ -93,8 +93,10 @@ VSVER = 12
VSVER = 14
!elseif $(VCVERSION) > 1909 && $(VCVERSION) < 1920
VSVER = 15
-!elseif $(VCVERSION) > 1919 && $(VCVERSION) < 2000
+!elseif $(VCVERSION) > 1919 && $(VCVERSION) < 1930
VSVER = 16
+!elseif $(VCVERSION) > 1929 && $(VCVERSION) < 2000
+VSVER = 17
!else
VSVER = 0
!endif
diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build
index f9ddc357..09078b37 100644
--- a/MSVC_NMake/meson.build
+++ b/MSVC_NMake/meson.build
@@ -23,7 +23,7 @@ handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
if can_add_dist_script
# Distribute built files.
meson.add_dist_script(
- python3.path(), handle_built_files, 'dist_gen_msvc_files',
+ python3, handle_built_files, 'dist_gen_msvc_files',
meson.current_build_dir(),
untracked_msvc_nmake,
project_build_root / 'sigc++config.h',
diff --git a/Makefile.am b/Makefile.am
index 9a6f4a8a..0d9e4e1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,6 +45,7 @@ EXTRA_DIST = \
meson_options.txt \
sigc++config.h.meson \
MSVC_NMake/meson.build \
+ docs/manual/can_use_xmllint.xml \
docs/manual/meson.build \
docs/reference/meson.build \
examples/meson.build \
diff --git a/NEWS b/NEWS
index 3413e9ec..f72e4996 100755
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+2.10.8 (stable)
+
+Build:
+* Meson build: Perl is not required by new versions of mm-common
+ (Kjell Ahlstedt)
+* NMake Makefiles: Support building with VS2022
+ (Chun-wei Fan)
+
+Documentation:
+* Upgrade the manual from DocBook 4.1 to DocBook 5.0
+ (Kjell Ahlstedt)
+
+
2.10.7 (stable)
Meson build:
diff --git a/configure.ac b/configure.ac
index d1760ac9..b2850e9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see .
-AC_INIT([libsigc++], [2.10.7],
+AC_INIT([libsigc++], [2.10.8],
[https://github.com/libsigcplusplus/libsigcplusplus/issues/],
[libsigc++], [https://libsigcplusplus.github.io/libsigcplusplus/])
AC_PREREQ([2.59])
diff --git a/docs/doc-manual.am b/docs/doc-manual.am
index 8650987f..a7e64a4d 100644
--- a/docs/doc-manual.am
+++ b/docs/doc-manual.am
@@ -20,11 +20,22 @@ DOCBOOK_STYLESHEET ?= http://docbook.sourceforge.net/release/xsl/current/html/ch
html_tutorialdir = $(libdocdir)/tutorial/html
dist_html_tutorial_DATA = $(sort manual/html/index.html $(call vpath_listall,manual/html/*.html))
-dist_noinst_DATA += manual/README manual/libsigc_manual.xml
+dist_noinst_DATA += manual/libsigc_manual.xml
DISTCLEANFILES += $(addprefix manual/libsigc_manual.,dvi pdf ps)
MAINTAINERCLEANFILES += manual/html/*
+# Set the use.id.as.filename param so that we don't use the chapter / section
+# number as the filename, otherwise the url will change every time anything is
+# re-ordered or inserted in the documentation
+xslt_params = $(strip \
+ --param toc.section.depth 1 \
+ --stringparam chunker.output.indent 'yes' \
+ --stringparam chunker.output.encoding 'UTF-8' \
+ --stringparam toc.list.type 'ul' \
+ --stringparam use.id.as.filename '1' \
+ )
+
manual_srcfile = $(srcdir)/manual/libsigc_manual.xml
# Make sure that the documentation will always have been generated before
@@ -34,7 +45,7 @@ reference/html/%: | manual/html/index.html
manual/html/index.html: $(manual_srcfile)
-$(AM_V_at)rm -f manual/html/*
$(AM_V_at)$(MKDIR_P) manual/html
- $(AM_V_GEN)xsltproc -o manual/html/ --catalogs '$(DOCBOOK_STYLESHEET)' $(manual_srcfile)
+ $(AM_V_GEN)xsltproc $(xslt_params) -o manual/html/ --catalogs '$(DOCBOOK_STYLESHEET)' $(manual_srcfile)
manual/libsigc_manual.dvi: $(manual_srcfile)
$(AM_V_GEN)db2dvi -o manual $(manual_srcfile)
diff --git a/docs/manual/README b/docs/manual/README
deleted file mode 100644
index e69de29b..00000000
diff --git a/docs/manual/can_use_xmllint.xml b/docs/manual/can_use_xmllint.xml
new file mode 100644
index 00000000..8ff1b0d4
--- /dev/null
+++ b/docs/manual/can_use_xmllint.xml
@@ -0,0 +1,15 @@
+
+
+
+xmllint test
+
+
+Introduction
+
+ This is a short DocBook V5.0 document. It can be used for testing if the installed
+ version of xmllint or a similar program can validate a DocBook V5.0 document.
+
+
+
+
diff --git a/docs/manual/libsigc_manual.xml b/docs/manual/libsigc_manual.xml
index 32c17b20..aabdb935 100644
--- a/docs/manual/libsigc_manual.xml
+++ b/docs/manual/libsigc_manual.xml
@@ -1,26 +1,26 @@
-
-
-
-
-
- libsigc++
-
- Ainsley
- Pereira
-
-
- September 2002. Updated January 2004 by Murray Cumming
-
-
- libsigc++ is a C++ template library implementing typesafe callbacks. This is an intro to libsigc++.
-
-
-
-
-Introduction
-
-
-Motivation
+
+
+
+
+ libsigc++
+
+ Ainsley
+ Pereira
+
+ September 2002
+ September 2002. Updated January 2004 by Murray Cumming
+
+ libsigc++ is a C++ template library implementing typesafe callbacks. This is an intro to libsigc++.
+
+
+
+
+Introduction
+
+
+MotivationThere are many situations in which it is desirable to decouple code that
detects an event, and the code that deals with it. This is especially common in
@@ -69,14 +69,15 @@ register_click_handler(okbutton, clicked, somedata);
For the other side of the fence, libsigc++ provides signals, to which the
client can attach slots. When the signal is emitted, all the connected
slots are called.
-
+
-
-Connecting your code to signals
+
+Connecting your code to signals
+
+
+A simple example
-
-A simple exampleSo to get some experience, lets look at a simple example...Lets say you and I are writing an application which informs the user when
@@ -138,10 +139,10 @@ int main()
./example1(Try not to panic when the aliens land!)
-
+
-
-Using a member function
+
+Using a member functionSuppose you found a more sophisticated alien alerter class on the web,
such as this:
@@ -187,10 +188,10 @@ int main()
With a lambda expression you would lose the automatic disconnection that the
combination of sigc::trackable and sigc::mem_fun()
offers.
-
+
-
-Signals with parameters
+
+Signals with parametersFunctions taking no parameters and returning void are quite useful,
especially when they're members of classes that can store unlimited amounts of
@@ -252,10 +253,10 @@ int main()
Easy.
-
+
-
-Disconnecting
+
+DisconnectingIf you decide you no longer want your code to be called whenever a signal is
emitted, you must remember the return value of connect(), which we've been
@@ -263,14 +264,15 @@ int main()
connect() returns a sigc::connection object, which has a disconnect() member method. This does just what you think it does.
-
+
-
-Writing your own signals
+
+Writing your own signals
+
+
+Quick recap
-
-Quick recapIf all you want to do is use gtkmm, and connect your functionality to its
signals, you can probably stop reading here.
@@ -315,10 +317,11 @@ void AlienDetector::run()
// they landed in the carpark after all.
}
-
+
+
+
+What about return values?
-
-What about return values?If you only ever have one slot connected to a signal, or if you only care
about the return value of the last registered one, it's quite straightforward:
@@ -328,14 +331,15 @@ int a_return_value;
a_return_value = somesignal.emit();
-
+
-
-Advanced topics
+
+Advanced topics
+
+
+Rebinding
-
-RebindingSuppose you already have a function that you want to be called when a
signal is emitted, but it takes the wrong argument types. For example, lets try
to attach the warn_people(std::string) function to the detected signal
@@ -398,10 +402,11 @@ myaliendetector.signal_detected.connect( sigc::hide<std::string>( sigc::pt
hide the first argument of 3, for example, only the last).sigc::hide_return effectively makes the return type void.
-
+
+
+
+Retyping
-
-RetypingA similar topic is retyping. Perhaps you have a signal that takes an int, but
you want to connect a function that takes a double.
@@ -420,11 +425,12 @@ asignal.connect( sigc::retype( sigc::ptr_fun(&dostuff) ) );
If you only want to change the return type, you can use sigc::retype_return().
retype_return() needs one template argument, the new return type.
-
+
-
-Reference
- See the reference documentation online
+
+Reference
+
+ See the reference documentation online
diff --git a/docs/manual/meson.build b/docs/manual/meson.build
index 63ac751b..2442ddfa 100644
--- a/docs/manual/meson.build
+++ b/docs/manual/meson.build
@@ -1,21 +1,18 @@
# docs/manual
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
-# build_documentation, install_docdir, can_add_dist_script
+# build_documentation, install_docdir, can_add_dist_script, xsltproc
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
# install_tutorialdir
-# xsltproc is required by tutorial_custom_cmd html.
-xsltproc = find_program('xsltproc', required: build_documentation)
xmllint = find_program('xmllint', required: false)
-
can_parse_and_validate = xmllint.found()
validate = get_option('validation') ? 'true' : 'false'
dblatex = find_program('dblatex', required: false)
-can_build_pdf = dblatex.found() or (xmllint.found() and \
- find_program('docbook2pdf', required: false).found())
+can_build_pdf = dblatex.found() or (xsltproc.found() and \
+ find_program('fop', required: false).found())
build_pdf_by_default = get_option('build-pdf')
# Installation directories are relative to {prefix}.
@@ -27,6 +24,25 @@ if not build_documentation
subdir_done()
endif
+# Check if xmllint can be used.
+if xmllint.found()
+ can_parse_and_validate = run_command(
+ python3, tutorial_custom_cmd, 'xmllint',
+ validate,
+ meson.current_source_dir() / 'can_use_xmllint.xml',
+ meson.current_build_dir() / 'can_use_xmllint.stamp',
+ check: false,
+ ).returncode() == 0
+ if not can_parse_and_validate
+ # The DocBook V5.0 package is called docbook5-xml in Ubuntu,
+ # docbook5-schemas in Fedora. It may have other names in other distros.
+ warning('Can\'t validate XML file.\n' +
+ 'xmllint does not support Relax NG schemas and DocBook V5.0.\n' +
+ 'DocBook V5.0 support may require docbook5-xml, docbook5-schemas or a similar package.'
+ )
+ endif
+endif
+
install_data('..' / 'index.html', install_dir: install_docdir)
install_data('..' / 'images' / 'libsigc_logo.gif',
'..' / 'images' / 'top.gif',
@@ -68,13 +84,13 @@ endif
if can_build_pdf
# Create a PDF file of the DocBook.
- # Prefer dblatex, if both dblatex and docbook2pdf are available.
+ # Prefer dblatex, if both dblatex and fop are available.
custom_target('manual_pdf',
input: sigc_manual_xml,
output: sigc_manual_pdf,
command: [
python3, tutorial_custom_cmd,
- dblatex.found() ? 'dblatex' : 'docbook2pdf',
+ dblatex.found() ? 'dblatex' : 'fop',
'@INPUT@',
'@OUTPUT@'
],
@@ -85,7 +101,7 @@ endif
if can_add_dist_script
# Distribute built files.
meson.add_dist_script(
- python3.path(), tutorial_custom_cmd, 'dist_doc',
+ python3, tutorial_custom_cmd, 'dist_doc',
doc_dist_dir,
meson.current_build_dir(),
meson.current_source_dir() / sigc_manual_xml,
diff --git a/docs/reference/Doxyfile.in b/docs/reference/Doxyfile.in
index 49f329bf..b4676875 100644
--- a/docs/reference/Doxyfile.in
+++ b/docs/reference/Doxyfile.in
@@ -147,7 +147,6 @@ CLANG_OPTIONS =
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 1
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
diff --git a/docs/reference/README b/docs/reference/README
deleted file mode 100644
index ce164350..00000000
--- a/docs/reference/README
+++ /dev/null
@@ -1,6 +0,0 @@
-You need to have doxygen installed.
-
-make targets:
-
-all: builds the reference documentation
-post-html: uploads it to the sourceforge site.
\ No newline at end of file
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 59d41e8c..eeb1ad1e 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -145,7 +145,7 @@ devhelp_file = custom_target('devhelp',
# Install Devhelp file and html files.
meson.add_install_script(
- python3.path(), doc_reference, 'install_doc',
+ python3, doc_reference, 'install_doc',
doctool_dir,
devhelp_file.full_path(),
install_devhelpdir,
@@ -156,7 +156,7 @@ meson.add_install_script(
if can_add_dist_script
# Distribute built files and files copied by mm-common-get.
meson.add_dist_script(
- python3.path(), doc_reference, 'dist_doc',
+ python3, doc_reference, 'dist_doc',
doctool_dir,
doctool_dist_dir,
meson.current_build_dir(),
diff --git a/examples/member_method.cc b/examples/member_method.cc
index 2b4d732c..d7c1f6b8 100644
--- a/examples/member_method.cc
+++ b/examples/member_method.cc
@@ -16,7 +16,7 @@ class Something : public sigc::trackable
protected:
- virtual void on_print(int a);
+ void on_print(int a);
typedef sigc::signal type_signal_print;
type_signal_print signal_print;
@@ -36,7 +36,7 @@ Something::Something()
void Something::on_print(int a)
{
- std::cout << "on_print recieved: " << a << std::endl;
+ std::cout << "on_print received: " << a << std::endl;
}
int main()
diff --git a/examples/meson.build b/examples/meson.build
index 3779f72d..3c575aec 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -20,10 +20,9 @@ foreach ex : examples
endforeach
exe_file = executable(ex_name, ex_sources,
- cpp_args: '-DSIGCXX_DISABLE_DEPRECATED',
+ cpp_args: '-DSIGCXX_DISABLE_DEPRECATED=1',
dependencies: sigcxx_own_dep,
implicit_include_directories: false,
- gui_app: false,
build_by_default: build_examples
)
endforeach
diff --git a/meson.build b/meson.build
index 1ba98997..79e6c67c 100644
--- a/meson.build
+++ b/meson.build
@@ -1,14 +1,14 @@
# This file is part of libsigc++.
project('libsigc++', 'cpp',
- version: '2.10.7',
+ version: '2.10.8',
license: 'LGPLv2.1+',
default_options: [
'cpp_std=c++11',
'warning_level=0',
],
- meson_version: '>= 0.54.0', # required for meson.override_dependency()
- # and dep.get_variable(internal:)
+ meson_version: '>= 0.55.0', # required for meson.add_dist_script(python3, ...)
+ # and meson.add_install_script(python3, ...)
)
sigcxx_api_version = '2.0'
@@ -56,7 +56,7 @@ import os
import sys
sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
'''.format(project_source_root / '.git')
-is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
+is_git_build = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
# Are we testing a dist tarball while it's being built?
# There ought to be a better way. https://github.com/mesonbuild/meson/issues/6866
@@ -114,7 +114,6 @@ if maintainer_mode and not mm_common_get.found()
mm_common_get = find_program('mm-common-get', required: true)
endif
m4 = find_program('m4', required: maintainer_mode) # For building C++ code
-perl = find_program('perl', required: build_documentation)
doxygen = find_program('doxygen', required: build_documentation)
dot = find_program('dot', required: build_documentation) # Used by Doxygen
xsltproc = find_program('xsltproc', required: build_documentation)
@@ -128,19 +127,33 @@ tutorial_custom_cmd = project_source_root / 'tools' / 'tutorial-custom-cmd.py'
if maintainer_mode
# Copy files to untracked/build_scripts and untracked/docs.
run_command(mm_common_get, '--force', script_dir,
- project_source_root / 'untracked' / 'docs')
+ project_source_root / 'untracked' / 'docs',
+ check: true,
+ )
else
cmd_py = '''
import os
import sys
sys.exit(os.path.isfile("@0@"))
'''.format(doc_reference)
- file_exists = run_command(python3, '-c', cmd_py).returncode() != 0
+ file_exists = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
if not file_exists
warning('Missing files in untracked/. You may have to enable maintainer-mode.')
endif
endif
+# Check if perl is required and available.
+doc_perl_prop = run_command(
+ python3, doc_reference, 'get_script_property',
+ '', # MMDOCTOOLDIR is not used
+ 'requires_perl',
+ check: false,
+)
+if not (doc_perl_prop.returncode() == 0 and doc_perl_prop.stdout() == 'false')
+ # Perl is required, if documentation shall be built.
+ perl = find_program('perl', required: build_documentation)
+endif
+
# Set compiler warnings.
warning_flags = []
if warning_level == 'min'
@@ -189,7 +202,7 @@ pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
pkg_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
if not build_deprecated_api
- pkg_conf_data.set('SIGCXX_DISABLE_DEPRECATED', true)
+ pkg_conf_data.set('SIGCXX_DISABLE_DEPRECATED', 1)
endif
pkg_conf_data.set('SIGCXX_MAJOR_VERSION', sigcxx_major_version)
pkg_conf_data.set('SIGCXX_MINOR_VERSION', sigcxx_minor_version)
@@ -237,13 +250,13 @@ subdir('docs/manual')
if can_add_dist_script
# Add a ChangeLog file to the distribution directory.
meson.add_dist_script(
- python3.path(), dist_changelog,
+ python3, dist_changelog,
project_source_root,
)
# Add build scripts to the distribution directory, and delete .gitignore
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
meson.add_dist_script(
- python3.path(), dist_build_scripts,
+ python3, dist_build_scripts,
project_source_root,
'untracked' / 'build_scripts',
)
@@ -282,17 +295,15 @@ endif
validate = get_option('validation') and can_parse_and_validate
explain_val = ''
if get_option('validation') and not validate
- explain_val = ' (requires xmllint)'
+ explain_val = ' (requires xmllint with Relax NG and DocBook V5.0 support)'
endif
build_pdf = build_pdf_by_default and can_build_pdf
explain_pdf = ''
if build_pdf_by_default and not build_pdf
- explain_pdf = ' (requires dblatex or (xmllint and docbook2pdf))'
+ explain_pdf = ' (requires dblatex or (xsltproc and fop))'
endif
-
-
summary = [
'',
'------',
diff --git a/sigc++/meson.build b/sigc++/meson.build
index 37ec0790..7f382512 100644
--- a/sigc++/meson.build
+++ b/sigc++/meson.build
@@ -141,6 +141,7 @@ else # not maintainer_mode
meson.current_build_dir(),
src_untracked_sigcxx,
built_h_files + built_cc_files,
+ check: true,
)
untracked_built_cc_files = []
@@ -167,7 +168,7 @@ endif
# Install built .h files.
meson.add_install_script(
- python3.path(), handle_built_files, 'install_built_h_files',
+ python3, handle_built_files, 'install_built_h_files',
built_h_cc_dir,
install_includedir / sigcxx_pcname / 'sigc++', # subdir below {prefix}
built_h_files,
@@ -176,7 +177,7 @@ meson.add_install_script(
if can_add_dist_script
# Distribute built files.
meson.add_dist_script(
- python3.path(), handle_built_files, 'dist_built_files',
+ python3, handle_built_files, 'dist_built_files',
built_h_cc_dir,
untracked_sigcxx,
built_h_files + built_cc_files,
diff --git a/tests/meson.build b/tests/meson.build
index c0998a1a..7e9a2b38 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -59,7 +59,6 @@ foreach ex : test_programs
exe_file = executable(ex_name, ex_sources,
dependencies: sigcxx_own_dep,
implicit_include_directories: false,
- gui_app: false,
build_by_default: true
)
@@ -81,7 +80,6 @@ if can_benchmark
exe_file = executable(ex_name, ex_sources,
dependencies: [sigcxx_own_dep, benchmark_dep],
implicit_include_directories: false,
- gui_app: false,
build_by_default: do_benchmark
)
diff --git a/tests/test_disconnect.cc b/tests/test_disconnect.cc
index 85b16809..2d040d89 100644
--- a/tests/test_disconnect.cc
+++ b/tests/test_disconnect.cc
@@ -2,6 +2,12 @@
* Assigned to public domain. Use as you wish without restriction.
*/
+// sigc::signal<>.slots() is deprecated, but let's keep the test if possible.
+// If libsigc++ is configured with -Dbuild-deprecated-api=false
+// (--disable-deprecated-api), SIGCXX_DISABLE_DEPRECATED is defined in
+// sigc++config.h. An undef at the start of this file has no effect.
+#undef SIGCXX_DISABLE_DEPRECATED
+
#include "testutilities.h"
#include
#include
@@ -103,11 +109,20 @@ int main(int argc, char* argv[])
util->check_result(result_stream, "sig is connected to foo, bar (size=2): foo(2) bar(2) ");
A a; // iterators stay valid after further connections.
+#ifndef SIGCXX_DISABLE_DEPRECATED
cona = sig.slots().insert(conbar, sigc::mem_fun1(a, &A::foo));
+#else
+ cona = sig.connect(sigc::mem_fun1(a, &A::foo));
+#endif
result_stream << "sig is connected to foo, A::foo, bar (size=" << sig.size() << "): ";
sig(3);
+#ifndef SIGCXX_DISABLE_DEPRECATED
util->check_result(result_stream,
"sig is connected to foo, A::foo, bar (size=3): foo(3) A::foo(3) bar(3) ");
+#else
+ util->check_result(result_stream,
+ "sig is connected to foo, A::foo, bar (size=3): foo(3) bar(3) A::foo(3) ");
+#endif
conbar->disconnect(); // manual disconnection
result_stream << "sig is connected to foo, A::foo (size=" << sig.size() << "): ";
diff --git a/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py
index a99521ae..8b4b094e 100755
--- a/tools/tutorial-custom-cmd.py
+++ b/tools/tutorial-custom-cmd.py
@@ -8,7 +8,6 @@
import os
import sys
import subprocess
-from pathlib import Path
import shutil
subcommand = sys.argv[1]
@@ -20,9 +19,21 @@ def html():
input_xml_file = sys.argv[2]
output_html_dir = sys.argv[3]
+ # Set the use.id.as.filename param so that we don't use the chapter / section
+ # number as the filename, otherwise the url will change every time anything is
+ # re-ordered or inserted in the documentation.
# For a list of available parameters, see http://docbook.sourceforge.net/release/xsl/current/doc/html/
- xslt_params = []
+ xslt_params = [
+ '--param', 'toc.section.depth', '1',
+ '--stringparam', 'chunker.output.indent', 'yes',
+ '--stringparam', 'chunker.output.encoding', 'UTF-8',
+ '--stringparam', 'toc.list.type', 'ul',
+ '--param', 'use.id.as.filename', '1',
+ ]
+ # The recommended stylesheet for DocBook V5.0 is .../xsl-ns/...
+ # It's not used here because the docbook-xsl-ns package is not available
+ # when building with gnome-build-meta.
xslt_stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl'
# Remove old files and create the destination directory.
@@ -47,6 +58,8 @@ def html():
return result.returncode
def xmllint():
+ from pathlib import Path
+
# argv[2] argv[3] argv[4]
#
@@ -54,6 +67,15 @@ def xmllint():
input_xml_file = sys.argv[3]
stamp_file_path = sys.argv[4]
+ relax_ng_schema = 'http://docbook.org/xml/5.0/rng/docbook.rng'
+ # schematron_schema = 'http://docbook.org/xml/5.0/sch/docbook.sch'
+
+ # Validation against the Schematron schema does not work on Ubuntu 21.04:
+ # file:///usr/share/xml/docbook/schema/schematron/5.0/docbook.sch:6: element rule:
+ # Schemas parser error : Failed to compile context expression db:firstterm[@linkend]
+ # .....
+ # Schematron schema http://docbook.org/xml/5.0/sch/docbook.sch failed to compile
+
cmd = [
'xmllint',
'--noout',
@@ -61,7 +83,10 @@ def xmllint():
'--xinclude',
]
if validate == 'true':
- cmd += ['--postvalid']
+ cmd += [
+ '--relaxng', relax_ng_schema,
+ #'--schematron', schematron_schema,
+ ]
cmd += [input_xml_file]
result = subprocess.run(cmd)
if result.returncode:
@@ -70,6 +95,9 @@ def xmllint():
Path(stamp_file_path).touch(exist_ok=True)
return 0
+# dblatex and xsltproc+fop generate a PDF file.
+# docbook2pdf can generate PDF files from DocBook4 files, but not from DocBook5 files.
+# xsltproc+xmlroff (version 0.6.3) does not seem to work acceptably.
def dblatex():
# argv[2] argv[3]
#
@@ -80,40 +108,51 @@ def dblatex():
# For a list of available parameters, see http://dblatex.sourceforge.net/doc/manual/
dblatex_params = [
- '-P', 'toc.section.depth=2',
+ '-P', 'toc.section.depth=1',
'-P', 'paper.type=a4paper',
+ '-P', 'doc.collab.show=1',
+ '-P', 'latex.output.revhistory=0',
]
cmd = [
'dblatex',
] + dblatex_params + [
'-o', output_pdf_file,
- '--pdf', input_xml_file,
+ '--pdf',
+ input_xml_file,
]
return subprocess.run(cmd).returncode
-def docbook2pdf():
+def fop():
# argv[2] argv[3]
#
- # Create a PDF file, using docbook2pdf.
+ # Create a PDF file, using fop.
input_xml_file = sys.argv[2]
output_pdf_file = sys.argv[3]
- output_dir = os.path.dirname(output_pdf_file)
- if not output_dir:
- output_dir = '.'
- output_basename = os.path.basename(output_pdf_file)
- if output_basename.endswith('.pdf'):
- output_basename = output_basename[:-4]
- xml_file = os.path.join(output_dir, output_basename + '.xml')
+ fo_file = os.path.splitext(output_pdf_file)[0] + '.fo'
+
+ # For a list of available parameters, see http://docbook.sourceforge.net/release/xsl/current/doc/fo/
+ # For a list of available paper types, see the description of the page.width.portrait parameter.
+ xslt_params = [
+ '--param', 'toc.section.depth', '1',
+ '--stringparam', 'fop1.extensions', '1',
+ '--stringparam', 'page.orientation', 'portrait',
+ '--stringparam', 'paper.type', 'A4',
+ ]
+
+ xslt_stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl'
- # We need to produce an XML file with all of the XIncludes done.
+ # Generate a .fo (formatting object) file.
+ # fop can take an xslt stylesheet parameter, but it can only read local files.
+ # xsltproc is necessary if you want to read the stylesheet from the internet.
cmd = [
- 'xmllint',
+ 'xsltproc',
+ ] + xslt_params + [
+ '-o', fo_file,
'--xinclude',
- '--postvalid',
- '--output', xml_file,
+ xslt_stylesheet,
input_xml_file,
]
result = subprocess.run(cmd)
@@ -121,9 +160,9 @@ def docbook2pdf():
return result.returncode
cmd = [
- 'docbook2pdf',
- '--output', output_dir,
- xml_file,
+ 'fop',
+ '-fo', fo_file,
+ '-pdf', output_pdf_file,
]
return subprocess.run(cmd).returncode
@@ -168,8 +207,8 @@ def dist_doc():
sys.exit(xmllint())
if subcommand == 'dblatex':
sys.exit(dblatex())
-if subcommand == 'docbook2pdf':
- sys.exit(docbook2pdf())
+if subcommand == 'fop':
+ sys.exit(fop())
if subcommand == 'dist_doc':
sys.exit(dist_doc())
print(sys.argv[0], ': illegal subcommand,', subcommand)
diff --git a/untracked/README b/untracked/README
index 1fd8eca5..e7bd7d22 100644
--- a/untracked/README
+++ b/untracked/README
@@ -15,10 +15,10 @@ or the tarball is created with Meson.
1. Files copied by mm-common-get
--------------------------------
-untracked/docs/docs/doc-install.pl
- doc-postprocess.pl
- doxygen-extra.css
- tagfile-to-devhelp2.xsl
+untracked/docs/doc_install.py or doc-install.pl
+ doc_postprocess.py or doc-postprocess.pl
+ doxygen-extra.css
+ tagfile-to-devhelp2.xsl
untracked/build_scripts/dist-build-scripts.py
dist-changelog.py
doc-reference.py