Skip to content

Commit

Permalink
Merge branch 'ci' into transformer_replace_tailjmp_with_callout
Browse files Browse the repository at this point in the history
  • Loading branch information
s1341 committed Feb 1, 2024
2 parents b1622b8 + cbbb789 commit af7ff4a
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 70 deletions.
126 changes: 59 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

jobs:
gir:
if: false
runs-on: ubuntu-22.04
steps:
- name: Check out repo
Expand Down Expand Up @@ -46,65 +47,74 @@ jobs:
build
meson compile -C build
windows:
runs-on: windows-latest
desktop:
strategy:
matrix:
arch: [amd64_x86, amd64]
name:
- windows-x86_64
- windows-x86
- macos-x86_64
- linux-x86_64
include:
- name: windows-x86_64
os: windows
arch: x86_64
runner: windows-latest
- name: windows-x86
os: windows
arch: x86
runner: windows-latest
- name: macos-x86_64
os: macos
arch: x86_64
runner: macos-latest
- name: macos-arm64
os: macos
arch: arm64
runner: macos-12-arm64
- name: linux-x86_64
os: linux
arch: x86_64
runner: ubuntu-latest
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
FRIDA_MESON_OPTIONS: "-Dgumpp=enabled -Dgumjs=enabled -Ddevkits=gum,gumjs"
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/checkout@v4
with:
python-version: '${{ env.PYTHON_VERSION }}'
- name: Install dependencies
run: pip install meson==${{ env.MESON_VERSION }} ninja
- name: Environment
submodules: recursive
- name: Set up MSVS environment
if: ${{ matrix.os == 'windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build
if: ${{ matrix.os == 'windows' }}
run: |
meson setup `
--default-library static `
-Doptimization=s `
-Dgumpp=enabled `
-Dgumjs=enabled `
--force-fallback-for=zlib `
build
meson compile -C build
- name: Test
run: |
Copy-Item build\bindings\gumpp\frida-gumpp-1.0.dll -Destination build\tests\
.\build\tests\gum-tests.exe
macos-x86_64:
runs-on: macos-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '${{ env.PYTHON_VERSION }}'
- name: Install dependencies
run: pip install meson==${{ env.MESON_VERSION }} ninja
.\configure -- ${Env:FRIDA_MESON_OPTIONS}.Split(' ')
.\make
- name: Build
if: ${{ matrix.os != 'windows' }}
run: |
meson setup \
--default-library static \
-Doptimization=s \
-Dgumpp=enabled \
-Dgumjs=enabled \
--force-fallback-for=glib,capstone \
build
meson compile -C build
./configure -- $FRIDA_MESON_OPTIONS
make
- name: Upload Gum devkit
uses: actions/upload-artifact@v4
with:
name: frida-gum-devkit-${{ matrix.os }}-${{ matrix.arch }}
path: build/gum/devkit/
- name: Upload GumJS devkit
uses: actions/upload-artifact@v4
with:
name: frida-gumjs-devkit-${{ matrix.os }}-${{ matrix.arch }}
path: build/bindings/gumjs/devkit/
- name: Test
run: ./build/tests/gum-tests
run: make test

linux-x86:
if: false
runs-on: ubuntu-latest
steps:
- name: Check out repo
Expand Down Expand Up @@ -136,32 +146,9 @@ jobs:
- name: Test
run: ./build/tests/gum-tests

linux-x86_64:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '${{ env.PYTHON_VERSION }}'
- name: Install dependencies
run: pip install meson==${{ env.MESON_VERSION }} ninja
- name: Build
run: |
meson setup \
--default-library static \
--force-fallback-for=glib \
-Doptimization=s \
-Dgumpp=enabled \
-Dgumjs=enabled \
build
meson compile -C build
- name: Test
run: ./build/tests/gum-tests

linux-mips:
runs-on: ubuntu-latest
if: false
strategy:
matrix:
arch:
Expand Down Expand Up @@ -202,6 +189,7 @@ jobs:
meson compile -C build
freebsd-arm64:
if: false
runs-on: [self-hosted, freebsd, arm64]
steps:
- name: Checkout monorepo
Expand All @@ -222,6 +210,7 @@ jobs:
run: ./build/tests/gum-tests

ios-arm64:
if: false
runs-on: macos-latest
steps:
- name: Check out repo
Expand Down Expand Up @@ -267,6 +256,7 @@ jobs:
android-intel:
runs-on: ubuntu-latest
if: false
strategy:
matrix:
arch: [x86, x86_64]
Expand Down Expand Up @@ -333,6 +323,7 @@ jobs:
adb shell "su root sh -c 'set -ex; cd /data/local/tmp; tar xf runner.tar.gz; TMPDIR=/data/local/tmp ./gum-tests'"
android-arm:
if: false
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -378,6 +369,7 @@ jobs:
./gum-tests
qnx-armeabi:
if: false
runs-on: ubuntu-latest
container: fridadotre/qnx:latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.user
/__pycache__/
/build/
/deps/
/gum/backend-darwin/helpers/build/
/subprojects/capstone/
/subprojects/elfutils/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "releng"]
path = releng
url = https://github.com/frida/releng.git
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PYTHON ?= $(shell python3 --version >/dev/null 2>&1 && echo python3 || echo python)

all $(MAKECMDGOALS):
@$(PYTHON) \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" \
"$(shell pwd)" \
./build \
$(MAKECMDGOALS)

.PHONY: all $(MAKECMDGOALS)
26 changes: 26 additions & 0 deletions bindings/gumjs/devkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
devkit_outputs = [
'frida-gumjs.h',
static_lib_prefix + 'frida-gumjs' + static_lib_suffix,
'frida-gumjs-example.c',
]

if cc.get_argument_syntax() == 'msvc'
devkit_outputs += [
'frida-gumjs-example.sln',
'frida-gumjs-example.vcxproj',
'frida-gumjs-example.vcxproj.filters',
]
endif

custom_target('gumjs-devkit',
input: gumjs,
output: devkit_outputs,
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
14 changes: 14 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

if [ -z "$PYTHON" ]; then
PYTHON=$(python3 --version >/dev/null 2>&1 && echo python3 || echo python)
fi

pushd $(dirname $0) >/dev/null
srcroot=$(pwd)
popd >/dev/null

exec "$PYTHON" \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" \
"$srcroot" \
"$@"
17 changes: 17 additions & 0 deletions configure.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_

:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof

:_start_
call :set_real_dp0

endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" ^
"%dp0%" ^
%*
26 changes: 26 additions & 0 deletions gum/devkit/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
devkit_outputs = [
'frida-gum.h',
static_lib_prefix + 'frida-gum' + static_lib_suffix,
'frida-gum-example.c',
]

if cc.get_argument_syntax() == 'msvc'
devkit_outputs += [
'frida-gum-example.sln',
'frida-gum-example.vcxproj',
'frida-gum-example.vcxproj.filters',
]
endif

custom_target('gum-devkit',
input: gum,
output: devkit_outputs,
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
18 changes: 18 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_

:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof

:_start_
call :set_real_dp0

endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" ^
"%dp0%" ^
.\build ^
%*
25 changes: 25 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,31 @@ 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'
static_lib_prefix = ''
static_lib_suffix = '.lib'
devkit_options += ['--lib', find_program('lib')]
else
static_lib_prefix = 'lib'
static_lib_suffix = '.a'
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
1 change: 1 addition & 0 deletions releng
Submodule releng added at 002c47
Loading

0 comments on commit af7ff4a

Please sign in to comment.