# Contributor: Sébastien Luttringer <seblu@archlinux.org>
# Contributor: Tom Gundersen <teg@jklm.no>
# Contributor: Joel Teichroeb <joel@teichroeb.net>

_pkgname=wayland
pkgname=static-compat-$_pkgname
pkgver=1.22.0
pkgrel=1
pkgdesc='A computer display server protocol'
arch=('x86_64')
url='https://wayland.freedesktop.org/'
license=('MIT')
depends=('static-compat-libffi' 'static-compat-expat' 'static-compat-libxml2')
options=(!emptydirs staticlibs)
makedepends=('static-compat-meson' 'ninja' 'libxslt' 'xmlto' 'doxygen' 'graphviz' 'docbook-xsl')
validpgpkeys=('C7223EBE4EF66513B892598911A30156E0E67611'  # Bryce Harrington
              'C0066D7DB8E9AC6844D728715E54498E697F11D7'  # Derek Foreman
              '34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48') # emersion <contact@emersion.fr>
source=("https://gitlab.freedesktop.org/wayland/wayland/-/releases/$pkgver/downloads/wayland-$pkgver.tar.xz"{,.sig})
sha256sums=('1540af1ea698a471c2d8e9d288332c7e0fd360c8f1d12936ebb7e7cbc2425842'
            'SKIP')

build() {
  source static-compat-environment
  export PATH=$PWD:$PATH
  printf '#!/usr/bin/bash\nexec /usr/bin/pkg-config --static "$@"\n' > pkg-config
  chmod +x pkg-config
  # remove check which expects "clock_gettime" to be a macro (in our old version of glibc it is a function, not a macro)
  sed -i 's|.*clock_gettime not found.*||g' $_pkgname-$pkgver/meson.build
  static-compat-meson build $_pkgname-$pkgver
  ninja -C build
}

check() {
  source static-compat-environment
  ninja -C build test
}

package() {
  source static-compat-environment
  DESTDIR="$pkgdir" ninja -C build install
  rm -r "$pkgdir/$static_compat_prefix"/share/{doc,man}
  install -Dm 644 $_pkgname-$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

# vim:set ts=2 sw=2 et:
