#!/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-fbdev
pkgver=0.5.0
pkgrel=03
pkgdesc="X.org framebuffer video driver"
arch=(x86_64)
url="https://xorg.freedesktop.org/"
depends=('glibc')
makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=25.2') # git)
conflicts=('xorg-server<21.1.1' 'X-ABI-VIDEODRV_VERSION<25' 'X-ABI-VIDEODRV_VERSION>=26')
groups=('xorg-drivers')
source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2{,.sig}
        gcc8.diff)

prepare() {
  cd $pkgname-$pkgver
  patch -Np0 -i ../gcc8.diff
}

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
}

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

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

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

license=('custom')

validpgpkeys=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2')

sha256sums=(dcc3d85f378022180e437a9ec00a59b6cb7680ff79c40394d695060af2374699 # xf86-video-fbdev-0.5.0.tar.bz2
	cc059a67e1823694c446e6302d3ac6d6f11c2136b09765ee556c5735d24ddb41 # xf86-video-fbdev-0.5.0.tar.bz2.sig
	050db537aae39b6deb1b2531b0064d62e2725f92b6c5c8ee6ade32e73cd3d5e8) # gcc8.diff
