# Template file for 'wpa_supplicant'
pkgname=wpa_supplicant
version=1.1
revision=1
build_wrksrc=$pkgname
short_desc="WPA/WPA2/IEEE 802.1X Supplicant"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-2"
homepage="http://hostap.epitest.fi"
distfiles="$homepage/releases/$pkgname-$version.tar.gz"
checksum=a54dbe5cfd47b724d7433366d536f76bbc31efea2df866a8f2f87c86a48b9e02
long_desc="
 $pkgname is a WPA Supplicant for Linux, BSD, Mac OS X, and Windows with
 support for WPA and WPA2 (IEEE 802.11i / RSN). It is suitable for both
 desktop/laptop computers and embedded systems. Supplicant is the IEEE
 802.1X/WPA component that is used in the client stations. It implements
 key negotiation with a WPA Authenticator and it controls the roaming and
 IEEE 802.11 authentication/association of the wlan driver.

 $pkgname is designed to be a daemon program that runs in the background
 and acts as the backend component controlling the wireless connection.
 $pkgname supports separate frontend programs and a text-based frontend
 (wpa_cli) and a GUI (wpa_gui) are included with $pkgname."

makedepends="pkg-config libnl3-devel openssl-devel dbus-devel readline-devel"
conf_files="/etc/${pkgname}.conf"

do_build() {
	sed -i 's|/usr/local|$(PREFIX)|g' Makefile
	cp -f ${FILESDIR}/config .config
	make PREFIX=/usr ${makejobs}
}

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

	vinstall ${FILESDIR}/${pkgname}.tmpfiles.d \
		644 usr/lib/tmpfiles.d ${pkgname}.conf
	vinstall ${FILESDIR}/${pkgname}.conf 644 etc/$pkgname

	vinstall wpa_supplicant.conf 644 usr/share/examples/${pkgname}
	for d in 5 8; do
		install -d ${DESTDIR}/usr/share/man/man${d}
	done
	install -m644 doc/docbook/*.5 ${DESTDIR}/usr/share/man/man5
	install -m644 doc/docbook/*.8 ${DESTDIR}/usr/share/man/man8
	install -d ${DESTDIR}/usr/share/dbus-1/system-services
	install -m644 dbus/*.service \
		${DESTDIR}/usr/share/dbus-1/system-services/
	vinstall dbus/dbus-${pkgname}.conf 644 \
		etc/dbus-1/system.d ${pkgname}.conf

	vmkdir usr/lib/systemd/system
	install -m644 systemd/*.service ${DESTDIR}/usr/lib/systemd/system
}
