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