summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d31e2a9ed39b4b9d723858adb63b89a777efc1bf (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: Aaron McDaniel (mcd1992) <'aur' at the domain 'fgthou.se'>
# Maintainer: Victor Golovanenko <drygdryg2014 at domain yandex.com>
pkgname=kaitai-struct-compiler-git
_pkgname='kaitai-struct-compiler'
pkgver=0.10.r56.g0acd030
pkgrel=1
pkgdesc='Compiler for the Kaitai declarative binary format parsing language.'
arch=('any')
url='https://kaitai.io'
license=('GPL3')
depends=('java-runtime')
makedepends=('git' 'sbt')
provides=('kaitai-struct-compiler')
conflicts=('kaitai-struct-compiler')
source=("$_pkgname::git+https://github.com/kaitai-io/kaitai_struct_compiler.git")
sha256sums=('SKIP')

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

build() {
  # Build the kaitai-compiler
  cd "$srcdir/$_pkgname"
  sbt --error compilerJVM/stage
}

package() {
  # Install java jar / classes
  cd "$srcdir/$_pkgname/jvm/target/universal/stage/lib/"
  for f in *.jar; do
    install -D -m 644 "$f" "$pkgdir/usr/share/java/$_pkgname/$f"
  done

  # Install binaries
  install -D -m 755 "$srcdir/$_pkgname/jvm/target/universal/stage/bin/kaitai-struct-compiler" "$pkgdir/usr/bin/kaitai-struct-compiler"

  # Patch kaitai-struct-compiler binary to point to system lib instead of installdir lib
  sed -i "s/^declare -r lib_dir=.*/declare -r lib_dir=\"\/usr\/share\/java\/${_pkgname}\/\"/" "${pkgdir}/usr/bin/kaitai-struct-compiler"

  # Install license
  install -D -m 644 "$srcdir/$_pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}