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.

461 lines
14 KiB

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