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.

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