diff --git a/dev-util/r2ghidra/patches/r2ghidra-5.9.4-source2.patchset b/dev-util/r2ghidra/patches/r2ghidra-5.9.4-source2.patchset new file mode 100644 index 000000000..f67e33ae3 --- /dev/null +++ b/dev-util/r2ghidra/patches/r2ghidra-5.9.4-source2.patchset @@ -0,0 +1,31 @@ +From 47c9200afb9488e2513ccea6dc8ab65374650107 Mon Sep 17 00:00:00 2001 +From: Begasus +Date: Tue, 15 Oct 2024 16:52:40 +0200 +Subject: Build fix + + +diff --git a/src/decompiler/filemanage.cc b/src/decompiler/filemanage.cc +index aa1d06c..e4a55b9 100644 +--- a/src/decompiler/filemanage.cc ++++ b/src/decompiler/filemanage.cc +@@ -239,13 +239,17 @@ void FileManage::directoryList(vector &res,const string &dirname,bool al + if (dir == (DIR *)0) return; + entry = readdir(dir); + while(entry != (struct dirent *)0) { ++#ifndef __HAIKU__ + if (entry->d_type == DT_DIR) { ++#endif + string fullname(entry->d_name); + if ((fullname!=".")&&(fullname!="..")) { + if (allowdot || (fullname[0] != '.')) + res.push_back( dirfinal + fullname ); + } ++#ifndef __HAIKU__ + } ++#endif + entry = readdir(dir); + } + closedir(dir); +-- +2.45.2 + diff --git a/dev-util/r2ghidra/r2ghidra-5.9.4.recipe b/dev-util/r2ghidra/r2ghidra-5.9.4.recipe new file mode 100644 index 000000000..579584956 --- /dev/null +++ b/dev-util/r2ghidra/r2ghidra-5.9.4.recipe @@ -0,0 +1,91 @@ +SUMMARY="Deep ghidra decompiler integration for radare2 and iaito" +DESCRIPTION="This is an integration of the Ghidra decompiler for radare2 \ +(https://github.com/radareorg/radare2). +It is solely based on the decompiler part of Ghidra, which is written entirely in C++, so Ghidra \ +itself is not required at all and the plugin can be built self-contained. +This project was presented at r2con 2019 as part of the Cutter talk: \ +https://youtu.be/eHtMiezr7l8?t=950](https://youtu.be/eHtMiezr7l8?t=950" +HOMEPAGE="https://radare.org/" +COPYRIGHT="2019-2023 thestr4ng3r + 2020-2024 FXTi + 2023 Florian Märkl + 2019-2024 pancake + 2003 Kristen Wegner + 2006-2020 Arseny Kapoulkine" +LICENSE="Apache v2 + MIT + GNU LGPL v3" +REVISION="1" +SOURCE_URI="https://github.com/radareorg/r2ghidra/archive/refs/tags/$portVersion.tar.gz" +CHECKSUM_SHA256="e2b04a336bf41d40b6dadd81c6015bdd3e8382d29a38d8f9791c77d2a63be6eb" +SOURCE_FILENAME="r2ghidra-$portVersion.tar.gz" +srcGitRev_2="21b6dbafee5b8265ee000827dd31f542ad46861d" +SOURCE_URI_2="https://github.com/radareorg/ghidra-native/archive/$srcGitRev_2.tar.gz" +CHECKSUM_SHA256_2="00b49c583d678f6847842693d26eff09259241b2bc3f9a202c14aeee57ba78d9" +SOURCE_FILENAME_2="ghidra-native-$srcGitRev_2.tar.gz" +SOURCE_DIR_2="ghidra-native-$srcGitRev_2" +PATCHES_2="r2ghidra-5.9.4-source2.patchset" +srcGitRev_3="0e3f1699ffab5f820060fe99c61f0f9495c0c5b6" +SOURCE_URI_3="https://github.com/zeux/pugixml/archive/$srcGitRev_3.tar.gz" +CHECKSUM_SHA256_3="24ebdbf69a71838d4071a327a2e19a23cc875c5f13c5e2377a95bb42e7475f9c" +SOURCE_FILENAME_3="pugixml-$srcGitRev_3.tar.gz" +SOURCE_DIR_3="pugixml-$srcGitRev_3" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="?x86" + +commandBinDir=$binDir +commandSuffix=$secondaryArchSuffix +if [ "$targetArchitecture" = x86_gcc2 ]; then + commandBinDir=$prefix/bin + commandSuffix= +fi + +PROVIDES=" + r2ghidra$secondaryArchSuffix = $portVersion + cmd:sleighc$commandSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libr_anal$secondaryArchSuffix >= 5.9.6 + devel:libr_asm$secondaryArchSuffix >= 5.9.6 + devel:libr_core$secondaryArchSuffix >= 5.9.6 + " +BUILD_PREREQUIRES=" + cmd:awk + cmd:bison + cmd:flex + cmd:gcc$secondaryArchSuffix + cmd:git + cmd:make + cmd:patch + cmd:pkg_config$secondaryArchSuffix + cmd:r2 + " + +BUILD() +{ + mkdir -p ghidra-native + cp -R $sourceDir2/* ghidra-native + cp -R $sourceDir3/* third-party/pugixml + + make -C ghidra-native patch + + runConfigure --omit-dirs binDir ./configure \ + --bindir=$commandBinDir + make $jobArgs +} + +INSTALL() +{ + make install R2_LIBR_PLUGINS=$libDir/radare2/5.9.6 +} + +TEST() +{ + make check +}