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.

495 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.67.0
  16. PKG_SOURCE_VERSION:=1_67_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_HASH:=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
  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.67.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. - 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
  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_67_0/
  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,contract,system,))
  252. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  253. $(eval $(call DefineBoostLibrary,date_time,,))
  254. #$(eval $(call DefineBoostLibrary,exception,,))
  255. $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,))
  256. $(eval $(call DefineBoostLibrary,filesystem,system,))
  257. $(eval $(call DefineBoostLibrary,graph,regex,))
  258. $(eval $(call DefineBoostLibrary,iostreams,,+zlib +liblzma +libbz2))
  259. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
  260. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  261. $(eval $(call DefineBoostLibrary,math,,))
  262. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  263. $(eval $(call DefineBoostLibrary,program_options,,))
  264. $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
  265. $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
  266. $(eval $(call DefineBoostLibrary,random,system,))
  267. $(eval $(call DefineBoostLibrary,regex,,))
  268. $(eval $(call DefineBoostLibrary,serialization,,))
  269. $(eval $(call DefineBoostLibrary,wserialization,serialization,))
  270. $(eval $(call DefineBoostLibrary,signals,,))
  271. $(eval $(call DefineBoostLibrary,stacktrace,,))
  272. $(eval $(call DefineBoostLibrary,system,,))
  273. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  274. $(eval $(call DefineBoostLibrary,timer,chrono))
  275. $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread,))
  276. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  277. define Host/Compile
  278. # b2 does not provide a configure-script nor a Makefile
  279. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  280. endef
  281. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  282. TARGET_LDFLAGS += -pthread -lrt
  283. TARGET_CFLAGS += \
  284. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  285. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.6/) \
  286. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  287. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
  288. ifneq ($(findstring mips,$(ARCH)),)
  289. BOOST_ABI = o32
  290. ifneq ($(findstring 64,$(ARCH)),)
  291. BOOST_ABI = o64
  292. endif
  293. else ifneq ($(findstring arm,$(ARCH)),)
  294. BOOST_ABI = aapcs
  295. else ifeq ($(ARCH),aarch64)
  296. BOOST_ABI = aapcs
  297. else
  298. BOOST_ABI = sysv
  299. endif
  300. comma := ,
  301. define Build/Compile
  302. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  303. ( cd $(PKG_BUILD_DIR) ; \
  304. 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 ; \
  305. $(if $(CONFIG_PACKAGE_boost-python3), \
  306. echo "using python : 3.6 : : $(STAGING_DIR)/usr/include/python3.6/ : $(STAGING_DIR)/usr/lib/libpython3.6.so ;" >> \
  307. tools/build/src/user-config.jam; \
  308. ) \
  309. $(if $(CONFIG_PACKAGE_boost-python), \
  310. echo "using python : 2.7 : : $(STAGING_DIR)/usr/include/python2.7/ : $(STAGING_DIR)/usr/lib/libpython2.7.so ;" >> \
  311. tools/build/src/user-config.jam; \
  312. ) \
  313. b2 \
  314. $(CONFIGURE_ARGS) \
  315. --ignore-site-config \
  316. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  317. --disable-long-double \
  318. $(if $(CONFIG_boost-variant-release), variant=release,) \
  319. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  320. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  321. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  322. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  323. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  324. $(if $(CONFIG_boost-static-libs),link=static,) \
  325. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  326. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  327. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  328. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  329. $(if $(CONFIG_boost-single-thread),threading=single,) \
  330. threading=multi \
  331. --without-mpi \
  332. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  333. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  334. $(foreach lib,$(BOOST_LIBS), \
  335. $(if $(findstring python,$(lib)), \
  336. $(if $(CONFIG_PACKAGE_boost-python),python=2.7,--without-python), \
  337. $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
  338. $(if $(findstring $(lib),wserialization),,--without-$(lib)) \
  339. ) \
  340. ) \
  341. ) \
  342. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  343. boost.locale.iconv=off) \
  344. \
  345. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  346. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  347. install ;\
  348. $(if $(CONFIG_PACKAGE_boost-python3), \
  349. b2 \
  350. $(CONFIGURE_ARGS) \
  351. --ignore-site-config \
  352. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  353. --disable-long-double \
  354. $(if $(CONFIG_boost-variant-release), variant=release,) \
  355. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  356. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  357. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  358. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  359. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  360. $(if $(CONFIG_boost-static-libs),link=static,) \
  361. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  362. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  363. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  364. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  365. $(if $(CONFIG_boost-single-thread),threading=single,) \
  366. threading=multi \
  367. $(foreach lib,$(BOOST_LIBS), \
  368. $(if $(findstring python,$(lib)), \
  369. $(if $(CONFIG_PACKAGE_boost-python3),python=3.6,), \
  370. ) \
  371. ) \
  372. install ;\
  373. ,) \
  374. )
  375. endef
  376. define Build/InstallDev
  377. $(INSTALL_DIR) \
  378. $(1)/usr/include/boost/
  379. $(CP) \
  380. $(PKG_INSTALL_DIR)/include/boost/* \
  381. $(1)/usr/include/boost/ \
  382. # copies _all_ header files - independent of <--with-library>-argument above
  383. $(INSTALL_DIR) $(1)/usr/lib
  384. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  385. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  386. endef
  387. define Host/Install
  388. $(INSTALL_DIR) \
  389. $(STAGING_DIR_HOSTPKG)/bin
  390. $(CP) \
  391. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
  392. $(STAGING_DIR_HOSTPKG)/bin/
  393. endef
  394. define Package/boost/Default/install
  395. $(INSTALL_DIR) \
  396. $(1)/usr/lib
  397. $(FIND) \
  398. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2).so*' -exec $(CP) {} $(1)/usr/lib/ \;
  399. $(FIND) \
  400. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)_*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  401. endef
  402. define Package/boost-test/install
  403. $(INSTALL_DIR) \
  404. $(1)/usr/lib
  405. $(FIND) \
  406. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  407. $(FIND) \
  408. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  409. endef
  410. define BuildBoostLibrary
  411. define Package/boost-$(1)/install
  412. $(call Package/boost/Default/install,$$(1),$(1))
  413. endef
  414. $$(eval $$(call BuildPackage,boost-$(1)))
  415. endef
  416. $(eval $(call HostBuild))
  417. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  418. $(eval $(call BuildPackage,boost-test))
  419. $(eval $(call BuildPackage,boost-libs))
  420. $(eval $(call BuildPackage,boost))