diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-11-28 00:09:29 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-12-06 20:07:43 -0500 |
commit | bed55a902c46ad0fb1330a19daaa9834a37d3336 (patch) | |
tree | fac2bed20c12c6ecb76fa843d44919e2fa8a86dc /mesonbuild/modules | |
parent | 283c65578d6bf4ec221dff4b96e42df378886637 (diff) | |
download | meson-bed55a902c46ad0fb1330a19daaa9834a37d3336.zip meson-bed55a902c46ad0fb1330a19daaa9834a37d3336.tar.gz meson-bed55a902c46ad0fb1330a19daaa9834a37d3336.tar.bz2 |
gnome module: document and fix install_dir x3, by allowing false *_gir and *_typelib
generate_gir forces building both the typelib and gir, and some people
only want one or the other (probably only the typelib?) which means
flagging the other as install_dir: false in the same way custom_target
supports.
As this always worked, albeit undocumented, make sure it keeps working.
It's pretty reasonable to allow, anyway.
Fixes https://github.com/mesonbuild/meson/pull/9484#issuecomment-980131791
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/gnome.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 181d728..038d179 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -801,13 +801,21 @@ class GnomeModule(ExtensionModule): def _make_gir_target(self, state: 'ModuleState', girfile: str, scan_command: T.List[str], generated_files: T.Sequence[T.Union[str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]], depends: T.List[build.Target], kwargs: T.Dict[str, T.Any]) -> GirTarget: + install = kwargs['install'] + + install_dir = kwargs['install_dir_gir'] + if install_dir is None: + install_dir = os.path.join(state.environment.get_datadir(), 'gir-1.0') + elif install_dir is False: + install = False + scankwargs = { 'input': generated_files, 'output': girfile, 'command': scan_command, 'depends': depends, - 'install': kwargs['install'], - 'install_dir': kwargs['install_dir_gir'] or os.path.join(state.environment.get_datadir(), 'gir-1.0'), + 'install': install, + 'install_dir': install_dir, 'install_tag': 'devel', 'build_by_default': kwargs['build_by_default'], } @@ -817,12 +825,20 @@ class GnomeModule(ExtensionModule): def _make_typelib_target(self, state: 'ModuleState', typelib_output: str, typelib_cmd: T.List[str], generated_files: T.Sequence[T.Union[str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]], kwargs: T.Dict[str, T.Any]) -> TypelibTarget: + install = kwargs['install'] + + install_dir = kwargs['install_dir_typelib'] + if install_dir is None: + install_dir = os.path.join(state.environment.get_libdir(), 'girepository-1.0') + elif install_dir is False: + install = False + typelib_kwargs = { 'input': generated_files, 'output': [typelib_output], 'command': typelib_cmd, - 'install': kwargs['install'], - 'install_dir': kwargs['install_dir_typelib'] or os.path.join(state.environment.get_libdir(), 'girepository-1.0'), + 'install': install, + 'install_dir': install_dir, 'install_tag': 'typelib', 'build_by_default': kwargs['build_by_default'], } @@ -900,8 +916,10 @@ class GnomeModule(ExtensionModule): KwargInfo('identifier_prefix', ContainerTypeInfo(list, str), default=[], listify=True), KwargInfo('include_directories', ContainerTypeInfo(list, (str, build.IncludeDirs)), default=[], listify=True), KwargInfo('includes', ContainerTypeInfo(list, (str, GirTarget)), default=[], listify=True), - KwargInfo('install_dir_gir', (str, NoneType)), - KwargInfo('install_dir_typelib', (str, NoneType)), + KwargInfo('install_dir_gir', (str, bool, NoneType), + validator=lambda x: 'as boolean can only be false' if x is True else None), + KwargInfo('install_dir_typelib', (str, bool, NoneType), + validator=lambda x: 'as boolean can only be false' if x is True else None), KwargInfo('link_with', ContainerTypeInfo(list, (build.SharedLibrary, build.StaticLibrary)), default=[], listify=True), KwargInfo('namespace', str, required=True), KwargInfo('nsversion', str, required=True), |