void-packages/srcpkgs/ghidra/template

109 lines
5.9 KiB
Bash

# Template file for 'ghidra'
pkgname=ghidra
version=11.0.1
revision=1
_dex_ver=2.1
_yajsw_ver=13.09
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 openjdk17 flex unzip protobuf which"
depends="openjdk17"
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/v${_dex_ver}/dex2jar-${_dex_ver}.zip
https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-${_yajsw_ver}/yajsw-stable-${_yajsw_ver}.zip
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/lib/java-sarif-2.1-modified.jar
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2012_x64.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2012_x86.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2015_x64.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2015_x86.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2017_x64.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2017_x86.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2019_x64.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vs2019_x86.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vsOlder_x64.fidb
https://github.com/NationalSecurityAgency/ghidra-data/raw/Ghidra_${version}/FunctionID/vsOlder_x86.fidb"
checksum="4913a5afad4093895e90a4a9d4e5a2d7f867c30d4b7445b8c7fce107a81b0ec7
7a9bdf843d43de4d1e94ec2e7b6f55825017b0c4a7ee39ff82660e2493a46f08
4dae732a535846ae5dfab753e82a4d5f93ad9a05a065e2172bb9774a1b15453a
7f736566494756d271aa5e4b1af6c89dc50d074ab1c6374a47df822264226b01
00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d
d4e98ab3f790b831793218430bba0d8b24a5fbf4da65b0c1ffa8cb0cfbeb0cdc
a490ed7e2ed21e587459feaeace7036b7ede4ce84e72e10dfd8c57434a6918b6
e04e9e40f9ecb601c85f4d84ed9bf66b45363be1d1e82c162e4c9902b8cb508f
b66ee696653e2ed365919deaaef885103120c792e22e79af70d1209d7e1d8644
d5fa5f697298174fa53d247d3599e6a12884605ad181c7b954e2380ec1f0bd89
d389cb8d76ff4a59ca35f891b8521c72ad5f0df96e253973a2d21a8614a4cc81
150007796fc36a4069660ad62449aadaaf3dd11b3864a5ef21e79831c9ce9118
eb630a36faa586a371eb734dc0bbd8d13ccaef697f3db5872596358f3dd2432a
8c3b51f4660cd27e1a0d610a9f3f2d5fbc833a66ac9ee4393ee2f2481e855866
98605c6b6b9214a945d844e41c85860d54649a45bca7873ef6991c0e93720787"
conf_files="/usr/libexec/ghidra/server/server.conf"
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
java-sarif-2.1-modified.jar"
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-stable-${_yajsw_ver}.zip dependencies/GhidraServer
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.fidb dependencies/fidb
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/AXMLPrinter2.jar dependencies/flatRepo
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/java-sarif-2.1-modified.jar dependencies/flatRepo
for _fn in ir reader reader-api translator; do
cp -f ../dex-tools-${_dex_ver}/lib/dex-${_fn}-${_dex_ver}.jar dependencies/flatRepo
done
}
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
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
rm ${DESTDIR}/usr/libexec/ghidra/Ghidra/Features/FileFormats/data/sevenzipnativelibs/Linux-amd64/lib7-Zip-JBinding.so
fi
}