summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2020-04-02 18:51:33 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2020-04-02 18:51:33 +0200
commit85a863c649881af4fcecfc882e47339c6943b096 (patch)
tree452f75754f565df610f3f50a49275a45a24081c2
parent88fdb3a14ec67de233fed22646fc9b14c24367f5 (diff)
downloadsigc++-85a863c649881af4fcecfc882e47339c6943b096.tar.gz
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/manual/meson.build: * docs/reference/meson.build: Don't use tools/dist-cmd.py. * sigc++/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. 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'. * tools/dist-cmd.py: Removed file. It's not necessary in add_dist_script() when the first parameter is python3.path().
-rw-r--r--MSVC_NMake/meson.build20
-rw-r--r--Makefile.am1
-rw-r--r--docs/manual/meson.build3
-rw-r--r--docs/reference/meson.build3
-rw-r--r--meson.build35
-rw-r--r--meson_options.txt6
-rw-r--r--sigc++/meson.build1
-rwxr-xr-xtools/dist-cmd.py12
8 files changed, 43 insertions, 38 deletions
diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build
index 8eba3dc..da56141 100644
--- a/MSVC_NMake/meson.build
+++ b/MSVC_NMake/meson.build
@@ -1,7 +1,7 @@
# MSVC_NMake
-# Input: pkg_conf_data, project_build_root, python3
-# Output: -
+# Input: pkg_conf_data, sigcxxconfig_h, project_build_root, python3
+# Output: sigc_rc
sigc_rc = configure_file(
input: 'sigc.rc.in',
@@ -9,14 +9,12 @@ sigc_rc = configure_file(
configuration: pkg_conf_data,
)
-generated_sigc_config_h_orig = project_build_root / 'sigc++config.h'
-
# Copy the generated configuration header into the MSVC project directory.
-cmd_py = '''
-import shutil
-shutil.copy2("@0@", "@1@")
-'''.format(generated_sigc_config_h_orig, project_build_root / 'MSVC_NMake')
-meson.add_postconf_script(python3.path(), '-c', cmd_py)
+configure_file(
+ input: sigcxxconfig_h,
+ output: 'sigc++config.h',
+ copy: true,
+)
untracked_msvc_nmake = 'untracked' / 'MSVC_NMake'
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
@@ -26,10 +24,10 @@ if not meson.is_subproject()
# (add_dist_script() is not allowed in a subproject)
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), handle_built_files, 'dist_gen_msvc_files',
meson.current_build_dir(),
untracked_msvc_nmake,
- generated_sigc_config_h_orig, meson.current_build_dir() / 'sigc.rc',
+ project_build_root / 'sigc++config.h',
+ meson.current_build_dir() / 'sigc.rc',
)
endif
diff --git a/Makefile.am b/Makefile.am
index ed7f7f3..4c24f42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,7 +50,6 @@ EXTRA_DIST = \
examples/meson.build \
sigc++/meson.build \
tests/meson.build \
- tools/dist-cmd.py \
tools/handle-built-files.py \
tools/tutorial-custom-cmd.py \
tools/gcc_template_specialization_operator_overload.cc \
diff --git a/docs/manual/meson.build b/docs/manual/meson.build
index 7036035..5b64636 100644
--- a/docs/manual/meson.build
+++ b/docs/manual/meson.build
@@ -1,7 +1,7 @@
# docs/manual
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
-# build_documentation, dist_cmd, install_docdir
+# build_documentation, install_docdir
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
# install_tutorialdir
@@ -86,7 +86,6 @@ if not meson.is_subproject()
# Distribute built files.
# (add_dist_script() is not allowed in a subproject)
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), tutorial_custom_cmd, 'dist_doc',
doc_dist_dir,
meson.current_build_dir(),
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index 60a0724..1803768 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -2,7 +2,7 @@
# Input: built_files_root, project_source_root, sigcxx_pcname,
# sigcxx_api_version, perl, build_documentation, source_h_files,
-# built_h_files, install_datadir, dist_cmd, python3,
+# built_h_files, install_datadir, python3, doc_reference,
# built_h_file_targets
# Output: install_docdir, install_devhelpdir
@@ -141,7 +141,6 @@ if not meson.is_subproject()
# Distribute built files and files copied by mm-common-get.
# (add_dist_script() is not allowed in a subproject)
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), doc_reference, 'dist_doc',
doctool_dir,
doctool_dist_dir,
diff --git a/meson.build b/meson.build
index cfd40ef..49358c6 100644
--- a/meson.build
+++ b/meson.build
@@ -56,11 +56,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 \
@@ -92,7 +103,10 @@ endif
# Some dependencies are required only in maintainer mode and/or
# if 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) # For building C++ code
perl = find_program('perl', required: build_documentation)
doxygen = find_program('doxygen', required: build_documentation)
@@ -103,13 +117,22 @@ script_dir = project_source_root / 'untracked' / 'build_scripts'
doc_reference = script_dir / 'doc-reference.py'
dist_changelog = script_dir / 'dist-changelog.py'
dist_build_scripts = script_dir / 'dist-build-scripts.py'
-dist_cmd = project_source_root / 'tools' / 'dist-cmd.py' # Must be committed to git.
tutorial_custom_cmd = project_source_root / 'tools' / 'tutorial-custom-cmd.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(doc_reference)
+ file_exists = run_command(python3, '-c', cmd_py).returncode() != 0
+ if not file_exists
+ warning('Missing files in untracked/. You may have to enable maintainer-mode.')
+ endif
endif
# Set compiler warnings.
@@ -188,7 +211,7 @@ configure_file(
)
install_includeconfigdir = install_libdir / sigcxx_pcname / 'include'
-configure_file(
+sigcxxconfig_h = configure_file(
input: 'sigc++config.h.meson',
output: 'sigc++config.h',
configuration: pkg_conf_data,
@@ -206,14 +229,12 @@ if not meson.is_subproject()
# Add a ChangeLog file to the distribution directory.
# (add_dist_script() is not allowed in a subproject)
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), dist_changelog,
project_source_root,
)
# Add build scripts to the distribution directory, and delete .gitignore
# files and an empty $MESON_DIST_ROOT/build/ directory.
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), dist_build_scripts,
project_source_root,
'untracked' / 'build_scripts',
diff --git a/meson_options.txt b/meson_options.txt
index b1ffd54..843f0a0 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')
+ value: 'if-git-build', description: 'Generate source code from .m4 files')
option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'],
- value: 'fatal', description: 'Compiler warning level')
+ 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'],
diff --git a/sigc++/meson.build b/sigc++/meson.build
index 4a6fb82..2814237 100644
--- a/sigc++/meson.build
+++ b/sigc++/meson.build
@@ -231,7 +231,6 @@ if not meson.is_subproject()
# Distribute built files.
# (add_dist_script() is not allowed in a subproject)
meson.add_dist_script(
- python3.path(), dist_cmd,
python3.path(), handle_built_files, 'dist_built_files',
built_h_cc_dir,
untracked_sigcxx,
diff --git a/tools/dist-cmd.py b/tools/dist-cmd.py
deleted file mode 100755
index 30da5da..0000000
--- a/tools/dist-cmd.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python3
-
-# External command, intended to be called with meson.add_dist_script() in meson.build.
-# meson.add_dist_script() can't call a script that's not committed to git.
-# This script shall be committed. It can be used for calling other non-committed scripts.
-
-# dist-cmd.py <cmd> <args>...
-
-import sys
-import subprocess
-
-sys.exit(subprocess.run(sys.argv[1:]).returncode)