# Template file for 'dhcpcd-qt'
pkgname=dhcpcd-qt
version=0.7.8
revision=1
wrksrc="dhcpcd-ui-${version}"
build_style=gnu-configure
configure_args="--with-qt --without-dhcpcd-online --without-icons --with-notification"
hostmakedepends="pkg-config"
makedepends="qt5-devel"
depends="dhcpcd dhcpcd-icons desktop-file-utils"
short_desc="Qt system tray monitor for dhcpcd"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-2-Clause"
homepage="http://roy.marples.name/projects/dhcpcd-ui"
distfiles="http://roy.marples.name/downloads/dhcpcd/dhcpcd-ui-${version}.tar.xz"
checksum=4170a07b8bbba65b30f8da8a15a4d776cbf17d030b666516821d450f594a9d6c

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" qt5-devel qt5-host-tools"
fi

post_configure() {
	vsed -i src/dhcpcd-qt/Makefile \
		-e "s;^\(CC .*=\).*;\1 ${CC};" \
		-e "s;^\(CXX .*=\).*;\1 ${CXX};" \
		-e "s;g++ -;${CXX} -;" \
		-e "s;^\(CFLAGS.*=.*\);& ${CFLAGS};" \
		-e "s;^\(CXXFLAGS.*=.*\);& ${CXXFLAGS};" \
		-e "s;^\(LFLAGS.*=.*\);& ${LDFLAGS};" \
		-e "s;^\(LINK .*=\).*;\1 ${CXX};" \
		-e "/STRIP/d" \
		-e 's|^LIBS.*|LIBS = $(SUBLIBS) -L../libdhcpcd ../libdhcpcd/libdhcpcd.a -L"${XBPS_CROSS_BASE}/usr/lib" -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread|'
}

pre_install() {
	head -n 25 src/dhcpcd-qt/dhcpcd-about.cpp > LICENSE
}

do_install() {
	make INSTALL_ROOT=${DESTDIR} install
	vlicense LICENSE
}
