Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
194 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* config.h.in. Generated from configure.ac by autoheader. */ | ||
|
||
/* Define to 1 if OS is Android based. */ | ||
#mesondefine HAVE_ANDROID | ||
|
||
/* Define to 1 if OS is Darwin based. */ | ||
#mesondefine HAVE_DARWIN | ||
|
||
/* Define to 1 if OS is iOS. */ | ||
#mesondefine HAVE_IOS | ||
|
||
/* Define to 1 if OS is Linux based. */ | ||
#mesondefine HAVE_LINUX | ||
|
||
/* Define to 1 if OS is macOS. */ | ||
#mesondefine HAVE_MACOS | ||
|
||
/* Define to 1 if OS is QNX based. */ | ||
#mesondefine HAVE_QNX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
project('frida-python', 'c', version: '1.0.0') | ||
|
||
host_os_family = '' | ||
host_os = host_machine.system() | ||
host_is_64bit = host_machine.cpu_family() == 'x86_64' or host_machine.cpu_family() == 'arm64' | ||
|
||
if not meson.is_cross_build() | ||
target_conditionals_prefix = '#include <TargetConditionals.h>' | ||
|
||
is_macos_src = target_conditionals_prefix + ''' | ||
#if !TARGET_OS_OSX | ||
# error Not macOS | ||
#endif | ||
''' | ||
if cc.compiles(is_macos_src, name: 'compiling for macOS') | ||
host_os = 'macos' | ||
endif | ||
|
||
is_ios_src = target_conditionals_prefix + ''' | ||
#if !TARGET_OS_IOS | ||
# error Not iOS | ||
#endif | ||
''' | ||
if cc.compiles(is_ios_src, name: 'compiling for iOS') | ||
host_os = 'ios' | ||
endif | ||
|
||
if cc.has_header('android/api-level.h') | ||
host_os = 'android' | ||
endif | ||
endif | ||
|
||
os_families = [ | ||
['windows', 'windows'], | ||
['macos', 'darwin'], | ||
['linux', 'linux'], | ||
['ios', 'darwin'], | ||
['android', 'linux'], | ||
['qnx', 'qnx'], | ||
] | ||
foreach f : os_families | ||
if f.get(0) == host_os | ||
host_os_family = f.get(1) | ||
endif | ||
endforeach | ||
|
||
if host_os_family == '' | ||
error('Unsupported OS') | ||
endif | ||
|
||
python = get_option('with-python') | ||
if python == '' | ||
python = find_program('python3', required: false) | ||
if not python.found() | ||
python = find_program('python') | ||
endif | ||
endif | ||
|
||
result = run_command(python, '-c', | ||
'import sys; sys.stdout.write("%d.%d" % (sys.version_info[0], sys.version_info[1]))') | ||
if result.returncode() != 0 | ||
error('Unable to detect Python version: ' + result.stdout() + result.stderr()) | ||
endif | ||
python_version = result.stdout() | ||
|
||
python_name = 'python' + python_version | ||
python_site_packages = join_paths(get_option('libdir'), python_name, 'site-packages') | ||
|
||
result = run_command(python, '-c', | ||
'from distutils import sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())') | ||
if result.returncode() != 0 | ||
error('Unable to detect Python include directory: ' + result.stdout() + result.stderr()) | ||
endif | ||
python_incdir = result.stdout() | ||
|
||
result = run_command(python, '-c', 'import sys;\n' + | ||
'sys.stdout.write("PyInit__frida" if sys.version_info[0] >= 3 else "init_frida")') | ||
if result.returncode() != 0 | ||
error('Unable to detect Python plugin export name: ' + result.stdout() + result.stderr()) | ||
endif | ||
python_plugin_export_name = result.stdout() | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
cdata = configuration_data() | ||
|
||
cdata.set('HAVE_' + host_os_family.to_upper(), 1) | ||
if host_os != host_os_family | ||
cdata.set('HAVE_' + host_os.to_upper(), 1) | ||
endif | ||
|
||
frida_core_dep = dependency('frida-core-1.0') | ||
|
||
configure_file(input: 'config.h.meson', | ||
output: 'config.h', | ||
configuration: cdata) | ||
|
||
subdir('src') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
option('with-python', type: 'string', description: 'Python interpreter to build for') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FRIDA_PYTHON { | ||
global: | ||
PyInit__frida; | ||
init_frida; | ||
|
||
local: | ||
*; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
frida_sources = [ | ||
'__init__.py', | ||
'application.py', | ||
'core.py', | ||
'discoverer.py', | ||
'kill.py', | ||
'lsd.py', | ||
'ps.py', | ||
'repl.py', | ||
'tracer.py', | ||
] | ||
|
||
install_data(frida_sources, install_dir: join_paths(python_site_packages, 'frida')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
subdir('frida') | ||
subdir('scripts') | ||
|
||
extra_link_args = [] | ||
if host_os_family == 'darwin' | ||
extra_link_args += ['-Wl,-exported_symbol,_' + python_plugin_export_name] | ||
elif host_os_family != 'windows' | ||
extra_link_args += ['-Wl,--version-script,' + join_paths(meson.current_source_dir(), '_frida.version')] | ||
endif | ||
|
||
extension = shared_module('_frida', '_frida.c', | ||
name_prefix: '', | ||
name_suffix: 'so', | ||
include_directories: include_directories(python_incdir), | ||
link_args: extra_link_args, | ||
dependencies: [frida_core_dep], | ||
install: true, | ||
install_dir: python_site_packages, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
scripts = [ | ||
'frida', | ||
'frida-discover', | ||
'frida-kill', | ||
'frida-ls-devices', | ||
'frida-ps', | ||
'frida-trace', | ||
] | ||
|
||
cdata = configuration_data() | ||
cdata.set('PYTHON', python) | ||
cdata.set('pythondir', python_site_packages) | ||
|
||
foreach s : scripts | ||
generated_script = configure_file( | ||
input: s + '.in', | ||
output: s, | ||
configuration: cdata, | ||
) | ||
install_data(generated_script, | ||
install_dir: get_option('bindir'), | ||
install_mode: 'rwxr-xr-x', | ||
) | ||
endforeach |