void-packages/srcpkgs/ghidra/template
2021-10-24 22:42:49 +02:00

74 lines
3.5 KiB
Bash

# Template file for 'ghidra'
pkgname=ghidra
version=10.0.4
revision=1
archs="x86_64*"
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 <abenson+void@gmail.com>"
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/catacombae/files/HFSExplorer/0.21/hfsexplorer-0_21-bin.zip
https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar"
checksum="76f1bd9604d49a2e59c47b347aedb90484bcfe51217c792e8cc771fc6481147c
7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc
90c9b54798abca5b12f4a678db7d0a4c970f4702cb153c11919536d0014dedbf
1398fcb1e93abb19992c4fa06d7fe5758aabb4c45781d7ef306c6f57ca7a7321
00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d"
skip_extraction="AXMLPrinter2.jar"
nopie=yes
nostrip_files="animals createStructure dataMutability inline ldiv opaque
setRegister switch compilerVsDecompiler custom globalRegVars.so
jumpWithinInstruction noReturn override.so sharedReturn"
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
post_extract() {
# makes patching easier
mv ${wrksrc}/ghidra-Ghidra_${version}_build ${wrksrc}/ghidra_build
}
do_configure() {
mkdir -p dependencies/flatRepo
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/AXMLPrinter2.jar dependencies/flatRepo
for lib in csframework.jar hfsx_dmglib.jar hfsx.jar iharder-base64.jar; do
cp -f ../lib/$lib dependencies/flatRepo
done
cp -f ../dex2jar-2.0/lib/dex-*.jar dependencies/flatRepo
mkdir -p ${wrksrc}/ghidra.bin/Ghidra/Features/GhidraServer/
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/yajsw-stable-12.12.zip ${wrksrc}/ghidra.bin/Ghidra/Features/GhidraServer/
gradle yajswDevUnpack
}
do_build() {
gradle buildGhidra
}
do_install() {
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)_linux64.zip
vmkdir usr/bin
ln -srf /usr/libexec/$pkgname/ghidraRun ${DESTDIR}/usr/bin/ghidra
}