include $(TOPDIR)/rules.mk

PKG_NAME:=wifi-services
PKG_VERSION:=0.0.5

LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=2a40bda6a6bb55af82de4eda37e636ba44c0f198
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/wifi-services.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=PROPRIETARY GENEXIS
PKG_LICENSE_FILES:=LICENSE

PKG_CONFIG_DEPENDS := \
		     CONFIG_PACKAGE_libwifiutils \
		     CONFIG_PACKAGE_libwifi

PKG_BUILD_DEPENDS := libwifi

include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk

MAKE_FLAGS += \
	CFLAGS="$(TARGET_CFLAGS) -Wall"

MAKE_PATH:=sta-ratings

define Package/wifi-services
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:= Wi-Fi extra services
  DEPENDS+=+libeasy +libwifiutils +libwifi
endef

define Package/wifi-services/description
  Provides extra Wi-Fi services
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/sta-ratings/libwifi-sta-ratings.so $(1)/usr/lib/
endef

define Package/wifi-services/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_BUILD_DIR)/sta-ratings/libwifi-sta-ratings.so $(1)/usr/lib/
	$(BBFDM_INSTALL_MS_PLUGIN) ./files/QoERating_Extension.json $(1) wifidmd
endef

$(eval $(call BuildPackage,wifi-services))
