cd "$SRCDIR"/hostapd

abinfo "Building hostapd ..."
export CFLAGS="${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $(pkg-config --cflags libnl-3.0)"
make

abinfo "Installing hostapd executables ..."
install -Dvm755 hostapd hostapd_cli \
    -t "$PKGDIR"/usr/bin/

abinfo "Installing configuration directory ..."
install -dv "$PKGDIR"/etc/hostapd

abinfo "Installing documentation and examples ..."
install -dv "$PKGDIR"/usr/share/doc/hostapd
install -vm644 -t "$PKGDIR"/usr/share/doc/hostapd \
    hostapd.{accept,conf,deny,eap_user,radius_clients,sim_db,vlan,wpa_psk} \
    wired.conf hlr_auc_gw.milenage_db

abinfo "Installing man pages ..."
install -Dvm644 hostapd.8 \
    "$PKGDIR/usr/share/man/man8/hostapd.8"
install -Dvm644 hostapd_cli.1 \
    "$PKGDIR/usr/share/man/man1/hostapd_cli.1"
