# Maintainer (Arch): Nicolas Cornu <ncornu@aldebaran-robotics.com>
# Maintainer (Hyperbola): Márcio Silva <coadde@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=proot
_pkgname=PRoot
pkgver=5.1.0
pkgrel=3
pkgdesc="chroot, mount --bind, and binfmt_misc without privilege/setup"
arch=('i686' 'x86_64' 'armv7h')
url="http://proot.me"
license=('GPL')
provides=('proot')
depends=('talloc')
makedepends=('python-docutils' 'libxslt')
source=(${pkgname}-v${pkgver}.tar.gz::https://github.com/cedric-vincent/${_pkgname}/archive/v${pkgver}.tar.gz
        0001-Fix-use-of-size.patch)
sha256sums=('50fcb882662b2de3e64e603b68d1af75e920d480191a49e11c0cb63d50040386'
            '6ecc533f18a18d2a85c7886bf98d6b05a2513677943d5eb2f570ce1ed773e6b4')

prepare() {
  cd "${srcdir}/PRoot-5.1.0"
  patch -p1 -i ${srcdir}/0001-Fix-use-of-size.patch
}

build() {
	cd "${srcdir}"/${_pkgname}-${pkgver}/src
	make -f GNUmakefile

	cd "${srcdir}"/${_pkgname}-${pkgver}/doc
	make -f GNUmakefile
}

package() {
	cd "${srcdir}"/${_pkgname}-${pkgver}

	install -m755 -d "${pkgdir}"/usr/bin
	install -m755 src/${pkgname} "${pkgdir}"/usr/bin

	install -m755 -d "${pkgdir}"/usr/share/man/man1/
	install -m644 -T doc/proot/man.1 "${pkgdir}"/usr/share/man/man1/${pkgname}.1

	install -m755 -d "${pkgdir}"/usr/share/doc/proot/
	install -m644 doc/proot/changelog.txt "${pkgdir}"/usr/share/doc/proot
	install -m644 doc/proot/index.html "${pkgdir}"/usr/share/doc/proot
	install -m644 doc/proot/manual.txt "${pkgdir}"/usr/share/doc/proot
	install -m644 doc/proot/roadmap.txt "${pkgdir}"/usr/share/doc/proot

	install -m755 -d "${pkgdir}"/usr/share/doc/proot/stylesheets
	install -m644 doc/proot/stylesheets/* "${pkgdir}"/usr/share/doc/proot/stylesheets
}

# vim: ft=sh syn=sh et
