# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=fakeroot
pkgver=1.36
pkgrel=1
pkgdesc='Tool for simulating superuser privileges'
arch=('x86_64')
license=('GPL-3.0-or-later')
url='https://tracker.debian.org/pkg/fakeroot'
install=fakeroot.install
depends=('glibc' 'filesystem' 'sed' 'util-linux' 'sh')
makedepends=('git' 'systemd' 'po4a')
checkdepends=('sharutils')
source=("git+https://salsa.debian.org/clint/fakeroot.git#tag=upstream/${pkgver}")
sha256sums=('6cf5ddf3fdb4d2ece465e4dc51b4d0b1a265c241bdaf2858f0a1519a9b4e8c63')

prepare() {
  cd "${pkgname}"

  autoreconf -fi
}

build() {
  cd "${pkgname}"

  ./configure \
    --prefix=/usr \
    --libdir=/usr/lib/libfakeroot \
    --disable-static \
    --with-ipc=sysv
  make

  cd doc
  po4a -k 0 --rm-backups --variable 'srcdir=../doc/' po4a/po4a.cfg
}

check() {
  cd "${pkgname}"

  make check
}

package() {
  cd "${pkgname}"

  make DESTDIR="${pkgdir}" install

  install -dm0755 "${pkgdir}/usr/lib/ld.so.conf.d/"
  echo '/usr/lib/libfakeroot' > "${pkgdir}/usr/lib/ld.so.conf.d/fakeroot.conf"

  # install README for sysv/tcp usage
  install -Dm0644 README "${pkgdir}/usr/share/doc/${pkgname}/README"
}
