# Template file for 'ghidra' pkgname=ghidra version=10.1.2 revision=1 _commit=7d843ec229d43c2d1a8178aaa892be90e37e95a2 archs="x86_64* aarch64*" # Other 64bit archs should be easily patchable, # grep for linux_arm_64 to find all places in need of patching create_wrksrc=yes build_wrksrc="ghidra_build" hostmakedepends="gradle openjdk11 flex unzip protobuf which" depends="openjdk11" short_desc="Software reverse engineering (SRE) framework" maintainer="Andrew Benson " license="Apache-2.0" homepage="https://ghidra-sre.org/" distfiles="https://github.com/NationalSecurityAgency/ghidra/archive/Ghidra_${version}_build.tar.gz https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-beta-13.01/yajsw-beta-13.01.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2012_x64.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2012_x86.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2015_x64.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2015_x86.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2017_x64.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2017_x86.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2019_x64.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vs2019_x86.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vsOlder_x64.fidb https://github.com/NationalSecurityAgency/ghidra-data/raw/${_commit}/FunctionID/vsOlder_x86.fidb" checksum="eac2ed632394f542da82a08578873f01e3890e2917f7d16ccb849f8b114a781c 7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc 430fb7901bd0fd52a5b90bd0cbd89e9d334077eb72a9b26896f465de1e593a99 00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d f26548a6df6b6963a418d8c83ac216d9e196b180d944a52b8123c457d472b7c9 0a8962cf3699d5b8d4b3a79400382462519edc26570a46b2085200e38534f900 187248f87fc1deb695bc3051b2d92f9b7482023a356821154db22478eed13088 1d05afa070e9c09b83ee15d544c8559ed0d2b53d7eac476f8f5f8849543b3812 1784ad6b25571177ff8212871867559998c6b8256bb1dbaeee864b580c1b2d6a bc9bf30621190e0eb56c4db5ec30ad0401ca7be0311f5a2ce3d894178eafd19c aab04eefd1142f7b3c3f86c8d766abe361b167b4fe4157c36fad18777b2a6fbd 0a2282ac3479ffc022e6cdb4e32e057bc10f0394cfb0f8016d7145be0167f5f7 fe1856c0acad297d9ba4fb6a2df1d32ba34df766d9f1a2a16da0ca2b375e23dd 46e56bc82ba68ad4e9a3c6a2e4ecd3428e2c390c7de0a379fa0165a58d46e115" skip_extraction="AXMLPrinter2.jar vs2012_x64.fidb vs2015_x64.fidb vs2017_x64.fidb vs2019_x64.fidb vsOlder_x64.fidb vsOlder_x86.fidb vs2012_x86.fidb vs2015_x86.fidb vs2017_x86.fidb vs2019_x86.fidb" nopie=yes nostrip_files="animals createStructure dataMutability inline ldiv opaque setRegister switch compilerVsDecompiler custom globalRegVars.so jumpWithinInstruction noReturn override.so sharedReturn write" skiprdeps="/usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/animals /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/compilerVsDecompiler /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/createStructure /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/custom /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/dataMutability /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/globalRegVars.so /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/inline /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/jumpWithinInstruction /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/ldiv /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/noReturn /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/opaque /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/override.so /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/setRegister /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/sharedReturn /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/switch /usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/write" python_version=2 # Jython 2.7.2 stuff nocross=yes post_extract() { # makes patching easier mv ${wrksrc}/ghidra-Ghidra_${version}_build ${wrksrc}/ghidra_build } do_configure() { mkdir -p dependencies/{GhidraServer,fidb,flatRepo} cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/yajsw-beta-13.01.zip dependencies/GhidraServer cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.fidb dependencies/fidb cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/AXMLPrinter2.jar dependencies/flatRepo cp -f ../dex2jar-2.0/lib/dex-*.jar dependencies/flatRepo } do_build() { gradle buildGhidra } do_install() { case "$XBPS_TARGET_MACHINE" in x86_64*) arch=x86_64;; aarch64*) arch=arm_64;; esac cd ${wrksrc}/${build_wrksrc} vmkdir usr/libexec/ghidra bsdtar --strip-components 1 -C ${DESTDIR}/usr/libexec/ghidra -xf build/dist/ghidra_${version}_DEV_$(date -u +%Y%m%d)_linux_${arch}.zip vmkdir usr/bin ln -srf /usr/libexec/$pkgname/ghidraRun ${DESTDIR}/usr/bin/ghidra }