### this file is sourced not run
PKGVER=5.4.0
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=proot-$PKGVER.tar.gz
MD5SUM=9b6e3e6e0e2c3bf4c2e1c450bf76e715
SRC_URL=https://github.com/proot-me/proot/archive/refs/tags/v$PKGVER.tar.gz
BUNDLE=

SLACKREQ='libtalloc libarchive' # liblzo2 build-time only
SLACKDESC="proot: proot $PKGVER (Non-privileged chroot)  
proot:  
proot: PRoot is a user-space implementation of chroot, bind-mount, and 
proot: binfmt_misc, enabling non-root users to use an arbitrary directory as 
proot: the new root filesystem, make files accessible somewhere else in the 
proot: filesystem hierarchy, or executing programs built for another CPU 
proot: architecture transparently through QEMU user-mode. This package also 
proot: comes with CARE, a tool to create an archive that contains all the 
proot: material required to re-execute it in the same context.  
proot: 
proot: https://proot-me.github.io/
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	true
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/proot* &&
	cp ../pkg/uthash.h src &&

	# official build instructions
	make -C src loader.elf loader-m32.elf build.h && # first build the config and loader
	make -C src proot care && # then compile PRoot and CARE
	#make -C test # run test suite

	# install
	make -C src PREFIX=/usr install install-care &&

	# docs
	make -C doc &&
	cp doc/proot/man.1 /usr/share/man/man1/proot.1 &&	
	mkdir -p /usr/share/doc/proot &&
	cp -a doc/* /usr/share/doc/proot &&
	
	pkg_build_slackdesc
}
