[glibmm] Meson build: Set default value of the 'warnings' option to 'min'
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Meson build: Set default value of the 'warnings' option to 'min'
- Date: Sun, 5 Apr 2020 14:39:25 +0000 (UTC)
commit 60b28e75eed154d265ccd480cc151cfba90bddda
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Sun Apr 5 15:51:44 2020 +0200
Meson build: Set default value of the 'warnings' option to 'min'
* meson.build: Use dist-warnings when a tarball is tested by
'ninja dist' or 'meson dist'. Check if generate-binding.py exists, if not
maintainer-mode. Add a better error message if mm-common-get is required
but not found.
* meson_options.txt: Set default value of the 'warnings' to 'min'.
Add 'dist-warnings' with default value 'fatal'.
meson.build | 30 +++++++++++++++++++++++++++---
meson_options.txt | 6 ++++--
2 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5a6e293a..5464e0ad 100644
--- a/meson.build
+++ b/meson.build
@@ -72,11 +72,22 @@ 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
+# 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
+is_dist_check = project_source_root.contains('dist-unpack') and \
+ project_build_root.contains('dist-build')
+
# Options.
maintainer_mode_opt = get_option('maintainer-mode')
maintainer_mode = maintainer_mode_opt == 'true' or \
(maintainer_mode_opt == 'if-git-build' and is_git_build)
-warning_level = get_option('warnings')
+if is_dist_check
+ message('Looks like a tarball is being tested. ' + \
+ 'Option "dist-warnings" is used instead of "warnings".')
+ warning_level = get_option('dist-warnings')
+else
+ warning_level = get_option('warnings')
+endif
build_deprecated_api = get_option('build-deprecated-api')
build_documentation_opt = get_option('build-documentation')
build_documentation = build_documentation_opt == 'true' or \
@@ -126,7 +137,10 @@ giomm_requires = ' '.join(giomm_requires)
# Some dependencies are required only in maintainer mode and/or if
# reference documentation shall be built.
-mm_common_get = find_program('mm-common-get', required: maintainer_mode)
+mm_common_get = find_program('mm-common-get', required: false)
+if maintainer_mode and not mm_common_get.found()
+ error('mm-common-get not found. mm-common >= 1.0.0 is required.')
+endif
m4 = find_program('m4', required: maintainer_mode) # Used by gmmproc
perl = find_program('perl', required: maintainer_mode or build_documentation)
doxygen = find_program('doxygen', required: build_documentation)
@@ -143,10 +157,20 @@ doc_reference_py = script_dir / 'doc-reference.py'
dist_changelog_py = script_dir / 'dist-changelog.py'
dist_build_scripts_py = script_dir / 'dist-build-scripts.py'
-if maintainer_mode and mm_common_get.found()
+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')
+else
+ cmd_py = '''
+import os
+import sys
+sys.exit(os.path.isfile("@0@"))
+'''.format(generate_binding_py)
+ file_exists = run_command(python3, '-c', cmd_py).returncode() != 0
+ if not file_exists
+ error('Missing files in untracked/. You must enable maintainer-mode.')
+ endif
endif
# glibmm's own script files.
diff --git a/meson_options.txt b/meson_options.txt
index b5a526c3..0fc1e1d7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,7 +1,9 @@
option('maintainer-mode', type: 'combo', choices: ['false', 'if-git-build', 'true'],
value: 'if-git-build', description: 'Generate source code from .hg and .ccg files')
-option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'], value: 'fatal',
- description: 'Compiler warning level')
+option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'],
+ value: 'min', description: 'Compiler warning level')
+option('dist-warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'],
+ value: 'fatal', description: 'Compiler warning level when a tarball is created')
option('build-deprecated-api', type: 'boolean', value: true,
description: 'Build deprecated API and include it in the library')
option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-mode', 'true'],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]