# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=cpio
pkgver=2.15
pkgrel=1
pkgdesc="A tool to copy files into or out of a cpio or tar archive"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=('GPL-3.0-or-later')
url="https://www.gnu.org/software/cpio"
depends=('glibc')
source=(https://ftp.gnu.org/gnu/cpio/cpio-${pkgver}.tar.gz{,.sig})
sha256sums=('efa50ef983137eefc0a02fdb51509d624b5e3295c980aa127ceee4183455499e'
            'SKIP')
validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732') # Sergey Poznyakoff <gray@gnu.org>

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr --mandir=/usr/share/man
  make
}

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

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  rm -f "${pkgdir}/usr/bin/mt" "${pkgdir}/pkg/usr/share/man/man1/mt.1"
  rm -rf "${pkgdir}/usr/libexec"
  rm -f "${pkgdir}/usr/share/man/man8/rmt.8"
  # remove infodir
  rm "$pkgdir/usr/share/info/dir"
}
