Merge pull request #4065 from ClaymorePT/boost_1.63_r3
[feed/packages.git] / libs / boost / Makefile
1 #
2 # Copyright (C) 2015-2017 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.63.0
20 PKG_SOURCE_VERSION:=1_63_0
21 PKG_RELEASE:=3
22
23 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
24 PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
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_MD5SUM:=beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0
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.63 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 |
58 | - Boost.Fiber |
59 | Also, due to hardware contraints, the following libs and those that are |
60 | dependent, are disabled for some Targets. |
61 | - Boost.Context |
62 | - Disabled for -> avr32, octeon and netlogic. |
63 | - Boost.Fiber |
64 | - Disabled for -> ar7, rb532, brcm63xx.smp, brcm63xx, brcm47xx, |
65 | brcm47xx.legacy, brcm2708_bcm2708, au1000, ath25, |
66 | adm8668 and adm5120. |
67 -----------------------------------------------------------------------------
68
69 This package provides the following run-time libraries:
70 - atomic
71 - chrono
72 - container
73 - context
74 - coroutine (Deprecated - use Coroutine2)
75 - - coroutine2 (Requires GCC v5 or newer)
76 - date_time
77 - exception
78 - filesystem
79 - fiber (Requires GCC v5 or newer)
80 - graph
81 - - graph-parallel
82 - iostreams
83 - locale (Requires kernel being compiled with full language support)
84 - log
85 - math
86 - program_options
87 - python
88 - python3
89 - random
90 - regex
91 - serialization
92 - signals
93 - system
94 - thread
95 - timer
96 - wave
97
98 There are many more header-only libraries supported by Boost.
99 See more at http://www.boost.org/doc/libs/1_63_0/
100 endef
101
102 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
103
104 BOOST_LIBS =
105
106 define Package/boost-libs
107 $(call Package/boost/Default)
108 TITLE+= (all libs)
109 DEPENDS+= $(BOOST_DEPENDS)
110 HIDDEN:=1
111 endef
112
113 define Package/boost-libs/description
114 This meta package contains only dependencies to the other libraries from
115 the boost libraries collection.
116 endef
117
118 # Create a meta-package of dependent libraries (for ALL)
119 define Package/boost-libs/install
120 true
121 endef
122
123 define Package/boost/install
124 true
125 endef
126
127 define Package/boost
128 $(call Package/boost/Default)
129 TITLE+= packages
130 endef
131
132 define Package/boost/config
133 menu "Select Boost Options"
134 depends on PACKAGE_boost
135 comment "Boost compilation options."
136
137 choice
138 prompt "Compile Boost libraries."
139 default boost-static-and-shared-libs
140 help
141 Choose which version to compile.
142 -> Shared:
143 - Only Shared libs will be compiled.
144 -> Static:
145 - Only Static libs will be compiled.
146 -> Both:
147 - Both Static and Shared libs will be compiled.
148
149 config boost-shared-libs
150 bool "Shared"
151
152 config boost-static-libs
153 bool "Static"
154
155 config boost-static-and-shared-libs
156 bool "Both"
157 endchoice
158
159 choice
160 prompt "Selects Boost Runtime linkage."
161 default boost-runtime-shared
162 help
163 Choose which C and C++ runtimes to use:
164 -> Use Shared runtimes.
165 -> Use Static runtimes.
166 - Not available if Shared libs are to be built.
167 -> Use both runtimes.
168 - Not available if Shared libs are to be built.
169 - Two separate versions of Boost are built, linking each to a different runtime.
170 - This option requires "Use tagged names" option to be active.
171
172 config boost-runtime-shared
173 bool "Shared"
174
175 config boost-runtime-static
176 depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
177 bool "Static"
178
179 config boost-runtime-static-and-shared
180 depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
181 bool "Both"
182 endchoice
183
184 choice
185 prompt "Select a Variant."
186 default boost-variant-release
187 help
188 Chooses which boost variant should be selected:
189 -> Release: Optimizes Boost for release.
190 - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
191 -> Debug:
192 - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
193 -> Profile:
194 - Profiling: On; Debug Symbols: On.
195
196 config boost-variant-release
197 bool "Release"
198
199 config boost-variant-debug
200 bool "Debug"
201
202 config boost-variant-profile
203 bool "Profile"
204 endchoice
205
206 config boost-use-name-tags
207 bool "Use tagged names."
208 help
209 Add name tags the lib files, to diferentiate each library version:
210 "-mt" for multi-threading.
211 "-d" for debugging.
212 "-s" for runtime static link".
213 Might break compatibility with libraries that expect boost libs with default names.
214 default n
215
216 config boost-single-thread
217 depends on @boost-use-name-tags
218 bool "Single thread Support."
219 help
220 Compile Boost libraries in single-thread mode.
221 default n
222
223 config boost-build-type-complete
224 depends on @boost-use-name-tags
225 bool "Complete Boost Build."
226 help
227 Builds both release and debug libs. It will take much longer to compile.
228 default n
229 endmenu
230
231 menu "Select Boost libraries"
232 depends on PACKAGE_boost
233 comment "Libraries"
234
235 config boost-libs-all
236 bool "Include all Boost libraries."
237 default m if ALL
238 select PACKAGE_boost-container
239 select PACKAGE_boost-date_time
240 select PACKAGE_boost-iostreams
241 select PACKAGE_boost-math
242 select PACKAGE_boost-program_options
243 select PACKAGE_boost-serialization
244 select PACKAGE_boost-signals
245 select PACKAGE_boost-regex
246 select PACKAGE_boost-graph if PACKAGE_boost-regex
247 select PACKAGE_boost-system
248 select PACKAGE_boost-atomic if PACKAGE_boost-system
249 select PACKAGE_boost-chrono if PACKAGE_boost-system
250 select PACKAGE_boost-random if PACKAGE_boost-system
251 select PACKAGE_boost-filesystem if PACKAGE_boost-system
252 select PACKAGE_boost-locale if PACKAGE_boost-system
253 select PACKAGE_boost-timer if PACKAGE_boost-chrono
254 select PACKAGE_boost-thread if PACKAGE_boost-chrono&&PACKAGE_boost-atomic
255 select PACKAGE_boost-context if PACKAGE_boost-chrono&&PACKAGE_boost-thread
256 select PACKAGE_boost-coroutine if PACKAGE_boost-context
257 select PACKAGE_boost-fiber if boost-coroutine2
258 select PACKAGE_boost-log if PACKAGE_boost-chrono&&PACKAGE_boost-date_time&&PACKAGE_boost-thread&&PACKAGE_boost-filesystem&&PACKAGE_boost-regex
259 select PACKAGE_boost-wave if PACKAGE_boost-date_time&&PACKAGE_boost-thread&&PACKAGE_boost-filesystem
260 select PACKAGE_boost-python
261 select PACKAGE_boost-python3
262 select boost-test-pkg if PACKAGE_boost-system&&PACKAGE_boost-timer
263 select boost-coroutine2 if PACKAGE_boost-coroutine
264 select boost-graph-parallel if PACKAGE_boost-graph
265
266
267 config boost-test-pkg
268 depends on PACKAGE_boost-system&&PACKAGE_boost-timer
269 bool "Boost test package."
270 default m if ALL
271 select PACKAGE_boost-test
272
273 config boost-coroutine2
274 depends on !@GCC_VERSION_4_8&&PACKAGE_boost-coroutine
275 bool "Boost couroutine2 support."
276 default m if ALL
277
278 config boost-graph-parallel
279 depends on PACKAGE_boost-graph
280 bool "Boost parallel graph support."
281 default m if ALL
282
283 $(foreach lib,$(BOOST_LIBS), \
284 config PACKAGE_boost-$(lib)
285 prompt "Boost $(lib) library."
286 default m if ALL
287 $(if $(findstring graph,$(lib)),depends on PACKAGE_boost-regex,)\
288 $(if $(findstring atomic,$(lib)),depends on PACKAGE_boost-system,)\
289 $(if $(findstring chrono,$(lib)),depends on PACKAGE_boost-system,)\
290 $(if $(findstring random,$(lib)),depends on PACKAGE_boost-system,)\
291 $(if $(findstring filesystem,$(lib)),depends on PACKAGE_boost-system,)\
292 $(if $(findstring locale,$(lib)),depends on PACKAGE_boost-system&&BUILD_NLS,)\
293 $(if $(findstring timer,$(lib)),depends on PACKAGE_boost-chrono,)\
294 $(if $(findstring thread,$(lib)),depends on PACKAGE_boost-chrono&&PACKAGE_boost-atomic,)\
295 $(if $(findstring context,$(lib)),depends on PACKAGE_boost-chrono&&PACKAGE_boost-thread&&@(!TARGET_avr32&&!TARGET_octeon&&!TARGET_netlogic),)\
296 $(if $(findstring coroutine,$(lib)),depends on PACKAGE_boost-context,)\
297 $(if $(findstring fiber,$(lib)),depends on @boost-coroutine2&&@(!TARGET_ar7&&!TARGET_rb532&&!TARGET_brcm63xx_smp&&!TARGET_brcm63xx&&!TARGET_brcm47xx&&!TARGET_brcm47xx_legacy&&!TARGET_brcm2708_bcm2708&&!TARGET_au1000&&!TARGET_ath25&&!TARGET_adm8668&&!TARGET_adm5120),)\
298 $(if $(findstring log,$(lib)),depends on PACKAGE_boost-chrono&&PACKAGE_boost-date_time&&PACKAGE_boost-thread&&PACKAGE_boost-filesystem&&PACKAGE_boost-regex,)\
299 $(if $(findstring wave,$(lib)),depends on PACKAGE_boost-date_time&&PACKAGE_boost-thread&&PACKAGE_boost-filesystem,)\
300 $(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)
301 )
302 endmenu
303
304 endef
305
306 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
307
308 define Package/boost-test
309 $(call Package/boost/Default)
310 TITLE+= (test)
311 HIDDEN:=1
312 endef
313
314 define Build/Configure
315 endef
316
317 # 1: short name
318 # 2: dependencies on other boost libraries (short name) - Deprecated
319 # 3: dependencies on other packages
320 # 4: conditional/inward dependencies
321 define DefineBoostLibrary
322
323 BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
324 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
325
326 BOOST_LIBS+= $(1)
327
328 define Package/boost-$(1)
329 $(call Package/boost/Default)
330 TITLE+= ($(1))
331 DEPENDS+= $(3) $(if $(4),@$(4),)
332 HIDDEN:=1
333 endef
334
335 define Package/boost-$(1)/description
336 This package contains the Boost $(1) library.
337 endef
338 endef
339
340
341 ## If you are thinking in making changes to the following list, for some reason, the order of what follows matters.
342 $(eval $(call DefineBoostLibrary,container,,,))
343 $(eval $(call DefineBoostLibrary,date_time,,,))
344 $(eval $(call DefineBoostLibrary,iostreams,,+zlib,))
345 $(eval $(call DefineBoostLibrary,math,,,))
346 $(eval $(call DefineBoostLibrary,program_options,,,))
347 $(eval $(call DefineBoostLibrary,serialization,,,))
348 $(eval $(call DefineBoostLibrary,signals,,,))
349
350 $(eval $(call DefineBoostLibrary,regex,,,))
351 $(eval $(call DefineBoostLibrary,graph,,,))
352
353 $(eval $(call DefineBoostLibrary,system,,,))
354 $(eval $(call DefineBoostLibrary,atomic,,,))
355 $(eval $(call DefineBoostLibrary,chrono,,,))
356 $(eval $(call DefineBoostLibrary,random,,,))
357 $(eval $(call DefineBoostLibrary,filesystem,,,))
358 $(eval $(call DefineBoostLibrary,locale,,$(ICONV_DEPENDS),BUILD_NLS))
359 $(eval $(call DefineBoostLibrary,timer,,,))
360 $(eval $(call DefineBoostLibrary,thread,,,))
361 $(eval $(call DefineBoostLibrary,context,,,))
362 $(eval $(call DefineBoostLibrary,coroutine,,,))
363 $(eval $(call DefineBoostLibrary,fiber,,,))
364 $(eval $(call DefineBoostLibrary,log,,,))
365 $(eval $(call DefineBoostLibrary,wave,,,))
366 $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
367 $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
368
369 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
370 #$(eval $(call DefineBoostLibrary,exception,,))
371
372
373 define Host/Compile
374 # b2 does not provide a configure-script nor a Makefile
375 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
376 endef
377
378 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
379 TARGET_LDFLAGS += -pthread -lrt
380
381 TARGET_CFLAGS += \
382 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
383
384 EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
385
386 ifneq ($(findstring mips,$(ARCH)),)
387 BOOST_ABI = o32
388 ifneq ($(findstring 64,$(ARCH)),)
389 BOOST_ABI = o64
390 endif
391 else ifneq ($(findstring arm,$(ARCH)),)
392 BOOST_ABI = aapcs
393 else ifeq ($(ARCH),aarch64)
394 BOOST_ABI = aapcs
395 else
396 BOOST_ABI = sysv
397 endif
398
399 comma := ,
400
401
402 define Build/Compile
403 $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
404 ( cd $(PKG_BUILD_DIR) ; \
405 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 ; \
406 $(if $(CONFIG_PACKAGE_boost-python3), \
407 echo "using python : 3.6 : : $(STAGING_DIR)/usr/include/python3.6/ ;" >> \
408 tools/build/src/user-config.jam; \
409 ) \
410 $(if $(CONFIG_PACKAGE_boost-python), \
411 echo "using python : 2.7 : : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
412 tools/build/src/user-config.jam; \
413 ) \
414 b2 \
415 $(CONFIGURE_ARGS) \
416 --ignore-site-config \
417 --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
418 --disable-long-double \
419 $(if $(CONFIG_boost-variant-release), variant=release,) \
420 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
421 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
422 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
423 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
424 $(if $(CONFIG_boost-shared-libs),link=shared,) \
425 $(if $(CONFIG_boost-static-libs),link=static,) \
426 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
427 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
428 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
429 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
430 $(if $(CONFIG_boost-single-thread),threading=single,) \
431 threading=multi \
432 --without-mpi \
433 $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
434 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
435 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
436 $(foreach lib,$(BOOST_LIBS), \
437 $(if $(findstring python,$(lib)), \
438 $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
439 $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
440 ) \
441 $(if $(CONFIG_PACKAGE_boost-python),python=2.7,) \
442 $(if $(CONFIG_PACKAGE_boost-python3),python=3.6,) \
443 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
444 boost.locale.iconv=off) \
445 \
446 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
447 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
448 install \
449 )
450 endef
451
452 define Build/InstallDev
453 $(INSTALL_DIR) \
454 $(1)/usr/include/boost/
455
456 $(CP) \
457 $(PKG_INSTALL_DIR)/include/boost/* \
458 $(1)/usr/include/boost/ \
459 # copies _all_ header files - independent of <--with-library>-argument above
460
461 $(INSTALL_DIR) $(1)/usr/lib
462 $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
463 $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
464 endef
465
466 define Host/Install
467 $(INSTALL_DIR) \
468 $(STAGING_DIR_HOSTPKG)/bin
469
470 $(CP) \
471 $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
472 $(STAGING_DIR_HOSTPKG)/bin/
473 endef
474
475 define Package/boost/Default/install
476 $(INSTALL_DIR) \
477 $(1)/usr/lib
478
479 $(FIND) \
480 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2).so*' -exec $(CP) {} $(1)/usr/lib/ \;
481 $(FIND) \
482 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)_*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
483 endef
484
485 define Package/boost-test/install
486 $(INSTALL_DIR) \
487 $(1)/usr/lib
488
489 $(FIND) \
490 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
491
492 $(FIND) \
493 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
494 endef
495
496 define BuildBoostLibrary
497 define Package/boost-$(1)/install
498 $(call Package/boost/Default/install,$$(1),$(1))
499 endef
500
501 $$(eval $$(call BuildPackage,boost-$(1)))
502 endef
503
504 $(eval $(call HostBuild))
505
506 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
507 $(eval $(call BuildPackage,boost-test))
508 $(eval $(call BuildPackage,boost-libs))
509 $(eval $(call BuildPackage,boost))