void-packages/srcpkgs/ghidra/template

103 lines
5.5 KiB
Bash

# Template file for 'ghidra'
pkgname=ghidra
version=10.2.3
revision=1
# commit id of 'ghidra-data' repo:
_commit=939210dab2570714944ac35a4daef9633fd842b3
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/2.0/dex-tools-2.0.zip
https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-13.05/yajsw-stable-13.05.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="b200db34e7dae42914fafc45075e84cebf2c635ea47d4422a10b399913f0312e
7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc
ff7a4c8262f7d24079b16607122bad8f6fb024f051c27b91883d9498568429a9
00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d
80d1c31c636b1775dd06001747dfb7e2ff60ff716299a8fcc232b8d2faa53a21
8fc7ea9451b3a201ac3623b4a0924427cbb6bba410bdf9ebba4f2dfe8e77dfad
c3c16d23517c233d6950d5d43e34cdfa1b15c1ee2e066c8e9a53b4f75a907a87
6fc0a61e935a0060ab33bd6406c9ca5f215ac3dff655f83c18f3d144ad389fe5
5b0f8b8dee110d8c54fc27ed808ea28c2c675e95f3809e33eb99f03672741833
2a81615d588aa80043f7bc3a35db04580c990c90398e77399fcffc66f053e5ac
80413b57ae20fc1850d15a401d1cec87ac61b1809a1dafc2fa4403bf2029ec94
68b96a4e13ee2c157517636aa1c7841f750fbfc0026188f6123af017f3fa3117
2466595f6e74d9599e16095cc61c6de769461c935c20a442db1d2dfd2d7bde9b
5b97f786eaebc785aaa365f17eb7cc9a1dd2b5a15b277a5229157ea76945fdc1"
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"
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-13.05.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
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
rm ${DESTDIR}/usr/libexec/ghidra/Ghidra/Features/FileFormats/data/sevenzipnativelibs/Linux-amd64/lib7-Zip-JBinding.so
fi
}