summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ec7a129d0ed08ae0bd8e7459cfd9e53e3f49a071 (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
59
60
61
62
63
64
65
# Maintainer: Kevin MacMartin <prurigro at gmail dot com>

_pkgname=fb-adb
pkgname=$_pkgname-git
pkgver=20160514.r338.5e970a4
pkgrel=1
pkgdesc='A better shell to use in place of adb when connecting to Android devices'
url='https://github.com/facebook/fb-adb'
license=('GPL3')
arch=('i686' 'x86_64')
depends=('android-tools')
makedepends=('git' 'vim' 'android-sdk-build-tools')
options=('!strip' '!buildflags')
source=("git+$url.git")
sha512sums=('SKIP')
sha512sums=('SKIP')
_ndkver=10e
_sdkver=24.4.1

[[ -z "$ANDROID_NDK" ]] && {
  source_i686+=("android-ndk-r$_ndkver-linux-i686.bin::http://dl.google.com/android/ndk/android-ndk-r$_ndkver-linux-x86.bin")
  source_x86_64+=("http://dl.google.com/android/ndk/android-ndk-r$_ndkver-linux-$CARCH.bin")
  sha512sums_i686+=('8d66229f6f07d6fba00650a96267c3c4a8308d296d9f13aa359af34ad49f57ba3a02e39f14d2b04609816e5f28ed939e71024043a0f08dc3711895a42e39f771')
  sha512sums_x86_64+=('b2ba10d7757ed7189b4e6dc2ecd38fce0c32dc6701151542b9e225e890faee84dded30dd4e907b0e42473e2a6df8ef4d46f37514edc270a04e1129d9c9e677fa')
}

[[ -z "$ANDROID_SDK" ]] && {
  source+=("https://dl.google.com/android/android-sdk_r$_sdkver-linux.tgz")
  sha512sums+=('96fb71d78a8c2833afeba6df617edcd6cc4e37ecd0c3bec38c39e78204ed3c2bd54b138a56086bf5ccd95e372e3c36e72c1550c13df8232ec19537da93049284')
}

pkgver() {
  cd $_pkgname
  printf "%s.r%s.%s" "$(git show -s --format=%ci master | sed 's/\ .*//g;s/-//g')" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  [[ -z "$ANDROID_SDK" ]] && {
    cd android-sdk-linux
    ln -sf /opt/android-sdk/build-tools build-tools
    printf '%s\n' 'y' | ./tools/android update sdk --no-ui
  }
}

build() {
  [[ -z "$ANDROID_NDK" ]] \
    && export ANDROID_NDK="$srcdir/android-ndk-r$_ndkver"

  [[ -z "$ANDROID_SDK" ]] \
    && export ANDROID_SDK="$srcdir/android-sdk-linux"

  # configure
  cd $_pkgname
  ./autogen.sh

  # build
  install -d build
  cd build
  ../configure --enable-checking=yes
  make
}

package() {
  install -Dm755 $_pkgname/build/$_pkgname "$pkgdir/usr/bin/$_pkgname"
}