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.

496 lines
15 KiB

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