summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 060dab761b23c2e429cca445160c72718e691adb (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
# Maintainer: Alex Sarum <rum.274.4 at gmail dot com>

_pkgname=ghidra-firmware-utils
pkgname=ghidra-extension-$(echo $_pkgname | tr '[:upper:]' '[:lower:]')-git
pkgver=r49.gba9b7cc
pkgrel=1
pkgdesc="Ghidra utilities for analyzing PC firmware"
arch=('x86_64')
url=https://github.com/al3xtjames/${_pkgname}
license=('Apache')
provides=()
conflicts=()
depends=('ghidra')
makedepends=('git' 'gradle' 'unzip' 'ghidra')
optdepends=()
source=("$pkgname::git+https://github.com/al3xtjames/${_pkgname}")
sha512sums=('SKIP')

prepare() {
  cp -rlfT $srcdir/$pkgname $srcdir/${_pkgname}
}

pkgver() {
  cd $srcdir/${_pkgname}
  count_commits=$(git rev-list --count HEAD)
  commit=$(git rev-parse --short HEAD)
  echo "r${count_commits}.g${commit}"
}

build() {
  cd $srcdir/${_pkgname}
  rm -rf dist
  GHIDRA_INSTALL_DIR=$(dirname $(readlink -fe $(which ghidra))) gradle
}

package() {
  ghidra_dir=$(dirname $(readlink -fe $(which ghidra)))
  cd $srcdir/${_pkgname}
  
  install -d $pkgdir/${ghidra_dir}/Ghidra/Extensions

  # Extract built archive into destination folder
  unzip -u dist/*.zip -d $pkgdir/${ghidra_dir}/Ghidra/Extensions/

  install -Dm 644 LICENSE.txt -t $pkgdir/usr/share/licenses/$pkgname
}