summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-03-12 16:29:01 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-03-12 16:29:01 +0100
commit5461f51e1f2e8ba55615c233ca41efa16da04005 (patch)
treeb22ea38bad3fc248afe9ca2806c2163116347631 /meson.build
parent62bf2765cf7eea7a74d083a36376f43ab01a5604 (diff)
downloadmm-common-5461f51e1f2e8ba55615c233ca41efa16da04005.tar.gz
meson.build: Make it possible to use mm-common as a subproject
If mm-common is a subproject, make mm-common-get2 that can be executed without being installed. The main project is built before the subprojects have been installed.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build47
1 files changed, 46 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index b89ea25..3f91718 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,7 @@
project('mm-common',
version: '1.0.2',
- meson_version: '>= 0.50.0', # required for python3.path()
+ meson_version: '>= 0.54.0', # required for meson.override_dependency()
license: 'GPLv2+'
)
@@ -205,6 +205,51 @@ configure_file(
install_dir: install_man1dir
)
+if meson.is_subproject()
+ # A version of mm-common-get that can be executed uninstalled.
+ conf_data_subproj = configuration_data()
+ conf_data_subproj.merge_from(conf_data)
+ conf_data_subproj.set('configure_input', 'mm-common-get2 (for execution uninstalled). Generated from util/mm-common-get.in')
+ conf_data_subproj.set('datadir_py', project_build_root)
+ mm_common_get2 = configure_file(
+ input: 'util' / 'mm-common-get.in',
+ output: 'mm-common-get2',
+ configuration: conf_data_subproj,
+ install: false,
+ )
+ # Make the uninstalled mm-common-get2 executable.
+ cmd_py = '''
+import os
+import sys
+os.chmod(sys.argv[1], 0o755)'''
+ run_command(python3, '-c', cmd_py, project_build_root / 'mm-common-get2')
+
+ # A main project that looks for mm-common-get shall find mm_common_get2.
+ meson.override_find_program('mm-common-get', mm_common_get2)
+
+ # Copy files needed by mm-common-get2 from source dir to build dir.
+ # The directory structure must be the same as in the installation directory.
+ run_command(python3, script_dir / 'copy-files.py',
+ project_source_root / 'util' / 'build_scripts',
+ project_build_root / meson.project_name() / 'build',
+ meson_build_support_basefiles,
+ )
+ run_command(python3, script_dir / 'copy-files.py',
+ project_source_root / 'util',
+ project_build_root / meson.project_name() / 'doctool',
+ doctool_basefiles,
+ )
+
+ mm_common_libstdc_dep = declare_dependency(
+ variables: {
+ 'doxytagfile': project_build_root / 'libstdc++.tag',
+ 'htmlrefpub': 'http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/'
+ }
+ )
+ # A main project that looks for mm-common-libstdc++.pc shall find mm_common_libstdc_dep.
+ meson.override_dependency('mm-common-libstdc++', mm_common_libstdc_dep)
+endif
+
# Skeleton project.
skeletonmm_basefiles = [
'.gitignore',