# Maintainer: Alec Su <ae40515@yahoo.com.tw>

pkgname='luit'
pkgver=20260907
pkgrel=1
pkgdesc='Luit is a filter that can be run between an arbitrary application and a UTF-8 terminal emulator'
arch=('i686' 'x86_64')
url='https://invisible-island.net/luit/luit.html'
msys2_changelog_url='https://invisible-island.net/luit/luit.log.html'
msys2_references=(
  'anitya: 15047'
  'archlinux: luit'
  'gentoo: x11-apps/luit'
)
license=('spdx:MIT')
depends=(
  'gcc-libs'
  'libiconv'
  'zlib'
)
makedepends=(
  'gcc'
  'libiconv-devel'
  'patch'
  'zlib-devel'
  'autotools'
)
source=(
  "https://invisible-mirror.net/archives/${pkgname}/${pkgname}-${pkgver}.tgz"{,.asc}
  'luit-20190106-fix-ldflags.patch'
)
sha256sums=('97bd13da3e3aa59785d64504d37389612a327953bb7581508c5fea5182f9f561'
  'SKIP'
  'b2384d6801841d30830354c0806356be993ff86e9c8f1dfdca80a1de011da981')
validpgpkeys=(
  'C52048C0C0748FEE227D47A2702353E0F7E48EDB' # "Thomas E. Dickey (self-signed w/o SHA1) <dickey@invisible-island.net>"
  '19882D92DDA4C400C22C0D56CC2AF4472167BE03' # "Thomas Dickey <dickey@invisible-island.net>"
)

prepare() {
  cd "luit-${pkgver}"

  patch -Np0 -i "${srcdir}/luit-20190106-fix-ldflags.patch"
}

build() {
  cd "luit-${pkgver}"

  ./configure --prefix=/usr

  make
}

package() {
  cd "luit-${pkgver}"

  make DESTDIR="${pkgdir}" install

  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}
