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.

454 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:=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_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_DEPENDS += boost/host
  26. PKG_BUILD_PARALLEL:=0
  27. PKG_USE_MIPS16:=0
  28. include $(INCLUDE_DIR)/package.mk
  29. include $(INCLUDE_DIR)/host-build.mk
  30. define Package/boost/Default
  31. SECTION:=libs
  32. CATEGORY:=Libraries
  33. TITLE:=Boost C++ source library
  34. URL:=http://www.boost.org
  35. DEPENDS:=+libstdcpp +libpthread +librt
  36. endef
  37. define Package/boost/description
  38. This package provides the Boost v1.62 libraries.
  39. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  40. -----------------------------------------------------------------------------
  41. | Warning |
  42. | In order to build all of the Boost Libraries, it is necessary |
  43. | to use, at least, GCC version 5 (C++14 support) and, it is necessary to |
  44. | compile the kernel with Full Language Support. |
  45. | Without these requirerements, the following libs will not be available: |
  46. | - Boost.Locale |
  47. | - Boost.Coroutine2 |
  48. | - Boost.Fiber |
  49. -----------------------------------------------------------------------------
  50. This package provides the following run-time libraries:
  51. - atomic
  52. - chrono
  53. - container
  54. - context
  55. - coroutine (Deprecated - use Coroutine2)
  56. - - coroutine2 (Requires GCC v5 and up)
  57. - date_time
  58. - exception
  59. - filesystem
  60. - fiber (Requires GCC v5 and up) - BROKEN
  61. - graph
  62. - - graph-parallel
  63. - iostreams
  64. - locale (Requires kernel being compiled with full language support)
  65. - log
  66. - math
  67. - program_options
  68. - python
  69. - python3
  70. - random
  71. - regex
  72. - serialization
  73. - signals
  74. - system
  75. - thread
  76. - timer
  77. - wave
  78. There are many more header-only libraries supported by Boost.
  79. See more at http://www.boost.org/doc/libs/1_62_0/
  80. endef
  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. DEPENDS:=+ALL:boost-libs +ALL:boost-test
  103. endef
  104. define Package/boost/config
  105. menu "Select Boost Options"
  106. depends on PACKAGE_boost
  107. comment "Boost compilation options."
  108. choice
  109. prompt "Compile Boost libraries."
  110. default boost-static-and-shared-libs
  111. help
  112. Choose which version to compile.
  113. -> Shared:
  114. - Only Shared libs will be compiled.
  115. -> Static:
  116. - Only Static libs will be compiled.
  117. -> Both:
  118. - Both Static and Shared libs will be compiled.
  119. config boost-shared-libs
  120. bool "Shared"
  121. config boost-static-libs
  122. bool "Static"
  123. config boost-static-and-shared-libs
  124. bool "Both"
  125. endchoice
  126. choice
  127. prompt "Selects Boost Runtime linkage."
  128. default boost-runtime-shared
  129. help
  130. Choose which C and C++ runtimes to use:
  131. -> Use Shared runtimes.
  132. -> Use Static runtimes.
  133. - Not available if Shared libs are to be built.
  134. -> Use both runtimes.
  135. - Not available if Shared libs are to be built.
  136. - Two separate versions of Boost are built, linking each to a different runtime.
  137. - This option requires "Use tagged names" option to be active.
  138. config boost-runtime-shared
  139. bool "Shared"
  140. config boost-runtime-static
  141. depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
  142. bool "Static"
  143. config boost-runtime-static-and-shared
  144. depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
  145. bool "Both"
  146. endchoice
  147. choice
  148. prompt "Select a Variant."
  149. default boost-variant-release
  150. help
  151. Chooses which boost variant should be selected:
  152. -> Release: Optimizes Boost for release.
  153. - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
  154. -> Debug:
  155. - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
  156. -> Profile:
  157. - Profiling: On; Debug Symbols: On.
  158. config boost-variant-release
  159. bool "Release"
  160. config boost-variant-debug
  161. bool "Debug"
  162. config boost-variant-profile
  163. bool "Profile"
  164. endchoice
  165. config boost-use-name-tags
  166. bool "Use tagged names."
  167. help
  168. Add name tags the lib files, to diferentiate each library version:
  169. "-mt" for multi-threading.
  170. "-d" for debugging.
  171. "-s" for runtime static link".
  172. Might break compatibility with libraries that expect boost libs with default names.
  173. default n
  174. config boost-single-thread
  175. depends on @boost-use-name-tags
  176. bool "Single thread Support."
  177. help
  178. Compile Boost libraries in single-thread mode.
  179. default n
  180. config boost-build-type-complete
  181. depends on @boost-use-name-tags
  182. bool "Complete Boost Build."
  183. help
  184. Builds both release and debug libs. It will take much longer to compile.
  185. default n
  186. endmenu
  187. menu "Select Boost libraries"
  188. depends on PACKAGE_boost
  189. comment "Libraries"
  190. config boost-libs-all
  191. bool "Include all Boost libraries."
  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. select PACKAGE_boost-test
  199. config boost-coroutine2
  200. depends on !@GCC_VERSION_4_8
  201. bool "Boost couroutine2 support."
  202. select PACKAGE_boost-coroutine
  203. default n
  204. config boost-graph-parallel
  205. bool "Boost parallel graph support."
  206. select PACKAGE_boost-graph
  207. default n
  208. $(foreach lib,$(BOOST_LIBS), \
  209. config PACKAGE_boost-$(lib)
  210. prompt "Boost $(lib) library."
  211. $(if $(findstring locale,$(lib)),depends on @BUILD_NLS,)
  212. $(if $(findstring fiber,$(lib)),depends on BROKEN,)
  213. )
  214. endmenu
  215. endef
  216. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  217. define Package/boost-test
  218. $(call Package/boost/Default)
  219. TITLE+= (test)
  220. HIDDEN:=1
  221. DEPENDS+=+boost-system +boost-timer
  222. endef
  223. define Build/Configure
  224. endef
  225. # 1: short name
  226. # 2: dependencies on other boost libraries (short name)
  227. # 3: dependencies on other packages
  228. define DefineBoostLibrary
  229. BOOST_DEPENDS+= +boost-$(1)
  230. BOOST_LIBS+= $(1)
  231. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  232. define Package/boost-$(1)
  233. $(call Package/boost/Default)
  234. TITLE+= ($(1))
  235. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  236. HIDDEN:=1
  237. endef
  238. define Package/boost-$(1)/description
  239. This package contains the Boost $(1) library.
  240. endef
  241. endef
  242. $(eval $(call DefineBoostLibrary,atomic,system,))
  243. $(eval $(call DefineBoostLibrary,chrono,system,))
  244. $(eval $(call DefineBoostLibrary,container,,))
  245. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  246. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  247. $(eval $(call DefineBoostLibrary,date_time,,))
  248. #$(eval $(call DefineBoostLibrary,exception,,))
  249. $(eval $(call DefineBoostLibrary,fiber,coroutine,))
  250. $(eval $(call DefineBoostLibrary,filesystem,system,))
  251. $(eval $(call DefineBoostLibrary,graph,regex,))
  252. $(eval $(call DefineBoostLibrary,iostreams,,+PACKAGE_boost-iostreams:zlib))
  253. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS)))
  254. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  255. $(eval $(call DefineBoostLibrary,math,,))
  256. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  257. $(eval $(call DefineBoostLibrary,program_options,,))
  258. $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
  259. $(eval $(call DefineBoostLibrary,python3,,+PACKAGE_boost-python3:python3))
  260. $(eval $(call DefineBoostLibrary,random,system,))
  261. $(eval $(call DefineBoostLibrary,regex,,))
  262. $(eval $(call DefineBoostLibrary,serialization,,))
  263. $(eval $(call DefineBoostLibrary,signals,,))
  264. $(eval $(call DefineBoostLibrary,system,,))
  265. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  266. $(eval $(call DefineBoostLibrary,timer,chrono))
  267. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  268. define Host/Compile
  269. # b2 does not provide a configure-script nor a Makefile
  270. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  271. endef
  272. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  273. TARGET_LDFLAGS += -pthread -lrt
  274. TARGET_CFLAGS += \
  275. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  276. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  277. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  278. ifneq ($(findstring mips,$(ARCH)),)
  279. BOOST_ABI = o32
  280. ifneq ($(findstring 64,$(ARCH)),)
  281. BOOST_ABI = o64
  282. endif
  283. else ifneq ($(findstring arm,$(ARCH)),)
  284. BOOST_ABI = aapcs
  285. else ifeq ($(ARCH),aarch64)
  286. BOOST_ABI = aapcs
  287. else
  288. BOOST_ABI = sysv
  289. endif
  290. comma := ,
  291. define Build/Compile
  292. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  293. ( cd $(PKG_BUILD_DIR) ; \
  294. 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 ; \
  295. $(if $(CONFIG_PACKAGE_boost-python3), \
  296. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  297. tools/build/src/user-config.jam; \
  298. ) \
  299. $(if $(CONFIG_PACKAGE_boost-python), \
  300. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  301. tools/build/src/user-config.jam; \
  302. ) \
  303. b2 \
  304. $(CONFIGURE_ARGS) \
  305. --ignore-site-config \
  306. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  307. --disable-long-double \
  308. $(if $(CONFIG_boost-variant-release), variant=release,) \
  309. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  310. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  311. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  312. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  313. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  314. $(if $(CONFIG_boost-static-libs),link=static,) \
  315. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  316. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  317. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  318. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  319. $(if $(CONFIG_boost-single-thread),threading=single,) \
  320. threading=multi \
  321. --without-mpi \
  322. $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
  323. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  324. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  325. $(foreach lib,$(BOOST_LIBS), \
  326. $(if $(findstring python,$(lib)), \
  327. $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
  328. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
  329. ) \
  330. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  331. boost.locale.iconv=off) \
  332. \
  333. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  334. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  335. install \
  336. )
  337. endef
  338. define Build/InstallDev
  339. $(INSTALL_DIR) \
  340. $(1)/usr/include/boost/
  341. $(CP) \
  342. $(PKG_INSTALL_DIR)/include/boost/* \
  343. $(1)/usr/include/boost/ \
  344. # copies _all_ header files - independent of <--with-library>-argument above
  345. $(INSTALL_DIR) $(1)/usr/lib
  346. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  347. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  348. endef
  349. define Host/Install
  350. $(INSTALL_DIR) \
  351. $(STAGING_DIR)/host/bin
  352. $(CP) \
  353. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
  354. $(STAGING_DIR)/host/bin/
  355. endef
  356. define Package/boost/Default/install
  357. $(INSTALL_DIR) \
  358. $(1)/usr/lib
  359. $(FIND) \
  360. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  361. endef
  362. define Package/boost-test/install
  363. $(INSTALL_DIR) \
  364. $(1)/usr/lib
  365. $(FIND) \
  366. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  367. $(FIND) \
  368. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  369. endef
  370. define BuildBoostLibrary
  371. define Package/boost-$(1)/install
  372. $(call Package/boost/Default/install,$$(1),$(1))
  373. endef
  374. $$(eval $$(call BuildPackage,boost-$(1)))
  375. endef
  376. $(eval $(call HostBuild))
  377. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  378. $(eval $(call BuildPackage,boost-test))
  379. $(eval $(call BuildPackage,boost-libs))
  380. $(eval $(call BuildPackage,boost))