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.

502 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:=6
  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. define Package/boost/Default
  28. SECTION:=libs
  29. CATEGORY:=Libraries
  30. TITLE:=Boost C++ source library
  31. URL:=https://www.boost.org
  32. DEPENDS:=+libstdcpp +libpthread +librt
  33. endef
  34. define Package/boost/description
  35. This package provides the Boost v1.74.0 libraries.
  36. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  37. This package provides the following run-time libraries:
  38. - atomic
  39. - chrono
  40. - container
  41. - context
  42. - contract
  43. - coroutine and coroutine2 (Coroutine is deprecated - use Coroutine2)
  44. - date_time
  45. - exception
  46. - filesystem
  47. - fiber
  48. - graph
  49. - - graph-parallel
  50. - iostreams
  51. - locale
  52. - log
  53. - math
  54. - nowide
  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_74_0/
  68. endef
  69. PKG_BUILD_DEPENDS:=boost/host
  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 fiber,$(lib)),depends on !boost-fiber-exclude,)\
  237. $(if $(findstring context,$(lib)),depends on !boost-context-exclude,)
  238. $(if $(findstring coroutine,$(lib)),depends on !boost-coroutine-exclude,)
  239. )
  240. endmenu
  241. endef
  242. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  243. define Package/boost-test
  244. $(call Package/boost/Default)
  245. TITLE+= (test)
  246. HIDDEN:=1
  247. DEPENDS+=+boost-system +boost-timer
  248. endef
  249. define Build/Configure
  250. endef
  251. define Package/boost/Default/install
  252. $(INSTALL_DIR) $(1)/usr/lib
  253. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
  254. endef
  255. # 1: short name
  256. # 2: dependencies on other boost libraries (short name)
  257. # 3: dependencies on other packages
  258. # 4: conditional/inward dependencies
  259. # 5: dependencies compiled only when this package has been selected
  260. define DefineBoostLibrary
  261. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  262. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  263. BOOST_LIBS+= $(1)
  264. define Package/boost-$(1)
  265. $(call Package/boost/Default)
  266. TITLE+= ($(1))
  267. DEPENDS+= $(foreach lib,$(2),+boost-$(lib)) $(3) $(if $(4),@$(4),) $(patsubst %,+PACKAGE_boost-$(1):%,$(5))
  268. HIDDEN:=1
  269. endef
  270. define Package/boost-$(1)/description
  271. This package contains the Boost $(1) library.
  272. endef
  273. define Package/boost-$(1)/install
  274. $(if $(CONFIG_boost-static-libs),true,$(call Package/boost/Default/install,$$(1),$(1)))
  275. endef
  276. endef
  277. $(eval $(call DefineBoostLibrary,atomic,system))
  278. $(eval $(call DefineBoostLibrary,chrono,system))
  279. $(eval $(call DefineBoostLibrary,container))
  280. $(eval $(call DefineBoostLibrary,context,chrono system,,!boost-context-exclude))
  281. $(eval $(call DefineBoostLibrary,contract,system))
  282. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,,!boost-coroutine-exclude))
  283. $(eval $(call DefineBoostLibrary,date_time))
  284. #$(eval $(call DefineBoostLibrary,exception,,))
  285. $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
  286. $(eval $(call DefineBoostLibrary,filesystem,system))
  287. $(eval $(call DefineBoostLibrary,graph,regex))
  288. $(eval $(call DefineBoostLibrary,iostreams,,,,zlib liblzma libbz2 libzstd))
  289. $(eval $(call DefineBoostLibrary,locale,system chrono thread,,,icu))
  290. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex))
  291. $(eval $(call DefineBoostLibrary,math))
  292. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  293. $(eval $(call DefineBoostLibrary,nowide))
  294. $(eval $(call DefineBoostLibrary,program_options))
  295. $(eval $(call DefineBoostLibrary,python3,,,,python3-base))
  296. $(eval $(call DefineBoostLibrary,random,system))
  297. $(eval $(call DefineBoostLibrary,regex,,,,icu))
  298. $(eval $(call DefineBoostLibrary,serialization))
  299. $(eval $(call DefineBoostLibrary,wserialization,serialization))
  300. $(eval $(call DefineBoostLibrary,stacktrace))
  301. $(eval $(call DefineBoostLibrary,system))
  302. $(eval $(call DefineBoostLibrary,thread,system chrono atomic))
  303. $(eval $(call DefineBoostLibrary,timer,chrono))
  304. $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread))
  305. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem))
  306. include $(INCLUDE_DIR)/host-build.mk
  307. define Host/Compile
  308. # b2 does not provide a configure-script nor a Makefile
  309. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  310. ( cd $(HOST_BUILD_DIR) ; \
  311. ./bootstrap.sh --prefix=$(STAGING_DIR_HOSTPKG) \
  312. --with-libraries=context,filesystem,program_options,regex,system ;\
  313. ./b2 --ignore-site-config install )
  314. endef
  315. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  316. TARGET_LDFLAGS += -pthread -lrt -lstdc++ -Wl,--gc-sections,--as-needed,--print-gc-sections
  317. TARGET_CFLAGS += \
  318. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC -ffunction-sections -fdata-sections -flto
  319. EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_USE_VERSION_10),-std=gnu++20,$(if $(CONFIG_GCC_USE_VERSION_5),-std=gnu++14,-std=gnu++17))
  320. ifneq ($(findstring mips,$(ARCH)),)
  321. BOOST_ABI = o32
  322. ifneq ($(findstring 64,$(ARCH)),)
  323. BOOST_ABI = o64
  324. endif
  325. else ifneq ($(findstring arm,$(ARCH)),)
  326. BOOST_ABI = aapcs
  327. else ifeq ($(ARCH),aarch64)
  328. BOOST_ABI = aapcs
  329. else
  330. BOOST_ABI = sysv
  331. endif
  332. comma := ,
  333. define Build/Compile
  334. $(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),))
  335. ( cd $(PKG_BUILD_DIR) ; \
  336. echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
  337. tools/build/src/user-config.jam ; \
  338. b2 \
  339. $(CONFIGURE_ARGS) \
  340. --ignore-site-config \
  341. --toolset=gcc abi=$(BOOST_ABI) \
  342. --disable-long-double \
  343. $(if $(CONFIG_boost-compile-visibility-global), visibility=global,) \
  344. $(if $(CONFIG_boost-compile-visibility-protected), visibility=protected,) \
  345. $(if $(CONFIG_boost-compile-visibility-hidden), visibility=hidden,) \
  346. $(if $(CONFIG_boost-variant-release), variant=release,) \
  347. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  348. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  349. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  350. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  351. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  352. $(if $(CONFIG_boost-static-libs),link=static,) \
  353. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  354. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  355. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  356. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  357. $(if $(CONFIG_boost-single-thread),threading=single,) \
  358. threading=multi \
  359. --without-mpi \
  360. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  361. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  362. --without-python \
  363. $(foreach lib,$(BOOST_LIBS), \
  364. $(if $(findstring python3,$(lib)),, \
  365. $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
  366. $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
  367. ) \
  368. ) \
  369. ) \
  370. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.std=off boost.locale.posix=off) \
  371. \
  372. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  373. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  374. install ;\
  375. $(if $(CONFIG_PACKAGE_boost-python3), \
  376. 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)\" ;" > \
  377. tools/build/src/user-config.jam ; \
  378. echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
  379. tools/build/src/user-config.jam; \
  380. b2 -a \
  381. $(CONFIGURE_ARGS) \
  382. --ignore-site-config \
  383. --toolset=gcc abi=$(BOOST_ABI) \
  384. --disable-long-double \
  385. $(if $(CONFIG_boost-variant-release), variant=release,) \
  386. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  387. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  388. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  389. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  390. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  391. $(if $(CONFIG_boost-static-libs),link=static,) \
  392. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  393. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  394. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  395. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  396. $(if $(CONFIG_boost-single-thread),threading=single,) \
  397. threading=multi \
  398. --with-python \
  399. install ;\
  400. ,) \
  401. )
  402. endef
  403. define Build/InstallDev
  404. $(INSTALL_DIR) \
  405. $(1)/usr/include/boost/
  406. $(CP) \
  407. $(PKG_INSTALL_DIR)/include/boost/* \
  408. $(1)/usr/include/boost/ \
  409. # copies _all_ header files - independent of <--with-library>-argument above
  410. $(INSTALL_DIR) $(1)/usr/lib
  411. # copies all cmake files, compiled archive and shared object files
  412. $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
  413. endef
  414. define Host/Install
  415. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  416. $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
  417. endef
  418. define Package/boost-test/install
  419. $(if $(CONFIG_boost-static-libs),true,
  420. $(INSTALL_DIR) $(1)/usr/lib
  421. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_{unit_test_framework,prg_exec_monitor}*.so* $(1)/usr/lib/
  422. )
  423. endef
  424. $(eval $(call HostBuild))
  425. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildPackage,boost-$(lib))))
  426. $(eval $(call BuildPackage,boost-test))
  427. $(eval $(call BuildPackage,boost-libs))
  428. $(eval $(call BuildPackage,boost))