1
0

Makefile 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. #
  2. # Copyright (C) 2015-2017 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.63.0
  16. PKG_SOURCE_VERSION:=1_63_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:=beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0
  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.63 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)
  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_63_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. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
  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) $(EXTRA_CXXFLAGS)\" <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_HOSTPKG)/bin
  356. $(CP) \
  357. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
  358. $(STAGING_DIR_HOSTPKG)/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))