# Template file for 'dmenu'
pkgname=dmenu
version=4.6
revision=1
makedepends="libXinerama-devel libXft-devel freetype-devel"
short_desc="A generic menu for X"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="MIT"
homepage="http://tools.suckless.org/dmenu/"
distfiles="http://dl.suckless.org/tools/${pkgname}-${version}.tar.gz"
checksum=4a7a24008a621c3cd656155ad91ab8136db8f0d3b9ec56dafeec518cabda96b3

build_options="fuzzymatch"
desc_option_fuzzymatch="Enable Fuzzymatch support"

pre_build() {
	local srcdir="${XBPS_SRCDISTDIR}/${pkgname}-${version}/"
	if [ "$build_option_fuzzymatch" ]; then
		msg_normal "Applying fuzzymatch patches"
		patch -p1 < "${FILESDIR}/fuzzymatch.patch"
	fi
}

do_build() {
	cp ${FILESDIR}/config.h config.h
	sed -i -e "s|^FREETYPEINC|#FREETYPEINC|g" \
		-e "s|^X11INC|#X11INC|g" \
		-e "s|^X11LIB|#X11LIB|g" config.mk

	x11inc=$XBPS_CROSS_BASE/usr/include/X11
	x11lib=$XBPS_CROSS_BASE/usr/lib
	freetypeinc=$XBPS_CROSS_BASE/usr/include/freetype2
	make CC="$CC" ${makejobs} X11INC=$x11inc X11LIB=$x11lib FREETYPEINC=$freetypeinc
}

do_install() {
	make PREFIX=/usr DESTDIR=${DESTDIR} install
	vlicense LICENSE
}
