pkgname=libX11
pkgver=1.8.12
pkgdesc="X11 client-side library"
arch=(x86_64)
homepage="https://gitlab.freedesktop.org/xorg/lib/libx11"
# keep xorgproto runtime dependency
# https://lists.archlinux.org/pipermail/arch-dev-public/2019-December/029767.html
depends=('libxcb' 'glibc' 'xorg-proto')
makedepends=('xtrans')
license=('MIT AND X11')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://xorg.freedesktop.org//releases/individual/lib/${sources[0]}")
md5sums=("146d770e564812e00f97e0cbdce632b7")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local conf_args=(
    --prefix=/usr
    --disable-static
    --disable-xf86bigfont
    --without-xmlto
    --without-specs
    --enable-ipv6
    --without-fop
    --with-keysymdefdir="/usr/include/X11"
  )
  ./configure "${conf_args[@]}"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

src_check() {
  make -k check
}

src_install() {
  make DESTDIR="${pkgdir}" install
  rm -rf "${pkgdir}"/usr/share/X11/locale

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

# vim:ft=sh syn=sh et sw=2:
