Merge pull request #13691 from BKPepe/babel
[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:=5
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
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 define Package/boost/Default/install
306 $(INSTALL_DIR) $(1)/usr/lib
307 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* $(1)/usr/lib/
308 endef
309
310 # 1: short name
311 # 2: dependencies on other boost libraries (short name)
312 # 3: dependencies on other packages
313 # 4: conditional/inward dependencies
314 # 5: dependencies compiled only when this package has been selected
315 define DefineBoostLibrary
316 BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
317 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
318
319 BOOST_LIBS+= $(1)
320
321 define Package/boost-$(1)
322 $(call Package/boost/Default)
323 TITLE+= ($(1))
324 DEPENDS+= $(foreach lib,$(2),+boost-$(lib)) $(3) $(if $(4),@$(4),) $(patsubst %,+PACKAGE_boost-$(1):%,$(5))
325 HIDDEN:=1
326 endef
327
328 define Package/boost-$(1)/description
329 This package contains the Boost $(1) library.
330 endef
331
332 define Package/boost-$(1)/install
333 $(if $(CONFIG_boost-static-libs),true,$(call Package/boost/Default/install,$$(1),$(1)))
334 endef
335 endef
336
337 $(eval $(call DefineBoostLibrary,atomic,system))
338 $(eval $(call DefineBoostLibrary,chrono,system))
339 $(eval $(call DefineBoostLibrary,container))
340 $(eval $(call DefineBoostLibrary,context,chrono system,,!boost-context-exclude))
341 $(eval $(call DefineBoostLibrary,contract,system))
342 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,,!boost-coroutine-exclude))
343 $(eval $(call DefineBoostLibrary,date_time))
344 #$(eval $(call DefineBoostLibrary,exception,,))
345 $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,!boost-fiber-exclude))
346 $(eval $(call DefineBoostLibrary,filesystem,system))
347 $(eval $(call DefineBoostLibrary,graph,regex))
348 $(eval $(call DefineBoostLibrary,iostreams,,,,zlib liblzma libbz2 libzstd))
349 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
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))
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 = o64
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.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
440 boost.locale.iconv=off) \
441 \
442 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
443 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
444 install ;\
445 $(if $(CONFIG_PACKAGE_boost-python3), \
446 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)\" ;" > \
447 tools/build/src/user-config.jam ; \
448 echo "using python : $(BOOST_PYTHON3_VER) : : $(STAGING_DIR)/usr/include/python$(BOOST_PYTHON3_VER)/ : $(STAGING_DIR)/usr/lib/libpython$(BOOST_PYTHON3_VER).so ;" >> \
449 tools/build/src/user-config.jam; \
450 b2 -a \
451 $(CONFIGURE_ARGS) \
452 --ignore-site-config \
453 --toolset=gcc abi=$(BOOST_ABI) \
454 --disable-long-double \
455 $(if $(CONFIG_boost-variant-release), variant=release,) \
456 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
457 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
458 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
459 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
460 $(if $(CONFIG_boost-shared-libs),link=shared,) \
461 $(if $(CONFIG_boost-static-libs),link=static,) \
462 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
463 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
464 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
465 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
466 $(if $(CONFIG_boost-single-thread),threading=single,) \
467 threading=multi \
468 --with-python \
469 install ;\
470 ,) \
471 )
472 endef
473
474 define Build/InstallDev
475 $(INSTALL_DIR) \
476 $(1)/usr/include/boost/
477
478 $(CP) \
479 $(PKG_INSTALL_DIR)/include/boost/* \
480 $(1)/usr/include/boost/ \
481 # copies _all_ header files - independent of <--with-library>-argument above
482
483 $(INSTALL_DIR) $(1)/usr/lib
484 # copies all cmake files, compiled archive and shared object files
485 $(CP) -v $(PKG_INSTALL_DIR)/lib/{*.{a,so*},cmake} $(1)/usr/lib/ || :
486 endef
487
488 define Host/Install
489 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
490 $(CP) $(HOST_BUILD_DIR)/tools/build/src/engine/b2 $(STAGING_DIR_HOSTPKG)/bin/
491 endef
492
493 define Package/boost-test/install
494 $(if $(CONFIG_boost-static-libs),true,
495 $(INSTALL_DIR) $(1)/usr/lib
496 $(CP) $(PKG_INSTALL_DIR)/lib/libboost_{unit_test_framework,prg_exec_monitor}*.so* $(1)/usr/lib/
497 )
498 endef
499
500 $(eval $(call HostBuild))
501
502 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildPackage,boost-$(lib))))
503 $(eval $(call BuildPackage,boost-test))
504 $(eval $(call BuildPackage,boost-libs))
505 $(eval $(call BuildPackage,boost))