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