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