#!/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=xf86-video-vesa
pkgver=2.6.0
pkgrel=01
pkgdesc="X.org vesa video driver"
arch=(x86_64)
url="https://xorg.freedesktop.org/"
depends=('glibc')
makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=25.2')
conflicts=('xorg-server<21.1.1' 'X-ABI-VIDEODRV_VERSION<25' 'X-ABI-VIDEODRV_VERSION>=26')
#options=('debug')  ###  uncomment this to also build the debug pkg
groups=('xorg-drivers' 'xorg')
source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.xz{,.sig})

prepare() {
  cd ${pkgname}-${pkgver}
#  # https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa/-/merge_requests/5
#  patch -Np1 -i ../0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch
}

build() {
  cd ${pkgname}-${pkgver}

  # Since pacman 5.0.2-2, hardened flags are now enabled in makepkg.conf
  # With them, module fail to load with undefined symbol.
  # See https://bugs.archlinux.org/task/55102 / https://bugs.archlinux.org/task/54845
  export CFLAGS=${CFLAGS/-fno-plt}
  export CXXFLAGS=${CXXFLAGS/-fno-plt}
  export LDFLAGS=${LDFLAGS/,-z,now}

  ./configure --prefix=/usr
  make
}

package() {
  cd ${pkgname}-${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=('DD38563A8A8224537D1F90E45B8A2D50A0ECD0D3') #  "Adam Jackson <ajax@nwnk.net>"
#validpgpkeys+=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # "Adam Jackson <ajax@nwnk.net>"
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # "Alan Coopersmith <alan.coopersmith@oracle.com>"

sha256sums=(10082771b1a8f659c60b3d9b70456a4b59948a75b3cade2dfa33b8b05e549bb1  # xf86-video-vesa-2.6.0.tar.xz
	4c84dcdabfd1dd98e9f0702603417aeda7ca4954770fd7a3453e357110d5cc8b) # xf86-video-vesa-2.6.0.tar.xz.sig

