Fix meson build for windows

This commit is contained in:
pancake authored and pancake committed 2022-06-07 11:41:05 +02:00
1 parent e74761856c
commit 753da63578
5 files changed
+105 -66

No files matched your search

+55 -51
View File
@@ -87,29 +87,29 @@ jobs:
# R2_DEBUG=1 r2 -qc 'af;pdg' /bin/ls | tee a.txt
# grep entry0 a.txt
linux-cmake-ok:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cloning Repo
run: git clone --depth=1 https://github.com/radareorg/radare2
- name: Packaging Radare2 for Debian
# run: make -C radare2/dist/debian
run: ( cd radare2 && sys/debian.sh )
- name: Installing Radare2
run: sudo dpkg -i radare2/dist/debian/*/*.deb
- name: Building r2ghidra with cmake
run: |
./preconfigure && cmake -DCMAKE_INSTALL_PREFIX=/usr -B b && make -C b -j4 && sudo make -C b install
ls -l /usr/lib/radare2/5.6.9/
ls -l /usr/lib/radare2/5.6.9/plugins
- name: Testing r2ghidra oneliner
run: r2 -H;r2 -l /usr/lib/radare2/last/plugins/core_ghidra.so -qc 'af;pdg' /bin/ls | tee a.txt && grep entry0 a.txt
- name: Pub
uses: actions/upload-artifact@v2
with:
path: radare2/dist/debian/*/*.deb
# linux-cmake-ok:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Cloning Repo
# run: git clone --depth=1 https://github.com/radareorg/radare2
# - name: Packaging Radare2 for Debian
# # run: make -C radare2/dist/debian
# run: ( cd radare2 && sys/debian.sh )
# - name: Installing Radare2
# run: sudo dpkg -i radare2/dist/debian/*/*.deb
# - name: Building r2ghidra with cmake
# run: |
# ./preconfigure && cmake -DCMAKE_INSTALL_PREFIX=/usr -B b && make -C b -j4 && sudo make -C b install
# ls -l /usr/lib/radare2/5.6.9/
# ls -l /usr/lib/radare2/5.6.9/plugins
# - name: Testing r2ghidra oneliner
# run: r2 -H;r2 -l /usr/lib/radare2/last/plugins/core_ghidra.so -qc 'af;pdg' /bin/ls | tee a.txt && grep entry0 a.txt
# - name: Pub
# uses: actions/upload-artifact@v2
# with:
# path: radare2/dist/debian/*/*.deb
macos-acr-ok:
# The type of runner that the job will run on
@@ -142,18 +142,18 @@ jobs:
path: dist/macos/*.zip
#path: radare2/dist/macos/*.pkg src/*.dylib /tmp/r2ghidra-macos-${{env.R2V}}.tar.gz dist/macos/*.zip
macos-cmake-ok:
runs-on: macos-latest
if: ${{ false }} # disable for now
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Installing radare2
run: git clone --depth=1 https://github.com/radareorg/radare2 && radare2/sys/install.sh
- name: Building r2ghidra with cmake
run: ./preconfigure && sudo cmake -DCMAKE_INSTALL_PREFIX=/usr -B build && sudo make -C build -j4 && sudo make -C build install
- name: Testing r2ghidra
run: r2 -qc 'af;pdg' /bin/ls | tee a.txt && grep iVar a.txt
# macos-cmake-ok:
# runs-on: macos-latest
# if: ${{ false }} # disable for now
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Installing radare2
# run: git clone --depth=1 https://github.com/radareorg/radare2 && radare2/sys/install.sh
# - name: Building r2ghidra with cmake
# run: ./preconfigure && sudo cmake -DCMAKE_INSTALL_PREFIX=/usr -B build && sudo make -C build -j4 && sudo make -C build install
# - name: Testing r2ghidra
# run: r2 -qc 'af;pdg' /bin/ls | tee a.txt && grep iVar a.txt
w64:
runs-on: windows-latest
@@ -184,23 +184,27 @@ jobs:
call preconfigure.bat
call configure.bat
call make.bat
- name: make
shell: cmd
run: |
cd
set PKG_CONFIG_PATH=%CD%\radare2\lib\pkgconfig
set PATH=%CD%\radare2\bin;%PATH%
set ARCH=x64
git submodule update --init
make ghidra-native
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir destdir build
cd build
cmake -GNinja ..
cmake --build .
copy *.dll ..\destdir
cd ..\destdir
mkdir destdir
copy w\*.dll destdir
cd destdir
zip -r ..\r2ghidra-w64.zip *
# - name: make
# shell: cmd
# run: |
# cd
# set PKG_CONFIG_PATH=%CD%\radare2\lib\pkgconfig
# set PATH=%CD%\radare2\bin;%PATH%
# set ARCH=x64
# git submodule update --init
# make ghidra-native
# call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
# mkdir destdir build
# cd build
# cmake -GNinja ..
# cmake --build .
# copy *.dll ..\destdir
# cd ..\destdir
# zip -r ..\r2ghidra-w64.zip *
- uses: actions/upload-artifact@v2
with:
name: r2ghidra-${{env.R2V}}-w64.zip
+2 -1
View File
@@ -1,3 +1,4 @@
@echo OFF
echo "Configuring the build directory with cmake"
cmake -B build -GNinja
meson w
REM cmake -B build -GNinja
+5 -3
View File
@@ -1,13 +1,15 @@
if EXIST build (
if EXIST w (
echo Building R2Ghidra Plugins
) else (
configure.bat
)
cmake --build build
ninja -C w
REM cmake --build build
echo Copying Plugins
mkdir destdir
copy build\*.dll destdir
copy w\*.dll destdir
echo Copying Sleigh Files
mkdir destdir\r2ghidra_sleigh
+38 -11
View File
@@ -1,10 +1,10 @@
project(
'r2ghidra',
['c', 'cpp'],
license : 'LGPL3',
meson_version : '>=0.50.1',
version : '5.7.0',
default_options : ['c_std=c11', 'cpp_std=c++11']
license : 'LGPL3',
meson_version : '>=0.50.1',
version : '5.7.0',
default_options : ['c_std=c11', 'cpp_std=c++11']
)
pugixml_sources = [
@@ -26,7 +26,40 @@ r2ghidra_sources = [
'src/SleighInstruction.cpp',
]
r_core = dependency('r_core')
incdirs = [
'src',
'third-party/pugixml/src/',
'ghidra-native/src/decompiler/',
]
if meson.get_compiler('cpp').get_id() == 'msvc'
incdirs += [
'radare2/include/libr',
'radare2/include/libr/sdb',
]
cpp = meson.get_compiler('cpp')
add_global_arguments('-D_WINDOWS', language:'cpp')
r2libdir = [
meson.current_source_dir() + '\\radare2\\lib',
'C:\\radare2\\lib'
]
r_core = [
cpp.find_library('r_core', dirs: r2libdir),
cpp.find_library('r_io', dirs: r2libdir),
cpp.find_library('r_bin', dirs: r2libdir),
cpp.find_library('r_cons', dirs: r2libdir),
cpp.find_library('r_flag', dirs: r2libdir),
cpp.find_library('r_reg', dirs: r2libdir),
cpp.find_library('r_util', dirs: r2libdir),
cpp.find_library('r_anal', dirs: r2libdir),
cpp.find_library('r_config', dirs: r2libdir),
]
else
r_core = dependency('r_core')
endif
r2ghidra_incdirs = include_directories(incdirs)
ghidra_decompiler_sources = [
'ghidra-native/src/decompiler/action.cc',
@@ -157,12 +190,6 @@ sleighc_sources = [
ghidra_decompiler_sources,
]
r2ghidra_incdirs = [
'src',
'third-party/pugixml/src/',
'ghidra-native/src/decompiler/',
]
r2ghidra_core_plugin = library('core_r2ghidra',
r2ghidra_core_sources,
dependencies: [r_core],
+5
View File
@@ -1,10 +1,15 @@
set PKG_CONFIG_PATH=%CD%\radare2\lib\pkgconfig
set PATH=%CD%\radare2\bin;%PATH%
set VSARCH=x64
git submodule update --init
python -m wget https://github.com/radareorg/ghidra-native/releases/download/0.1.8/ghidra-native-0.1.8.zip
unzip -q ghidra-native-0.1.8.zip
if %ERRORLEVEL% NEQ 0 (
powershell "Expand-Archive -LiteralPath ghidra-native-0.1.8.zip -DestinationPath ."
)
ren ghidra-native-0.1.8 ghidra-native
REM call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64