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