Makefile 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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_VERSION:=2016-06-15
  9. PKG_RELEASE:=1
  10. PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  13. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_SOURCE_VERSION:=$(PKG_REV)
  15. PKG_SOURCE_PROTO:=git
  16. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  17. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  18. PKG_LICENSE:=BSD-3-Clause
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
  22. CONFIG_PACKAGE_kmod-ath9k \
  23. CONFIG_PACKAGE_kmod-cfg80211 \
  24. CONFIG_PACKAGE_hostapd \
  25. CONFIG_PACKAGE_hostapd-mini \
  26. CONFIG_PACKAGE_kmod-hostap \
  27. CONFIG_WPA_RFKILL_SUPPORT \
  28. CONFIG_DRIVER_WEXT_SUPPORT \
  29. CONFIG_DRIVER_11N_SUPPORT
  30. LOCAL_TYPE=$(strip \
  31. $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
  32. $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
  33. hostapd \
  34. )))
  35. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  36. CONFIG_VARIANT:=$(LOCAL_VARIANT)
  37. ifeq ($(LOCAL_VARIANT),mesh)
  38. CONFIG_VARIANT:=full
  39. endif
  40. ifeq ($(LOCAL_TYPE),supplicant)
  41. ifeq ($(LOCAL_VARIANT),full)
  42. PKG_CONFIG_DEPENDS += \
  43. CONFIG_WPA_SUPPLICANT_INTERNAL \
  44. CONFIG_WPA_SUPPLICANT_OPENSSL
  45. endif
  46. endif
  47. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  48. include $(INCLUDE_DIR)/package.mk
  49. STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
  50. ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
  51. HOSTAPD_IEEE80211N:=y
  52. endif
  53. DRIVER_MAKEOPTS= \
  54. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  55. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  56. CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  57. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  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 @(!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/Description
  166. WPA Supplicant
  167. endef
  168. define Package/wpa-supplicant/config
  169. source "$(SOURCE)/Config.in"
  170. endef
  171. define Package/wpa-supplicant-p2p
  172. $(Package/wpa-supplicant)
  173. TITLE:=WPA Supplicant (with Wi-Fi P2P support)
  174. DEPENDS:=$(DRV_DEPENDS)
  175. CONFLICTS:=wpad wpad-mini wpad-mesh
  176. VARIANT:=supplicant-p2p
  177. endef
  178. define Package/wpa-supplicant-p2p/Description
  179. WPA Supplicant (with Wi-Fi P2P support)
  180. endef
  181. define Package/wpa-supplicant-mesh
  182. $(Package/wpa-supplicant)
  183. TITLE:=WPA Supplicant (with 802.11s and SAE)
  184. DEPENDS:=$(DRV_DEPENDS) @(!TARGET_uml||BROKEN)
  185. CONFLICTS:=wpad wpad-mesh wpad-mesh
  186. VARIANT:=supplicant-mesh
  187. endef
  188. define Package/wpa-supplicant-mesh/Description
  189. WPA Supplicant (variant with 802.11s and SAE support)
  190. endef
  191. define Package/wpa-supplicant-mini
  192. $(Package/wpa-supplicant)
  193. TITLE:=WPA Supplicant (minimal version)
  194. DEPENDS:=$(DRV_DEPENDS)
  195. CONFLICTS:=wpad wpad-mini wpad-mesh
  196. VARIANT:=supplicant-mini
  197. endef
  198. define Package/wpa-supplicant-mini/Description
  199. WPA Supplicant (minimal version)
  200. endef
  201. define Package/wpa-cli
  202. SECTION:=net
  203. CATEGORY:=Network
  204. DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad||PACKAGE_wpad-mesh
  205. TITLE:=WPA Supplicant command line interface
  206. endef
  207. define Package/wpa-cli/Description
  208. WPA Supplicant control utility
  209. endef
  210. define Package/hostapd-common
  211. TITLE:=hostapd/wpa_supplicant common support files
  212. SECTION:=net
  213. CATEGORY:=Network
  214. endef
  215. define Package/hostapd-common-old
  216. TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  217. SECTION:=net
  218. CATEGORY:=Network
  219. endef
  220. define Package/eapol-test
  221. TITLE:=802.1x authentication test utility
  222. SECTION:=net
  223. CATEGORY:=Network
  224. VARIANT:=supplicant-full
  225. DEPENDS:=$(DRV_DEPENDS)
  226. endef
  227. ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
  228. define Build/Configure/rebuild
  229. $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
  230. rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
  231. rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
  232. rm -f $(PKG_BUILD_DIR)/.config_*
  233. touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
  234. endef
  235. endif
  236. define Build/Configure
  237. $(Build/Configure/rebuild)
  238. $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  239. $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  240. )
  241. $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  242. endef
  243. TARGET_CPPFLAGS := \
  244. -I$(STAGING_DIR)/usr/include/libnl-tiny \
  245. -I$(PKG_BUILD_DIR)/src/crypto \
  246. $(TARGET_CPPFLAGS) \
  247. -DCONFIG_LIBNL20 \
  248. -D_GNU_SOURCE \
  249. $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
  250. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  251. TARGET_LDFLAGS += -Wl,--gc-sections
  252. ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
  253. TARGET_LDFLAGS += -lubox -lubus
  254. endif
  255. ifdef CONFIG_PACKAGE_kmod-cfg80211
  256. TARGET_LDFLAGS += -lm -lnl-tiny
  257. endif
  258. define Build/RunMake
  259. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  260. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
  261. $(TARGET_CONFIGURE_OPTS) \
  262. $(DRIVER_MAKEOPTS) \
  263. LIBS="$(TARGET_LDFLAGS)" \
  264. LIBS_c="$(TARGET_LDFLAGS_C)" \
  265. BCHECK= \
  266. $(2)
  267. endef
  268. define Build/Compile/wpad
  269. echo ` \
  270. $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
  271. $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
  272. sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
  273. ` > $(PKG_BUILD_DIR)/.cflags
  274. +$(call Build/RunMake,hostapd, \
  275. CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
  276. MULTICALL=1 \
  277. hostapd_cli hostapd_multi.a \
  278. )
  279. +$(call Build/RunMake,wpa_supplicant, \
  280. CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
  281. MULTICALL=1 \
  282. wpa_cli wpa_supplicant_multi.a \
  283. )
  284. $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
  285. $(TARGET_CFLAGS) \
  286. ./files/multicall.c \
  287. $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
  288. $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
  289. $(TARGET_LDFLAGS)
  290. endef
  291. define Build/Compile/hostapd
  292. $(call Build/RunMake,hostapd, \
  293. hostapd hostapd_cli \
  294. )
  295. endef
  296. define Build/Compile/supplicant
  297. $(call Build/RunMake,wpa_supplicant, \
  298. wpa_cli wpa_supplicant \
  299. )
  300. endef
  301. define Build/Compile/supplicant-full
  302. $(call Build/RunMake,wpa_supplicant, \
  303. eapol_test \
  304. )
  305. endef
  306. define Build/Compile
  307. $(Build/Compile/$(LOCAL_TYPE))
  308. $(Build/Compile/$(BUILD_VARIANT))
  309. endef
  310. define Install/hostapd
  311. $(INSTALL_DIR) $(1)/usr/sbin
  312. endef
  313. define Install/supplicant
  314. $(INSTALL_DIR) $(1)/usr/sbin
  315. endef
  316. define Package/hostapd-common/install
  317. $(INSTALL_DIR) $(1)/lib/netifd
  318. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  319. endef
  320. define Package/hostapd-common-old/install
  321. $(INSTALL_DIR) $(1)/lib/wifi
  322. $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  323. $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  324. endef
  325. define Package/hostapd/install
  326. $(call Install/hostapd,$(1))
  327. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  328. endef
  329. Package/hostapd-mini/install = $(Package/hostapd/install)
  330. ifneq ($(LOCAL_TYPE),supplicant)
  331. define Package/hostapd-utils/install
  332. $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
  333. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
  334. $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
  335. endef
  336. endif
  337. define Package/wpad/install
  338. $(call Install/hostapd,$(1))
  339. $(call Install/supplicant,$(1))
  340. $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
  341. $(LN) wpad $(1)/usr/sbin/hostapd
  342. $(LN) wpad $(1)/usr/sbin/wpa_supplicant
  343. endef
  344. Package/wpad-mini/install = $(Package/wpad/install)
  345. Package/wpad-mesh/install = $(Package/wpad/install)
  346. define Package/wpa-supplicant/install
  347. $(call Install/supplicant,$(1))
  348. $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
  349. endef
  350. Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
  351. Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
  352. ifneq ($(LOCAL_TYPE),hostapd)
  353. define Package/wpa-cli/install
  354. $(INSTALL_DIR) $(1)/usr/sbin
  355. $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
  356. endef
  357. endif
  358. ifeq ($(BUILD_VARIANT),supplicant-full)
  359. define Package/eapol-test/install
  360. $(INSTALL_DIR) $(1)/usr/sbin
  361. $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
  362. endef
  363. endif
  364. $(eval $(call BuildPackage,hostapd))
  365. $(eval $(call BuildPackage,hostapd-mini))
  366. $(eval $(call BuildPackage,wpad))
  367. $(eval $(call BuildPackage,wpad-mesh))
  368. $(eval $(call BuildPackage,wpad-mini))
  369. $(eval $(call BuildPackage,wpa-supplicant))
  370. $(eval $(call BuildPackage,wpa-supplicant-mesh))
  371. $(eval $(call BuildPackage,wpa-supplicant-mini))
  372. $(eval $(call BuildPackage,wpa-supplicant-p2p))
  373. $(eval $(call BuildPackage,wpa-cli))
  374. $(eval $(call BuildPackage,hostapd-utils))
  375. $(eval $(call BuildPackage,hostapd-common))
  376. $(eval $(call BuildPackage,hostapd-common-old))
  377. $(eval $(call BuildPackage,eapol-test))