# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=tar
pkgver=1.34
pkgrel=1
pkgdesc="Utility used to store, backup, and transport files"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/tar/tar.html"
license=('GPL3')
groups=('compression')
depends=('libiconv' 'libintl' 'sh')
makedepends=('libiconv-devel' 'gettext-devel')
options=('!emptydirs')
install=tar.install
source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz
        tar-1.33-textmount.patch
        tar-1.33-msys2.patch)
sha256sums=('63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28'
            '0f25281eeef9d52184ec2dc6aad718c307710bf185ad2f771a52ea5c6c3b8aae'
            'b17db2ae030c7468595860f82b152d92d2d5ee9fa3638e8faa95d0fad64b686f')
#validpgpkeys=('325F650C4C2B6AD58807327A3602B07F55D0C732') # Sergey Poznyakoff

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/tar-1.33-textmount.patch
  patch -p1 -i ${srcdir}/tar-1.33-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure \
    --build=${CHOST} \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --libexecdir=/usr/lib/tar \
    --enable-backup-scripts
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check || true
}

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