# Maintainer: David Mott <mott.david.j@gmail.com>
# Contributor: Niklas Holm <jadedcyborg@gmail.com>

pkgname='parallel'
pkgver=20231122
pkgrel='1'
pkgdesc="A shell tool for executing jobs in parallel"
arch=('any')
url='https://www.gnu.org/software/parallel/'
msys2_references=(
  "cpe: cpe:/a:gnu:parallel"
)
license=('GPL3')
depends=('perl')
makedepends=('autotools')
source=("https://ftpmirror.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.bz2"{,".sig"}
        "0001-support-MSys2.patch")
validpgpkeys=('CDA01A4208C4F74506107E7BD1AB451688888888')
sha256sums=('822c9cf8aa171520ad867db13ef13426669bd164c81b900a3dbcb556611beae2'
            'SKIP'
            '20b526c7ffc8632e5eccb1171e30a08650d550de9e2f6e56fe3bb86165e2d3e7')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}/0001-support-MSys2.patch"

  # ACLOCAL_PATH is needed to pick up local m4 macro
  ACLOCAL_PATH="${srcdir}/${pkgname}-${pkgver}" autoreconf -vif
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --build="${CHOST}" \
    --host="${CHOST}" \
    --target="${CHOST}" \
    --prefix="/usr"
  make
}

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