summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cb69552b8fc48bcb6c49c3e3a20aeab9c1a94da9 (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
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Firef0x <Firefgx (at) gmail (dot) com>
# Contributor: sh0 <mee@sh0.org>
# Contributor: Lekensteyn <lekensteyn@gmail.com>

pkgname=smali-git
_gitname=smali
pkgver=2.0.7.1385.0c7e7b7
pkgrel=1
pkgdesc="An assembler/disassembler for Android's dex format"
url="https://github.com/JesusFreke/smali"
arch=('any')
license=('BSD')
depends=('java-runtime' 'bash')
makedepends=('git' 'java-environment' 'gradle')
provides=('smali')
conflicts=('smali')
source=(${pkgname}::git+https://github.com/JesusFreke/${_gitname})
sha512sums=('SKIP')

pkgver() {
  cd ${pkgname}
  _version=$(grep -e '^version' build.gradle|cut -d\' -f2)
  printf "%s.%s.%s" "${_version}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${pkgname}
  for file in baksmali smali; do
    # prevent from printing path on launch
    sed '/echo ${newProg}/d' -i scripts/${file}
    # fix ls path
    sed 's|/bin/ls|/usr/bin/ls|' -i scripts/${file}
  done
}

build() {
  cd ${pkgname}
  gradle --gradle-user-home=. build
}

check() {
  cd ${pkgname}
  gradle --gradle-user-home=. test
}

package() {
  cd ${pkgname}
  install -d "${pkgdir}/usr/bin"
  for file in baksmali smali; do
    install -Dm 644 "${file}/build/libs/${file}.jar" "${pkgdir}/usr/share/java/${pkgname}/${file}.jar"
    install -Dm 755 scripts/${file} "${pkgdir}/usr/share/java/${pkgname}/${file}"
    ln -s "/usr/share/java/${pkgname}/${file}" "${pkgdir}/usr/bin/${file}"
  done
  install -Dm 644 NOTICE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim: ts=2 sw=2 et: