blob: 39ec5f40e67bec639058bc04b974bd2365dc276e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# Maintainer: Luke Street <luke@street.dev>
# Contributor: Daniel Brodsky <danbrodsky@pm.me>
# Based on AUR ghidra-git
# Original Darcula patch from https://digmi.org/2019/03/26/ghidracula/
pkgname=ghidra-darcula
_darcula=5f401c27dc0710575d45e13c2c255d78dbe0a4ab
_darcula_version=2019.09
pkgver=10.2.2
pkgrel=1
pkgdesc='Software reverse engineering framework (with dark theme)'
arch=('x86_64' 'aarch64')
options=(!strip)
url='https://ghidra-sre.org'
license=(Apache)
provides=('ghidra')
conflicts=(
'ghidra'
'ghidra-dev'
'ghidra-desktop'
)
depends=(
'bash'
'java-environment=17'
'polkit'
)
makedepends=(
'fop'
'git'
'gradle'
'unzip'
)
source=(
"git+https://github.com/NationalSecurityAgency/ghidra#tag=Ghidra_${pkgver}_build"
"git+https://github.com/encounter/darcula-laf.git#commit=${_darcula}"
ghidra.desktop
ghidra-root.desktop
ghidra.policy
darcula.patch
)
sha512sums=(
'SKIP'
'SKIP'
'4cf019d5bfde5265d667400111fb0c2473caa2457756c9c73e33d6128da3b116bf8d1b8cbb4092bbe27ea65ea5ab46f922e05a1e53ff36b90f76d8fcc4bfc1e7'
'c717029cf31860e27b5563c3ff4b2740d4b1997bc50481214e24c38f12d9acbfa9ca2cbfe594d43071fbf8420ac8f022119c2c23ddef0c717d96860e22eb35c3'
'0a35f58b1820ac65ce37d09b0a6904ab7018c773c73ecd29bcfda37cbd27f34af868585084b5cd408b1066b7956df043cb1573a1e3d890e173be737d2de51401'
'86f7290a7380705666f807f825aa2db6d4ff59cbbda319e2467cdb13fa96143f65cd9f37e9150f5f0b984a8ecf26874f251e1b3830d2ff13bb96bfa171de9316'
)
_pkgname="${pkgname/-*/}"
_stop='\e[m'
_color="\e[33m"
_bold='\e[1m'
_prefix=" ${_bold}${_color}==>$_stop "
pkgver() {
cd "$_pkgname"
git describe --tags | sed 's#Ghidra_##;s#_build##;s#-#+#g;s#+#+r#'
}
prepare() {
cd "$_pkgname"
# Check Java version (thanks @ignapk)
JDK_VERSION=$(java -version 2>&1)
if [[ ! $JDK_VERSION =~ 17\.0 ]]; then
echo "FAILURE: You seem to have jdk17 installed correctly but your system defaults to another java version. To enable jdk17 please type: sudo archlinux-java set java-17-openjdk"
exit 1
fi
echo -e "${_prefix}Setting up the build dependencies"
gradle --parallel --init-script gradle/support/fetchDependencies.gradle init
echo -e "${_prefix}Applying Darcula patch"
patch -Np1 -i "$srcdir"/darcula.patch
sed -i "/dependencies {/a\\\\timplementation ':darcula-laf:${_darcula_version}'" Ghidra/Framework/Docking/build.gradle
echo "MODULE FILE LICENSE: lib/darcula-laf-${_darcula_version}.jar Apache License 2.0" >> Ghidra/Framework/Docking/Module.manifest
echo -e "${_prefix}Setting release to PUBLIC"
sed -i 's/application\.release\.name=.*/application.release.name=PUBLIC/' Ghidra/application.properties
##
## FOR GHIDRA DEVELOPERS
## (Left commented because the steps below are only required if you want to develop and contribute to ghidra)
## https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md
##
# echo -e "${_prefix}Setting up the developers environment"
# gradle --parallel prepDev
#
# echo -e "${_prefix}Setting up the eclipse configurations"
# gradle --parallel eclipse
#
# echo -e "${_prefix}Compiling the linux64 native binaries"
# gradle --parallel buildNatives_linux64
#
# echo -e "${_prefix}Compiling the precompile language modules"
# gradle --parallel sleighCompile
}
build() {
cd "$srcdir"/darcula-laf
echo -e "${_prefix}Building darcula-laf"
gradle --parallel jar
mkdir -p "$srcdir/$_pkgname"/flatRepo
cp build/libs/darcula-laf-${_darcula_version}.jar -t "$srcdir/$_pkgname"/dependencies/flatRepo
cd "$srcdir/$_pkgname"
echo -e "${_prefix}Building Ghidra"
gradle --parallel buildGhidra
}
package() {
cd "$_pkgname"
echo -e "${_prefix}Creating the package base"
install -d "$pkgdir"/{opt,usr/bin}
echo -e "${_prefix}Extracting the zip archive"
_appver=$(grep -oP '(?<=^application.version=).*$' Ghidra/application.properties)
_relname=$(grep -oP '(?<=^application.release.name=).*$' Ghidra/application.properties)
unzip -u build/dist/ghidra_"${_appver}_${_relname}_$(date +"%Y%m%d")"_linux_*.zip -d "$pkgdir"/opt
echo -e "${_prefix}Setting up a versionless directory name"
mv "$pkgdir"/opt/ghidra{_"${_appver}_${_relname}",}
echo -e "${_prefix}Setting up /usr/bin launchers"
ln -s /opt/ghidra/ghidraRun "$pkgdir"/usr/bin/ghidra
ln -s /opt/ghidra/support/analyzeHeadless "$pkgdir"/usr/bin/ghidra-headless
echo -e "${_prefix}Setting up desktop shortcuts"
install -Dm 644 ../ghidra.desktop -t "$pkgdir"/usr/share/applications
install -Dm 644 ../ghidra-root.desktop -t "$pkgdir"/usr/share/applications
echo -e "${_prefix}Setting up desktop icon"
install -Dm 644 Ghidra/Framework/Generic/src/main/resources/images/GhidraIcon256.png "$pkgdir"/usr/share/pixmaps/ghidra.png
echo -e "${_prefix}Setting up policy file for the \"run as root\" desktop shortcut"
install -Dm 644 ../ghidra.policy -t "$pkgdir"/usr/share/polkit-1/actions
}
|