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

_pkgname=gotools
pkgname=ghidra-extension-$(echo $_pkgname | tr '[:upper:]' '[:lower:]')-git
pkgver=0.1.2.r0.g8b0c484
pkgrel=1
pkgdesc="Plugin for Ghidra to assist reversing Golang binaries"
arch=('x86_64')
url=https://github.com/felberj/${_pkgname}
license=('MIT')
provides=()
conflicts=()
depends=('ghidra')
makedepends=('git' 'gradle' 'unzip' 'ghidra')
optdepends=()
source=("$pkgname::git+https://github.com/felberj/${_pkgname}")
sha512sums=('SKIP')

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

pkgver() {
  cd $srcdir/${_pkgname}
  git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

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 -t $pkgdir/usr/share/licenses/$pkgname
}