Skip to content

Commit

Permalink
meson: Add support for building devkits
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Jan 31, 2024
1 parent 1374a82 commit c66012a
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bindings/gumjs/devkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
custom_target('gumjs-devkit',
input: gumjs,
output: [
'frida-gumjs.h',
'libfrida-gumjs.a',
'frida-gumjs-example.c',
],
command: [
mkdevkit,
'frida-gumjs',
f'@host_os@-@host_arch@',
meson.current_build_dir(),
] + devkit_options,
install: true,
install_dir: get_option('libdir') / 'frida' / 'devkits' / 'gumjs'
)
4 changes: 4 additions & 0 deletions bindings/gumjs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,7 @@ pkg.generate(filebase: 'frida-gumjs-inspector-' + api_version,
)

meson.override_dependency('frida-gumjs-inspector-' + api_version, gumjs_inspector_dep)

if 'gumjs' in get_option('devkits')
subdir('devkit')
endif
16 changes: 16 additions & 0 deletions gum/devkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
custom_target('gum-devkit',
input: gum,
output: [
'frida-gum.h',
'libfrida-gum.a',
'frida-gum-example.c',
],
command: [
mkdevkit,
'frida-gum',
f'@host_os@-@host_arch@',
meson.current_build_dir(),
] + devkit_options,
install: true,
install_dir: get_option('libdir') / 'frida' / 'devkits' / 'gum'
)
4 changes: 4 additions & 0 deletions gum/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,7 @@ pkg.generate(gum,
)

meson.override_dependency('frida-gum-' + api_version, gum_dep)

if 'gum' in get_option('devkits')
subdir('devkit')
endif
21 changes: 21 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,27 @@ else
gir = disabler()
endif

mkdevkit = find_program('./releng/mkdevkit.py')
uninstalled_dir = meson.global_build_root() / 'meson-uninstalled'
devkit_options = [
'--cc', '\n'.join(cc.cmd_array()),
'--c-args', '\n'.join(get_option('c_args')),
'--pkg-config-path', '\n'.join([uninstalled_dir] + get_option('pkg_config_path')),
]
if cc.get_argument_syntax() == 'msvc'
devkit_options += ['--lib', find_program('lib')]
else
foreach tool : ['ar', 'nm', 'objcopy']
p = find_program(tool, required: false)
if p.found()
devkit_options += ['--' + tool, p]
endif
endforeach
endif
if host_os_family == 'darwin'
devkit_options += ['--libtool', find_program('libtool')]
endif

if glib_dep.type_name() == 'internal' or cc.has_function('g_thread_set_callbacks', dependencies: [glib_dep])
cdata.set('HAVE_FRIDA_GLIB', 1)
endif
Expand Down
7 changes: 7 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ option('frida_java_bridge',
description: 'Build JavaScript bindings with Java bridge included'
)

option('devkits',
type: 'array',
choices: ['gum', 'gumjs'],
value: [],
description: 'Devkits to build'
)

option('tests',
type: 'feature',
value: 'auto',
Expand Down

0 comments on commit c66012a

Please sign in to comment.