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.

508 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.74.0
  12. PKG_SOURCE_VERSION:=1_74_0
  13. PKG_RELEASE:=4
  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:=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
  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.74.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. - nowide
  56. - program_options
  57. - python3
  58. - random
  59. - regex
  60. - serialization and wserialization
  61. - stackstrace
  62. - system
  63. - thread
  64. - timer
  65. - type_erasure
  66. - wave
  67. There are many more header-only libraries supported by Boost.
  68. See more at http://www.boost.org/doc/libs/1_74_0/
  69. endef
  70. PKG_BUILD_DEPENDS:=boost/host PACKAGE_boost-python3:python3
  71. include ../../lang/python/python3-version.mk
  72. BOOST_PYTHON3_VER=$(PYTHON3_VERSION)
  73. BOOST_LIBS =
  74. define Package/boost-libs
  75. $(call Package/boost/Default)
  76. TITLE+= (all libs)
  77. DEPENDS+= $(BOOST_DEPENDS)
  78. HIDDEN:=1
  79. endef
  80. define Package/boost-libs/description
  81. This meta package contains only dependencies to the other libraries from
  82. the boost libraries collection.
  83. endef
  84. # Create a meta-package of dependent libraries (for ALL)
  85. define Package/boost-libs/install
  86. true
  87. endef
  88. define Package/boost/install
  89. true
  90. endef
  91. define Package/boost
  92. $(call Package/boost/Default)
  93. TITLE+= packages
  94. endef
  95. define Package/boost/config
  96. # Invisible config dependency
  97. config boost-context-exclude
  98. bool
  99. default y if (TARGET_arc770 || TARGET_archs38 || TARGET_octeon || TARGET_octeontx)
  100. default n
  101. config boost-coroutine-exclude
  102. bool
  103. default y if boost-context-exclude
  104. default n
  105. config boost-fiber-exclude
  106. bool
  107. default y if boost-coroutine-exclude
  108. default n
  109. menu "Select Boost Options"
  110. depends on PACKAGE_boost
  111. comment "Boost compilation options."
  112. choice
  113. prompt "Compile Visibility."
  114. default boost-compile-visibility-hidden
  115. help
  116. Choose Boost symbols compilation visibility.
  117. -> Global:
  118. - a.k.a. "default" in gcc documentation. Global symbols are considered public,
  119. they are exported from shared libraries and can be redefined by another
  120. shared library or executable.
  121. -> Protected:
  122. - a.k.a. "symbolic". Protected symbols are exported from shared libraries but
  123. cannot be redefined by another shared library or executable. This mode is
  124. not supported on some platforms, for example OS X.
  125. -> Hidden:
  126. - Hidden symbols are not exported from shared libraries and cannot be
  127. redefined by a different shared library or executable loaded in a process.
  128. In this mode, public symbols have to be explicitly marked in the source code
  129. to be exported from shared libraries. This is the recommended mode.
  130. config boost-compile-visibility-global
  131. bool "Global"
  132. config boost-compile-visibility-protected
  133. bool "Protected"
  134. config boost-compile-visibility-hidden
  135. bool "Hidden"
  136. endchoice
  137. choice
  138. prompt "Compile Boost libraries."
  139. default boost-static-and-shared-libs
  140. help
  141. Choose which version to compile.
  142. -> Shared:
  143. - Only Shared libs will be compiled.
  144. -> Static:
  145. - Only Static libs will be compiled.
  146. -> Both:
  147. - Both Static and Shared libs will be compiled.
  148. config boost-shared-libs
  149. bool "Shared"
  150. config boost-static-libs
  151. bool "Static"
  152. config boost-static-and-shared-libs
  153. bool "Both"
  154. endchoice
  155. choice
  156. prompt "Selects Boost Runtime linkage."
  157. default boost-runtime-shared
  158. help
  159. Choose which C and C++ runtimes to use:
  160. -> Use Shared runtimes.
  161. -> Use Static runtimes.
  162. - Not available if Shared libs are to be built.
  163. -> Use both runtimes.
  164. - Not available if Shared libs are to be built.
  165. - Two separate versions of Boost are built, linking each to a different runtime.
  166. - This option requires "Use tagged names" option to be active.
  167. config boost-runtime-shared
  168. bool "Shared"
  169. config boost-runtime-static
  170. depends on (!boost-shared-libs && !boost-static-and-shared-libs)
  171. bool "Static"
  172. config boost-runtime-static-and-shared
  173. depends on (boost-use-name-tags && !boost-shared-libs && !boost-static-and-shared-libs)
  174. bool "Both"
  175. endchoice
  176. choice
  177. prompt "Select a Variant."
  178. default boost-variant-release
  179. help
  180. Chooses which boost variant should be selected:
  181. -> Release: Optimizes Boost for release.
  182. - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
  183. -> Debug:
  184. - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
  185. -> Profile:
  186. - Profiling: On; Debug Symbols: On.
  187. config boost-variant-release
  188. bool "Release"
  189. config boost-variant-debug
  190. bool "Debug"
  191. config boost-variant-profile
  192. bool "Profile"
  193. endchoice
  194. config boost-use-name-tags
  195. bool "Use tagged names."
  196. help
  197. Add name tags the lib files, to diferentiate each library version:
  198. "-mt" for multi-threading.
  199. "-d" for debugging.
  200. "-s" for runtime static link".
  201. Might break compatibility with libraries that expect boost libs with default names.
  202. default n
  203. config boost-single-thread
  204. depends on boost-use-name-tags
  205. bool "Single thread Support."
  206. help
  207. Compile Boost libraries in single-thread mode.
  208. default n
  209. config boost-build-type-complete
  210. depends on boost-use-name-tags
  211. bool "Complete Boost Build."
  212. help
  213. Builds both release and debug libs. It will take much longer to compile.
  214. default n
  215. endmenu
  216. menu "Select Boost libraries"
  217. depends on PACKAGE_boost
  218. comment "Libraries"
  219. config boost-libs-all
  220. bool "Include all Boost libraries."
  221. default m if ALL
  222. select PACKAGE_boost-libs
  223. select boost-test-pkg
  224. select boost-graph-parallel
  225. config boost-test-pkg
  226. bool "Boost test package."
  227. default m if ALL
  228. select PACKAGE_boost-test
  229. config boost-graph-parallel
  230. bool "Boost parallel graph support."
  231. select PACKAGE_boost-graph
  232. default m if ALL
  233. $(foreach lib,$(BOOST_LIBS),
  234. config PACKAGE_boost-$(lib)
  235. prompt "Boost $(lib) $(if $(findstring python3,$(lib)),$(paren_left)v$(BOOST_PYTHON3_VER)$(paren_right) ,)library."
  236. default m if ALL
  237. $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
  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),) $(patsubst %,+PACKAGE_boost-$(1):%,$(5))
  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 libzstd))
  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,nowide))
  288. $(eval $(call DefineBoostLibrary,program_options))
  289. $(eval $(call DefineBoostLibrary,python3))
  290. $(eval $(call DefineBoostLibrary,random,system))
  291. $(eval $(call DefineBoostLibrary,regex))
  292. $(eval $(call DefineBoostLibrary,serialization))
  293. $(eval $(call DefineBoostLibrary,wserialization,serialization))
  294. $(eval $(call DefineBoostLibrary,stacktrace))
  295. $(eval $(call DefineBoostLibrary,system))
  296. $(eval $(call DefineBoostLibrary,thread,system chrono atomic))
  297. $(eval $(call DefineBoostLibrary,timer,chrono))
  298. $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread))
  299. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem))
  300. include $(INCLUDE_DIR)/host-build.mk
  301. define Host/Compile
  302. # b2 does not provide a configure-script nor a Makefile
  303. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  304. ( cd $(HOST_BUILD_DIR) ; \
  305. ./bootstrap.sh --prefix=$(STAGING_DIR_HOSTPKG) \
  306. --with-libraries=context,filesystem,program_options,regex,system ;\
  307. ./b2 --ignore-site-config install )
  308. endef
  309. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  310. TARGET_LDFLAGS += -pthread -lrt
  311. TARGET_CFLAGS += \
  312. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  313. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_USE_VERSION_10),-std=gnu++20,$(if $(CONFIG_GCC_USE_VERSION_5),-std=gnu++14,-std=gnu++17))
  314. ifneq ($(findstring mips,$(ARCH)),)
  315. BOOST_ABI = o32
  316. ifneq ($(findstring 64,$(ARCH)),)
  317. BOOST_ABI = o64
  318. endif
  319. else ifneq ($(findstring arm,$(ARCH)),)
  320. BOOST_ABI = aapcs
  321. else ifeq ($(ARCH),aarch64)
  322. BOOST_ABI = aapcs
  323. else
  324. BOOST_ABI = sysv
  325. endif
  326. comma := ,
  327. define Build/Compile
  328. $(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),))
  329. ( cd $(PKG_BUILD_DIR) ; \
  330. echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  331. tools/build/src/user-config.jam ; \
  332. b2 \
  333. $(CONFIGURE_ARGS) \
  334. --ignore-site-config \
  335. --toolset=gcc abi=$(BOOST_ABI) \
  336. --disable-long-double \
  337. $(if $(CONFIG_boost-compile-visibility-global), visibility=global,) \
  338. $(if $(CONFIG_boost-compile-visibility-protected), visibility=protected,) \
  339. $(if $(CONFIG_boost-compile-visibility-hidden), visibility=hidden,) \
  340. $(if $(CONFIG_boost-variant-release), variant=release,) \
  341. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  342. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  343. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  344. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  345. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  346. $(if $(CONFIG_boost-static-libs),link=static,) \
  347. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  348. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  349. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  350. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  351. $(if $(CONFIG_boost-single-thread),threading=single,) \
  352. threading=multi \
  353. --without-mpi \
  354. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  355. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  356. --without-python \
  357. $(foreach lib,$(BOOST_LIBS), \
  358. $(if $(findstring python3,$(lib)),, \
  359. $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
  360. $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
  361. ) \
  362. ) \
  363. ) \
  364. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  365. boost.locale.iconv=off) \
  366. \
  367. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  368. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  369. install ;\
  370. $(if $(CONFIG_PACKAGE_boost-python3), \
  371. 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)\" ;" > \
  372. tools/build/src/user-config.jam ; \
  373. echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
  374. tools/build/src/user-config.jam; \
  375. b2 -a \
  376. $(CONFIGURE_ARGS) \
  377. --ignore-site-config \
  378. --toolset=gcc abi=$(BOOST_ABI) \
  379. --disable-long-double \
  380. $(if $(CONFIG_boost-variant-release), variant=release,) \
  381. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  382. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  383. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  384. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  385. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  386. $(if $(CONFIG_boost-static-libs),link=static,) \
  387. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  388. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  389. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  390. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  391. $(if $(CONFIG_boost-single-thread),threading=single,) \
  392. threading=multi \
  393. --with-python \
  394. install ;\
  395. ,) \
  396. )
  397. endef
  398. define Build/InstallDev
  399. $(INSTALL_DIR) \
  400. $(1)/usr/include/boost/
  401. $(CP) \
  402. $(PKG_INSTALL_DIR)/include/boost/* \
  403. $(1)/usr/include/boost/ \
  404. # copies _all_ header files - independent of <--with-library>-argument above
  405. $(INSTALL_DIR) $(1)/usr/lib
  406. # copies all cmake files, compiled archive and shared object files
  407. $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
  408. endef
  409. define Host/Install
  410. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  411. $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
  412. endef
  413. define Package/boost/Default/install
  414. $(INSTALL_DIR) $(1)/usr/lib
  415. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
  416. endef
  417. define Package/boost-test/install
  418. $(INSTALL_DIR) $(1)/usr/lib
  419. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* $(1)/usr/lib/
  420. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* $(1)/usr/lib/
  421. endef
  422. define BuildBoostLibrary
  423. define Package/boost-$(1)/install
  424. $(call Package/boost/Default/install,$$(1),$(1))
  425. endef
  426. $$(eval $$(call BuildPackage,boost-$(1)))
  427. endef
  428. $(eval $(call HostBuild))
  429. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  430. $(eval $(call BuildPackage,boost-test))
  431. $(eval $(call BuildPackage,boost-libs))
  432. $(eval $(call BuildPackage,boost))