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.

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