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