Merge pull request #13636 from neheb/pdnsr2
[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.74.0
15 PKG_SOURCE_VERSION:=1_74_0
16 PKG_RELEASE:=4
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:=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
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 include $(INCLUDE_DIR)/nls.mk
36
37 define Package/boost/Default
38 SECTION:=libs
39 CATEGORY:=Libraries
40 TITLE:=Boost C++ source library
41 URL:=https://www.boost.org
42 DEPENDS:=+libstdcpp +libpthread +librt
43 endef
44
45 define Package/boost/description
46 This package provides the Boost v1.74.0 libraries.
47 Boost is a set of free, peer-reviewed, portable C++ source libraries.
48
49 This package provides the following run-time libraries:
50 - atomic
51 - chrono
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 - locale (Requires kernel being compiled with full language support)
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_74_0/
81 endef
82
83 PKG_BUILD_DEPENDS:=boost/host PACKAGE_boost-python3:python3
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 || TARGET_octeon || TARGET_octeontx)
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 locale,$(lib)),depends on BUILD_NLS,)\
286 $(if $(findstring fiber,$(lib)),depends on !boost-fiber-exclude,)\
287 $(if $(findstring context,$(lib)),depends on !boost-context-exclude,)
288 $(if $(findstring coroutine,$(lib)),depends on !boost-coroutine-exclude,)
289 )
290 endmenu
291 endef
292
293 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
294
295 define Package/boost-test
296 $(call Package/boost/Default)
297 TITLE+= (test)
298 HIDDEN:=1
299 DEPENDS+=+boost-system +boost-timer
300 endef
301
302 define Build/Configure
303 endef
304
305 # 1: short name
306 # 2: dependencies on other boost libraries (short name)
307 # 3: dependencies on other packages
308 # 4: conditional/inward dependencies
309 define DefineBoostLibrary
310
311 BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
312 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
313
314 BOOST_LIBS+= $(1)
315
316 define Package/boost-$(1)
317 $(call Package/boost/Default)
318 TITLE+= ($(1))
319 DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),) $(patsubst %,+PACKAGE_boost-$(1):%,$(5))
320 HIDDEN:=1
321 endef
322
323 define Package/boost-$(1)/description
324 This package contains the Boost $(1) library.
325 endef
326 endef
327
328 $(eval $(call DefineBoostLibrary,atomic,system))
329 $(eval $(call DefineBoostLibrary,chrono,system))
330 $(eval $(call DefineBoostLibrary,container))
331 $(eval $(call DefineBoostLibrary,context,chrono system,,!boost-context-exclude))
332 $(eval $(call DefineBoostLibrary,contract,system))
333 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,,!boost-coroutine-exclude))
334 $(eval $(call DefineBoostLibrary,date_time))
335 #$(eval $(call DefineBoostLibrary,exception,,))
336 $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
337 $(eval $(call DefineBoostLibrary,filesystem,system))
338 $(eval $(call DefineBoostLibrary,graph,regex))
339 $(eval $(call DefineBoostLibrary,iostreams,,,,zlib liblzma libbz2 libzstd))
340 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
341 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex))
342 $(eval $(call DefineBoostLibrary,math))
343 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
344 $(eval $(call DefineBoostLibrary,nowide))
345 $(eval $(call DefineBoostLibrary,program_options))
346 $(eval $(call DefineBoostLibrary,python3))
347 $(eval $(call DefineBoostLibrary,random,system))
348 $(eval $(call DefineBoostLibrary,regex))
349 $(eval $(call DefineBoostLibrary,serialization))
350 $(eval $(call DefineBoostLibrary,wserialization,serialization))
351 $(eval $(call DefineBoostLibrary,stacktrace))
352 $(eval $(call DefineBoostLibrary,system))
353 $(eval $(call DefineBoostLibrary,thread,system chrono atomic))
354 $(eval $(call DefineBoostLibrary,timer,chrono))
355 $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread))
356 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem))
357
358 include $(INCLUDE_DIR)/host-build.mk
359
360 define Host/Compile
361 # b2 does not provide a configure-script nor a Makefile
362 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
363
364 ( cd $(HOST_BUILD_DIR) ; \
365 ./bootstrap.sh --prefix=$(STAGING_DIR_HOSTPKG) \
366 --with-libraries=context,filesystem,program_options,regex,system ;\
367 ./b2 --ignore-site-config install )
368 endef
369
370 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
371 TARGET_LDFLAGS += -pthread -lrt
372
373 TARGET_CFLAGS += \
374 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
375
376 EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_USE_VERSION_10),-std=gnu++20,$(if $(CONFIG_GCC_USE_VERSION_5),-std=gnu++14,-std=gnu++17))
377
378 ifneq ($(findstring mips,$(ARCH)),)
379 BOOST_ABI = o32
380 ifneq ($(findstring 64,$(ARCH)),)
381 BOOST_ABI = o64
382 endif
383 else ifneq ($(findstring arm,$(ARCH)),)
384 BOOST_ABI = aapcs
385 else ifeq ($(ARCH),aarch64)
386 BOOST_ABI = aapcs
387 else
388 BOOST_ABI = sysv
389 endif
390
391 comma := ,
392
393 define Build/Compile
394 $(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),))
395 ( cd $(PKG_BUILD_DIR) ; \
396 echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
397 tools/build/src/user-config.jam ; \
398 b2 \
399 $(CONFIGURE_ARGS) \
400 --ignore-site-config \
401 --toolset=gcc abi=$(BOOST_ABI) \
402 --disable-long-double \
403 $(if $(CONFIG_boost-compile-visibility-global), visibility=global,) \
404 $(if $(CONFIG_boost-compile-visibility-protected), visibility=protected,) \
405 $(if $(CONFIG_boost-compile-visibility-hidden), visibility=hidden,) \
406 $(if $(CONFIG_boost-variant-release), variant=release,) \
407 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
408 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
409 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
410 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
411 $(if $(CONFIG_boost-shared-libs),link=shared,) \
412 $(if $(CONFIG_boost-static-libs),link=static,) \
413 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
414 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
415 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
416 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
417 $(if $(CONFIG_boost-single-thread),threading=single,) \
418 threading=multi \
419 --without-mpi \
420 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
421 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
422 --without-python \
423 $(foreach lib,$(BOOST_LIBS), \
424 $(if $(findstring python3,$(lib)),, \
425 $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
426 $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
427 ) \
428 ) \
429 ) \
430 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
431 boost.locale.iconv=off) \
432 \
433 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
434 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
435 install ;\
436 $(if $(CONFIG_PACKAGE_boost-python3), \
437 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)\" ;" > \
438 tools/build/src/user-config.jam ; \
439 echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
440 tools/build/src/user-config.jam; \
441 b2 -a \
442 $(CONFIGURE_ARGS) \
443 --ignore-site-config \
444 --toolset=gcc abi=$(BOOST_ABI) \
445 --disable-long-double \
446 $(if $(CONFIG_boost-variant-release), variant=release,) \
447 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
448 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
449 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
450 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
451 $(if $(CONFIG_boost-shared-libs),link=shared,) \
452 $(if $(CONFIG_boost-static-libs),link=static,) \
453 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
454 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
455 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
456 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
457 $(if $(CONFIG_boost-single-thread),threading=single,) \
458 threading=multi \
459 --with-python \
460 install ;\
461 ,) \
462 )
463 endef
464
465 define Build/InstallDev
466 $(INSTALL_DIR) \
467 $(1)/usr/include/boost/
468
469 $(CP) \
470 $(PKG_INSTALL_DIR)/include/boost/* \
471 $(1)/usr/include/boost/ \
472 # copies _all_ header files - independent of <--with-library>-argument above
473
474 $(INSTALL_DIR) $(1)/usr/lib
475 # copies all cmake files, compiled archive and shared object files
476 $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
477 endef
478
479 define Host/Install
480 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
481 $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
482 endef
483
484 define Package/boost/Default/install
485 $(INSTALL_DIR) $(1)/usr/lib
486 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
487 endef
488
489 define Package/boost-test/install
490 $(INSTALL_DIR) $(1)/usr/lib
491 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* $(1)/usr/lib/
492 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* $(1)/usr/lib/
493 endef
494
495 define BuildBoostLibrary
496 define Package/boost-$(1)/install
497 $(call Package/boost/Default/install,$$(1),$(1))
498 endef
499
500 $$(eval $$(call BuildPackage,boost-$(1)))
501 endef
502
503 $(eval $(call HostBuild))
504
505 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
506 $(eval $(call BuildPackage,boost-test))
507 $(eval $(call BuildPackage,boost-libs))
508 $(eval $(call BuildPackage,boost))