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.

460 lines
14 KiB

  1. #
  2. # Copyright (C) 2015-2016 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.62.0
  16. PKG_SOURCE_VERSION:=1_62_0
  17. PKG_RELEASE:=4
  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:=36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0
  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.62 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) - BROKEN
  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_62_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 fiber,$(lib)),depends on BROKEN,)\
  215. $(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)
  216. )
  217. endmenu
  218. endef
  219. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  220. define Package/boost-test
  221. $(call Package/boost/Default)
  222. TITLE+= (test)
  223. HIDDEN:=1
  224. DEPENDS+=+boost-system +boost-timer
  225. endef
  226. define Build/Configure
  227. endef
  228. # 1: short name
  229. # 2: dependencies on other boost libraries (short name)
  230. # 3: dependencies on other packages
  231. # 4: conditional/inward dependencies
  232. define DefineBoostLibrary
  233. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  234. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  235. BOOST_LIBS+= $(1)
  236. define Package/boost-$(1)
  237. $(call Package/boost/Default)
  238. TITLE+= ($(1))
  239. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
  240. HIDDEN:=1
  241. endef
  242. define Package/boost-$(1)/description
  243. This package contains the Boost $(1) library.
  244. endef
  245. endef
  246. $(eval $(call DefineBoostLibrary,atomic,system,))
  247. $(eval $(call DefineBoostLibrary,chrono,system,))
  248. $(eval $(call DefineBoostLibrary,container,,))
  249. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  250. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  251. $(eval $(call DefineBoostLibrary,date_time,,))
  252. #$(eval $(call DefineBoostLibrary,exception,,))
  253. $(eval $(call DefineBoostLibrary,fiber,coroutine,,BROKEN))
  254. $(eval $(call DefineBoostLibrary,filesystem,system,))
  255. $(eval $(call DefineBoostLibrary,graph,regex,))
  256. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  257. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
  258. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  259. $(eval $(call DefineBoostLibrary,math,,))
  260. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  261. $(eval $(call DefineBoostLibrary,program_options,,))
  262. $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
  263. $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
  264. $(eval $(call DefineBoostLibrary,random,system,))
  265. $(eval $(call DefineBoostLibrary,regex,,))
  266. $(eval $(call DefineBoostLibrary,serialization,,))
  267. $(eval $(call DefineBoostLibrary,signals,,))
  268. $(eval $(call DefineBoostLibrary,system,,))
  269. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  270. $(eval $(call DefineBoostLibrary,timer,chrono))
  271. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  272. define Host/Compile
  273. # b2 does not provide a configure-script nor a Makefile
  274. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  275. endef
  276. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  277. TARGET_LDFLAGS += -pthread -lrt
  278. TARGET_CFLAGS += \
  279. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  280. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  281. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  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) $(if $(CONFIG_boost-coroutine2),-std=c++14,)\" <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))