Closed anthraxx closed 2 years ago
Fixed in b827e93c7c266306793d0cee1773e62ad3a2aa9f
the sleigh files are shipped in a separate zip in the release page. you can build them, but only with make for now
@trufae great thanks. Do you have any pointer how one could build/distribute sleigh files themselves? Its important for us to be able to build them ourselves.
I think right now I figured it like this:
make -C ghidra sleigh-build
export R2_LIBR_PLUGINS=$(r2 -H R2_LIBR_PLUGINS)
DESTDIR="${pkgdir}" make -C ghidra install
yep. thats how you build it if you think it's worth to have the instructions in the readme they can be added. it will be good to be able to build it with meson too, but i dont see it as a prioriy right now
@trufae Sounds good enough for now, thank you! Compared the results to the provided zip and they seem to match. Good enough for now. If its ever moved over to meson please make us somehow aware :D
Yeah the sleigh files are portable. You can generate them once and use them on different systems. The zip in the release page is generated by the ci.
i'll open a ticket to make that part meson friendly when i get bored :)
btw i have a patch installing the sleighc compiler, not sure if you want to package this bonary too. Or maybe in a separate package because that may allow users to build their own custom processors
@trufae nice, good to hear. I've done some first meson adjustments for iaito but wanted to check in on some translations related topics. Can i reach you somewhere or should we discuss that on a bug ticket at iaito
?
Sure, use mail, telegram or discord
workaround for meson in https://github.com/NixOS/nixpkgs/pull/213388 using xargs to run sleighc in parallel (using a sparse checkout of ghidra, 6 of 240 MB)
{
# workround for https://github.com/radareorg/r2ghidra/issues/93
# https://github.com/radareorg/r2ghidra/blob/master/ghidra/Makefile
postBuild = ''
GHIDRA_SLEIGH_HOME=../ghidra/src/Processors
cp -v ../ghidra-processors.txt.default ../ghidra-processors.txt
echo "Compiling processor files"
./sleighc -a $GHIDRA_SLEIGH_HOME/DATA
cat ../ghidra-processors.txt | sed "s|^|$GHIDRA_SLEIGH_HOME/|" | xargs -n1 -P$NIX_BUILD_CORES ./sleighc -a 2>/dev/null
'';
# TODO use radare2.abiVersion https://github.com/radareorg/radare2/pull/20545
postInstall = ''
echo "Installing processor files to $out/lib/radare2/${radare2.version}/r2ghidra_sleigh"
mkdir $out/lib/radare2/${radare2.version}/r2ghidra_sleigh
for a in DATA $(cat ../ghidra-processors.txt); do
for b in $GHIDRA_SLEIGH_HOME/$a/*/*/*.{cspec,ldefs,pspec,sla}; do
cp $b $out/lib/radare2/${radare2.version}/r2ghidra_sleigh
done
done
'';
for reference ...
https://mesonbuild.com/Custom-build-targets.html
https://github.com/radareorg/r2ghidra/blob/0799403b8ae3c2a09a176f1312825619912185e3/Makefile#L22-L23
It seems that the meson build system is lacking some instructions. Its not installing a single file:
Expected files:
/usr/lib/radare2/$version/r2ghidra_sleigh
sleigh as well as the.so
its called like this:
Expected installed files: