diff --git a/aedi/target/__init__.py b/aedi/target/__init__.py index 6591a220..b9de0e61 100644 --- a/aedi/target/__init__.py +++ b/aedi/target/__init__.py @@ -126,6 +126,7 @@ def targets(): P7ZipTarget(), PbzxTarget(), QPakManTarget(), + Radare2Target(), SeverZipTarget(), UnrarTarget(), ZipTarget(), diff --git a/aedi/target/tool_tier2.py b/aedi/target/tool_tier2.py index 233fe711..58845faf 100644 --- a/aedi/target/tool_tier2.py +++ b/aedi/target/tool_tier2.py @@ -16,6 +16,7 @@ # along with this program. If not, see . # +import os import subprocess from ..state import BuildState @@ -86,6 +87,38 @@ class QPakManTarget(base.CMakeTarget): self.copy_to_bin(state) +class Radare2Target(base.MesonTarget): + def __init__(self, name='radare2'): + super().__init__(name) + self.configure_prefix = False + + def prepare_source(self, state: BuildState): + state.download_source( + 'https://github.com/radareorg/radare2/archive/refs/tags/5.8.4.tar.gz', + '8ea45bd82e5ea37e270ca14ac2a6f947c647a24f9de9e18bf8cebc71c0816dcd', + patches='radare2-fix-build') + + def detect(self, state: BuildState) -> bool: + return state.has_source_file('man/radare2.1') + + def configure(self, state: BuildState): + option = state.options + option['blob'] = 'true' + option['enable_tests'] = 'false' + option['enable_r2r'] = 'false' + option['r2_gittip'] = 'ab809417aa6b676922f95cf77861924eb90e7ef2' + option['r2_version_commit'] = '1' + + super().configure(state) + + def post_build(self, state: BuildState): + super().post_build(state) + + bin_path = state.install_path / 'bin' + os.unlink(bin_path / 'r2blob.static') + os.rename(bin_path / 'r2blob', bin_path / 'radare2') + + class SeverZipTarget(base.MakeTarget): # Build with --os-version-x64=10.13 command line option diff --git a/patch/radare2-fix-build.diff b/patch/radare2-fix-build.diff new file mode 100644 index 00000000..e6a7234d --- /dev/null +++ b/patch/radare2-fix-build.diff @@ -0,0 +1,8 @@ +--- a/libr/arch/p/xtensa/plugin.c ++++ b/libr/arch/p/xtensa/plugin.c +@@ -2106,3 +2106,5 @@ + .version = R2_VERSION + }; + #endif ++ ++xtensa_isa xtensa_default_isa;