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

pkgname=coreutils
pkgver=9.4
pkgrel=02
pkgdesc='The basic file, shell and text manipulation utilities of the GNU operating system'
url='https://www.gnu.org/software/coreutils/'
depends=('glibc' 'acl' 'attr' 'gmp' 'libcap' 'openssl')
source=("https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
#        '01-FS#77969.patch::https://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=76f2fb627118a26c25003dbd98c22c153b7ee1d2'
#        'copy-fix-reflink-auto-fallback.patch'
#        'gnulib-backupfile-62607.patch'
#        'coreutils-backup-62607.patch')

prepare() {
  cd $pkgname-$pkgver
  # apply patch from the source array (should be a pacman feature)
  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    [[ $src = *.patch ]] || continue
    echo "Applying patch $src..."
    patch -Np1 < "../$src"
  done

}

build() {
  cd $pkgname-$pkgver
  ./configure \
      --prefix=/usr \
      --libexecdir=/usr/lib \
      --with-openssl \
      --enable-no-install-program=groups,hostname,kill,uptime
  make
}

#check() {
#  cd $pkgname-$pkgver
#  make check
#}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL-3.0-or-later' 'GFDL-1.3-or-later')

validpgpkeys=('6C37DC12121A5006BC1DB804DF6FD971306037D9') # Pádraig Brady

sha256sums=(ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e52  # coreutils-9.4.tar.xz
	290c9baaf94bdad2f126cb9e7a1a98214afc4e3cbdf6d362b0acb4ffc56f72c7) # coreutils-9.4.tar.xz.sig

##  92a9bff1f2a2f0a91b36295dde220c35fde7c7bf5d020a9532740d4930d82b4a  coreutils-9.4-02-x86_64.pkg.tar.lz

