# $Id: PKGBUILD 142104 2015-09-28 16:48:17Z anatolik $
# Maintainer: Anatol Pomozov
# Contributor: 謝致邦 <Yeking@Red54.com>
# Contributor: Alucryd <alucryd at gmail dot com>

pkgname=android-tools
pkgver=5.1.1_r18
pkgrel=1
pkgdesc='Android platform tools'
arch=(i686 x86_64)
url='http://tools.android.com/'
license=(Apache MIT)
depends=(openssl pcre)
makedepends=(git)
source=(git+https://android.googlesource.com/platform/system/core#tag=android-$pkgver
        git+https://android.googlesource.com/platform/system/extras#tag=android-$pkgver
        git+https://android.googlesource.com/platform/external/libselinux#tag=android-$pkgver
        git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver
        Makefile
        bash_completion) # Bash completion file was taken from https://github.com/mbrubeck/android-completion
sha1sums=('SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          '67baba7465ba6a65c206e8373656e5fe1d85f188'
          'e1bd94fd4dd260af3c068496071d67738d431aec')

prepare() {
  # another way to fix the compilation error is to add #include <stddef.h>
  sed -e 's/f2fs_sparse_file = NULL/f2fs_sparse_file = 0/g' -i extras/f2fs_utils/f2fs_utils.c 
}

build() {
  make
}

package(){
  make DESTDIR="$pkgdir" install

  install -Dm 644 bash_completion "$pkgdir"/etc/bash_completion.d/$pkgname
}
