# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

pkgname=autoconf-archive
pkgver=2023.02.20
pkgrel=1
pkgdesc="Autoconf Macro Archive"
arch=('any')
license=('spdx:GPL-3.0-or-later')
url="https://www.gnu.org/software/autoconf-archive"
conflicts=(gnome-common)
replaces=(gnome-common)
provides=(gnome-common)
makedepends=('autotools')
source=(https://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz
        msysize-autoconf-archive-2019.01.06.patch)
sha256sums=('71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33'
            'd2afa48081316320faea33683eecf3eb146617a8cab85ae8590b4f7882c1a529')

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
  for _patch in "$@"
  do
    msg2 "Applying $_patch"
    patch -Nbp1 -i "${srcdir}/$_patch"
  done
}

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  apply_patch_with_msg msysize-autoconf-archive-2019.01.06.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

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

  install -Dm644 COPYING $pkgdir/usr/share/licenses/${pkgname}-${pkgver}/COPYING
  install -Dm644 COPYING.EXCEPTION $pkgdir/usr/share/licenses/${pkgname}-${pkgver}/COPYING.EXCEPTION
}
