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.

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