3130e86099836145a731de02f89c31ef72c3a34e
[openwrt/openwrt.git] / package / network / utils / iwinfo / Makefile
1 #
2 # Copyright (C) 2010-2016 Jo-Philipp Wich <jo@mein.io>
3 #
4 # This is free software, licensed under the GPL 2 license.
5 #
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=libiwinfo
10 PKG_VERSION:=2016-07-04
11 PKG_RELEASE=$(PKG_SOURCE_VERSION)
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(LEDE_GIT)/project/iwinfo.git
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE_VERSION:=96d322d5941c57be58f8e8d5c6e2b28e90ed3598
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
19 PKG_LICENSE:=GPL-2.0
20
21 PKG_FLAGS := nonshared
22
23 PKG_CONFIG_DEPENDS := \
24 CONFIG_PACKAGE_kmod-brcm-wl \
25 CONFIG_PACKAGE_kmod-brcm-wl-mini \
26 CONFIG_PACKAGE_kmod-brcm-wl-mimo \
27 CONFIG_PACKAGE_kmod-madwifi \
28 CONFIG_PACKAGE_kmod-cfg80211
29
30 include $(INCLUDE_DIR)/package.mk
31
32
33 define Package/libiwinfo
34 SECTION:=libs
35 CATEGORY:=Libraries
36 TITLE:=Generalized Wireless Information Library (iwinfo)
37 DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci
38 ABI_VERSION:=$(PKG_RELEASE)
39 endef
40
41 define Package/libiwinfo/description
42 Wireless information library with consistent interface for proprietary Broadcom,
43 madwifi, nl80211 and wext driver interfaces.
44 endef
45
46
47 define Package/libiwinfo-lua
48 SUBMENU:=Lua
49 SECTION:=lang
50 CATEGORY:=Languages
51 TITLE:=libiwinfo Lua binding
52 DEPENDS:=+libiwinfo +liblua
53 endef
54
55 define Package/libiwinfo-lua/description
56 This is the Lua binding for the iwinfo library. It provides access to all enabled
57 backends.
58 endef
59
60
61 define Package/iwinfo
62 SECTION:=utils
63 CATEGORY:=Utilities
64 TITLE:=Generalized Wireless Information utility
65 DEPENDS:=+libiwinfo
66 endef
67
68 define Package/iwinfo/description
69 Command line frontend for the wireless information library.
70 endef
71
72
73 define Build/Configure
74 endef
75
76 IWINFO_BACKENDS := \
77 $(if $(CONFIG_PACKAGE_kmod-brcm-wl),wl) \
78 $(if $(CONFIG_PACKAGE_kmod-brcm-wl-mini),wl) \
79 $(if $(CONFIG_PACKAGE_kmod-brcm-wl-mimo),wl) \
80 $(if $(CONFIG_PACKAGE_kmod-madwifi),madwifi) \
81 $(if $(CONFIG_PACKAGE_kmod-cfg80211),nl80211)
82
83 TARGET_CFLAGS += \
84 -I$(STAGING_DIR)/usr/include/libnl-tiny \
85 -I$(STAGING_DIR)/usr/include \
86 -D_GNU_SOURCE
87
88 MAKE_FLAGS += \
89 FPIC="$(FPIC)" \
90 CFLAGS="$(TARGET_CFLAGS)" \
91 LDFLAGS="$(TARGET_LDFLAGS)" \
92 BACKENDS="$(IWINFO_BACKENDS)"
93
94 define Build/InstallDev
95 $(INSTALL_DIR) $(1)/usr/include/iwinfo
96 $(CP) $(PKG_BUILD_DIR)/include/iwinfo.h $(1)/usr/include/
97 $(CP) $(PKG_BUILD_DIR)/include/iwinfo/* $(1)/usr/include/iwinfo/
98 $(INSTALL_DIR) $(1)/usr/lib
99 $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so $(1)/usr/lib/libiwinfo.so
100 $(INSTALL_DIR) $(1)/usr/lib/lua
101 $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
102 endef
103
104 define Package/libiwinfo/install
105 $(INSTALL_DIR) $(1)/usr/lib
106 $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so $(1)/usr/lib/libiwinfo.so
107 $(INSTALL_DIR) $(1)/usr/share/libiwinfo
108 $(INSTALL_DATA) $(PKG_BUILD_DIR)/hardware.txt $(1)/usr/share/libiwinfo/hardware.txt
109 endef
110
111 define Package/libiwinfo-lua/install
112 $(INSTALL_DIR) $(1)/usr/lib/lua
113 $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
114 endef
115
116 define Package/iwinfo/install
117 $(INSTALL_DIR) $(1)/usr/bin
118 $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo $(1)/usr/bin/iwinfo
119 endef
120
121 $(eval $(call BuildPackage,libiwinfo))
122 $(eval $(call BuildPackage,libiwinfo-lua))
123 $(eval $(call BuildPackage,iwinfo))