#!/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-nouveau
pkgver=1.0.17
pkgrel=02
pkgdesc="Open Source 3D acceleration driver for nVidia cards"
arch=('x86_64')
url="https://nouveau.freedesktop.org/"
depends=('mesa')
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')
groups=('xorg-drivers')
source=(https://xorg.freedesktop.org/archive/individual/driver/$pkgname-$pkgver.tar.bz2{,.sig}
        xorg-server-21.1.diff)

prepare() {
  cd $pkgname-$pkgver
  patch -np1 -i ../xorg-server-21.1.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
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}

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

license=('GPL')

validpgpkeys=('B97BD6A80CAC4981091AE547FE558C72A67013C3') # Maarten Lankhorst <maarten@debian.org>
validpgpkeys+=('C9FA6B58BC799041500F769AC5469FB8758F9C2B') # "Lyude Paul <lyude@redhat.com>"
validpgpkeys+=('BFB9B0C276D5767C710086EFB178BE4EA075DE07') # "Ilia Mirkin <imirkin@alum.mit.edu>"

sha256sums=(499322e27a55c8183166bf2dd1e47d085eb834143e0d7036baba8427b90c156b # xf86-video-nouveau-1.0.17.tar.bz2
	a20ed54d80990906940149cdeb0594373e7f0033778689277b8335b8c87c8929 # xf86-video-nouveau-1.0.17.tar.bz2.sig
	1a24074aa7ae3226100e9fc4d58c911e23f64e32109c0516228b91e303d1d658) #  xorg-server-21.1.diff
