You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
13 KiB

  1. #
  2. # Copyright (C) 2015-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. #
  8. # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
  9. # Dude, this "boost" is really one of the most crude stuff I ported yet.
  10. #
  11. include $(TOPDIR)/rules.mk
  12. include $(INCLUDE_DIR)/nls.mk
  13. include $(INCLUDE_DIR)/target.mk
  14. PKG_NAME:=boost
  15. PKG_VERSION:=1.61.0
  16. PKG_SOURCE_VERSION=1_61_0
  17. PKG_RELEASE:=2
  18. PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.gz
  19. PKG_SOURCE_URL:=@SF/boost/$(PKG_NAME)/$(PKG_VERSION)
  20. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  21. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  22. PKG_MD5SUM:=874805ba2e2ee415b1877ef3297bf8ad
  23. PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
  24. PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
  25. PKG_BUILD_DEPENDS += boost/host
  26. PKG_BUILD_PARALLEL:=0
  27. PKG_USE_MIPS16:=0
  28. include $(INCLUDE_DIR)/package.mk
  29. include $(INCLUDE_DIR)/host-build.mk
  30. define Package/boost/Default
  31. SECTION:=libs
  32. CATEGORY:=Libraries
  33. TITLE:=Boost C++ source library
  34. URL:=http://www.boost.org
  35. DEPENDS:=+libstdcpp +libpthread +librt
  36. endef
  37. define Package/boost/description
  38. This package provides the Boost v1.61 libraries.
  39. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  40. This package provides the following run-time libraries:
  41. - atomic
  42. - chrono
  43. - container
  44. - context
  45. - coroutine
  46. - - coroutine2 (requires GCC v5 and up)
  47. - date_time
  48. - exception
  49. - filesystem
  50. - graph
  51. - - graph-parallel
  52. - iostreams
  53. - locale (requires kernel being compiled with full language support)
  54. - log
  55. - math
  56. - program_options
  57. - python
  58. - python3
  59. - random
  60. - regex
  61. - serialization
  62. - signals
  63. - system
  64. - thread
  65. - timer
  66. - wave
  67. There are many more header-only libraries supported by Boost.
  68. See more at http://www.boost.org/doc/libs/1_61_0/
  69. endef
  70. BOOST_LIBS =
  71. define Package/boost-libs
  72. $(call Package/boost/Default)
  73. TITLE+= (all libs)
  74. DEPENDS+= $(BOOST_DEPENDS)
  75. HIDDEN:=1
  76. endef
  77. define Package/boost-libs/description
  78. This meta package contains only dependencies to the other libraries from
  79. the boost libraries collection.
  80. endef
  81. # Create a meta-package of dependent libraries (for ALL)
  82. define Package/boost-libs/install
  83. true
  84. endef
  85. define Package/boost/install
  86. true
  87. endef
  88. define Package/boost
  89. $(call Package/boost/Default)
  90. TITLE+= packages
  91. DEPENDS:=+ALL:boost-libs +ALL:boost-test
  92. endef
  93. define Package/boost/config
  94. menu "Select Boost Options"
  95. depends on PACKAGE_boost
  96. comment "Boost compilation options."
  97. choice
  98. prompt "Compile Boost libraries."
  99. default boost-static-and-shared-libs
  100. help
  101. Choose which version to compile.
  102. -> Shared:
  103. - Only Shared libs will be compiled.
  104. -> Static:
  105. - Only Static libs will be compiled.
  106. -> Both:
  107. - Both Static and Shared libs will be compiled.
  108. config boost-shared-libs
  109. bool "Shared"
  110. config boost-static-libs
  111. bool "Static"
  112. config boost-static-and-shared-libs
  113. bool "Both"
  114. endchoice
  115. choice
  116. prompt "Selects Boost Runtime linkage."
  117. default boost-runtime-shared
  118. help
  119. Choose which C and C++ runtimes to use:
  120. -> Use Shared runtimes.
  121. -> Use Static runtimes.
  122. - Not available if Shared libs are to be built.
  123. -> Use both runtimes.
  124. - Not available if Shared libs are to be built.
  125. - Two separate versions of Boost are built, linking each to a different runtime.
  126. - This option requires "Use tagged names" option to be active.
  127. config boost-runtime-shared
  128. bool "Shared"
  129. config boost-runtime-static
  130. depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
  131. bool "Static"
  132. config boost-runtime-static-and-shared
  133. depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
  134. bool "Both"
  135. endchoice
  136. choice
  137. prompt "Select a Variant."
  138. default boost-variant-release
  139. help
  140. Chooses which boost variant should be selected:
  141. -> Release: Optimizes Boost for release.
  142. - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
  143. -> Debug:
  144. - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
  145. -> Profile:
  146. - Profiling: On; Debug Symbols: On.
  147. config boost-variant-release
  148. bool "Release"
  149. config boost-variant-debug
  150. bool "Debug"
  151. config boost-variant-profile
  152. bool "Profile"
  153. endchoice
  154. config boost-use-name-tags
  155. bool "Use tagged names."
  156. help
  157. Add name tags the lib files, to diferentiate each library version:
  158. "-mt" for multi-threading.
  159. "-d" for debugging.
  160. "-s" for runtime static link".
  161. Might break compatibility with libraries that expect boost libs with default names.
  162. default n
  163. config boost-single-thread
  164. depends on @boost-use-name-tags
  165. bool "Single thread Support."
  166. help
  167. Compile Boost libraries in single-thread mode.
  168. default n
  169. config boost-build-type-complete
  170. depends on @boost-use-name-tags
  171. bool "Complete Boost Build."
  172. help
  173. Builds both release and debug libs. It will take much longer to compile.
  174. default n
  175. endmenu
  176. menu "Select Boost libraries"
  177. depends on PACKAGE_boost
  178. comment "Libraries"
  179. config boost-libs-all
  180. bool "Include all Boost libraries."
  181. select PACKAGE_boost-libs
  182. config boost-test-pkg
  183. bool "Boost test package."
  184. select PACKAGE_boost-test
  185. config boost-coroutine2
  186. depends on @(GCC_VERSION_5 || GCC_VERSION_6)
  187. bool "Boost couroutine2 support."
  188. select PACKAGE_boost-coroutine
  189. default n
  190. config boost-graph-parallel
  191. bool "Boost parallel graph support."
  192. select PACKAGE_boost-graph
  193. default n
  194. $(foreach lib,$(BOOST_LIBS), \
  195. config PACKAGE_boost-$(lib)
  196. prompt "Boost $(lib) library."
  197. $(if $(findstring locale,$(lib)),depends on @BUILD_NLS,)
  198. )
  199. endmenu
  200. endef
  201. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  202. define Package/boost-test
  203. $(call Package/boost/Default)
  204. TITLE+= (test)
  205. HIDDEN:=1
  206. DEPENDS+=+boost-system +boost-timer
  207. endef
  208. define Build/Configure
  209. endef
  210. # 1: short name
  211. # 2: dependencies on other boost libraries (short name)
  212. # 3: dependencies on other packages
  213. define DefineBoostLibrary
  214. BOOST_DEPENDS+= +boost-$(1)
  215. BOOST_LIBS+= $(1)
  216. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  217. define Package/boost-$(1)
  218. $(call Package/boost/Default)
  219. TITLE+= ($(1))
  220. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  221. HIDDEN:=1
  222. endef
  223. define Package/boost-$(1)/description
  224. This package contains the Boost $(1) library.
  225. endef
  226. endef
  227. $(eval $(call DefineBoostLibrary,atomic,system,))
  228. $(eval $(call DefineBoostLibrary,chrono,system,))
  229. $(eval $(call DefineBoostLibrary,container,,))
  230. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  231. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  232. $(eval $(call DefineBoostLibrary,date_time,,))
  233. #$(eval $(call DefineBoostLibrary,exception,,))
  234. $(eval $(call DefineBoostLibrary,filesystem,system,))
  235. $(eval $(call DefineBoostLibrary,graph,regex,))
  236. $(eval $(call DefineBoostLibrary,iostreams,,+PACKAGE_boost-iostreams:zlib))
  237. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS)))
  238. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  239. $(eval $(call DefineBoostLibrary,math,,))
  240. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  241. $(eval $(call DefineBoostLibrary,program_options,,))
  242. $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
  243. $(eval $(call DefineBoostLibrary,python3,,+PACKAGE_boost-python3:python3))
  244. $(eval $(call DefineBoostLibrary,random,system,))
  245. $(eval $(call DefineBoostLibrary,regex,,))
  246. $(eval $(call DefineBoostLibrary,serialization,,))
  247. $(eval $(call DefineBoostLibrary,signals,,))
  248. $(eval $(call DefineBoostLibrary,system,,))
  249. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  250. $(eval $(call DefineBoostLibrary,timer,chrono))
  251. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  252. define Host/Compile
  253. # b2 does not provide a configure-script nor a Makefile
  254. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  255. endef
  256. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  257. TARGET_LDFLAGS += -pthread -lrt
  258. TARGET_CFLAGS += \
  259. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  260. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  261. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  262. ifneq ($(findstring mips,$(ARCH)),)
  263. BOOST_ABI = o32
  264. ifneq ($(findstring 64,$(ARCH)),)
  265. BOOST_ABI = o64
  266. endif
  267. else ifneq ($(findstring arm,$(ARCH)),)
  268. BOOST_ABI = aapcs
  269. else ifeq ($(ARCH),aarch64)
  270. BOOST_ABI = aapcs
  271. else
  272. BOOST_ABI = sysv
  273. endif
  274. comma := ,
  275. define Build/Compile
  276. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  277. ( cd $(PKG_BUILD_DIR) ; \
  278. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(if $(CONFIG_boost-coroutine2),-std=c++14,)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  279. $(if $(CONFIG_PACKAGE_boost-python3), \
  280. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  281. tools/build/src/user-config.jam; \
  282. ) \
  283. $(if $(CONFIG_PACKAGE_boost-python), \
  284. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  285. tools/build/src/user-config.jam; \
  286. ) \
  287. b2 \
  288. $(CONFIGURE_ARGS) \
  289. --ignore-site-config \
  290. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  291. --disable-long-double \
  292. $(if $(CONFIG_boost-variant-release), variant=release,) \
  293. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  294. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  295. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  296. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  297. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  298. $(if $(CONFIG_boost-static-libs),link=static,) \
  299. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  300. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  301. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  302. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  303. $(if $(CONFIG_boost-single-thread),threading=single,) \
  304. threading=multi \
  305. --without-mpi \
  306. $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
  307. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  308. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  309. $(foreach lib,$(BOOST_LIBS), \
  310. $(if $(findstring python,$(lib)), \
  311. $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
  312. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
  313. ) \
  314. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  315. boost.locale.iconv=off) \
  316. \
  317. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  318. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  319. install \
  320. )
  321. endef
  322. define Build/InstallDev
  323. $(INSTALL_DIR) \
  324. $(1)/usr/include/boost/
  325. $(CP) \
  326. $(PKG_INSTALL_DIR)/include/boost/* \
  327. $(1)/usr/include/boost/ \
  328. # copies _all_ header files - independent of <--with-library>-argument above
  329. $(INSTALL_DIR) $(1)/usr/lib
  330. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  331. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  332. endef
  333. define Host/Install
  334. $(INSTALL_DIR) \
  335. $(STAGING_DIR)/host/bin
  336. $(CP) \
  337. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
  338. $(STAGING_DIR)/host/bin/
  339. endef
  340. define Package/boost/Default/install
  341. $(INSTALL_DIR) \
  342. $(1)/usr/lib
  343. $(FIND) \
  344. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  345. endef
  346. define Package/boost-test/install
  347. $(INSTALL_DIR) \
  348. $(1)/usr/lib
  349. $(FIND) \
  350. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  351. $(FIND) \
  352. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  353. endef
  354. define BuildBoostLibrary
  355. define Package/boost-$(1)/install
  356. $(call Package/boost/Default/install,$$(1),$(1))
  357. endef
  358. $$(eval $$(call BuildPackage,boost-$(1)))
  359. endef
  360. $(eval $(call HostBuild))
  361. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  362. $(eval $(call BuildPackage,boost-test))
  363. $(eval $(call BuildPackage,boost-libs))
  364. $(eval $(call BuildPackage,boost))