From d8e0ad51de85adffed3d715752a7add75454e622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Tue, 19 Mar 2024 23:07:59 +0100 Subject: [PATCH] meson: Install the generated .gir --- src/api/generate.py | 8 +++++++- src/api/meson.build | 15 ++++++++++++++- src/meson.build | 4 +++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/api/generate.py b/src/api/generate.py index 0afc18e11..35a2ed62c 100755 --- a/src/api/generate.py +++ b/src/api/generate.py @@ -9,8 +9,9 @@ def main(): parser = argparse.ArgumentParser(description="Generate refined Frida API definitions") - parser.add_argument('--output', dest='output_type', choices=['bundle', 'header', 'vapi', 'vapi-stamp'], default='bundle') + parser.add_argument('--output', dest='output_type', choices=['bundle', 'header', 'gir', 'vapi', 'vapi-stamp'], default='bundle') parser.add_argument('api_version', metavar='api-version', type=str) + parser.add_argument('core_gir', metavar='/path/to/Frida-x.y.gir', type=argparse.FileType('r', encoding='utf-8')) parser.add_argument('core_vapi', metavar='/path/to/frida-core.vapi', type=argparse.FileType('r', encoding='utf-8')) parser.add_argument('core_header', metavar='/path/to/frida-core.h', type=argparse.FileType('r', encoding='utf-8')) parser.add_argument('base_vapi', metavar='/path/to/frida-base.vapi', type=argparse.FileType('r', encoding='utf-8')) @@ -21,12 +22,17 @@ def main(): output_type = args.output_type api_version = args.api_version + core_gir = args.core_gir.read() core_vapi = args.core_vapi.read() core_header = args.core_header.read() base_vapi = args.base_vapi.read() base_header = args.base_header.read() output_dir = Path(args.output_dir) + if output_type == 'gir': + (output_dir / f"Frida-{api_version}.gir").write_text(core_gir, encoding='utf-8') + return + if output_type == 'vapi-stamp': (output_dir / f"frida-core-{api_version}.vapi.stamp").write_bytes(b"") return diff --git a/src/api/meson.build b/src/api/meson.build index ea0bb8e6a..d09c2d210 100644 --- a/src/api/meson.build +++ b/src/api/meson.build @@ -2,6 +2,7 @@ generate_api = [python, files('generate.py')] generate_api_args = [ api_version, + core_build_dir / core_gir_name, core_build_dir / 'frida-core.vapi', core_build_dir / 'frida-core.h', base_build_dir / f'frida-base-@api_version@.vapi', @@ -21,6 +22,18 @@ core_public_h = custom_target('frida-core-header', install_dir: header_install_dir, ) +core_public_gir = custom_target('frida-core-gir', + input: [core, base], + output: [core_gir_name], + command: [ + generate_api, + '--output=gir', + generate_api_args, + ], + install: true, + install_dir: girdir, +) + core_public_vapi = custom_target('frida-core-vapi', input: [core, base], output: [ @@ -71,7 +84,7 @@ if host_os == 'android' endif core_public_dep = declare_dependency( - sources: [core_public_h, core_public_vapi_stamp, core_public_extra_headers], + sources: [core_public_h, core_public_gir, core_public_vapi_stamp, core_public_extra_headers], include_directories: include_directories('.'), link_args: backend_libs_private, link_with: core_public_lib, diff --git a/src/meson.build b/src/meson.build index dcf1c6d60..42add408b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -524,6 +524,8 @@ core_vala_args = [ '--pkg=json-glib-1.0', ] +core_gir_name = f'Frida-@api_version@.gir' + core = library('frida-core', core_sources, c_args: frida_component_cflags, vala_args: [ @@ -533,7 +535,7 @@ core = library('frida-core', core_sources, gumjs_inspector_vala_args, '--pkg=gmodule-2.0', ], - vala_gir: 'Frida-' + api_version + '.gir', + vala_gir: core_gir_name, link_args: backend_libs_private, link_with: backend_libs, dependencies: core_deps + internal_deps,