Use the upstream Meson dependency, shared source manifest, and Sleigh compilation helper instead of maintaining local copies. Check pinned subprojects before Make and XPS builds, cache fetched revisions for offline reuse, and save local ghidra-native changes in a named stash before updating.
r2plugin
This directory contains the make and meson files required to link the
r2ghidra core plugin (including the ghidra-native decompiler) statically
inside radare2, using the XPS (static external plugins) mechanism. See
libr/xps/README.md in the radare2 source tree for the full details.
This way a custom radare2 build ships pdg out of the box, without
loading r2ghidra as an external plugin file.
Usage
Run these commands from the radare2 source tree:
mkdir -p libr/xps/p
ln -s ../../../../r2ghidra libr/xps/p/r2ghidra
echo 'EXTERNAL_PLUGINS+=r2ghidra' >> libr/xps/config.mk
make -C libr/xps clean all
make -C libr/xps/p/r2ghidra/r2plugin prepare
The prepare step fetches the ghidra-native and zlib subprojects (network
access on first run) and generates config.h if missing.
It also checks dependency revisions and updates ghidra-native in place, saving
local changes in its Git stash before switching versions. Both XPS build systems
read the native source manifest shipped by ghidra-native.
Then build radare2 as usual. With make:
./configure
make -j
With meson:
meson setup build --reconfigure
meson compile -C build
Verify the plugin is linked in:
./binr/radare2/radare2 -q -c 'Lc~r2ghidra' --
Notes
- The sleigh processor definitions are still needed at runtime. Install
them with
r2pm -ci r2ghidra-sleighormake -C ghidra user-installfrom this repository. - The in-tree build always uses the r2 XML APIs (rxml) instead of pugixml, and compiles its own static zlib with hidden visibility to avoid symbol clashes.
- Object files for the make build are stored under
r2plugin/obj/.