# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=libcaca
pkgver=0.99.beta20
pkgrel=2
pkgdesc='Color ASCII art library'
arch=('x86_64' 'aarch64')
url='http://caca.zoy.org/wiki/libcaca'
license=('custom:WTFPL')
depends=('freeglut' 'gcc-libs' 'glibc' 'glu' 'imlib2' 'libglvnd' 'libx11' 'ncurses' 'slang' 'zlib')
makedepends=('doxygen' 'pango' 'python')
optdepends=('python: Python bindings')
source=("https://github.com/cacalabs/libcaca/releases/download/v$pkgver/$pkgname-$pkgver.tar.bz2")
sha256sums=('ff9aa641af180a59acedc7fc9e663543fb397ff758b5122093158fd628125ac1')

build() {
  cd $pkgname-$pkgver
  # We can't support LTO on non-x86_64 because it breaks configure
  [ x"$CARCH" = x"x86_64" ] || CFLAGS=${CFLAGS/$LTOFLAGS/}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
