From b43cb23a02fb32a3d9f959b009c7a65e0252b8a4 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 4 Jul 2021 18:35:56 +0200 Subject: [PATCH 01/15] docs/manual/libsigc_manual.xml: Add id on elements --- docs/manual/libsigc_manual.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/manual/libsigc_manual.xml b/docs/manual/libsigc_manual.xml index 32c17b20..30645c4a 100644 --- a/docs/manual/libsigc_manual.xml +++ b/docs/manual/libsigc_manual.xml @@ -16,10 +16,10 @@ - + Introduction - + Motivation There are many situations in which it is desirable to decouple code that @@ -72,10 +72,10 @@ register_click_handler(okbutton, clicked, somedata); - + Connecting your code to signals - + A simple example So to get some experience, lets look at a simple example... @@ -140,7 +140,7 @@ int main() - + Using a member function Suppose you found a more sophisticated alien alerter class on the web, @@ -189,7 +189,7 @@ int main() offers. - + Signals with parameters Functions taking no parameters and returning void are quite useful, @@ -254,7 +254,7 @@ int main() Easy. - + Disconnecting If you decide you no longer want your code to be called whenever a signal is @@ -266,10 +266,10 @@ int main() - + Writing your own signals - + Quick recap If all you want to do is use gtkmm, and connect your functionality to its signals, you can probably stop reading here. @@ -317,7 +317,7 @@ void AlienDetector::run() - + 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: @@ -331,10 +331,10 @@ a_return_value = somesignal.emit(); - + Advanced topics - + Rebinding Suppose 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 @@ -400,7 +400,7 @@ myaliendetector.signal_detected.connect( sigc::hide<std::string>( sigc::pt sigc::hide_return effectively makes the return type void. - + Retyping A similar topic is retyping. Perhaps you have a signal that takes an int, but you want to connect a function that takes a double. @@ -423,7 +423,7 @@ asignal.connect( sigc::retype( sigc::ptr_fun(&dostuff) ) ); - + Reference See the reference documentation online From c52a2693b8772c496eaad01eb3b996193b48cc59 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 4 Jul 2021 18:36:36 +0200 Subject: [PATCH 02/15] docs/manual: Add some formatting when html files are generated making it slightly more similar to gtkmm-documentation and libxml++. In Autotools builds, don't distribute the empty manual/README file. --- docs/doc-manual.am | 15 +++++++++++++-- tools/tutorial-custom-cmd.py | 11 ++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) 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/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py index a99521ae..f0a8a184 100755 --- a/tools/tutorial-custom-cmd.py +++ b/tools/tutorial-custom-cmd.py @@ -20,8 +20,17 @@ 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', + '--stringparam', 'use.id.as.filename', '1', + ] xslt_stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl' From 77ac2a47e753705f7d3a444fb0a3aac6896b06f2 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 4 Jul 2021 18:36:58 +0200 Subject: [PATCH 03/15] docs: Remove some obsolete files Remove docs/manual/README and docs/reference/README. --- docs/manual/README | 0 docs/reference/README | 6 ------ 2 files changed, 6 deletions(-) delete mode 100644 docs/manual/README delete mode 100644 docs/reference/README diff --git a/docs/manual/README b/docs/manual/README deleted file mode 100644 index e69de29b..00000000 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 From 40d769545feba313ed49ca2792bb9d176a8733cd Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Tue, 17 Aug 2021 18:34:43 +0200 Subject: [PATCH 04/15] meson.build: Check if Perl is required for building documentation New versions of mm-common use the Python scripts doc_postprocess.py and doc_install.py instead of the Perl scripts doc-postprocess.pl and doc-install.pl when documentation is built. --- meson.build | 12 +++++++++++- untracked/README | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 1ba98997..c75394a5 100644 --- a/meson.build +++ b/meson.build @@ -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) @@ -141,6 +140,17 @@ sys.exit(os.path.isfile("@0@")) endif endif +# Check if perl is required and available. +# Done now, when the doc_reference script is available. +doc_perl_prop = run_command( + python3, doc_reference, 'get_script_property', + '', # MMDOCTOOLDIR is not used + 'requires_perl') +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' 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 From 12d6c14dd31ab68de774c881e7393dfafdd8ce8c Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 20 Sep 2021 10:47:45 +0200 Subject: [PATCH 05/15] docs/manual: Upgrade from DocBook 4.1 to DocBook 5.0 --- docs/manual/libsigc_manual.xml | 120 +++++++++++++++++---------------- docs/manual/meson.build | 13 ++-- meson.build | 5 +- tools/tutorial-custom-cmd.py | 63 ++++++++++------- 4 files changed, 109 insertions(+), 92 deletions(-) diff --git a/docs/manual/libsigc_manual.xml b/docs/manual/libsigc_manual.xml index 30645c4a..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 + +
+Motivation There 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 example So 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 function Suppose 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 parameters Functions 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 +
+Disconnecting If 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 recap If 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 - -Rebinding Suppose 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 - -Retyping A 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..bc98af93 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}. @@ -68,13 +65,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@' ], diff --git a/meson.build b/meson.build index c75394a5..bc8d2644 100644 --- a/meson.build +++ b/meson.build @@ -141,7 +141,6 @@ sys.exit(os.path.isfile("@0@")) endif # Check if perl is required and available. -# Done now, when the doc_reference script is available. doc_perl_prop = run_command( python3, doc_reference, 'get_script_property', '', # MMDOCTOOLDIR is not used @@ -298,11 +297,9 @@ 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/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py index f0a8a184..50b6a5b9 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] @@ -29,7 +28,7 @@ def html(): '--stringparam', 'chunker.output.indent', 'yes', '--stringparam', 'chunker.output.encoding', 'UTF-8', '--stringparam', 'toc.list.type', 'ul', - '--stringparam', 'use.id.as.filename', '1', + '--param', 'use.id.as.filename', '1', ] xslt_stylesheet = 'http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl' @@ -56,6 +55,8 @@ def html(): return result.returncode def xmllint(): + from pathlib import Path + # argv[2] argv[3] argv[4] # @@ -63,6 +64,8 @@ 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' + cmd = [ 'xmllint', '--noout', @@ -70,7 +73,7 @@ def xmllint(): '--xinclude', ] if validate == 'true': - cmd += ['--postvalid'] + cmd += ['--relaxng', relax_ng_schema] cmd += [input_xml_file] result = subprocess.run(cmd) if result.returncode: @@ -79,6 +82,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] # @@ -89,40 +95,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) @@ -130,9 +147,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 @@ -177,8 +194,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) From 0a9ee763b22c146727d14a50da0c5bbc82e70435 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 27 Sep 2021 10:30:58 +0200 Subject: [PATCH 06/15] docs/manual, Meson config: Check if xmllint can be used --- Makefile.am | 1 + docs/manual/can_use_xmllint.xml | 15 +++++++++++++++ docs/manual/meson.build | 18 ++++++++++++++++++ meson.build | 2 +- tools/tutorial-custom-cmd.py | 12 +++++++++++- 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 docs/manual/can_use_xmllint.xml 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/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/meson.build b/docs/manual/meson.build index bc98af93..d2f97b9f 100644 --- a/docs/manual/meson.build +++ b/docs/manual/meson.build @@ -24,6 +24,24 @@ 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', + ).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', diff --git a/meson.build b/meson.build index bc8d2644..2c8b8294 100644 --- a/meson.build +++ b/meson.build @@ -291,7 +291,7 @@ 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 diff --git a/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py index 50b6a5b9..c1029680 100755 --- a/tools/tutorial-custom-cmd.py +++ b/tools/tutorial-custom-cmd.py @@ -65,6 +65,13 @@ def xmllint(): 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', @@ -73,7 +80,10 @@ def xmllint(): '--xinclude', ] if validate == 'true': - cmd += ['--relaxng', relax_ng_schema] + cmd += [ + '--relaxng', relax_ng_schema, + #'--schematron', schematron_schema, + ] cmd += [input_xml_file] result = subprocess.run(cmd) if result.returncode: From be079fac9df66de7e52067f4e58eb43c9c797187 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 9 Nov 2021 13:55:42 +0800 Subject: [PATCH 07/15] NMake Makefiles: Allow building with VS2022 Add checks to distnguish between VS2019 and VS2022. --- MSVC_NMake/detectenv-msvc.mak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 53551050c59c3a35e64816f78e555ee2e064cc31 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sat, 11 Dec 2021 12:50:17 +0100 Subject: [PATCH 08/15] sigc++.h: Don't mention CMake There is no CMake support in sigc++-2.0. --- sigc++/sigc++.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sigc++/sigc++.h b/sigc++/sigc++.h index 7acb5493..cc63c353 100644 --- a/sigc++/sigc++.h +++ b/sigc++/sigc++.h @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #ifndef SIGCXX_SIGCXX_H @@ -100,19 +99,6 @@ * Your @c PKG_CHECK_MODULES() call should also mention any other libraries that * you need to use via pkg-config. * - * @subsection cmake Using CMake - * - * If using CMake, use the following in @c CMakeList.txt: - * @code - * include(FindPkgConfig) - * pkg_check_modules(DEPS REQUIRED sigc++-2.0) - * include_directories(${DEPS_INCLUDE_DIRS}) - * target_link_libraries(yourprogram ${DEPS_LIBRARIES}) - * @endcode - * - * Your @c pkg_check_modules() call should also mention any other libraries that - * you need to use via pkg-config. - * * @section scope Scope of Documentation * * libsigc++ contains many template functions and template classes/structs, From 663df15c62859495cf1ec5d5e3978a4d2b0f32ae Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 12 Dec 2021 10:53:43 +0100 Subject: [PATCH 09/15] Revert "sigc++.h: Don't mention CMake" This reverts commit 53551050c59c3a35e64816f78e555ee2e064cc31. sigc++-2.0 can be used by a CMake project even though sigc++-2.0 itself has not been built with CMake. --- sigc++/sigc++.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sigc++/sigc++.h b/sigc++/sigc++.h index cc63c353..7acb5493 100644 --- a/sigc++/sigc++.h +++ b/sigc++/sigc++.h @@ -14,6 +14,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * */ #ifndef SIGCXX_SIGCXX_H @@ -99,6 +100,19 @@ * Your @c PKG_CHECK_MODULES() call should also mention any other libraries that * you need to use via pkg-config. * + * @subsection cmake Using CMake + * + * If using CMake, use the following in @c CMakeList.txt: + * @code + * include(FindPkgConfig) + * pkg_check_modules(DEPS REQUIRED sigc++-2.0) + * include_directories(${DEPS_INCLUDE_DIRS}) + * target_link_libraries(yourprogram ${DEPS_LIBRARIES}) + * @endcode + * + * Your @c pkg_check_modules() call should also mention any other libraries that + * you need to use via pkg-config. + * * @section scope Scope of Documentation * * libsigc++ contains many template functions and template classes/structs, From 14cd9c908eb6086291a7a8cbbff99439030364b8 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 31 Jan 2022 09:29:06 +0100 Subject: [PATCH 10/15] tools/tutorial-custom-cmd.py: Add comment about used stylesheet --- tools/tutorial-custom-cmd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/tutorial-custom-cmd.py b/tools/tutorial-custom-cmd.py index c1029680..8b4b094e 100755 --- a/tools/tutorial-custom-cmd.py +++ b/tools/tutorial-custom-cmd.py @@ -31,6 +31,9 @@ def html(): '--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. From 6f9483e111bba31eade429016afa03218f3a3ff3 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Fri, 11 Feb 2022 15:32:40 +0100 Subject: [PATCH 11/15] docs/reference/Doxyfile.in: Remove obsolete entry --- docs/reference/Doxyfile.in | 1 - 1 file changed, 1 deletion(-) 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 From 88d8790c07e0cb82a78085702a3fd52713bc3d1a Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Fri, 11 Feb 2022 15:33:06 +0100 Subject: [PATCH 12/15] meson.build: Specify 'check' option in run_command() The default value will be changed in future Meson releases. Don't use deprecated python3.path() and execute(..., gui_app: ...). --- MSVC_NMake/meson.build | 2 +- docs/manual/meson.build | 3 ++- docs/reference/meson.build | 4 ++-- examples/meson.build | 1 - meson.build | 20 ++++++++++++-------- sigc++/meson.build | 5 +++-- tests/meson.build | 2 -- 7 files changed, 20 insertions(+), 17 deletions(-) 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/docs/manual/meson.build b/docs/manual/meson.build index d2f97b9f..2442ddfa 100644 --- a/docs/manual/meson.build +++ b/docs/manual/meson.build @@ -31,6 +31,7 @@ if xmllint.found() 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, @@ -100,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/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/meson.build b/examples/meson.build index 3779f72d..c55bfdd8 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -23,7 +23,6 @@ foreach ex : examples cpp_args: '-DSIGCXX_DISABLE_DEPRECATED', 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 2c8b8294..ad6ee382 100644 --- a/meson.build +++ b/meson.build @@ -7,8 +7,8 @@ project('libsigc++', 'cpp', '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 @@ -127,14 +127,16 @@ 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 @@ -144,7 +146,9 @@ endif doc_perl_prop = run_command( python3, doc_reference, 'get_script_property', '', # MMDOCTOOLDIR is not used - 'requires_perl') + '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) @@ -246,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', ) 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 ) From 4bb3060056adeba0bf3be0ddf5e5c9f0d9d5b29a Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Fri, 11 Feb 2022 15:37:04 +0100 Subject: [PATCH 13/15] 2.10.8 --- NEWS | 13 +++++++++++++ configure.ac | 2 +- meson.build | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) 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/meson.build b/meson.build index ad6ee382..97096bed 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ # 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', From b995711638f9fb4f72b053cd25d59dc229b8e551 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 15 Aug 2022 15:34:38 +0200 Subject: [PATCH 14/15] examples/member_method: Make on_print() non-virtual so it can be compiled with the -Wnon-virtual-dtor compiler option. --- examples/member_method.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() From cd68de2df3b9e80b5b25a087fbf94b432b9ef84b Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 15 Aug 2022 15:35:05 +0200 Subject: [PATCH 15/15] Fix build with -Dbuild-deprecated-api=false Fixes #82 --- examples/meson.build | 2 +- meson.build | 2 +- tests/test_disconnect.cc | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index c55bfdd8..3c575aec 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -20,7 +20,7 @@ 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, build_by_default: build_examples diff --git a/meson.build b/meson.build index 97096bed..79e6c67c 100644 --- a/meson.build +++ b/meson.build @@ -202,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) 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() << "): ";