Merge pull request #12036 from micmac1/json-glib
[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.73.0
15 PKG_SOURCE_VERSION:=1_73_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:=4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402
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.73.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 - 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_72_0/
80 endef
81
82 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python3:python3
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 locale,$(lib)),depends on BUILD_NLS,)\
285 $(if $(findstring python3,$(lib)),depends on PACKAGE_python3,)\
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),)
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 +zstd))
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,program_options))
345 $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
346 $(eval $(call DefineBoostLibrary,random,system))
347 $(eval $(call DefineBoostLibrary,regex))
348 $(eval $(call DefineBoostLibrary,serialization))
349 $(eval $(call DefineBoostLibrary,wserialization,serialization))
350 $(eval $(call DefineBoostLibrary,stacktrace))
351 $(eval $(call DefineBoostLibrary,system))
352 $(eval $(call DefineBoostLibrary,thread,system chrono atomic))
353 $(eval $(call DefineBoostLibrary,timer,chrono))
354 $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread))
355 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem))
356
357 include $(INCLUDE_DIR)/host-build.mk
358
359 define Host/Compile
360 # b2 does not provide a configure-script nor a Makefile
361 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
362
363 ( cd $(HOST_BUILD_DIR) ; \
364 ./bootstrap.sh --prefix=$(STAGING_DIR_HOSTPKG) \
365 --with-libraries=context,filesystem,program_options,regex,system ;\
366 ./b2 --ignore-site-config install )
367 endef
368
369 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
370 TARGET_LDFLAGS += -pthread -lrt
371
372 TARGET_CFLAGS += \
373 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
374
375 EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_USE_VERSION_5),-std=gnu++14,-std=gnu++17)
376
377 ifneq ($(findstring mips,$(ARCH)),)
378 BOOST_ABI = o32
379 ifneq ($(findstring 64,$(ARCH)),)
380 BOOST_ABI = o64
381 endif
382 else ifneq ($(findstring arm,$(ARCH)),)
383 BOOST_ABI = aapcs
384 else ifeq ($(ARCH),aarch64)
385 BOOST_ABI = aapcs
386 else
387 BOOST_ABI = sysv
388 endif
389
390 comma := ,
391
392 define Build/Compile
393 $(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),))
394 ( cd $(PKG_BUILD_DIR) ; \
395 echo "using gcc : $(GCC_VERSION) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > \
396 tools/build/src/user-config.jam ; \
397 b2 \
398 $(CONFIGURE_ARGS) \
399 --ignore-site-config \
400 --toolset=gcc abi=$(BOOST_ABI) \
401 --disable-long-double \
402 $(if $(CONFIG_boost-compile-visibility-global), visibility=global,) \
403 $(if $(CONFIG_boost-compile-visibility-protected), visibility=protected,) \
404 $(if $(CONFIG_boost-compile-visibility-hidden), visibility=hidden,) \
405 $(if $(CONFIG_boost-variant-release), variant=release,) \
406 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
407 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
408 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
409 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
410 $(if $(CONFIG_boost-shared-libs),link=shared,) \
411 $(if $(CONFIG_boost-static-libs),link=static,) \
412 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
413 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
414 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
415 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
416 $(if $(CONFIG_boost-single-thread),threading=single,) \
417 threading=multi \
418 --without-mpi \
419 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
420 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
421 --without-python \
422 $(foreach lib,$(BOOST_LIBS), \
423 $(if $(findstring python3,$(lib)),, \
424 $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
425 $(if $(findstring wserialization,$(lib)),,--without-$(lib)) \
426 ) \
427 ) \
428 ) \
429 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
430 boost.locale.iconv=off) \
431 \
432 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
433 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
434 install ;\
435 $(if $(CONFIG_PACKAGE_boost-python3), \
436 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)\" ;" > \
437 tools/build/src/user-config.jam ; \
438 echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
439 tools/build/src/user-config.jam; \
440 b2 -a \
441 $(CONFIGURE_ARGS) \
442 --ignore-site-config \
443 --toolset=gcc abi=$(BOOST_ABI) \
444 --disable-long-double \
445 $(if $(CONFIG_boost-variant-release), variant=release,) \
446 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
447 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
448 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
449 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
450 $(if $(CONFIG_boost-shared-libs),link=shared,) \
451 $(if $(CONFIG_boost-static-libs),link=static,) \
452 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
453 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
454 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
455 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
456 $(if $(CONFIG_boost-single-thread),threading=single,) \
457 threading=multi \
458 --with-python \
459 install ;\
460 ,) \
461 )
462 endef
463
464 define Build/InstallDev
465 $(INSTALL_DIR) \
466 $(1)/usr/include/boost/
467
468 $(CP) \
469 $(PKG_INSTALL_DIR)/include/boost/* \
470 $(1)/usr/include/boost/ \
471 # copies _all_ header files - independent of <--with-library>-argument above
472
473 $(INSTALL_DIR) $(1)/usr/lib
474 # copies all cmake files, compiled archive and shared object files
475 $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
476 endef
477
478 define Host/Install
479 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
480 $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
481 endef
482
483 define Package/boost/Default/install
484 $(INSTALL_DIR) $(1)/usr/lib
485 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
486 endef
487
488 define Package/boost-test/install
489 $(INSTALL_DIR) $(1)/usr/lib
490 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* $(1)/usr/lib/
491 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* $(1)/usr/lib/
492 endef
493
494 define BuildBoostLibrary
495 define Package/boost-$(1)/install
496 $(call Package/boost/Default/install,$$(1),$(1))
497 endef
498
499 $$(eval $$(call BuildPackage,boost-$(1)))
500 endef
501
502 $(eval $(call HostBuild))
503
504 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
505 $(eval $(call BuildPackage,boost-test))
506 $(eval $(call BuildPackage,boost-libs))
507 $(eval $(call BuildPackage,boost))