diff --git a/compat/build.py b/compat/build.py index 549d30f5f..ddbb85dde 100755 --- a/compat/build.py +++ b/compat/build.py @@ -31,6 +31,7 @@ def main(argv): command.add_argument("role", help="project vs subproject", choices=["project", "subproject"]) command.add_argument("builddir", help="build directory", type=Path) command.add_argument("top_builddir", help="top build directory", type=Path) + command.add_argument("frida_version", help="the Frida version") command.add_argument("host_os", help="operating system binaries are being built for") command.add_argument("host_arch", help="architecture binaries are being built for") command.add_argument("host_toolchain", help="the kind of toolchain being used", @@ -43,6 +44,7 @@ def main(argv): command.set_defaults(func=lambda args: setup(args.role, args.builddir, args.top_builddir, + args.frida_version, args.host_os, args.host_arch, args.host_toolchain, @@ -86,6 +88,7 @@ def parse_array_option_value(v: str) -> set[str]: def setup(role: Role, builddir: Path, top_builddir: Path, + frida_version: str, host_os: str, host_arch: str, host_toolchain: str, @@ -224,7 +227,7 @@ def setup(role: Role, target=AGENT_TARGET), ] - state = State(role, builddir, top_builddir, host_os, host_arch, host_toolchain, outputs) + state = State(role, builddir, top_builddir, frida_version, host_os, host_arch, host_toolchain, outputs) serialized_state = base64.b64encode(pickle.dumps(state)).decode('ascii') variable_names, output_names = zip(*[(output.identifier, output.name) \ @@ -237,6 +240,7 @@ class State: role: Role builddir: Path top_builddir: Path + frida_version: str host_os: str host_arch: str host_toolchain: str @@ -290,6 +294,9 @@ def call_internal_meson(argv, *args, **kwargs): if not (workdir / "build.ninja").exists(): if options is None: options = load_meson_options(state.top_builddir, state.role, set(subprojects.keys())) + version_opt = next((opt for opt in options if opt.startswith("-Dfrida_version=")), None) + if version_opt is None: + options += [f"-Dfrida_version={state.frida_version}"] if state.host_os == "windows": if state.host_toolchain == "microsoft": diff --git a/compat/meson.build b/compat/meson.build index 1ff7a0b7c..1c458e2af 100644 --- a/compat/meson.build +++ b/compat/meson.build @@ -37,6 +37,7 @@ if no_overridden_compat_bits meson.is_subproject() ? 'subproject' : 'project', meson.current_build_dir(), meson.global_build_root(), + frida_version, host_os, host_abi, host_toolchain, diff --git a/meson.build b/meson.build index 3e6eb030d..ad2bcc897 100644 --- a/meson.build +++ b/meson.build @@ -13,9 +13,14 @@ Vala compiler from: https://github.com/frida/vala''') endif +releng = meson.global_source_root() / 'releng' +if not import('fs').exists(releng) + releng = meson.project_source_root() / 'releng' +endif + frida_version = get_option('frida_version') if frida_version == '' - frida_version = meson.project_version() + frida_version = run_command(releng / 'frida_version.py', meson.project_source_root(), check: true).stdout().strip() endif tokens = frida_version.split('.') frida_major_version = tokens[0].to_int() @@ -554,10 +559,6 @@ if get_option('devkits').length() != 0 if get_option('default_library') != 'static' error('Devkits can only be generated from static libraries') endif - releng = meson.global_source_root() / 'releng' - if not import('fs').exists(releng) - releng = meson.project_source_root() / 'releng' - endif mkdevkit = find_program(releng / 'mkdevkit.py') uninstalled_dir = meson.global_build_root() / 'meson-uninstalled' devkit_options = [