# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

_pkgname=libx11
pkgname=$_pkgname-static
pkgver=1.7.0
pkgrel=3
pkgdesc="X11 client-side library"
arch=(x86_64)
url="https://xorg.freedesktop.org/"
# keep xorgproto runtime dependency
# https://lists.archlinux.org/pipermail/arch-dev-public/2019-December/029767.html
depends=('libxcb-static' 'xorgproto')
makedepends=('xorg-util-macros' 'libx11' 'xtrans')
license=('custom')
options=(!emptydirs staticlibs)
source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.bz2{,.sig})
sha512sums=('f661ca90350fd8a94f054b00f12f5122cea068ebff706acfd399462236c189a296a2358d17d16166635101cf56cc19303dd407873a159932d093c9f33556f9fb'
            'SKIP')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>
validpgpkeys+=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb@laas.fr>
validpgpkeys+=('3BB639E56F861FA2E86505690FDD682D974CA72A') # Matt Turner <mattst88@gmail.com>
validpgpkeys+=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # Adam Jackson <ajax@nwnk.net>
validpgpkeys=('C383B778255613DFDB409D91DB221A6900000011') # "Keith Packard <keithp@keithp.com>"

build() {
  cd libX11-${pkgver}
  #export PKG_CONFIG_PATH=/usr/static/lib/pkgconfig:/usr/lib/pkgconfig
  ./configure --prefix=/usr/static --disable-shared --enable-static --disable-xf86bigfont
  make
}

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

package() {
  cd "${srcdir}/libX11-${pkgver}"
  make DESTDIR="${pkgdir}" install
  rm -r "$pkgdir"/usr/static/share/{man,doc}

  install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
