# Template file for 'nerd-fonts'
pkgname=nerd-fonts
version=2.1.0
revision=3
depends="font-util xbps-triggers nerd-fonts-ttf nerd-fonts-otf"
short_desc="Iconic font aggregator, collection and patcher"
maintainer="cinerea0 <cinerea0@protonmail.com>"
license="MIT"
homepage="https://nerdfonts.com"
distfiles="https://github.com/ryanoasis/nerd-fonts/archive/v${version}.tar.gz"
checksum="a084ca91a174b547bab4523507824c76aa91ebcf38f9256a4ffd181813f87bd8"

do_install() {
	vmkdir usr/share/fonts/NerdFonts/otf
	vmkdir usr/share/fonts/NerdFonts/ttf
	vmkdir usr/lib/NerdFonts

	# get all patched fonts
	find patched-fonts -name '*.otf' -exec install -Dm644 '{}' ${DESTDIR}/usr/share/fonts/NerdFonts/otf \;
	find patched-fonts -name '*.ttf' -exec install -Dm644 '{}' ${DESTDIR}/usr/share/fonts/NerdFonts/ttf \;

	# remove windows-compatible fonts
	find ${DESTDIR}/usr/share/fonts/NerdFonts -name '*Windows Compatible.*tf' -delete

	# install patching scripts
	for sh in bin/scripts/lib/i_*.sh; do
		vinstall $sh 744 usr/lib/NerdFonts
	done

	vlicense LICENSE
}

nerd-fonts-otf_package() {
	short_desc="Iconic font aggregator, collection and patcher - otf fonts"
	font_dirs="usr/share/fonts/NerdFonts/otf"
	depends="font-util xbps-triggers"
	pkg_install() {
		vmove usr/share/fonts/NerdFonts/otf
	}
}

nerd-fonts-ttf_package() {
	short_desc="Iconic font aggregator, collection and patcher - ttf fonts"
	font_dirs="usr/share/fonts/NerdFonts/ttf"
	depends="font-util xbps-triggers"
	pkg_install() {
		vmove usr/share/fonts/NerdFonts/ttf
	}
}
