# Template file for 'rtl8812au-dkms'

pkgname=rtl8812au-dkms
version=20170910
revision=1
short_desc="Realtek 8812AU/8821AU USB WiFi driver (DKMS)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="LGPL-2.1"
homepage="http://www.dlink.com"

triggers="dkms"
dkms_modules="rtl8812au 4.3.14"
hostmakedepends="git"
depends="dkms"
noarch=yes

do_fetch() {
	git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux ${pkgname}-${version}
	cd ${pkgname}-${version}
	git reset --hard 0292aa694
}
do_install() {
	local modname=rtl8812au
	local modver=4.3.14
	local dest=/usr/src/${modname}-${modver}

	vmkdir ${dest}
	cp -r dkms.conf Kconfig Makefile.dkms Makefile platform core hal include os_dep ${DESTDIR}/${dest}
	cp Makefile ${DESTDIR}/${dest}/Makefile
	sed "s/#MODULE_VERSION#/${modver}/" dkms.conf > ${DESTDIR}/${dest}/dkms.conf

	# modules-load.d(5) file.
	vmkdir usr/lib/modules-load.d
	echo "rtl8812au" > ${DESTDIR}/usr/lib/modules-load.d/${pkgname}.conf
	chmod 644 ${DESTDIR}/usr/lib/modules-load.d/${pkgname}.conf
}
