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.

508 lines
17 KiB

  1. #
  2. # This is free software, licensed under the GNU General Public License v2.
  3. # See /LICENSE for more information.
  4. #
  5. #
  6. # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
  7. # Dude, this "boost" is really one of the most crude stuff I ported yet.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=boost
  11. PKG_VERSION:=1.68.0
  12. PKG_SOURCE_VERSION:=1_68_0
  13. PKG_RELEASE:=4
  14. PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
  15. PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_NAME)/$(PKG_VERSION) https://dl.bintray.com/boostorg/release/$(PKG_VERSION)/source/
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  17. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  18. PKG_HASH:=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7
  19. PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
  20. PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_USE_MIPS16:=0
  23. include $(INCLUDE_DIR)/package.mk
  24. include $(INCLUDE_DIR)/nls.mk
  25. define Package/boost/Default
  26. SECTION:=libs
  27. CATEGORY:=Libraries
  28. TITLE:=Boost C++ source library
  29. URL:=http://www.boost.org
  30. DEPENDS:=+libstdcpp +libpthread +librt
  31. endef
  32. define Package/boost/description
  33. This package provides the Boost v1.68.0 libraries.
  34. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  35. -----------------------------------------------------------------------------
  36. | Warning |
  37. | In order to build all of the Boost Libraries, it is necessary |
  38. | to use, at least, GCC version 5 (C++14 support) and, it is necessary to |
  39. | compile the kernel with Full Language Support. |
  40. | Without these requirerements, the following libs will not be available: |
  41. | - Boost.Locale |
  42. | - Boost.Coroutine2 (header-only library - requires C++11) |
  43. | - Boost.Fiber (requires C++14) |
  44. -----------------------------------------------------------------------------
  45. This package provides the following run-time libraries:
  46. - atomic
  47. - chrono
  48. - container
  49. - context
  50. - contract
  51. - coroutine (Deprecated - use Coroutine2)
  52. - - coroutine2 (Requires GCC v5 and up)
  53. - date_time
  54. - exception
  55. - filesystem
  56. - fiber (Requires GCC v5 and up)
  57. - graph
  58. - - graph-parallel
  59. - iostreams
  60. - locale (Requires kernel being compiled with full language support)
  61. - log
  62. - math
  63. - program_options
  64. - python
  65. - python3
  66. - random
  67. - regex
  68. - serialization and wserialization
  69. - signals
  70. - stackstrace
  71. - system
  72. - thread
  73. - timer
  74. - type_erasure
  75. - wave
  76. There are many more header-only libraries supported by Boost.
  77. See more at http://www.boost.org/doc/libs/1_67_0/
  78. endef
  79. PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
  80. include ../../lang/python/python-version.mk
  81. BOOST_PYTHON_VER=$(PYTHON_VERSION)
  82. include ../../lang/python/python3-version.mk
  83. BOOST_PYTHON3_VER=$(PYTHON3_VERSION)
  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. # Invisible config dependency
  200. config boost-fiber-exclude
  201. bool
  202. default y if (CPU_TYPE=mips32 || CPU_TYPE=mips64)
  203. config boost-test-pkg
  204. bool "Boost test package."
  205. default m if ALL
  206. select PACKAGE_boost-test
  207. config boost-coroutine2
  208. depends on !@GCC_VERSION_4_8
  209. bool "Boost couroutine2 support."
  210. select PACKAGE_boost-coroutine
  211. default n
  212. config boost-graph-parallel
  213. bool "Boost parallel graph support."
  214. select PACKAGE_boost-graph
  215. default n
  216. $(foreach lib,$(BOOST_LIBS), \
  217. config PACKAGE_boost-$(lib)
  218. prompt "Boost $(lib) $(if $(findstring python,$(lib)),$(paren_left)v$(if $(findstring 3,$(lib)),$(BOOST_PYTHON3_VER),$(BOOST_PYTHON_VER))$(paren_right) ,)library."
  219. default m if ALL
  220. $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
  221. $(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)\
  222. $(if $(findstring fiber,$(lib)),depends on (CPU_TYPE!=mips32 && CPU_TYPE!=mips64),)
  223. )
  224. endmenu
  225. endef
  226. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  227. define Package/boost-test
  228. $(call Package/boost/Default)
  229. TITLE+= (test)
  230. HIDDEN:=1
  231. DEPENDS+=+boost-system +boost-timer
  232. endef
  233. define Build/Configure
  234. endef
  235. # 1: short name
  236. # 2: dependencies on other boost libraries (short name)
  237. # 3: dependencies on other packages
  238. # 4: conditional/inward dependencies
  239. define DefineBoostLibrary
  240. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  241. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  242. BOOST_LIBS+= $(1)
  243. define Package/boost-$(1)
  244. $(call Package/boost/Default)
  245. TITLE+= ($(1))
  246. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
  247. HIDDEN:=1
  248. endef
  249. define Package/boost-$(1)/description
  250. This package contains the Boost $(1) library.
  251. endef
  252. endef
  253. $(eval $(call DefineBoostLibrary,atomic,system,))
  254. $(eval $(call DefineBoostLibrary,chrono,system,))
  255. $(eval $(call DefineBoostLibrary,container,,))
  256. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  257. $(eval $(call DefineBoostLibrary,contract,system,))
  258. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  259. $(eval $(call DefineBoostLibrary,date_time,,))
  260. #$(eval $(call DefineBoostLibrary,exception,,))
  261. $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
  262. $(eval $(call DefineBoostLibrary,filesystem,system,))
  263. $(eval $(call DefineBoostLibrary,graph,regex,))
  264. $(eval $(call DefineBoostLibrary,iostreams,,+zlib +liblzma +libbz2))
  265. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
  266. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  267. $(eval $(call DefineBoostLibrary,math,,))
  268. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  269. $(eval $(call DefineBoostLibrary,program_options,,))
  270. $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
  271. $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
  272. $(eval $(call DefineBoostLibrary,random,system,))
  273. $(eval $(call DefineBoostLibrary,regex,,))
  274. $(eval $(call DefineBoostLibrary,serialization,,))
  275. $(eval $(call DefineBoostLibrary,wserialization,serialization,))
  276. $(eval $(call DefineBoostLibrary,signals,,))
  277. $(eval $(call DefineBoostLibrary,stacktrace,,))
  278. $(eval $(call DefineBoostLibrary,system,,))
  279. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  280. $(eval $(call DefineBoostLibrary,timer,chrono))
  281. $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread,))
  282. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  283. include $(INCLUDE_DIR)/host-build.mk
  284. define Host/Compile
  285. # b2 does not provide a configure-script nor a Makefile
  286. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  287. endef
  288. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  289. TARGET_LDFLAGS += -pthread -lrt
  290. TARGET_CFLAGS += \
  291. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  292. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
  293. ifneq ($(findstring mips,$(ARCH)),)
  294. BOOST_ABI = o32
  295. ifneq ($(findstring 64,$(ARCH)),)
  296. BOOST_ABI = o64
  297. endif
  298. else ifneq ($(findstring arm,$(ARCH)),)
  299. BOOST_ABI = aapcs
  300. else ifeq ($(ARCH),aarch64)
  301. BOOST_ABI = aapcs
  302. else
  303. BOOST_ABI = sysv
  304. endif
  305. comma := ,
  306. define Build/Compile
  307. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CONFIG_CPU_TYPE) $(if $(CONFIG_CPU_SUBTYPE),and cpu subtype $(CONFIG_CPU_SUBTYPE),))
  308. ( cd $(PKG_BUILD_DIR) ; \
  309. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  310. tools/build/src/user-config.jam ; \
  311. b2 \
  312. $(CONFIGURE_ARGS) \
  313. --ignore-site-config \
  314. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  315. --disable-long-double \
  316. $(if $(CONFIG_boost-variant-release), variant=release,) \
  317. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  318. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  319. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  320. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  321. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  322. $(if $(CONFIG_boost-static-libs),link=static,) \
  323. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  324. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  325. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  326. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  327. $(if $(CONFIG_boost-single-thread),threading=single,) \
  328. threading=multi \
  329. --without-mpi \
  330. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  331. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  332. --without-python \
  333. $(foreach lib,$(BOOST_LIBS), \
  334. $(if $(findstring python,$(lib)),, \
  335. $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
  336. $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
  337. ) \
  338. ) \
  339. ) \
  340. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  341. boost.locale.iconv=off) \
  342. \
  343. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  344. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  345. install ;\
  346. $(if $(CONFIG_PACKAGE_boost-python), \
  347. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/python$(BOOST_PYTHON_VER)/ \" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  348. tools/build/src/user-config.jam ; \
  349. echo "using python : $(BOOST_PYTHON_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON_VER).so ;" >> \
  350. tools/build/src/user-config.jam; \
  351. b2 -a \
  352. $(CONFIGURE_ARGS) \
  353. --ignore-site-config \
  354. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  355. --disable-long-double \
  356. $(if $(CONFIG_boost-variant-release), variant=release,) \
  357. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  358. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  359. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  360. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  361. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  362. $(if $(CONFIG_boost-static-libs),link=static,) \
  363. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  364. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  365. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  366. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  367. $(if $(CONFIG_boost-single-thread),threading=single,) \
  368. threading=multi \
  369. --with-python \
  370. install ;\
  371. ,) \
  372. $(if $(CONFIG_PACKAGE_boost-python3), \
  373. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ \" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  374. tools/build/src/user-config.jam ; \
  375. echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
  376. tools/build/src/user-config.jam; \
  377. b2 -a \
  378. $(CONFIGURE_ARGS) \
  379. --ignore-site-config \
  380. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  381. --disable-long-double \
  382. $(if $(CONFIG_boost-variant-release), variant=release,) \
  383. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  384. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  385. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  386. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  387. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  388. $(if $(CONFIG_boost-static-libs),link=static,) \
  389. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  390. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  391. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  392. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  393. $(if $(CONFIG_boost-single-thread),threading=single,) \
  394. threading=multi \
  395. --with-python \
  396. install ;\
  397. ,) \
  398. )
  399. endef
  400. define Build/InstallDev
  401. $(INSTALL_DIR) \
  402. $(1)/usr/include/boost/
  403. $(CP) \
  404. $(PKG_INSTALL_DIR)/include/boost/* \
  405. $(1)/usr/include/boost/ \
  406. # copies _all_ header files - independent of <--with-library>-argument above
  407. $(INSTALL_DIR) $(1)/usr/lib
  408. # copies all compiled archive and shared object files
  409. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.{a,so*} $(1)/usr/lib/
  410. endef
  411. define Host/Install
  412. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  413. $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 $(STAGING_DIR_HOSTPKG)/bin/
  414. endef
  415. define Package/boost/Default/install
  416. $(INSTALL_DIR) $(1)/usr/lib
  417. $(if $(findstring python,$(2)), $(if $(findstring 3,$(2)), \
  418. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_python3*.so* $(1)/usr/lib/ , \
  419. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_python2*.so* $(1)/usr/lib/ ), \
  420. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/ )
  421. endef
  422. define Package/boost-test/install
  423. $(INSTALL_DIR) $(1)/usr/lib
  424. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* $(1)/usr/lib/
  425. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* $(1)/usr/lib/
  426. endef
  427. define BuildBoostLibrary
  428. define Package/boost-$(1)/install
  429. $(call Package/boost/Default/install,$$(1),$(1))
  430. endef
  431. $$(eval $$(call BuildPackage,boost-$(1)))
  432. endef
  433. $(eval $(call HostBuild))
  434. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  435. $(eval $(call BuildPackage,boost-test))
  436. $(eval $(call BuildPackage,boost-libs))
  437. $(eval $(call BuildPackage,boost))