diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-04-15 15:49:29 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-04-15 15:49:29 +0200 |
commit | 17617ce926cf35230ec9fbe04e53b85afbd26988 (patch) | |
tree | 2fce918f61199f339c3046165aa4816c33c3e766 | |
parent | 13677bd24a4bb5bd6afd57917c05a50ec77b9494 (diff) | |
download | mm-common-17617ce926cf35230ec9fbe04e53b85afbd26988.tar.gz |
skeletonmm: Some fixes in the Meson build system
* meson.build: Remove dist-cmd.py from the skeletonmm tarball.
* skeletonmm/doc/reference/meson.build:
* skeletonmm/skeleton/skeletonmm/meson.build: Don't use dist-cmd.py.
* skeletonmm/meson.build: Don't use dist-cmd.py. Add a better error message
if mm-common-get is required but not found. If not maintainer-mode, check
that generate-binding.py exists.
* skeletonmm/meson_options.txt: Default value of warnings is 'min'.
Add dist-warnings.
* skeletonmm/tools/dist-cmd.py: Removed file. It's not necessary in
add_dist_script() when the first parameter is python3.path().
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | skeletonmm/doc/reference/meson.build | 3 | ||||
-rw-r--r-- | skeletonmm/meson.build | 33 | ||||
-rw-r--r-- | skeletonmm/meson_options.txt | 6 | ||||
-rw-r--r-- | skeletonmm/skeleton/skeletonmm/meson.build | 3 | ||||
-rwxr-xr-x | skeletonmm/tools/dist-cmd.py | 12 |
6 files changed, 33 insertions, 25 deletions
diff --git a/meson.build b/meson.build index 92c639a..df2a3c3 100644 --- a/meson.build +++ b/meson.build @@ -237,7 +237,6 @@ skeletonmm_basefiles = [ 'tests/meson.build', 'tests/test1/main.cc', 'tests/test2/main.cc', - 'tools/dist-cmd.py', 'tools/generate_defs_and_docs.sh', 'tools/extra_defs_gen/generate_defs_skeleton.cc', 'tools/extra_defs_gen/meson.build', diff --git a/skeletonmm/doc/reference/meson.build b/skeletonmm/doc/reference/meson.build index 1ff7194..e1989aa 100644 --- a/skeletonmm/doc/reference/meson.build +++ b/skeletonmm/doc/reference/meson.build @@ -2,7 +2,7 @@ # Input: built_files_root, project_source_root, skeletonmm_pcname, perl, # hg_ccg_basenames, extra_h_files, built_h_file_targets, install_datadir, -# dist_cmd, python3 +# python3 # Output: install_docdir, install_devhelpdir tag_file_modules = [ @@ -137,7 +137,6 @@ if not meson.is_subproject() # Distribute built files and files copied by mm-common-prepare. # (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/skeletonmm/meson.build b/skeletonmm/meson.build index 0c885c6..717c49e 100644 --- a/skeletonmm/meson.build +++ b/skeletonmm/meson.build @@ -52,11 +52,21 @@ 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? +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 \ @@ -87,7 +97,10 @@ gnome = import('gnome') # 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 (in glibmm) perl = find_program('perl', required: maintainer_mode or build_documentation) doxygen = find_program('doxygen', required: build_documentation) @@ -97,18 +110,28 @@ xsltproc = find_program('xsltproc', required: build_documentation) # Where to find gmmproc and generate_wrap_init.pl. gmmproc_dir = glibmm_dep.get_pkgconfig_variable('gmmprocdir') +# Script files copied to 'untracked' by mm-common-get. script_dir = project_source_root / 'untracked' / 'build_scripts' generate_binding = script_dir / 'generate-binding.py' doc_reference = script_dir / 'doc-reference.py' dist_changelog = script_dir / 'dist-changelog.py' dist_build_scripts = script_dir / 'dist-build-scripts.py' check_dllexport_usage = script_dir / 'check-dllexport-usage.py' -dist_cmd = project_source_root / 'tools' / 'dist-cmd.py' # Must be committed to git. -if maintainer_mode and mm_common_get.found() +if maintainer_mode # Copy files to untracked/build_scripts and untracked/doc. run_command(mm_common_get, '--force', script_dir, project_source_root / 'untracked' / 'doc') +else + cmd_py = ''' +import os +import sys +sys.exit(os.path.isfile("@0@")) +'''.format(generate_binding) + 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 cpp_compiler = meson.get_compiler('cpp') @@ -141,14 +164,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/skeletonmm/meson_options.txt b/skeletonmm/meson_options.txt index 6611d15..5cf429d 100644 --- a/skeletonmm/meson_options.txt +++ b/skeletonmm/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'], diff --git a/skeletonmm/skeleton/skeletonmm/meson.build b/skeletonmm/skeleton/skeletonmm/meson.build index 89e9373..db6327a 100644 --- a/skeletonmm/skeleton/skeletonmm/meson.build +++ b/skeletonmm/skeleton/skeletonmm/meson.build @@ -2,7 +2,7 @@ # Input: skeletonmm_build_dep, skeletonmm_pcname, maintainer_mode, project_source_root, # generate_binding, m4_files, skeletonmm_libversion, install_includedir, -# dist_cmd, python3 +# python3 # Output: hg_ccg_basenames, extra_h_files, built_h_file_targets, built_files_root, # skeletonmm_dep @@ -158,7 +158,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(), generate_binding, 'dist_built_files', built_h_cc_dir, untracked_skeletonmm, diff --git a/skeletonmm/tools/dist-cmd.py b/skeletonmm/tools/dist-cmd.py deleted file mode 100755 index 30da5da..0000000 --- a/skeletonmm/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) |