#!/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-vmware
pkgver=13.3.0
pkgrel=04
pkgdesc="X.org vmware video driver"
arch=(x86_64)
url="https://xorg.freedesktop.org/"
depends=('mesa')
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')
options=('!emptydirs')
#options=('!emptydirs' 'debug') ##  uncomment this to have the debug pkg produced
source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2{,.sig}
        gcc8.diff
        gcc12.1.diff)

prepare() {
  cd $pkgname-${pkgver}
  patch -Np0 -i ../gcc8.diff
  patch -Np1 -i ../gcc12.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 --enable-vmwarectrl-client 
  make
}

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=('90D027AEAF33CBABC140735BC1F5D3CDF5176580') #  Thomas Hellstrom (VMware) <thellstrom@vmware.com>

sha256sums=(47971924659e51666a757269ad941a059ef5afe7a47b5101c174a6022ac4066c # xf86-video-vmware-13.3.0.tar.bz2
	a2d40cc25bdf4c05c16fd92b71f58284f7f5a8851dec3aeb7c04e597e93a3794 # xf86-video-vmware-13.3.0.tar.bz2.sig
	76ac76c213a3a27e757d62d59980ddd65b34ac02bd0e4efb00833fc69c01793e # gcc8.diff
	b724003615ef95b62b7477324e52c92610535b78654eab526aeb93cda99d5aa3) # gcc12.1.diff


