Skip to content

Commit 8c87c4b

Browse files
committed
Meson build: Set default value of the 'warnings' option to 'min'
* MSVC_NMake/meson.build: Copy sigc++config.h with configure_file(). * Makefile.am: Remove tools/dist-cmd.py. * docs/docs/manual/meson.build: * docs/docs/reference/meson.build: Don't use tools/dist-cmd.py. * meson.build: Use dist-warnings when a tarball is tested by 'ninja dist' or 'meson dist'. Check if doc-reference.py exists, if not maintainer-mode. * meson_options.txt: Set default value of the 'warnings' to 'min'. Add 'dist-warnings' with default value 'fatal'. * tools/dist-cmd.py: Removed file. It's not necessary in add_dist_script() when the first parameter is python3.path().
1 parent 7e20b36 commit 8c87c4b

File tree

7 files changed

+40
-34
lines changed

7 files changed

+40
-34
lines changed

MSVC_NMake/meson.build

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MSVC_NMake
22

3-
# Input: pkg_conf_data, project_build_root, python3
4-
# Output: -
3+
# Input: pkg_conf_data, sigcxxconfig_h, project_build_root, python3
4+
# Output: sigc_rc
55

66
sigc_rc = configure_file(
77
input: 'sigc.rc.in',
@@ -10,11 +10,11 @@ sigc_rc = configure_file(
1010
)
1111

1212
# 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', project_build_root / 'MSVC_NMake')
17-
meson.add_postconf_script(python3.path(), '-c', cmd_py)
13+
configure_file(
14+
input: sigcxxconfig_h,
15+
output: 'sigc++config.h',
16+
copy: true,
17+
)
1818

1919
untracked_msvc_nmake = 'untracked' / 'MSVC_NMake'
2020
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
@@ -24,10 +24,10 @@ if not meson.is_subproject()
2424
# (add_dist_script() is not allowed in a subproject)
2525

2626
meson.add_dist_script(
27-
python3.path(), dist_cmd,
2827
python3.path(), handle_built_files, 'dist_gen_msvc_files',
2928
meson.current_build_dir(),
3029
untracked_msvc_nmake,
31-
project_build_root / 'sigc++config.h', meson.current_build_dir() / 'sigc.rc',
30+
project_build_root / 'sigc++config.h',
31+
meson.current_build_dir() / 'sigc.rc',
3232
)
3333
endif

Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ EXTRA_DIST = \
5555
examples/meson.build \
5656
sigc++/meson.build \
5757
tests/meson.build \
58-
tools/dist-cmd.py \
5958
tools/handle-built-files.py \
6059
tools/tutorial-custom-cmd.py \
6160
untracked/README

docs/docs/manual/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# docs/docs/manual
22

33
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4-
# build_documentation, dist_cmd, book_name
4+
# build_documentation, book_name
55
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
66
# install_tutorialdir
77

@@ -81,7 +81,6 @@ if not meson.is_subproject()
8181
# Distribute built files.
8282
# (add_dist_script() is not allowed in a subproject)
8383
meson.add_dist_script(
84-
python3.path(), dist_cmd,
8584
python3.path(), tutorial_custom_cmd, 'dist_doc',
8685
doc_dist_dir,
8786
meson.current_build_dir(),

docs/docs/reference/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Input: project_build_root, project_source_root, sigcxx_pcname,
44
# sigcxx_api_version, perl, build_documentation, source_h_files,
5-
# hg_ccg_basenames, install_datadir, dist_cmd, python3
5+
# hg_ccg_basenames, install_datadir, python3, doc_reference
66
# Output: install_docdir, install_devhelpdir, book_name
77

88
# There are no built source files in libsigc++-3.0.
@@ -115,7 +115,6 @@ if not meson.is_subproject()
115115
# Distribute built files and files copied by mm-common-get.
116116
# (add_dist_script() is not allowed in a subproject)
117117
meson.add_dist_script(
118-
python3.path(), dist_cmd,
119118
python3.path(), doc_reference, 'dist_doc',
120119
doctool_dir,
121120
doctool_dist_dir,

meson.build

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,22 @@ sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
5656
'''.format(project_source_root / '.git')
5757
is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
5858

59+
# Are we testing a dist tarball while it's being built?
60+
# There ought to be a better way. https://github.com/mesonbuild/meson/issues/6866
61+
is_dist_check = project_source_root.contains('dist-unpack') and \
62+
project_build_root.contains('dist-build')
63+
5964
# Options.
6065
maintainer_mode_opt = get_option('maintainer-mode')
6166
maintainer_mode = maintainer_mode_opt == 'true' or \
6267
(maintainer_mode_opt == 'if-git-build' and is_git_build)
63-
warning_level = get_option('warnings')
68+
if is_dist_check
69+
message('Looks like a tarball is being tested. ' + \
70+
'Option "dist-warnings" is used instead of "warnings".')
71+
warning_level = get_option('dist-warnings')
72+
else
73+
warning_level = get_option('warnings')
74+
endif
6475
build_deprecated_api = get_option('build-deprecated-api')
6576
build_documentation_opt = get_option('build-documentation')
6677
build_documentation = build_documentation_opt == 'true' or \
@@ -110,13 +121,23 @@ script_dir = project_source_root / 'untracked' / 'build_scripts'
110121
doc_reference = script_dir / 'doc-reference.py'
111122
dist_changelog = script_dir / 'dist-changelog.py'
112123
dist_build_scripts = script_dir / 'dist-build-scripts.py'
113-
dist_cmd = project_source_root / 'tools' / 'dist-cmd.py' # Must be committed to git.
114124
tutorial_custom_cmd = project_source_root / 'tools' / 'tutorial-custom-cmd.py'
115125

116-
if maintainer_mode and mm_common_get.found()
126+
if maintainer_mode
117127
# Copy files to untracked/build_scripts and untracked/docs/docs.
118128
run_command(mm_common_get, '--force', script_dir,
119129
project_source_root / 'untracked' / 'docs' / 'docs')
130+
else
131+
cmd_py = '''
132+
import os
133+
import sys
134+
sys.exit(os.path.isfile("@0@"))
135+
'''.format(doc_reference)
136+
file_exists = run_command(python3, '-c', cmd_py).returncode() != 0
137+
if not file_exists
138+
warning('Missing files in untracked/. ' + \
139+
'Enable maintainer-mode if you want to build documentation or create a dist tarball.')
140+
endif
120141
endif
121142

122143
# Set compiler warnings.
@@ -187,7 +208,7 @@ configure_file(
187208
)
188209

189210
install_includeconfigdir = install_libdir / sigcxx_pcname / 'include'
190-
configure_file(
211+
sigcxxconfig_h = configure_file(
191212
input: 'sigc++config.h.meson',
192213
output: 'sigc++config.h',
193214
configuration: pkg_conf_data,
@@ -206,14 +227,12 @@ if not meson.is_subproject()
206227
# Add a ChangeLog file to the distribution directory.
207228
# (add_dist_script() is not allowed in a subproject)
208229
meson.add_dist_script(
209-
python3.path(), dist_cmd,
210230
python3.path(), dist_changelog,
211231
project_source_root,
212232
)
213233
# Add build scripts to the distribution directory, and delete .gitignore
214234
# files and an empty $MESON_DIST_ROOT/build/ directory.
215235
meson.add_dist_script(
216-
python3.path(), dist_cmd,
217236
python3.path(), dist_build_scripts,
218237
project_source_root,
219238
'untracked' / 'build_scripts',

meson_options.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
option('maintainer-mode', type: 'combo', choices: ['false', 'if-git-build', 'true'],
2-
value: 'if-git-build', description: 'Generate source code from .hg and .ccg files')
2+
value: 'if-git-build', description: 'Let mm-common-get copy some files to untracked/')
33
option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'],
4-
value: 'fatal', description: 'Compiler warning level')
4+
value: 'min', description: 'Compiler warning level')
5+
option('dist-warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'],
6+
value: 'fatal', description: 'Compiler warning level when a tarball is created')
57
option('build-deprecated-api', type: 'boolean', value: true,
68
description: 'Build deprecated API and include it in the library')
79
option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-mode', 'true'],

tools/dist-cmd.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)