#!/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=xorg-xinit
pkgver=1.4.2
pkgrel=01
pkgdesc="X.Org initialisation program "
arch=('x86_64')
url="https://xorg.freedesktop.org/"
depends=('libx11' 'xorg-xauth' 'xorg-xrdb' 'xorg-xmodmap')
makedepends=('xorg-util-macros')
optdepends=('xorg-twm' 'xterm')
backup=('etc/X11/xinit/xserverrc'
        'etc/X11/xinit/xinitrc')
source=(${url}/releases/individual/app/xinit-${pkgver}.tar.xz{,.sig}
        06_move_serverauthfile_into_tmp.diff
        fs25361.patch
#        fs46369.patch
#        use_uname_-n_instead_of_hostname.diff
        xserverrc)
options=(!emptydirs)

prepare() {
  cd xinit-${pkgver}
  patch -Np1 -i ../06_move_serverauthfile_into_tmp.diff
  patch -Np1 -i ../fs25361.patch
#  patch -Np1 -i ../fs46369.patch
#  # FS#67679
#  patch -Np1 -i ../use_uname_-n_instead_of_hostname.diff
  sed -i -e 's/XSLASHGLOB.sh/XSLASHGLOB/' xinitrc.cpp
}

build() {
  cd xinit-${pkgver}
  autoreconf -fi
  ./configure --prefix=/usr --with-xinitdir=/etc/X11/xinit
  make
}

package() {
  cd xinit-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -m644 "${srcdir}/xserverrc" "${pkgdir}/etc/X11/xinit/xserverrc"
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}

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

license=('custom')

validpgpkeys=('7C2608F8E5F9E78D7A3F26FF177544B49AF313FB') #  "Hans de Goede <jwrdegoede@fedoraproject.org>"
validpgpkeys+=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # "Alan Coopersmith <alan.coopersmith@oracle.com>"

sha256sums=(b7d8dc8d22ef9f15985a10b606ee4f2aad6828befa437359934647e88d331f23  # xinit-1.4.2.tar.xz
	b76579950f496c39872905e0e29eb17f6a18d8df0749ffd3ddba986d24e5de34  # xinit-1.4.2.tar.xz.sig
	a478799400cad6537d7054c5290007024a083183ac15dbdb880ac86702416da9  # 06_move_serverauthfile_into_tmp.diff
	929ed22ab034ee483390857d56f45058aec8002f862987aecd7e1d271102aa22 # fs25361.patch
#	6e2c44b997e604db167f00168e8b6c68257be50447d7a80856b4aa910f52351e # fs46369.patch
#	71c84795c557721ee4b4495f04ff5d1e9c1e84e36bdd0a921e5734a94ef2f3ba # use_uname_-n_instead_of_hostname.diff
	86835010b5350c41035495b7b845db0eecf1e4b7eeaf152b12a881fa502e5387) #  xserverrc


