e7ffd91b366c71b157c902c8151048e99586428c
[feed/packages.git] / libs / boost / Makefile
1 #
2 # Copyright (C) 2015-2018 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 #
9 # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
10 # Dude, this "boost" is really one of the most crude stuff I ported yet.
11 #
12
13
14 include $(TOPDIR)/rules.mk
15 include $(INCLUDE_DIR)/nls.mk
16 include $(INCLUDE_DIR)/target.mk
17
18 PKG_NAME:=boost
19 PKG_VERSION:=1.67.0
20 PKG_SOURCE_VERSION:=1_67_0
21 PKG_RELEASE:=2
22
23 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
24 PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_NAME)/$(PKG_VERSION) https://dl.bintray.com/boostorg/release/$(PKG_VERSION)/source/
25 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
26 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
27 PKG_HASH:=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
28 PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
29 PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
30
31 PKG_BUILD_PARALLEL:=0
32 PKG_USE_MIPS16:=0
33
34 include $(INCLUDE_DIR)/package.mk
35 include $(INCLUDE_DIR)/host-build.mk
36
37
38 define Package/boost/Default
39 SECTION:=libs
40 CATEGORY:=Libraries
41 TITLE:=Boost C++ source library
42 URL:=http://www.boost.org
43 DEPENDS:=+libstdcpp +libpthread +librt
44 endef
45
46 define Package/boost/description
47 This package provides the Boost v1.67.0 libraries.
48 Boost is a set of free, peer-reviewed, portable C++ source libraries.
49
50 -----------------------------------------------------------------------------
51 | Warning |
52 | In order to build all of the Boost Libraries, it is necessary |
53 | to use, at least, GCC version 5 (C++14 support) and, it is necessary to |
54 | compile the kernel with Full Language Support. |
55 | Without these requirerements, the following libs will not be available: |
56 | - Boost.Locale |
57 | - Boost.Coroutine2 (header-only library - requires C++11) |
58 | - Boost.Fiber (requires C++14) |
59 -----------------------------------------------------------------------------
60
61 This package provides the following run-time libraries:
62 - atomic
63 - chrono
64 - container
65 - context
66 - contract (new in 1.67.0)
67 - coroutine (Deprecated - use Coroutine2)
68 - - coroutine2 (Requires GCC v5 and up)
69 - date_time
70 - exception
71 - filesystem
72 - fiber (Requires GCC v5 and up)
73 - graph
74 - - graph-parallel
75 - iostreams
76 - locale (Requires kernel being compiled with full language support)
77 - log
78 - math
79 - program_options
80 - python
81 - python3
82 - random
83 - regex
84 - serialization and wserialization
85 - signals
86 - stackstrace
87 - system
88 - thread
89 - timer
90 - type_erasure
91 - wave
92
93 There are many more header-only libraries supported by Boost.
94 See more at http://www.boost.org/doc/libs/1_67_0/
95 endef
96
97 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
98
99 BOOST_LIBS =
100
101 define Package/boost-libs
102 $(call Package/boost/Default)
103 TITLE+= (all libs)
104 DEPENDS+= $(BOOST_DEPENDS)
105 HIDDEN:=1
106 endef
107
108 define Package/boost-libs/description
109 This meta package contains only dependencies to the other libraries from
110 the boost libraries collection.
111 endef
112
113 # Create a meta-package of dependent libraries (for ALL)
114 define Package/boost-libs/install
115 true
116 endef
117
118 define Package/boost/install
119 true
120 endef
121
122 define Package/boost
123 $(call Package/boost/Default)
124 TITLE+= packages
125 endef
126
127 define Package/boost/config
128 menu "Select Boost Options"
129 depends on PACKAGE_boost
130 comment "Boost compilation options."
131
132 choice
133 prompt "Compile Boost libraries."
134 default boost-static-and-shared-libs
135 help
136 Choose which version to compile.
137 -> Shared:
138 - Only Shared libs will be compiled.
139 -> Static:
140 - Only Static libs will be compiled.
141 -> Both:
142 - Both Static and Shared libs will be compiled.
143
144 config boost-shared-libs
145 bool "Shared"
146
147 config boost-static-libs
148 bool "Static"
149
150 config boost-static-and-shared-libs
151 bool "Both"
152 endchoice
153
154 choice
155 prompt "Selects Boost Runtime linkage."
156 default boost-runtime-shared
157 help
158 Choose which C and C++ runtimes to use:
159 -> Use Shared runtimes.
160 -> Use Static runtimes.
161 - Not available if Shared libs are to be built.
162 -> Use both runtimes.
163 - Not available if Shared libs are to be built.
164 - Two separate versions of Boost are built, linking each to a different runtime.
165 - This option requires "Use tagged names" option to be active.
166
167 config boost-runtime-shared
168 bool "Shared"
169
170 config boost-runtime-static
171 depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
172 bool "Static"
173
174 config boost-runtime-static-and-shared
175 depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
176 bool "Both"
177 endchoice
178
179 choice
180 prompt "Select a Variant."
181 default boost-variant-release
182 help
183 Chooses which boost variant should be selected:
184 -> Release: Optimizes Boost for release.
185 - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
186 -> Debug:
187 - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
188 -> Profile:
189 - Profiling: On; Debug Symbols: On.
190
191 config boost-variant-release
192 bool "Release"
193
194 config boost-variant-debug
195 bool "Debug"
196
197 config boost-variant-profile
198 bool "Profile"
199 endchoice
200
201 config boost-use-name-tags
202 bool "Use tagged names."
203 help
204 Add name tags the lib files, to diferentiate each library version:
205 "-mt" for multi-threading.
206 "-d" for debugging.
207 "-s" for runtime static link".
208 Might break compatibility with libraries that expect boost libs with default names.
209 default n
210
211 config boost-single-thread
212 depends on @boost-use-name-tags
213 bool "Single thread Support."
214 help
215 Compile Boost libraries in single-thread mode.
216 default n
217
218 config boost-build-type-complete
219 depends on @boost-use-name-tags
220 bool "Complete Boost Build."
221 help
222 Builds both release and debug libs. It will take much longer to compile.
223 default n
224 endmenu
225
226 menu "Select Boost libraries"
227 depends on PACKAGE_boost
228 comment "Libraries"
229
230 config boost-libs-all
231 bool "Include all Boost libraries."
232 default m if ALL
233 select PACKAGE_boost-libs
234 select boost-test-pkg
235 select boost-coroutine2
236 select boost-graph-parallel
237
238 config boost-test-pkg
239 bool "Boost test package."
240 default m if ALL
241 select PACKAGE_boost-test
242
243 config boost-coroutine2
244 depends on !@GCC_VERSION_4_8
245 bool "Boost couroutine2 support."
246 select PACKAGE_boost-coroutine
247 default n
248
249 config boost-graph-parallel
250 bool "Boost parallel graph support."
251 select PACKAGE_boost-graph
252 default n
253
254 $(foreach lib,$(BOOST_LIBS), \
255 config PACKAGE_boost-$(lib)
256 prompt "Boost $(lib) library."
257 default m if ALL
258 $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
259 $(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)
260
261 )
262 endmenu
263
264 endef
265
266 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
267
268 define Package/boost-test
269 $(call Package/boost/Default)
270 TITLE+= (test)
271 HIDDEN:=1
272 DEPENDS+=+boost-system +boost-timer
273 endef
274
275 define Build/Configure
276 endef
277
278 # 1: short name
279 # 2: dependencies on other boost libraries (short name)
280 # 3: dependencies on other packages
281 # 4: conditional/inward dependencies
282 define DefineBoostLibrary
283
284 BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
285 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
286
287 BOOST_LIBS+= $(1)
288
289 define Package/boost-$(1)
290 $(call Package/boost/Default)
291 TITLE+= ($(1))
292 DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
293 HIDDEN:=1
294 endef
295
296 define Package/boost-$(1)/description
297 This package contains the Boost $(1) library.
298 endef
299 endef
300
301 $(eval $(call DefineBoostLibrary,atomic,system,))
302 $(eval $(call DefineBoostLibrary,chrono,system,))
303 $(eval $(call DefineBoostLibrary,container,,))
304 $(eval $(call DefineBoostLibrary,context,chrono system thread,))
305 $(eval $(call DefineBoostLibrary,contract,system,))
306 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
307 $(eval $(call DefineBoostLibrary,date_time,,))
308 #$(eval $(call DefineBoostLibrary,exception,,))
309 $(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,))
310 $(eval $(call DefineBoostLibrary,filesystem,system,))
311 $(eval $(call DefineBoostLibrary,graph,regex,))
312 $(eval $(call DefineBoostLibrary,iostreams,,+zlib +liblzma +libbz2))
313 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
314 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
315 $(eval $(call DefineBoostLibrary,math,,))
316 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
317 $(eval $(call DefineBoostLibrary,program_options,,))
318 $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
319 $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
320 $(eval $(call DefineBoostLibrary,random,system,))
321 $(eval $(call DefineBoostLibrary,regex,,))
322 $(eval $(call DefineBoostLibrary,serialization,,))
323 $(eval $(call DefineBoostLibrary,wserialization,serialization,))
324 $(eval $(call DefineBoostLibrary,signals,,))
325 $(eval $(call DefineBoostLibrary,stacktrace,,))
326 $(eval $(call DefineBoostLibrary,system,,))
327 $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
328 $(eval $(call DefineBoostLibrary,timer,chrono))
329 $(eval $(call DefineBoostLibrary,type_erasure,chrono system thread,))
330 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
331
332
333 define Host/Compile
334 # b2 does not provide a configure-script nor a Makefile
335 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
336 endef
337
338 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
339 TARGET_LDFLAGS += -pthread -lrt
340
341 TARGET_CFLAGS += \
342 $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
343 $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.6/) \
344 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
345
346 EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
347
348 ifneq ($(findstring mips,$(ARCH)),)
349 BOOST_ABI = o32
350 ifneq ($(findstring 64,$(ARCH)),)
351 BOOST_ABI = o64
352 endif
353 else ifneq ($(findstring arm,$(ARCH)),)
354 BOOST_ABI = aapcs
355 else ifeq ($(ARCH),aarch64)
356 BOOST_ABI = aapcs
357 else
358 BOOST_ABI = sysv
359 endif
360
361 comma := ,
362
363 define Build/Compile
364 $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
365 ( cd $(PKG_BUILD_DIR) ; \
366 echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
367 $(if $(CONFIG_PACKAGE_boost-python3), \
368 echo "using python : 3.6 : : $(STAGING_DIR)/usr/include/python3.6/ : $(STAGING_DIR)/usr/lib/libpython3.6.so ;" >> \
369 tools/build/src/user-config.jam; \
370 ) \
371 $(if $(CONFIG_PACKAGE_boost-python), \
372 echo "using python : 2.7 : : $(STAGING_DIR)/usr/include/python2.7/ : $(STAGING_DIR)/usr/lib/libpython2.7.so ;" >> \
373 tools/build/src/user-config.jam; \
374 ) \
375 b2 \
376 $(CONFIGURE_ARGS) \
377 --ignore-site-config \
378 --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
379 --disable-long-double \
380 $(if $(CONFIG_boost-variant-release), variant=release,) \
381 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
382 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
383 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
384 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
385 $(if $(CONFIG_boost-shared-libs),link=shared,) \
386 $(if $(CONFIG_boost-static-libs),link=static,) \
387 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
388 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
389 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
390 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
391 $(if $(CONFIG_boost-single-thread),threading=single,) \
392 threading=multi \
393 --without-mpi \
394 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
395 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
396 $(foreach lib,$(BOOST_LIBS), \
397 $(if $(findstring python,$(lib)), \
398 $(if $(CONFIG_PACKAGE_boost-python),python=2.7,--without-python), \
399 $(if $(CONFIG_PACKAGE_boost-$(lib)),, \
400 $(if $(findstring $(lib),wserialization),,--without-$(lib)) \
401 ) \
402 ) \
403 ) \
404 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
405 boost.locale.iconv=off) \
406 \
407 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
408 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
409 install ;\
410 $(if $(CONFIG_PACKAGE_boost-python3), \
411 b2 \
412 $(CONFIGURE_ARGS) \
413 --ignore-site-config \
414 --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
415 --disable-long-double \
416 $(if $(CONFIG_boost-variant-release), variant=release,) \
417 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
418 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
419 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
420 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
421 $(if $(CONFIG_boost-shared-libs),link=shared,) \
422 $(if $(CONFIG_boost-static-libs),link=static,) \
423 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
424 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
425 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
426 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
427 $(if $(CONFIG_boost-single-thread),threading=single,) \
428 threading=multi \
429 $(foreach lib,$(BOOST_LIBS), \
430 $(if $(findstring python,$(lib)), \
431 $(if $(CONFIG_PACKAGE_boost-python3),python=3.6,), \
432 ) \
433 ) \
434 install ;\
435 ,) \
436 )
437 endef
438
439 define Build/InstallDev
440 $(INSTALL_DIR) \
441 $(1)/usr/include/boost/
442
443 $(CP) \
444 $(PKG_INSTALL_DIR)/include/boost/* \
445 $(1)/usr/include/boost/ \
446 # copies _all_ header files - independent of <--with-library>-argument above
447
448 $(INSTALL_DIR) $(1)/usr/lib
449 $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
450 $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
451 endef
452
453 define Host/Install
454 $(INSTALL_DIR) \
455 $(STAGING_DIR_HOSTPKG)/bin
456
457 $(CP) \
458 $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
459 $(STAGING_DIR_HOSTPKG)/bin/
460 endef
461
462 define Package/boost/Default/install
463 $(INSTALL_DIR) \
464 $(1)/usr/lib
465
466 $(FIND) \
467 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2).so*' -exec $(CP) {} $(1)/usr/lib/ \;
468 $(FIND) \
469 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)_*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
470 endef
471
472 define Package/boost-test/install
473 $(INSTALL_DIR) \
474 $(1)/usr/lib
475
476 $(FIND) \
477 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
478
479 $(FIND) \
480 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
481 endef
482
483 define BuildBoostLibrary
484 define Package/boost-$(1)/install
485 $(call Package/boost/Default/install,$$(1),$(1))
486 endef
487
488 $$(eval $$(call BuildPackage,boost-$(1)))
489 endef
490
491 $(eval $(call HostBuild))
492
493 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
494 $(eval $(call BuildPackage,boost-test))
495 $(eval $(call BuildPackage,boost-libs))
496 $(eval $(call BuildPackage,boost))