#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=fakechroot
pkgver=2.20.1
pkgrel=02
pkgdesc="Gives a fake chroot environment"
arch=('x86_64')
url="https://github.com/dex4er/fakechroot/wiki"
depends=('sh' 'perl')
makedepends=(automake autoconf)
provides=('fakechroot')
conflicts=('fakechroot-git')
options=('staticlibs')
source=($pkgname-$pkgver.tar.gz::https://github.com/dex4er/fakechroot/archive/${pkgver}.tar.gz
        "fix_glibc_2.33_compatibility.patch::https://github.com/lipnitsk/fakechroot/commit/693a3597ea7fccfb62f357503ff177bd3e3d5a89.patch"
        "remove_ver_from_lstat.patch::https://github.com/lipnitsk/fakechroot/commit/75d7e6fa191c11a791faff06a0de86eaa7801d05.patch")

prepare() {
  cd $pkgname-$pkgver

  patch -Np1 -i "$srcdir/fix_glibc_2.33_compatibility.patch"
  patch -Np1 -i "$srcdir/remove_ver_from_lstat.patch"
}


build() {
  cd $pkgname-$pkgver
  ./autogen.sh
  ./configure \
	--prefix=/usr \
	--libdir=/usr/lib/libfakeroot \
	--sbindir=/usr/bin \
	--sysconfdir=/etc
  make
}

check() {
  cd $pkgname-$pkgver

#  # t/fts.t fails when building on BTRFS...  (really!)
#  make -k check
}
  
package() {
  cd $pkgname-$pkgver

  make DESTDIR="${pkgdir}" install
  
  install -dm755 "${pkgdir}"/etc/ld.so.conf.d/
  echo '/usr/lib/libfakeroot/fakechroot/' > "${pkgdir}"/etc/ld.so.conf.d/fakechroot.conf
}

#---- license gpg-key sha256sums ----

license=('LGPL')

md5sums=('69612efa06636e79a56898512222b0fc'
		SKIP
		SKIP)
sha512sums=('50f96d10de52eab32319746798396b972c021fb2e30679a2697214e01a974afbb4e0205dc51d5d9c7b57ac462d1a6fd14fd46ca9a92eefd20beef0d65ea76e0f'
		SKIP
		SKIP)

sha256sums=(7f9d60d0d48611969e195fadf84d05f6c74f71bbf8f41950ad8f5bf061773e18 #  fakechroot-2.20.1.tar.gz
	4038238c9a3ec67b6a749a55eb206f92fcc75a8e762d27b1cca236bd49fdcd40  # fix_glibc_2.33_compatibility.patch
	2ca655d046390b2822c0e8fc65c32a3c8851542896452e940b8e16d57f0dd0e5) # remove_ver_from_lstat.patch


