diff options
-rw-r--r-- | docs/markdown/Builtin-options.md | 5 | ||||
-rw-r--r-- | docs/markdown/snippets/licensesdir_option.md | 4 | ||||
-rw-r--r-- | docs/yaml/builtins/meson.yaml | 4 | ||||
-rw-r--r-- | mesonbuild/backend/backends.py | 18 | ||||
-rw-r--r-- | mesonbuild/coredata.py | 1 | ||||
-rw-r--r-- | mesonbuild/utils/universal.py | 1 |
6 files changed, 27 insertions, 6 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index 4c43f09..f8c3d8a 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -41,6 +41,7 @@ not be relied on, since they can be absolute paths in the following cases: | includedir | include | Header file directory | | infodir | share/info | Info page directory | | libdir | see below | Library directory | +| licensedir | see below | Licenses directory (since 1.1.0)| | libexecdir | libexec | Library executable directory | | localedir | share/locale | Locale data directory | | localstatedir | var | Localstate data directory | @@ -61,6 +62,10 @@ different distributions have different defaults. Using a [cross file](Cross-compilation.md#defining-the-environment), particularly the paths section may be necessary. +`licensedir` is empty by default. If set, it defines the default location +to install a dependency manifest and project licenses. For more details, +see [[meson.install_dependency_manifest]]. + ### Core options Options that are labeled "per machine" in the table are set per diff --git a/docs/markdown/snippets/licensesdir_option.md b/docs/markdown/snippets/licensesdir_option.md new file mode 100644 index 0000000..77ccd0d --- /dev/null +++ b/docs/markdown/snippets/licensesdir_option.md @@ -0,0 +1,4 @@ +## A new core directory option "licensedir" is available + +This will install a dependency manifest to the specified directory, if none +is is explicitly set. diff --git a/docs/yaml/builtins/meson.yaml b/docs/yaml/builtins/meson.yaml index a457dbf..1dd746f 100644 --- a/docs/yaml/builtins/meson.yaml +++ b/docs/yaml/builtins/meson.yaml @@ -323,6 +323,10 @@ methods: If license files are defined as well, they will be copied next to the manifest and referenced in it. + If this function is not used, the builtin option `licensedir` can + be used to install the manifest to a given directory with the name + `depmf.json`. + posargs: output_name: type: str diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 843af5d..c676d13 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1187,13 +1187,19 @@ class Backend: return outputs def generate_depmf_install(self, d: InstallData) -> None: - if self.build.dep_manifest_name is None: - return + depmf_path = self.build.dep_manifest_name + if depmf_path is None: + option_dir = self.environment.coredata.get_option(OptionKey('licensedir')) + assert isinstance(option_dir, str), 'for mypy' + if option_dir: + depmf_path = os.path.join(option_dir, 'depmf.json') + else: + return ifilename = os.path.join(self.environment.get_build_dir(), 'depmf.json') - ofilename = os.path.join(self.environment.get_prefix(), self.build.dep_manifest_name) - odirname = os.path.join(self.environment.get_prefix(), os.path.dirname(self.build.dep_manifest_name)) - out_name = os.path.join('{prefix}', self.build.dep_manifest_name) - out_dir = os.path.join('{prefix}', os.path.dirname(self.build.dep_manifest_name)) + ofilename = os.path.join(self.environment.get_prefix(), depmf_path) + odirname = os.path.join(self.environment.get_prefix(), os.path.dirname(depmf_path)) + out_name = os.path.join('{prefix}', depmf_path) + out_dir = os.path.join('{prefix}', os.path.dirname(depmf_path)) mfobj = {'type': 'dependency manifest', 'version': '1.0', 'projects': {k: v.to_json() for k, v in self.build.dep_manifest.items()}} with open(ifilename, 'w', encoding='utf-8') as f: diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 304b903..965fc1b 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -1197,6 +1197,7 @@ BUILTIN_DIR_OPTIONS: 'MutableKeyedOptionDictType' = OrderedDict([ (OptionKey('includedir'), BuiltinOption(UserStringOption, 'Header file directory', 'include')), (OptionKey('infodir'), BuiltinOption(UserStringOption, 'Info page directory', 'share/info')), (OptionKey('libdir'), BuiltinOption(UserStringOption, 'Library directory', default_libdir())), + (OptionKey('licensedir'), BuiltinOption(UserStringOption, 'Licenses directory', '')), (OptionKey('libexecdir'), BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())), (OptionKey('localedir'), BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')), (OptionKey('localstatedir'), BuiltinOption(UserStringOption, 'Localstate data directory', 'var')), diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py index a78ca7f..b85e298 100644 --- a/mesonbuild/utils/universal.py +++ b/mesonbuild/utils/universal.py @@ -2062,6 +2062,7 @@ _BUILTIN_NAMES = { 'includedir', 'infodir', 'libdir', + 'licensedir', 'libexecdir', 'localedir', 'localstatedir', |