# nouveau-drivers - the free NVIDIA driver. The alternative to nvidia-drivers.
#
# Arctic keeps a whole repo of these so that every nonfree package has a free
# counterpart you can install instead, and the installer offers the choice.
name=nouveau-drivers
version=1.0.18
release=1
desc="Free NVIDIA graphics driver (nouveau), replaces nvidia-drivers"
url="https://nouveau.freedesktop.org/"
license="MIT"
depend="glibc mesa libdrm"
makedepend="clang lld pkgconf"
provides="nvidia-alternative"
conflicts="nvidia-drivers"
source="https://x.org/pub/individual/driver/xf86-video-nouveau-$version.tar.xz"
sha256="SKIP"

build() {
	cd "xf86-video-nouveau-$version"
	./configure --prefix=/usr
	make -j"$JOBS"
}

package() {
	cd "xf86-video-nouveau-$version"
	make DESTDIR="$pkgdir" install
	# On Turing and later, nouveau needs the GSP firmware to reach full clocks.
	mkdir -p "$(dirname $pkgdir/etc/modprobe.d/nouveau.conf)"
cat >"$pkgdir/etc/modprobe.d/nouveau.conf" <<-'CONF'
		# Arctic Linux nouveau defaults
		options nouveau config=NvGspRm=1
		options nouveau modeset=1
CONF
chmod 644 "$pkgdir/etc/modprobe.d/nouveau.conf"
}
