NAME="fakechroot"
DESC="A tool for creating fake chroot enviroments"
VERSION="2.20.1"
FILES=(
  "https://github.com/dex4er/fakechroot/archive/$VERSION.tar.gz"
  "80.patch"
  "93.patch"
  "100.patch"
  "104.patch"
  "statx.patch"
)
HASHES=(
  "69612efa06636e79a56898512222b0fc"
  "7715c50ff332ee727afb834cd0f4b13f727d8152cff86ee0b8bebb286431b820f2a4e30a16655cf1e9f23c38cc31993a8563ca3aa08f10fa779894f282d20d51"
  "6a176a6a123efe5ff554b22dc0492a819f71581bdc38bc14a45ff61f163b8f2c6536bd1d559e2554bb08d4b7a59b87889bc99315995bfc8e2da1b28cf92c8def"
  "655f3c589d0c1958df0573b5d86e5541d0a31743d50e35347099679d41574f00ac5c6f13e74629073ebc1bbe138b6ac513abd47590d780adebe1d04c8c8c5194"
  "6545570c70c42e4753561687ea9eafb301aa6c7ad1f669212629232bd70275a90cc19129d0824a729884b1055e5155920bbd5b521b54fd450031bb25258d2970"
  "9da94ccffd8992e27a7de9b7e37d655b301036120b808dda23942a32228e8ad4"
)
DEPENDS=("perl" "bash")

PACKAGE() {
  tar xf $VERSION.tar.gz
  cd $NAME-$VERSION

  patch -Np1 -i "$ROOTDIR/statx.patch"
  patch -Np1 -i "$ROOTDIR/100.patch"
  patch -Np1 -i "$ROOTDIR/104.patch"
  patch -Np1 -i "$ROOTDIR/80.patch"
  patch -Np1 -i "$ROOTDIR/93.patch"

  ./configure --prefix=/usr --sbindir=/usr/bin \
    --libdir=/usr/lib/libfakeroot --sysconfdir=/etc
  make && make DESTDIR=$ROOTDIR install

  install -dm755 $ROOTDIR/etc/ld.so.conf.d/
  echo "/usr/lib/libfakeroot/fakechroot/" > $ROOTDIR/etc/ld.so.conf.d/fakechroot.conf

  cd .. && rm -rf $NAME-$VERSION
}
