#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=libx11
pkgver=1.8.3
pkgrel=06
pkgdesc="X11 client-side library w/o ipv6"
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' 'xorgproto')
makedepends=('xorg-util-macros' 'xtrans')
source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig}
	176.diff
	0001-Revert_Update_XPutBackEvent.diff)

prepare() {
  cd libX11-${pkgver}
  # https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/180 // fixes also MR #176/#187
  # should fix FS#76669; FS#69295; FS#76860
  patch -Np1 -i ../0001-Revert_Update_XPutBackEvent.diff
  # https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/176
  # should fix FS#76669
  patch -Np1 -i ../176.diff
}

build() {
  cd libX11-${pkgver}

  ./configure --prefix=/usr \
    --disable-static \
    --disable-xf86bigfont \
    --disable-ipv6

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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

package() {
  cd "${srcdir}/libX11-${pkgver}"
  make DESTDIR="${pkgdir}" install

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

#---- license gpg-key sha256sums ----

license=('custom')

#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>"
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>

sha256sums=(e31565c84006b6b8e01dc9399c806085739710bc2db2e0930f1511ed9d6585bd  # libX11-1.8.3.tar.xz
	1bbabdabac57d92e4aa6b36027f10cbbf1aac5083e0276ff07b16c4179e167fc  # libX11-1.8.3.tar.xz.sig
	3da9fb9737201802f36488e0f11f664a9a6a7a230357b7f0c44011d26d285c20  # 176.diff
	25cc0dbc16ab15c14c202c492d36593822098ae8abc422ff2e83f1aebc1579ca) # 0001-Revert_Update_XPutBackEvent.diff


