summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a1fc618574b136d435901d1dcabcd564c4f29b98 (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
# Maintainer: Karmanyaah Malhotra <karmanyaahm@gmail.com>
# Contributor: Haruue Icymoon <haruue@caoyue.com.cn>

pkgname=dex2jar-git
pkgver=2.1.nightly.28.r13.gd7a8611
pkgrel=3
pkgdesc='Tools to work with android .dex and java .class files, git version'
arch=('i686' 'x86_64')
url='https://github.com/pxb1988/dex2jar'
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}=$pkgver")
license=('Apache-2.0')
depends=('java-runtime')
makedepends=('jdk8-openjdk' 'git' 'gradle')
source=("${pkgname%-git}"::'git+https://github.com/pxb1988/dex2jar')
md5sums=('SKIP')

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

build() {
  cd "$srcdir/${pkgname%-git}"
  export JAVA_HOME="/usr/lib/jvm/java-8-openjdk"
  ./gradlew clean installDist
}

package() {
  mkdir -p "$pkgdir/usr/bin"
  mkdir -p "$pkgdir/opt/${pkgname%-git}/bin"
  mkdir -p "$pkgdir/opt/${pkgname%-git}/lib"
  mkdir -p "$pkgdir/usr/share/licenses/${pkgname%-git}"

  install -m755 "$srcdir/${pkgname%-git}"/dex-tools/build/install/dex-tools/*.sh "$pkgdir/opt/${pkgname%-git}"
  install -m755 "$srcdir/${pkgname%-git}"/dex-tools/build/install/dex-tools/bin/dex-tools "$pkgdir/opt/${pkgname%-git}/bin"
  install -m644 "$srcdir/${pkgname%-git}"/dex-tools/build/install/dex-tools/lib/* "$pkgdir/opt/${pkgname%-git}/lib"
  install -m644 "$srcdir/${pkgname%-git}"/dex-tools/build/install/dex-tools/NOTICE.txt "$pkgdir/opt/${pkgname%-git}"
  install -m644 "$srcdir/${pkgname%-git}"/dex-tools/build/install/dex-tools/LICENSE.txt "$pkgdir/usr/share/licenses/${pkgname%-git}"

  for i in $(ls "$pkgdir"/opt/"${pkgname%-git}"/*.sh); do
    f=$(basename $i)
    ln -s "/opt/${pkgname%-git}/$f" "$pkgdir/usr/bin/${f%.sh}"
  done

  ln -s "d2j-dex2jar" "$pkgdir/usr/bin/dex2jar"
}