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.

459 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:=5
  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 python,$(lib)),depends on PACKAGE_$(lib),)
  215. )
  216. endmenu
  217. endef
  218. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  219. define Package/boost-test
  220. $(call Package/boost/Default)
  221. TITLE+= (test)
  222. HIDDEN:=1
  223. DEPENDS+=+boost-system +boost-timer
  224. endef
  225. define Build/Configure
  226. endef
  227. # 1: short name
  228. # 2: dependencies on other boost libraries (short name)
  229. # 3: dependencies on other packages
  230. # 4: conditional/inward dependencies
  231. define DefineBoostLibrary
  232. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  233. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  234. BOOST_LIBS+= $(1)
  235. define Package/boost-$(1)
  236. $(call Package/boost/Default)
  237. TITLE+= ($(1))
  238. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
  239. HIDDEN:=1
  240. endef
  241. define Package/boost-$(1)/description
  242. This package contains the Boost $(1) library.
  243. endef
  244. endef
  245. $(eval $(call DefineBoostLibrary,atomic,system,))
  246. $(eval $(call DefineBoostLibrary,chrono,system,))
  247. $(eval $(call DefineBoostLibrary,container,,))
  248. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  249. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  250. $(eval $(call DefineBoostLibrary,date_time,,))
  251. #$(eval $(call DefineBoostLibrary,exception,,))
  252. $(eval $(call DefineBoostLibrary,fiber,coroutine,,))
  253. $(eval $(call DefineBoostLibrary,filesystem,system,))
  254. $(eval $(call DefineBoostLibrary,graph,regex,))
  255. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  256. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
  257. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  258. $(eval $(call DefineBoostLibrary,math,,))
  259. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  260. $(eval $(call DefineBoostLibrary,program_options,,))
  261. $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
  262. $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
  263. $(eval $(call DefineBoostLibrary,random,system,))
  264. $(eval $(call DefineBoostLibrary,regex,,))
  265. $(eval $(call DefineBoostLibrary,serialization,,))
  266. $(eval $(call DefineBoostLibrary,signals,,))
  267. $(eval $(call DefineBoostLibrary,system,,))
  268. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  269. $(eval $(call DefineBoostLibrary,timer,chrono))
  270. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  271. define Host/Compile
  272. # b2 does not provide a configure-script nor a Makefile
  273. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  274. endef
  275. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  276. TARGET_LDFLAGS += -pthread -lrt
  277. TARGET_CFLAGS += \
  278. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  279. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  280. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  281. ifneq ($(findstring mips,$(ARCH)),)
  282. BOOST_ABI = o32
  283. ifneq ($(findstring 64,$(ARCH)),)
  284. BOOST_ABI = o64
  285. endif
  286. else ifneq ($(findstring arm,$(ARCH)),)
  287. BOOST_ABI = aapcs
  288. else ifeq ($(ARCH),aarch64)
  289. BOOST_ABI = aapcs
  290. else
  291. BOOST_ABI = sysv
  292. endif
  293. comma := ,
  294. define Build/Compile
  295. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  296. ( cd $(PKG_BUILD_DIR) ; \
  297. 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 ; \
  298. $(if $(CONFIG_PACKAGE_boost-python3), \
  299. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  300. tools/build/src/user-config.jam; \
  301. ) \
  302. $(if $(CONFIG_PACKAGE_boost-python), \
  303. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  304. tools/build/src/user-config.jam; \
  305. ) \
  306. b2 \
  307. $(CONFIGURE_ARGS) \
  308. --ignore-site-config \
  309. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  310. --disable-long-double \
  311. $(if $(CONFIG_boost-variant-release), variant=release,) \
  312. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  313. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  314. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  315. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  316. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  317. $(if $(CONFIG_boost-static-libs),link=static,) \
  318. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  319. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  320. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  321. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  322. $(if $(CONFIG_boost-single-thread),threading=single,) \
  323. threading=multi \
  324. --without-mpi \
  325. $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
  326. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  327. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  328. $(foreach lib,$(BOOST_LIBS), \
  329. $(if $(findstring python,$(lib)), \
  330. $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
  331. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
  332. ) \
  333. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  334. boost.locale.iconv=off) \
  335. \
  336. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  337. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  338. install \
  339. )
  340. endef
  341. define Build/InstallDev
  342. $(INSTALL_DIR) \
  343. $(1)/usr/include/boost/
  344. $(CP) \
  345. $(PKG_INSTALL_DIR)/include/boost/* \
  346. $(1)/usr/include/boost/ \
  347. # copies _all_ header files - independent of <--with-library>-argument above
  348. $(INSTALL_DIR) $(1)/usr/lib
  349. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  350. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  351. endef
  352. define Host/Install
  353. $(INSTALL_DIR) \
  354. $(STAGING_DIR)/host/bin
  355. $(CP) \
  356. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
  357. $(STAGING_DIR)/host/bin/
  358. endef
  359. define Package/boost/Default/install
  360. $(INSTALL_DIR) \
  361. $(1)/usr/lib
  362. $(FIND) \
  363. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2).so*' -exec $(CP) {} $(1)/usr/lib/ \;
  364. $(FIND) \
  365. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)_*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  366. endef
  367. define Package/boost-test/install
  368. $(INSTALL_DIR) \
  369. $(1)/usr/lib
  370. $(FIND) \
  371. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  372. $(FIND) \
  373. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  374. endef
  375. define BuildBoostLibrary
  376. define Package/boost-$(1)/install
  377. $(call Package/boost/Default/install,$$(1),$(1))
  378. endef
  379. $$(eval $$(call BuildPackage,boost-$(1)))
  380. endef
  381. $(eval $(call HostBuild))
  382. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  383. $(eval $(call BuildPackage,boost-test))
  384. $(eval $(call BuildPackage,boost-libs))
  385. $(eval $(call BuildPackage,boost))