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 Mar 5, 2024
1 parent 6bb749f commit dc5e50c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
32 changes: 32 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,38 @@ else
codesign = ''
endif

if get_option('devkits').length() != 0
if get_option('default_library') != 'static'
error('Devkits can only be generated from static libraries')
endif
mkdevkit = find_program('./releng/mkdevkit.py')
uninstalled_dir = meson.global_build_root() / 'meson-uninstalled'
devkit_options = [
'--cc=' + '!'.join(cc.cmd_array()),
'--c-args=' + '!'.join(get_option('c_args')),
'--pkg-config-path=' + '!'.join([uninstalled_dir] + get_option('pkg_config_path')),
]
if host_toolchain == 'microsoft'
static_lib_prefix = ''
static_lib_suffix = '.lib'
devkit_options += ['--lib=' + lib.full_path()]
else
static_lib_prefix = 'lib'
static_lib_suffix = '.a'
devkit_options += [
'--ar=' + ar.full_path(),
'--nm=' + nm.full_path(),
]
objcopy = find_program('objcopy', required: false)
if objcopy.found()
devkit_options += '--objcopy=' + objcopy.full_path()
endif
endif
if host_os_family == 'darwin'
devkit_options += ['--libtool=' + libtool.full_path()]
endif
endif

modulate = [
python,
files('tools/modulate.py'),
Expand Down
7 changes: 7 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ option('compiler_snapshot',
description: 'Speed up compiler startup by using a snapshot'
)

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

option('tests',
type: 'feature',
value: 'auto',
Expand Down
26 changes: 26 additions & 0 deletions src/devkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
devkit_outputs = [
'frida-core.h',
static_lib_prefix + 'frida-core' + static_lib_suffix,
'frida-core-example.c',
]

if host_toolchain == 'microsoft'
devkit_outputs += [
'frida-core-example.sln',
'frida-core-example.vcxproj',
'frida-core-example.vcxproj.filters',
]
endif

custom_target('core-devkit',
input: core_public,
output: devkit_outputs,
command: [
mkdevkit,
'frida-core',
f'@host_os@-@host_arch@',
meson.current_build_dir(),
] + devkit_options,
install: true,
install_dir: get_option('libdir') / 'frida' / 'devkits' / 'core'
)
3 changes: 3 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -518,3 +518,6 @@ core_dep = declare_dependency(

core_build_dir = meson.current_build_dir()
subdir('api')
if 'core' in get_option('devkits')
subdir('devkit')
endif

0 comments on commit dc5e50c

Please sign in to comment.