Skip to content

Commit f0327f7

Browse files
committed
Add support for building libsigc++-3.0 with Meson
libsigc++-3.0 can be built with either Autotools or Meson.
1 parent b18ebf4 commit f0327f7

File tree

14 files changed

+1040
-0
lines changed

14 files changed

+1040
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Makefile.in
2424
/sigc++config.h
2525
/sigc++-*.pc
2626
/stamp-h?
27+
untracked/build_scripts/
28+
untracked/docs/

MSVC_NMake/meson.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# MSVC_NMake
2+
3+
# Input: pkg_conf_data, project_build_root, python3
4+
# Output: -
5+
6+
configure_file(
7+
input: 'sigc.rc.in',
8+
output: '@BASENAME@',
9+
configuration: pkg_conf_data,
10+
)
11+
12+
# Copy the generated configuration header into the MSVC project directory.
13+
cmd_py = '''
14+
import shutil
15+
shutil.copy2("@0@", "@1@")
16+
'''.format(project_build_root / 'sigc++config.h', meson.current_build_dir())
17+
meson.add_postconf_script(python3.path(), '-c', cmd_py)

Makefile.am

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ dist_noinst_DATA = \
4444

4545
DISTCLEANFILES = MSVC_NMake/sigc++config.h
4646

47+
# Distribute files needed when building libsigc++ with meson.
48+
EXTRA_DIST = \
49+
meson.build \
50+
meson_options.txt \
51+
sigc++config.h.meson \
52+
MSVC_NMake/meson.build \
53+
docs/docs/manual/meson.build \
54+
docs/docs/reference/meson.build \
55+
examples/meson.build \
56+
sigc++/meson.build \
57+
tests/meson.build \
58+
tools/dist-cmd.py \
59+
tools/tutorial-custom-cmd.py \
60+
untracked/README
61+
4762
# Optional: auto-generate the ChangeLog file from the git log on make dist
4863
include $(top_srcdir)/build/dist-changelog.am
4964

docs/docs/manual/meson.build

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# docs/docs/manual
2+
3+
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4+
# build_documentation, dist_cmd, book_name
5+
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
6+
# install_tutorialdir
7+
8+
# xsltproc is required by tutorial_custom_cmd html.
9+
xsltproc = find_program('xsltproc', required: build_documentation)
10+
xmllint = find_program('xmllint', required: false)
11+
12+
can_parse_and_validate = xmllint.found()
13+
14+
validate = get_option('validation') ? 'true' : 'false'
15+
16+
dblatex = find_program('dblatex', required: false)
17+
can_build_pdf = dblatex.found() or (xmllint.found() and \
18+
find_program('docbook2pdf', required: false).found())
19+
build_pdf_by_default = get_option('build-pdf')
20+
21+
# Installation directories are relative to {prefix}.
22+
install_tutorialdir = install_datadir / 'doc' / book_name / 'tutorial'
23+
24+
if not build_documentation
25+
# Documentation shall not be built or installed.
26+
# Return to the calling meson.build file.
27+
subdir_done()
28+
endif
29+
30+
doc_dist_dir = 'untracked' / 'docs' / 'docs' / 'manual' # Relative to MESON_DIST_ROOT
31+
32+
sigc_manual_xml = 'libsigc_manual.xml'
33+
sigc_manual_pdf = 'libsigc_manual.pdf'
34+
35+
# Create an html version of the DocBook.
36+
custom_target('manual_html',
37+
input: sigc_manual_xml,
38+
output: 'html',
39+
command: [
40+
python3, tutorial_custom_cmd, 'html',
41+
'@INPUT@',
42+
'@OUTPUT@',
43+
],
44+
build_by_default: true,
45+
install: true,
46+
install_dir: install_tutorialdir
47+
)
48+
49+
if can_parse_and_validate
50+
# Parse and possibly validate the DocBook.
51+
custom_target('manual_xmllint',
52+
input: sigc_manual_xml,
53+
output: 'manual_xmllint.stamp',
54+
command: [
55+
python3, tutorial_custom_cmd, 'xmllint',
56+
validate,
57+
'@INPUT@',
58+
'@OUTPUT@'
59+
],
60+
build_by_default: true,
61+
)
62+
endif
63+
64+
if can_build_pdf
65+
# Create a PDF file of the DocBook.
66+
# Prefer dblatex, if both dblatex and docbook2pdf are available.
67+
custom_target('manual_pdf',
68+
input: sigc_manual_xml,
69+
output: sigc_manual_pdf,
70+
command: [
71+
python3, tutorial_custom_cmd,
72+
dblatex.found() ? 'dblatex' : 'docbook2pdf',
73+
'@INPUT@',
74+
'@OUTPUT@'
75+
],
76+
build_by_default: build_pdf_by_default,
77+
)
78+
endif
79+
80+
if not meson.is_subproject()
81+
# Distribute built files.
82+
# (add_dist_script() is not allowed in a subproject)
83+
meson.add_dist_script(
84+
python3.path(), dist_cmd,
85+
python3.path(), tutorial_custom_cmd, 'dist_doc',
86+
doc_dist_dir,
87+
meson.current_build_dir(),
88+
meson.current_source_dir() / sigc_manual_xml,
89+
meson.current_build_dir() / sigc_manual_pdf,
90+
)
91+
endif

docs/docs/reference/meson.build

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# docs/docs/reference
2+
3+
# Input: project_build_root, project_source_root, sigcxx_pcname,
4+
# sigcxx_api_version, perl, build_documentation, source_h_files,
5+
# hg_ccg_basenames, install_datadir, dist_cmd, python3
6+
# Output: install_docdir, install_devhelpdir, book_name
7+
8+
# There are no built source files in libsigc++-3.0.
9+
10+
tag_file_modules = [
11+
'mm-common-libstdc++',
12+
]
13+
doxygen_tagfiles = ''
14+
docinstall_flags = []
15+
foreach module : tag_file_modules
16+
depmod = dependency(module, required: false)
17+
if depmod.found()
18+
doxytagfile = depmod.get_pkgconfig_variable('doxytagfile')
19+
htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '')
20+
htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '')
21+
if htmlrefpub == ''
22+
htmlrefpub = htmlrefdir
23+
elif htmlrefdir == ''
24+
htmlrefdir = htmlrefpub
25+
endif
26+
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
27+
if not htmlrefdir.endswith('/')
28+
htmlrefdir += '/'
29+
endif
30+
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
31+
endif
32+
endforeach
33+
34+
book_name = 'lib' + sigcxx_pcname
35+
book_title = meson.project_name() + ' Reference Manual'
36+
37+
# Configuration data for Doxyfile.
38+
doc_conf_data = configuration_data()
39+
doc_conf_data.set('configure_input',
40+
'docs/docs/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().')
41+
doc_conf_data.set('PACKAGE_NAME', meson.project_name())
42+
doc_conf_data.set('PACKAGE_VERSION', meson.project_version())
43+
doc_conf_data.set('abs_top_builddir', project_build_root)
44+
doc_conf_data.set('abs_top_srcdir', project_source_root)
45+
doc_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
46+
doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
47+
doc_conf_data.set('PERL', perl.path())
48+
49+
configure_file(
50+
input: 'Doxyfile.in',
51+
output: '@BASENAME@',
52+
configuration: doc_conf_data,
53+
)
54+
55+
# Installation directories relative to {prefix}.
56+
install_docdir = install_datadir / 'doc' / book_name
57+
install_reference_docdir = install_docdir / 'reference'
58+
install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name
59+
60+
if not build_documentation
61+
# Documentation shall not be built or installed.
62+
# Return to the calling meson.build file.
63+
subdir_done()
64+
endif
65+
66+
# Input .h files to Doxygen.
67+
src_h_files = []
68+
foreach file : source_h_files
69+
src_h_files += project_source_root / 'sigc++' / file
70+
endforeach
71+
src_h_files += project_source_root / 'sigc++' / 'sigc++.h'
72+
73+
doctool_dir = project_source_root / 'untracked' / 'docs' / 'docs' # MMDOCTOOLDIR
74+
doctool_dist_dir = 'untracked' / 'docs' / 'docs' # Relative to MESON_DIST_ROOT
75+
76+
tag_file = custom_target('html_and_tag',
77+
input: src_h_files,
78+
output: book_name + '.tag',
79+
command: [
80+
python3, doc_reference, 'doxygen',
81+
doctool_dir,
82+
'@OUTPUT@',
83+
'@INPUT@',
84+
],
85+
build_by_default: build_documentation,
86+
install: true,
87+
install_dir: install_reference_docdir,
88+
)
89+
90+
devhelp_file = custom_target('devhelp',
91+
input: tag_file,
92+
output: book_name + '.devhelp2',
93+
command: [
94+
python3, doc_reference, 'devhelp',
95+
doctool_dir,
96+
'@INPUT@',
97+
'@OUTPUT@',
98+
book_name,
99+
book_title,
100+
],
101+
build_by_default: build_documentation,
102+
)
103+
104+
# Install Devhelp file and html files.
105+
meson.add_install_script(
106+
python3.path(), doc_reference, 'install_doc',
107+
doctool_dir,
108+
devhelp_file.full_path(),
109+
install_devhelpdir,
110+
install_reference_docdir / 'html',
111+
docinstall_flags
112+
)
113+
114+
if not meson.is_subproject()
115+
# Distribute built files and files copied by mm-common-get.
116+
# (add_dist_script() is not allowed in a subproject)
117+
meson.add_dist_script(
118+
python3.path(), dist_cmd,
119+
python3.path(), doc_reference, 'dist_doc',
120+
doctool_dir,
121+
doctool_dist_dir,
122+
meson.current_build_dir(),
123+
tag_file.full_path(),
124+
devhelp_file.full_path(),
125+
)
126+
endif

examples/meson.build

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# examples
2+
3+
# input: sigcxx_dep, build_examples
4+
5+
examples = [
6+
# [[dir-name], exe-name, [sources]]
7+
[[], 'hello_world', ['hello_world.cc']],
8+
[[], 'member_method', ['member_method.cc']],
9+
]
10+
11+
foreach ex : examples
12+
dir = ''
13+
foreach dir_part : ex[0]
14+
dir = dir / dir_part
15+
endforeach
16+
ex_name = (dir / ex[1]).underscorify()
17+
ex_sources = []
18+
foreach src : ex[2]
19+
ex_sources += dir / src
20+
endforeach
21+
22+
exe_file = executable(ex_name, ex_sources,
23+
dependencies: sigcxx_dep,
24+
gui_app: false,
25+
build_by_default: build_examples
26+
)
27+
endforeach

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy