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.

441 lines
13 KiB

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