pkgname=libsparse
pkgver="1.0.0"
pkgrel=2
pkgdesc="Android Sparse library"
url="https://android.googlesource.com"
arch="all"
license="APACHE2"
depends="python3"
makedepends="zlib-dev"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/anestisb/android-simg2img/archive/${pkgver}.tar.gz"
options="!check"

build() {
    cd "$srcdir"/android-simg2img-"$pkgver"
    sed -i -e 's./usr/bin/env python./usr/bin/env python3.' simg_dump.py
    make sparse
    make
}

package() {
    cd "$srcdir"/android-simg2img-"$pkgver"

    for i in append2simg img2simg simg2img simg2simg simg_dump.py; do
        install -D -m755 "$i" "$pkgdir"/usr/bin/"$i"
    done
}

sha512sums="e43ad20760243ee88441d3016dea776224373377a5f0d367fca2da8b44f4dcc17c779ad2aed79b2f04861f4e56ec3472c0f2dc5c8fc12dc87f57d608cfc8faf6  libsparse-1.0.0.tar.gz"
