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