1
0

Makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. # Copyright (C) 2006-2014 OpenWrt.org
  2. #
  3. # This is free software, licensed under the GNU General Public License v2.
  4. # See /LICENSE for more information.
  5. #
  6. include $(TOPDIR)/rules.mk
  7. PKG_NAME:=hostapd
  8. PKG_RELEASE:=7
  9. PKG_SOURCE_URL:=http://w1.fi/hostap.git
  10. PKG_SOURCE_PROTO:=git
  11. PKG_SOURCE_DATE:=2016-12-19
  12. PKG_SOURCE_VERSION:=ad02e79d12fd70ed6bd5fbaf64001a2851e5bb7b
  13. PKG_MIRROR_HASH:=7a0983f004b156d46911765c113754a4c00f56fb889430620bbd061b3b1fcf33
  14. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  15. PKG_LICENSE:=BSD-3-Clause
  16. PKG_BUILD_PARALLEL:=1
  17. PKG_CONFIG_DEPENDS:= \
  18. CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
  19. CONFIG_PACKAGE_kmod-ath9k \
  20. CONFIG_PACKAGE_kmod-cfg80211 \
  21. CONFIG_PACKAGE_hostapd \
  22. CONFIG_PACKAGE_hostapd-mini \
  23. CONFIG_WPA_RFKILL_SUPPORT \
  24. CONFIG_DRIVER_WEXT_SUPPORT \
  25. CONFIG_DRIVER_11N_SUPPORT \
  26. CONFIG_DRIVER_11AC_SUPPORT
  27. LOCAL_TYPE=$(strip \
  28. $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
  29. $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
  30. hostapd \
  31. )))
  32. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  33. CONFIG_VARIANT:=$(LOCAL_VARIANT)
  34. ifeq ($(LOCAL_VARIANT),mesh)
  35. CONFIG_VARIANT:=full
  36. endif
  37. ifneq ($(LOCAL_TYPE),hostapd)
  38. ifeq ($(LOCAL_VARIANT),full)
  39. PKG_CONFIG_DEPENDS += \
  40. CONFIG_WPA_SUPPLICANT_INTERNAL \
  41. CONFIG_WPA_SUPPLICANT_OPENSSL
  42. endif
  43. endif
  44. PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  45. include $(INCLUDE_DIR)/package.mk
  46. STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
  47. ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
  48. HOSTAPD_IEEE80211N:=y
  49. endif
  50. ifneq ($(CONFIG_DRIVER_11AC_SUPPORT),)
  51. HOSTAPD_IEEE80211AC:=y
  52. endif
  53. DRIVER_MAKEOPTS= \
  54. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  55. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  56. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  57. CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
  58. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  59. ifeq ($(LOCAL_VARIANT),full)
  60. DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT)
  61. endif
  62. ifneq ($(LOCAL_TYPE),hostapd)
  63. ifdef CONFIG_WPA_SUPPLICANT_OPENSSL
  64. ifeq ($(LOCAL_VARIANT),full)
  65. DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  66. TARGET_LDFLAGS += -lcrypto -lssl
  67. endif
  68. endif
  69. ifeq ($(LOCAL_VARIANT),mesh)
  70. DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  71. TARGET_LDFLAGS += -lcrypto -lssl
  72. endif
  73. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  74. TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
  75. endif
  76. ifdef CONFIG_WPA_RFKILL_SUPPORT
  77. DRIVER_MAKEOPTS += NEED_RFKILL=y
  78. endif
  79. DRIVER_MAKEOPTS += \
  80. CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
  81. endif
  82. ifdef CONFIG_USE_GLIBC
  83. TARGET_LDFLAGS += -lrt
  84. TARGET_LDFLAGS_C += -lrt
  85. endif
  86. DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny
  87. define Package/hostapd/Default
  88. SECTION:=net
  89. CATEGORY:=Network
  90. TITLE:=IEEE 802.1x Authenticator
  91. URL:=http://hostap.epitest.fi/
  92. DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
  93. endef
  94. define Package/hostapd
  95. $(call Package/hostapd/Default)
  96. TITLE+= (full)
  97. VARIANT:=full
  98. CONFLICTS:=wpad wpad-mini wpad-mesh
  99. endef
  100. define Package/hostapd/description
  101. This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
  102. Authenticator.
  103. endef
  104. define Package/hostapd-mini
  105. $(call Package/hostapd/Default)
  106. TITLE+= (WPA-PSK only)
  107. VARIANT:=mini
  108. CONFLICTS:=wpad wpad-mini wpad-mesh
  109. endef
  110. define Package/hostapd-mini/description
  111. This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
  112. endef
  113. define Package/hostapd-utils
  114. $(call Package/hostapd/Default)
  115. TITLE+= (utils)
  116. DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mesh||PACKAGE_wpad-mini
  117. endef
  118. define Package/hostapd-utils/description
  119. This package contains a command line utility to control the
  120. IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
  121. endef
  122. define Package/wpad/Default
  123. SECTION:=net
  124. CATEGORY:=Network
  125. TITLE:=IEEE 802.1x Authenticator/Supplicant
  126. DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
  127. URL:=http://hostap.epitest.fi/
  128. endef
  129. define Package/wpad
  130. $(call Package/wpad/Default)
  131. TITLE+= (full)
  132. DEPENDS+=+WPA_SUPPLICANT_OPENSSL:libopenssl
  133. VARIANT:=wpad-full
  134. endef
  135. define Package/wpad/description
  136. This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
  137. Authenticator and Supplicant
  138. endef
  139. define Package/wpad-mini
  140. $(call Package/wpad/Default)
  141. TITLE+= (WPA-PSK only)
  142. VARIANT:=wpad-mini
  143. endef
  144. define Package/wpad-mini/description
  145. This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
  146. endef
  147. define Package/wpad-mesh
  148. $(call Package/wpad/Default)
  149. TITLE+= (with 802.11s mesh and SAE support)
  150. DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN)
  151. VARIANT:=wpad-mesh
  152. endef
  153. define Package/wpad-mesh/description
  154. This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (with 802.11s mesh and SAE support).
  155. endef
  156. define Package/wpa-supplicant
  157. SECTION:=net
  158. CATEGORY:=Network
  159. TITLE:=WPA Supplicant
  160. URL:=http://hostap.epitest.fi/wpa_supplicant/
  161. DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
  162. CONFLICTS:=wpad wpad-mini wpad-mesh
  163. VARIANT:=supplicant-full
  164. endef
  165. define Package/wpa-supplicant/config
  166. source "$(SOURCE)/Config.in"
  167. endef
  168. define Package/wpa-supplicant-p2p
  169. $(Package/wpa-supplicant)
  170. TITLE:=WPA Supplicant (with Wi-Fi P2P support)
  171. DEPENDS:=$(DRV_DEPENDS) @PACKAGE_kmod-cfg80211
  172. CONFLICTS:=wpad wpad-mini wpad-mesh
  173. VARIANT:=supplicant-p2p
  174. endef
  175. define Package/wpa-supplicant-mesh
  176. $(Package/wpa-supplicant)
  177. TITLE:=WPA Supplicant (with 802.11s and SAE)
  178. DEPENDS:=$(DRV_DEPENDS) +PACKAGE_wpa-supplicant-mesh:libopenssl @PACKAGE_kmod-cfg80211 @(!TARGET_uml||BROKEN)
  179. CONFLICTS:=wpad wpad-mesh wpad-mesh
  180. VARIANT:=supplicant-mesh
  181. endef
  182. define Package/wpa-supplicant-mini
  183. $(Package/wpa-supplicant)
  184. TITLE:=WPA Supplicant (minimal version)
  185. DEPENDS:=$(DRV_DEPENDS)
  186. CONFLICTS:=wpad wpad-mini wpad-mesh
  187. VARIANT:=supplicant-mini
  188. endef
  189. define Package/wpa-cli
  190. SECTION:=net
  191. CATEGORY:=Network
  192. DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad||PACKAGE_wpad-mesh
  193. TITLE:=WPA Supplicant command line control utility
  194. endef
  195. define Package/hostapd-common
  196. TITLE:=hostapd/wpa_supplicant common support files
  197. SECTION:=net
  198. CATEGORY:=Network
  199. endef
  200. define Package/eapol-test
  201. TITLE:=802.1x authentication test utility
  202. SECTION:=net
  203. CATEGORY:=Network
  204. VARIANT:=supplicant-full
  205. DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
  206. endef
  207. ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
  208. define Build/Configure/rebuild
  209. $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
  210. rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
  211. rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
  212. rm -f $(PKG_BUILD_DIR)/.config_*
  213. touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
  214. endef
  215. endif
  216. define Build/Configure
  217. $(Build/Configure/rebuild)
  218. $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  219. $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  220. )
  221. $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  222. endef
  223. TARGET_CPPFLAGS := \
  224. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  225. -I$(PKG_BUILD_DIR)/src/crypto \
  226. $(TARGET_CPPFLAGS) \
  227. -DCONFIG_LIBNL20 \
  228. -D_GNU_SOURCE \
  229. $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
  230. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  231. TARGET_LDFLAGS += -Wl,--gc-sections
  232. ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
  233. TARGET_LDFLAGS += -lubox -lubus
  234. endif
  235. ifdef CONFIG_PACKAGE_kmod-cfg80211
  236. TARGET_LDFLAGS += -lm -lnl-tiny
  237. endif
  238. define Build/RunMake
  239. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  240. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
  241. $(TARGET_CONFIGURE_OPTS) \
  242. $(DRIVER_MAKEOPTS) \
  243. LIBS="$(TARGET_LDFLAGS)" \
  244. LIBS_c="$(TARGET_LDFLAGS_C)" \
  245. BCHECK= \
  246. $(2)
  247. endef
  248. define Build/Compile/wpad
  249. echo ` \
  250. $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
  251. $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
  252. sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
  253. ` > $(PKG_BUILD_DIR)/.cflags
  254. +$(call Build/RunMake,hostapd, \
  255. CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
  256. MULTICALL=1 \
  257. hostapd_cli hostapd_multi.a \
  258. )
  259. +$(call Build/RunMake,wpa_supplicant, \
  260. CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
  261. MULTICALL=1 \
  262. wpa_cli wpa_supplicant_multi.a \
  263. )
  264. $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
  265. $(TARGET_CFLAGS) \
  266. ./files/multicall.c \
  267. $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
  268. $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
  269. $(TARGET_LDFLAGS)
  270. endef
  271. define Build/Compile/hostapd
  272. +$(call Build/RunMake,hostapd, \
  273. hostapd hostapd_cli \
  274. )
  275. endef
  276. define Build/Compile/supplicant
  277. +$(call Build/RunMake,wpa_supplicant, \
  278. wpa_cli wpa_supplicant \
  279. )
  280. endef
  281. define Build/Compile/supplicant-full
  282. +$(call Build/RunMake,wpa_supplicant, \
  283. eapol_test \
  284. )
  285. endef
  286. define Build/Compile
  287. $(Build/Compile/$(LOCAL_TYPE))
  288. $(Build/Compile/$(BUILD_VARIANT))
  289. endef
  290. define Install/hostapd
  291. $(INSTALL_DIR) $(1)/usr/sbin
  292. endef
  293. define Install/supplicant
  294. $(INSTALL_DIR) $(1)/usr/sbin
  295. endef
  296. define Package/hostapd-common/install
  297. $(INSTALL_DIR) $(1)/lib/netifd
  298. $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
  299. endef
  300. define Package/hostapd/install
  301. $(call Install/hostapd,$(1))
  302. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  303. endef
  304. Package/hostapd-mini/install = $(Package/hostapd/install)
  305. ifneq ($(LOCAL_TYPE),supplicant)
  306. define Package/hostapd-utils/install
  307. $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
  308. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
  309. $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
  310. endef
  311. endif
  312. define Package/wpad/install
  313. $(call Install/hostapd,$(1))
  314. $(call Install/supplicant,$(1))
  315. $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
  316. $(LN) wpad $(1)/usr/sbin/hostapd
  317. $(LN) wpad $(1)/usr/sbin/wpa_supplicant
  318. endef
  319. Package/wpad-mini/install = $(Package/wpad/install)
  320. Package/wpad-mesh/install = $(Package/wpad/install)
  321. define Package/wpa-supplicant/install
  322. $(call Install/supplicant,$(1))
  323. $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
  324. endef
  325. Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
  326. Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
  327. Package/wpa-supplicant-mesh/install = $(Package/wpa-supplicant/install)
  328. ifneq ($(LOCAL_TYPE),hostapd)
  329. define Package/wpa-cli/install
  330. $(INSTALL_DIR) $(1)/usr/sbin
  331. $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
  332. endef
  333. endif
  334. ifeq ($(BUILD_VARIANT),supplicant-full)
  335. define Package/eapol-test/install
  336. $(INSTALL_DIR) $(1)/usr/sbin
  337. $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
  338. endef
  339. endif
  340. $(eval $(call BuildPackage,hostapd))
  341. $(eval $(call BuildPackage,hostapd-mini))
  342. $(eval $(call BuildPackage,wpad))
  343. $(eval $(call BuildPackage,wpad-mesh))
  344. $(eval $(call BuildPackage,wpad-mini))
  345. $(eval $(call BuildPackage,wpa-supplicant))
  346. $(eval $(call BuildPackage,wpa-supplicant-mesh))
  347. $(eval $(call BuildPackage,wpa-supplicant-mini))
  348. $(eval $(call BuildPackage,wpa-supplicant-p2p))
  349. $(eval $(call BuildPackage,wpa-cli))
  350. $(eval $(call BuildPackage,hostapd-utils))
  351. $(eval $(call BuildPackage,hostapd-common))
  352. $(eval $(call BuildPackage,eapol-test))