NAME="wpa-supplicant"
DESC="Wi-Fi Protected Access (WPA) client and IEEE 802.1X supplicant"
VERSION="2.10"
FILES=(
  "https://w1.fi/releases/wpa_supplicant-$VERSION.tar.gz"
  "config"
)
HASHES=(
  "d26797fcb002898d4ee989179346e1cc"
  "60817c54ef2508a3038eccb20ea862554ef3c55d878ca4bd08ee17a86cf17ffd"
)
DEPENDS=("libnl")

PACKAGE() {
  tar xf wpa_supplicant-$VERSION.tar.gz
  cd wpa_supplicant-$VERSION

  cp -v "$ROOTDIR/config" wpa_supplicant/.config
  cd wpa_supplicant && make BINDIR=/usr/sbin LIBDIR=/usr/lib
  mkdir -pv $ROOTDIR/usr/sbin
  mkdir -pv $ROOTDIR/usr/share/man/man5
  mkdir -pv $ROOTDIR/usr/share/man/man8
  mkdir -pv $ROOTDIR/usr/share/dbus-1/system-services

  install -v -m755 wpa_{cli,passphrase,supplicant} $ROOTDIR/usr/sbin/ 
  install -v -m644 doc/docbook/wpa_supplicant.conf.5 \
    $ROOTDIR/usr/share/man/man5/
  install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 \
    $ROOTDIR/usr/share/man/man8/

  install -v -m644 dbus/fi.w1.wpa_supplicant1.service \
    $ROOTDIR/usr/share/dbus-1/system-services/ 
  install -v -d -m755 $ROOTDIR/etc/dbus-1/system.d
  install -v -m644 dbus/dbus-wpa_supplicant.conf \
    $ROOTDIR/etc/dbus-1/system.d/wpa_supplicant.conf
  
  cd ../.. && rm -rf wpa_supplicant-$VERSION
}
