diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-04-02 18:32:11 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-04-02 18:32:11 +0200 |
commit | 8c87c4b2ae3c002fbb799b731feef97ae84828fc (patch) | |
tree | 9d7edbb19d621efc3e6394055fa4d56c1a527876 | |
parent | 7e20b36bddab74faed39aa3768d07fd372fce596 (diff) | |
download | sigc++-8c87c4b2ae3c002fbb799b731feef97ae84828fc.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/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().
-rw-r--r-- | MSVC_NMake/meson.build | 18 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | docs/docs/manual/meson.build | 3 | ||||
-rw-r--r-- | docs/docs/reference/meson.build | 3 | ||||
-rw-r--r-- | meson.build | 31 | ||||
-rw-r--r-- | meson_options.txt | 6 | ||||
-rwxr-xr-x | tools/dist-cmd.py | 12 |
7 files changed, 40 insertions, 34 deletions
diff --git a/MSVC_NMake/meson.build b/MSVC_NMake/meson.build index a799535..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', @@ -10,11 +10,11 @@ sigc_rc = configure_file( ) # Copy the generated configuration header into the MSVC project directory. -cmd_py = ''' -import shutil -shutil.copy2("@0@", "@1@") -'''.format(project_build_root / 'sigc++config.h', 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' @@ -24,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, - project_build_root / 'sigc++config.h', 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 80b4136..0b7b78b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,7 +55,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 \ untracked/README diff --git a/docs/docs/manual/meson.build b/docs/docs/manual/meson.build index c17bf3e..a90bb09 100644 --- a/docs/docs/manual/meson.build +++ b/docs/docs/manual/meson.build @@ -1,7 +1,7 @@ # docs/docs/manual # input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3, -# build_documentation, dist_cmd, book_name +# build_documentation, book_name # output: can_parse_and_validate, build_pdf_by_default, can_build_pdf, # install_tutorialdir @@ -81,7 +81,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/docs/reference/meson.build b/docs/docs/reference/meson.build index 98e69a3..464214b 100644 --- a/docs/docs/reference/meson.build +++ b/docs/docs/reference/meson.build @@ -2,7 +2,7 @@ # Input: project_build_root, project_source_root, sigcxx_pcname, # sigcxx_api_version, perl, build_documentation, source_h_files, -# hg_ccg_basenames, install_datadir, dist_cmd, python3 +# hg_ccg_basenames, install_datadir, python3, doc_reference # Output: install_docdir, install_devhelpdir, book_name # There are no built source files in libsigc++-3.0. @@ -115,7 +115,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 449d43c..2bbb307 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 \ @@ -110,13 +121,23 @@ 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/docs. run_command(mm_common_get, '--force', script_dir, project_source_root / 'untracked' / 'docs' / '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/. ' + \ + 'Enable maintainer-mode if you want to build documentation or create a dist tarball.') + endif endif # Set compiler warnings. @@ -187,7 +208,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 +227,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..138e302 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: 'Let mm-common-get copy some files to untracked/') 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/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) |