# Maintainer: Martchus <martchus@gmx.net>

_android_api_level=24
_rev=r07
_pkg_arch=aarch64
_android_arch=arm64-v8a

pkgname=android-$_pkg_arch-system-image
pkgver=${_android_api_level}_${_rev}
pkgrel=1
pkgdesc="Android system image (${_pkg_arch}, latest API)"
arch=('any')
url='http://developer.android.com/sdk/index.html'
license=('custom')
depends=("android-platform")
provides=("${pkgname}-${_android_api_level}" "android-system-image-${_android_arch}")
conflicts=("${pkgname}-${_android_api_level}" "android-system-image-${_android_arch}")
replaces=("android-system-image-${_android_arch}")
options=('!strip')
source=("http://dl-ssl.google.com/android/repository/sys-img/android/${_android_arch}-${_android_api_level}_${_rev}.zip"
        "source.properties")
sha1sums=('3454546b4eed2d6c3dd06d47757d6da9f4176033'
          'e03457681f0105a1679cbb8af213b0c8600f9bee')

package() {
  _destdir="${pkgdir}/opt/android-sdk/system-images/android-${_android_api_level}/default"
  mkdir -p "${_destdir}"
  mv "${srcdir}/${_android_arch}" "${_destdir}"
  install -Dm644 "${srcdir}/source.properties" "${_destdir}/${_android_arch}/"

  chmod -R ugo+rX "${pkgdir}/opt"
}
