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.

504 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.77.0
  12. PKG_SOURCE_VERSION:=1_77_0
  13. PKG_RELEASE:=$(AUTORELEASE)
  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:=fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854
  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.77.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. - json
  52. - locale
  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_77_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)
  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 fiber,$(lib)),depends on !boost-fiber-exclude,)\
  238. $(if $(findstring context,$(lib)),depends on !boost-context-exclude,)
  239. $(if $(findstring coroutine,$(lib)),depends on !boost-coroutine-exclude,)
  240. )
  241. endmenu
  242. endef
  243. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  244. define Package/boost-test
  245. $(call Package/boost/Default)
  246. TITLE+= (test)
  247. HIDDEN:=1
  248. DEPENDS+=+boost-system +boost-timer
  249. endef
  250. define Build/Configure
  251. endef
  252. define Package/boost/Default/install
  253. $(INSTALL_DIR) $(1)/usr/lib
  254. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
  255. endef
  256. # 1: short name
  257. # 2: dependencies on other boost libraries (short name)
  258. # 3: dependencies on other packages
  259. # 4: conditional/inward dependencies
  260. # 5: dependencies compiled only when this package has been selected
  261. define DefineBoostLibrary
  262. BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
  263. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  264. BOOST_LIBS+= $(1)
  265. define Package/boost-$(1)
  266. $(call Package/boost/Default)
  267. TITLE+= ($(1))
  268. DEPENDS+= $(foreach lib,$(2),+boost-$(lib)) $(3) $(if $(4),@$(4),) $(patsubst %,+PACKAGE_boost-$(1):%,$(5))
  269. HIDDEN:=1
  270. endef
  271. define Package/boost-$(1)/description
  272. This package contains the Boost $(1) library.
  273. endef
  274. define Package/boost-$(1)/install
  275. $(if $(CONFIG_boost-static-libs),true,$(call Package/boost/Default/install,$$(1),$(1)))
  276. endef
  277. endef
  278. $(eval $(call DefineBoostLibrary,atomic,system))
  279. $(eval $(call DefineBoostLibrary,chrono,system))
  280. $(eval $(call DefineBoostLibrary,container))
  281. $(eval $(call DefineBoostLibrary,context,chrono system,,!boost-context-exclude))
  282. $(eval $(call DefineBoostLibrary,contract,system))
  283. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,,!boost-coroutine-exclude))
  284. $(eval $(call DefineBoostLibrary,date_time))
  285. #$(eval $(call DefineBoostLibrary,exception,,))
  286. $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
  287. $(eval $(call DefineBoostLibrary,filesystem,system atomic))
  288. $(eval $(call DefineBoostLibrary,graph,regex))
  289. $(eval $(call DefineBoostLibrary,iostreams,,,,zlib liblzma libbz2 libzstd))
  290. $(eval $(call DefineBoostLibrary,json,container))
  291. $(eval $(call DefineBoostLibrary,locale,system chrono thread,,,icu))
  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,,,,icu))
  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 = n64
  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.std=off boost.locale.posix=off) \
  373. \
  374. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  375. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  376. install ;\
  377. $(if $(CONFIG_PACKAGE_boost-python3), \
  378. 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)\" ;" > \
  379. tools/build/src/user-config.jam ; \
  380. echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
  381. tools/build/src/user-config.jam; \
  382. b2 -a \
  383. $(CONFIGURE_ARGS) \
  384. --ignore-site-config \
  385. --toolset=gcc abi=$(BOOST_ABI) \
  386. --disable-long-double \
  387. $(if $(CONFIG_boost-variant-release), variant=release,) \
  388. $(if $(CONFIG_boost-variant-debug), variant=debug,) \
  389. $(if $(CONFIG_boost-variant-profile), variant=profile,) \
  390. $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
  391. $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
  392. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  393. $(if $(CONFIG_boost-static-libs),link=static,) \
  394. $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
  395. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  396. $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
  397. $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
  398. $(if $(CONFIG_boost-single-thread),threading=single,) \
  399. threading=multi \
  400. --with-python \
  401. install ;\
  402. ,) \
  403. )
  404. endef
  405. define Build/InstallDev
  406. $(INSTALL_DIR) \
  407. $(1)/usr/include/boost/
  408. $(CP) \
  409. $(PKG_INSTALL_DIR)/include/boost/* \
  410. $(1)/usr/include/boost/ \
  411. # copies _all_ header files - independent of <--with-library>-argument above
  412. $(INSTALL_DIR) $(1)/usr/lib
  413. # copies all cmake files, compiled archive and shared object files
  414. $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
  415. endef
  416. define Host/Install
  417. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
  418. $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
  419. endef
  420. define Package/boost-test/install
  421. $(if $(CONFIG_boost-static-libs),true,
  422. $(INSTALL_DIR) $(1)/usr/lib
  423. $(CP) $(PKG_INSTALL_DIR)/lib/libboost_{unit_test_framework,prg_exec_monitor}*.so* $(1)/usr/lib/
  424. )
  425. endef
  426. $(eval $(call HostBuild))
  427. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildPackage,boost-$(lib))))
  428. $(eval $(call BuildPackage,boost-test))
  429. $(eval $(call BuildPackage,boost-libs))
  430. $(eval $(call BuildPackage,boost))