144 lines
8.2 KiB
Bash
144 lines
8.2 KiB
Bash
# Template file for 'ghidra'
|
|
pkgname=ghidra
|
|
version=11.2
|
|
revision=1
|
|
_dex_ver=2.1
|
|
_yajsw_ver=13.12
|
|
_pybag_ver=2.2.12
|
|
_capstone_ver=5.0.1
|
|
_comtypes_ver=1.4.1
|
|
_pywin32_ver=306
|
|
_protobuf_ver=3.20.3
|
|
_setuptools_ver=68.0.0
|
|
_wheel_ver=0.37.1
|
|
_psutil_ver=5.9.8
|
|
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 openjdk21 flex unzip protobuf which python3-wheel python3-pip"
|
|
depends="openjdk21"
|
|
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
|
|
${PYPI_SITE/\/source}/py3/P/Pybag/Pybag-${_pybag_ver}-py3-none-any.whl
|
|
${PYPI_SITE/\/source}/py3/c/capstone/capstone-${_capstone_ver}-py3-none-win_amd64.whl
|
|
${PYPI_SITE/\/source}/py3/c/comtypes/comtypes-${_comtypes_ver}-py3-none-any.whl
|
|
${PYPI_SITE/\/source}/cp312/p/pywin32/pywin32-${_pywin32_ver}-cp312-cp312-win_amd64.whl
|
|
${PYPI_SITE/\/source}/py2.py3/p/protobuf/protobuf-${_protobuf_ver}-py2.py3-none-any.whl
|
|
${PYPI_SITE/\/source}/py3/s/setuptools/setuptools-${_setuptools_ver}-py3-none-any.whl
|
|
${PYPI_SITE/\/source}/py2.py3/w/wheel/wheel-${_wheel_ver}-py2.py3-none-any.whl
|
|
${PYPI_SITE}/p/psutil/psutil-${_psutil_ver}.tar.gz
|
|
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="4281824afdc66b40d4d661355311687e9adb63aeb240b2561bb53ce898910bfe
|
|
7a9bdf843d43de4d1e94ec2e7b6f55825017b0c4a7ee39ff82660e2493a46f08
|
|
c6fc59815d3800d14ec977926a8afd3f606a0ebd74d2cfd60601677466edeaa2
|
|
7f736566494756d271aa5e4b1af6c89dc50d074ab1c6374a47df822264226b01
|
|
00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d
|
|
eda5ee6c4e873902981b7f525b42a02428b87c7368df2c5bdfe1ded0e6884126
|
|
1bfa5c81e6880caf41a31946cd6d2d069c048bcc22edf121254b501a048de675
|
|
a208a0e3ca1c0a5362735da0ff661822801dce87312b894d7d752add010a21b0
|
|
37257794c1ad39ee9be652da0462dc2e394c8159dfd913a8a4e8eb6fd346da0e
|
|
a7ca6d488aa8ff7f329d4c545b2dbad8ac31464f1d8b1c87ad1346717731e4db
|
|
11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f
|
|
4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a
|
|
6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c
|
|
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 Pybag-${_pybag_ver}-py3-none-any.whl
|
|
capstone-${_capstone_ver}-py3-none-win_amd64.whl comtypes-${_comtypes_ver}-py3-none-any.whl
|
|
pywin32-${_pywin32_ver}-cp312-cp312-win_amd64.whl protobuf-${_protobuf_ver}-py2.py3-none-any.whl
|
|
setuptools-${_setuptools_ver}-py3-none-any.whl wheel-${_wheel_ver}-py2.py3-none-any.whl"
|
|
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=ignore # jython, not system python 2
|
|
nocross=yes
|
|
|
|
post_extract() {
|
|
# makes patching easier
|
|
mv ${wrksrc}/ghidra-Ghidra_${version}_build ${wrksrc}/ghidra_build
|
|
}
|
|
|
|
do_configure() {
|
|
mkdir -p dependencies/{GhidraServer,fidb,flatRepo,Debugger-agent-dbgeng,Debugger-rmi-trace}
|
|
cp -f ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.fidb dependencies/fidb
|
|
vsrccopy yajsw-stable-${_yajsw_ver}.zip dependencies/GhidraServer
|
|
vsrccopy AXMLPrinter2.jar dependencies/flatRepo
|
|
vsrccopy java-sarif-2.1-modified.jar dependencies/flatRepo
|
|
vsrccopy Pybag-${_pybag_ver}-py3-none-any.whl dependencies/Debugger-agent-dbgeng
|
|
vsrccopy capstone-${_capstone_ver}-py3-none-win_amd64.whl dependencies/Debugger-agent-dbgeng
|
|
vsrccopy comtypes-${_comtypes_ver}-py3-none-any.whl dependencies/Debugger-agent-dbgeng
|
|
vsrccopy pywin32-${_pywin32_ver}-cp312-cp312-win_amd64.whl dependencies/Debugger-agent-dbgeng
|
|
vsrccopy protobuf-${_protobuf_ver}-py2.py3-none-any.whl dependencies/Debugger-rmi-trace
|
|
vsrccopy psutil-${_psutil_ver}.tar.gz dependencies/Debugger-rmi-trace
|
|
vsrccopy setuptools-${_setuptools_ver}-py3-none-any.whl dependencies/Debugger-rmi-trace
|
|
vsrccopy wheel-${_wheel_ver}-py2.py3-none-any.whl dependencies/Debugger-rmi-trace
|
|
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
|
|
}
|