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.

507 lines
16 KiB

  1. #
  2. # This is free software, licensed under the GNU General Public License v2.
  3. # See /LICENSE for more information.
  4. #
  5. #
  6. # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
  7. # Dude, this "boost" is really one of the most crude stuff I ported yet.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=boost
  11. PKG_VERSION:=1.72.0
  12. PKG_SOURCE_VERSION:=1_72_0
  13. PKG_RELEASE:=1
  14. PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
  15. PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_NAME)/$(PKG_VERSION) https://dl.bintray.com/boostorg/release/$(PKG_VERSION)/source/
  16. PKG_HASH:=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
  17. PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
  18. PKG_LICENSE:=BSL-1.0
  19. PKG_LICENSE_FILES:=LICENSE_1_0.txt
  20. PKG_CPE_ID:=cpe:/a:boost:boost
  21. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  22. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
  23. HOST_BUILD_PARALLEL:=1
  24. PKG_BUILD_PARALLEL:=1
  25. PKG_USE_MIPS16:=0
  26. include $(INCLUDE_DIR)/package.mk
  27. include $(INCLUDE_DIR)/nls.mk
  28. define Package/boost/Default
  29. SECTION:=libs
  30. CATEGORY:=Libraries
  31. TITLE:=Boost C++ source library
  32. URL:=https://www.boost.org
  33. DEPENDS:=+libstdcpp +libpthread +librt
  34. endef
  35. define Package/boost/description
  36. This package provides the Boost v1.72.0 libraries.
  37. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  38. This package provides the following run-time libraries:
  39. - atomic
  40. - chrono
  41. - container
  42. - context
  43. - contract
  44. - coroutine and coroutine2 (Coroutine is deprecated - use Coroutine2)
  45. - date_time
  46. - exception
  47. - filesystem
  48. - fiber
  49. - graph
  50. - - graph-parallel
  51. - iostreams
  52. - locale (Requires kernel being compiled with full language support)
  53. - log
  54. - math
  55. - program_options
  56. - python3
  57. - random
  58. - regex
  59. - serialization and wserialization
  60. - stackstrace
  61. - system
  62. - thread
  63. - timer
  64. - type_erasure
  65. - wave
  66. There are many more header-only libraries supported by Boost.
  67. See more at http://www.boost.org/doc/libs/1_72_0/
  68. endef
  69. PKG_BUILD_DEPENDS:=boost/host PACKAGE_python3:python3
  70. include ../../lang/python/python3-version.mk
  71. BOOST_PYTHON3_VER=$(PYTHON3_VERSION)
  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. 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. endef
  94. define Package/boost/config
  95. # Invisible config dependency
  96. config boost-context-exclude
  97. bool
  98. default y if (TARGET_arc770 || TARGET_archs38 || TARGET_octeon || TARGET_octeontx)
  99. default n
  100. config boost-coroutine-exclude
  101. bool
  102. default y if boost-context-exclude
  103. default n
  104. config boost-fiber-exclude
  105. bool
  106. default y if boost-coroutine-exclude
  107. default n
  108. menu "Select Boost Options"
  109. depends on PACKAGE_boost
  110. comment "Boost compilation options."
  111. choice
  112. prompt "Compile Visibility."
  113. default boost-compile-visibility-hidden
  114. help
  115. Choose Boost symbols compilation visibility.
  116. -> Global:
  117. - a.k.a. "default" in gcc documentation. Global symbols are considered public,
  118. they are exported from shared libraries and can be redefined by another
  119. shared library or executable.
  120. -> Protected:
  121. - a.k.a. "symbolic". Protected symbols are exported from shared libraries but
  122. cannot be redefined by another shared library or executable. This mode is
  123. not supported on some platforms, for example OS X.
  124. -> Hidden:
  125. - Hidden symbols are not exported from shared libraries and cannot be
  126. redefined by a different shared library or executable loaded in a process.
  127. In this mode, public symbols have to be explicitly marked in the source code
  128. to be exported from shared libraries. This is the recommended mode.
  129. config boost-compile-visibility-global
  130. bool "Global"
  131. config boost-compile-visibility-protected
  132. bool "Protected"
  133. config boost-compile-visibility-hidden
  134. bool "Hidden"
  135. endchoice
  136. choice
  137. prompt "Compile Boost libraries."
  138. default boost-static-and-shared-libs
  139. help
  140. Choose which version to compile.
  141. -> Shared:
  142. - Only Shared libs will be compiled.
  143. -> Static:
  144. - Only Static libs will be compiled.
  145. -> Both:
  146. - Both Static and Shared libs will be compiled.
  147. config boost-shared-libs
  148. bool "Shared"
  149. config boost-static-libs
  150. bool "Static"
  151. config boost-static-and-shared-libs
  152. bool "Both"
  153. endchoice
  154. choice
  155. prompt "Selects Boost Runtime linkage."
  156. default boost-runtime-shared
  157. help
  158. Choose which C and C++ runtimes to use:
  159. -> Use Shared runtimes.
  160. -> Use Static runtimes.
  161. - Not available if Shared libs are to be built.
  162. -> Use both runtimes.
  163. - Not available if Shared libs are to be built.
  164. - Two separate versions of Boost are built, linking each to a different runtime.
  165. - This option requires "Use tagged names" option to be active.
  166. config boost-runtime-shared
  167. bool "Shared"
  168. config boost-runtime-static
  169. depends on (!boost-shared-libs && !boost-static-and-shared-libs)
  170. bool "Static"
  171. config boost-runtime-static-and-shared
  172. depends on (boost-use-name-tags && !boost-shared-libs && !boost-static-and-shared-libs)
  173. bool "Both"
  174. endchoice
  175. choice
  176. prompt "Select a Variant."
  177. default boost-variant-release
  178. help
  179. Chooses which boost variant should be selected:
  180. -> Release: Optimizes Boost for release.
  181. - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
  182. -> Debug:
  183. - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
  184. -> Profile:
  185. - Profiling: On; Debug Symbols: On.
  186. config boost-variant-release
  187. bool "Release"
  188. config boost-variant-debug
  189. bool "Debug"
  190. config boost-variant-profile
  191. bool "Profile"
  192. endchoice
  193. config boost-use-name-tags
  194. bool "Use tagged names."
  195. help
  196. Add name tags the lib files, to diferentiate each library version:
  197. "-mt" for multi-threading.
  198. "-d" for debugging.
  199. "-s" for runtime static link".
  200. Might break compatibility with libraries that expect boost libs with default names.
  201. default n
  202. config boost-single-thread
  203. depends on boost-use-name-tags
  204. bool "Single thread Support."
  205. help
  206. Compile Boost libraries in single-thread mode.
  207. default n
  208. config boost-build-type-complete
  209. depends on boost-use-name-tags
  210. bool "Complete Boost Build."
  211. help
  212. Builds both release and debug libs. It will take much longer to compile.
  213. default n
  214. endmenu
  215. menu "Select Boost libraries"
  216. depends on PACKAGE_boost
  217. comment "Libraries"
  218. config boost-libs-all
  219. bool "Include all Boost libraries."
  220. default m if ALL
  221. select PACKAGE_boost-libs
  222. select boost-test-pkg
  223. select boost-graph-parallel
  224. config boost-test-pkg
  225. bool "Boost test package."
  226. default m if ALL
  227. select PACKAGE_boost-test
  228. config boost-graph-parallel
  229. bool "Boost parallel graph support."
  230. select PACKAGE_boost-graph
  231. default m if ALL
  232. $(foreach lib,$(BOOST_LIBS), \
  233. config PACKAGE_boost-$(lib)
  234. prompt "Boost $(lib) $(if $(findstring python3,$(lib)),$(paren_left)v$(BOOST_PYTHON3_VER)$(paren_right) ,)library."
  235. default m if ALL
  236. $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
  237. $(if $(findstring python3,$(lib)),depends on PACKAGE_python3,)\
  238. $(if $(findstring fiber,$(lib)),depends on !boost-fiber-exclude,)\
  239. $(if $(findstring context,$(lib)),depends on !boost-context-exclude,)
  240. $(if $(findstring coroutine,$(lib)),depends on !boost-coroutine-exclude,)
  241. )
  242. endmenu
  243. endef
  244. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  245. define Package/boost-test
  246. $(call Package/boost/Default)
  247. TITLE+= (test)
  248. HIDDEN:=1
  249. DEPENDS+=+boost-system +boost-timer
  250. endef
  251. define Build/Configure
  252. endef
  253. # 1: short name
  254. # 2: dependencies on other boost libraries (short name)
  255. # 3: dependencies on other packages
  256. # 4: conditional/inward dependencies
  257. define DefineBoostLibrary
  258. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  259. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  260. BOOST_LIBS+= $(1)
  261. define Package/boost-$(1)
  262. $(call Package/boost/Default)
  263. TITLE+= ($(1))
  264. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
  265. HIDDEN:=1
  266. endef
  267. define Package/boost-$(1)/description
  268. This package contains the Boost $(1) library.
  269. endef
  270. endef
  271. $(eval $(call DefineBoostLibrary,atomic,system))
  272. $(eval $(call DefineBoostLibrary,chrono,system))
  273. $(eval $(call DefineBoostLibrary,container))
  274. $(eval $(call DefineBoostLibrary,context,chrono system,,!boost-context-exclude))
  275. $(eval $(call DefineBoostLibrary,contract,system))
  276. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,,!boost-coroutine-exclude))
  277. $(eval $(call DefineBoostLibrary,date_time))
  278. #$(eval $(call DefineBoostLibrary,exception,,))
  279. $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
  280. $(eval $(call DefineBoostLibrary,filesystem,system))
  281. $(eval $(call DefineBoostLibrary,graph,regex))
  282. $(eval $(call DefineBoostLibrary,iostreams,,+zlib +liblzma +libbz2 +zstd))
  283. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
  284. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex))
  285. $(eval $(call DefineBoostLibrary,math))
  286. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  287. $(eval $(call DefineBoostLibrary,program_options))
  288. $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
  289. $(eval $(call DefineBoostLibrary,random,system))
  290. $(eval $(call DefineBoostLibrary,regex))
  291. $(eval $(call DefineBoostLibrary,serialization))
  292. $(eval $(call DefineBoostLibrary,wserialization,serialization))
  293. $(eval $(call DefineBoostLibrary,stacktrace))
  294. $(eval $(call DefineBoostLibrary,system))
  295. $(eval $(call DefineBoostLibrary,thread,system chrono atomic))
  296. $(eval $(call DefineBoostLibrary,timer,chrono))
  297. $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread))
  298. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem))
  299. include $(INCLUDE_DIR)/host-build.mk
  300. define Host/Compile
  301. # b2 does not provide a configure-script nor a Makefile
  302. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  303. ( cd $(HOST_BUILD_DIR) ; \
  304. ./bootstrap.sh --prefix=$(STAGING_DIR_HOSTPKG) \
  305. --with-libraries=context,filesystem,program_options,regex,system ;\
  306. ./b2 --ignore-site-config install )
  307. endef
  308. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  309. TARGET_LDFLAGS += -pthread -lrt
  310. TARGET_CFLAGS += \
  311. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  312. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_USE_VERSION_5),-std=gnu++14,-std=gnu++17)
  313. ifneq ($(findstring mips,$(ARCH)),)
  314. BOOST_ABI = o32
  315. ifneq ($(findstring 64,$(ARCH)),)
  316. BOOST_ABI = o64
  317. endif
  318. else ifneq ($(findstring arm,$(ARCH)),)
  319. BOOST_ABI = aapcs
  320. else ifeq ($(ARCH),aarch64)
  321. BOOST_ABI = aapcs
  322. else
  323. BOOST_ABI = sysv
  324. endif
  325. comma := ,
  326. define Build/Compile
  327. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu type $(CONFIG_CPU_TYPE) $(if $(CONFIG_CPU_SUBTYPE),and cpu subtype $(CONFIG_CPU_SUBTYPE),))
  328. ( cd $(PKG_BUILD_DIR) ; \
  329. echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  330. tools/build/src/user-config.jam ; \
  331. b2 \
  332. $(CONFIGURE_ARGS) \
  333. --ignore-site-config \
  334. --toolset=gcc abi=$(BOOST_ABI) \
  335. --disable-long-double \
  336. $(if $(CONFIG_boost-compile-visibility-global), visibility=global,) \
  337. $(if $(CONFIG_boost-compile-visibility-protected), visibility=protected,) \
  338. $(if $(CONFIG_boost-compile-visibility-hidden), visibility=hidden,) \
  339. $(if $(CONFIG_boost-variant-release), variant=release,) \
  340. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  341. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  342. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  343. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  344. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  345. $(if $(CONFIG_boost-static-libs),link=static,) \
  346. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  347. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  348. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  349. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  350. $(if $(CONFIG_boost-single-thread),threading=single,) \
  351. threading=multi \
  352. --without-mpi \
  353. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  354. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  355. --without-python \
  356. $(foreach lib,$(BOOST_LIBS), \
  357. $(if $(findstring python3,$(lib)),, \
  358. $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
  359. $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
  360. ) \
  361. ) \
  362. ) \
  363. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  364. boost.locale.iconv=off) \
  365. \
  366. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  367. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  368. install ;\
  369. $(if $(CONFIG_PACKAGE_boost-python3), \
  370. echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ \" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  371. tools/build/src/user-config.jam ; \
  372. echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
  373. tools/build/src/user-config.jam; \
  374. b2 -a \
  375. $(CONFIGURE_ARGS) \
  376. --ignore-site-config \
  377. --toolset=gcc abi=$(BOOST_ABI) \
  378. --disable-long-double \
  379. $(if $(CONFIG_boost-variant-release), variant=release,) \
  380. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  381. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  382. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  383. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  384. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  385. $(if $(CONFIG_boost-static-libs),link=static,) \
  386. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  387. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  388. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  389. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  390. $(if $(CONFIG_boost-single-thread),threading=single,) \
  391. threading=multi \
  392. --with-python \
  393. install ;\
  394. ,) \
  395. )
  396. endef
  397. define Build/InstallDev
  398. $(INSTALL_DIR) \
  399. $(1)/usr/include/boost/
  400. $(CP) \
  401. $(PKG_INSTALL_DIR)/include/boost/* \
  402. $(1)/usr/include/boost/ \
  403. # copies _all_ header files - independent of <--with-library>-argument above
  404. $(INSTALL_DIR) $(1)/usr/lib
  405. # copies all cmake files, compiled archive and shared object files
  406. $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
  407. endef
  408. define Host/Install
  409. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  410. $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
  411. endef
  412. define Package/boost/Default/install
  413. $(INSTALL_DIR) $(1)/usr/lib
  414. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
  415. endef
  416. define Package/boost-test/install
  417. $(INSTALL_DIR) $(1)/usr/lib
  418. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* $(1)/usr/lib/
  419. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* $(1)/usr/lib/
  420. endef
  421. define BuildBoostLibrary
  422. define Package/boost-$(1)/install
  423. $(call Package/boost/Default/install,$$(1),$(1))
  424. endef
  425. $$(eval $$(call BuildPackage,boost-$(1)))
  426. endef
  427. $(eval $(call HostBuild))
  428. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  429. $(eval $(call BuildPackage,boost-test))
  430. $(eval $(call BuildPackage,boost-libs))
  431. $(eval $(call BuildPackage,boost))