Merge pull request #3494 from ffainelli/plc-utils-3481
[feed/packages.git] / libs / boost / Makefile
1 #
2 # Copyright (C) 2015-2016 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.62.0
20 PKG_SOURCE_VERSION:=1_62_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:=36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0
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.62 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 -----------------------------------------------------------------------------
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) - BROKEN
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
84 - signals
85 - system
86 - thread
87 - timer
88 - wave
89
90 There are many more header-only libraries supported by Boost.
91 See more at http://www.boost.org/doc/libs/1_62_0/
92 endef
93
94 PKG_BUILD_DEPENDS:=boost/host
95 HOST_BUILD_DEPENDS:=PACKAGE_python:python/host PACKAGE_python3:python3/host
96
97 BOOST_LIBS =
98
99 define Package/boost-libs
100 $(call Package/boost/Default)
101 TITLE+= (all libs)
102 DEPENDS+= $(BOOST_DEPENDS)
103 HIDDEN:=1
104 endef
105
106 define Package/boost-libs/description
107 This meta package contains only dependencies to the other libraries from
108 the boost libraries collection.
109 endef
110
111 # Create a meta-package of dependent libraries (for ALL)
112 define Package/boost-libs/install
113 true
114 endef
115
116 define Package/boost/install
117 true
118 endef
119
120 define Package/boost
121 $(call Package/boost/Default)
122 TITLE+= packages
123 DEPENDS:=+ALL:boost-libs +ALL:boost-test
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 select PACKAGE_boost-libs
232 select boost-test-pkg
233 select boost-coroutine2
234 select boost-graph-parallel
235
236 config boost-test-pkg
237 bool "Boost test package."
238 select PACKAGE_boost-test
239
240 config boost-coroutine2
241 depends on !@GCC_VERSION_4_8
242 bool "Boost couroutine2 support."
243 select PACKAGE_boost-coroutine
244 default n
245
246 config boost-graph-parallel
247 bool "Boost parallel graph support."
248 select PACKAGE_boost-graph
249 default n
250
251 $(foreach lib,$(BOOST_LIBS), \
252 config PACKAGE_boost-$(lib)
253 prompt "Boost $(lib) library."
254 default m if ALL
255 $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
256 $(if $(findstring fiber,$(lib)),depends on BROKEN,)\
257 $(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)
258
259 )
260 endmenu
261
262 endef
263
264 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
265
266 define Package/boost-test
267 $(call Package/boost/Default)
268 TITLE+= (test)
269 HIDDEN:=1
270 DEPENDS+=+boost-system +boost-timer
271 endef
272
273 define Build/Configure
274 endef
275
276 # 1: short name
277 # 2: dependencies on other boost libraries (short name)
278 # 3: dependencies on other packages
279 # 4: conditional/inward dependencies
280 define DefineBoostLibrary
281
282 BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
283 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
284
285 BOOST_LIBS+= $(1)
286
287 define Package/boost-$(1)
288 $(call Package/boost/Default)
289 TITLE+= ($(1))
290 DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
291 HIDDEN:=1
292 endef
293
294 define Package/boost-$(1)/description
295 This package contains the Boost $(1) library.
296 endef
297 endef
298
299 $(eval $(call DefineBoostLibrary,atomic,system,))
300 $(eval $(call DefineBoostLibrary,chrono,system,))
301 $(eval $(call DefineBoostLibrary,container,,))
302 $(eval $(call DefineBoostLibrary,context,chrono system thread,))
303 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
304 $(eval $(call DefineBoostLibrary,date_time,,))
305 #$(eval $(call DefineBoostLibrary,exception,,))
306 $(eval $(call DefineBoostLibrary,fiber,coroutine,,BROKEN))
307 $(eval $(call DefineBoostLibrary,filesystem,system,))
308 $(eval $(call DefineBoostLibrary,graph,regex,))
309 $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
310 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
311 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
312 $(eval $(call DefineBoostLibrary,math,,))
313 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
314 $(eval $(call DefineBoostLibrary,program_options,,))
315 $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
316 $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
317 $(eval $(call DefineBoostLibrary,random,system,))
318 $(eval $(call DefineBoostLibrary,regex,,))
319 $(eval $(call DefineBoostLibrary,serialization,,))
320 $(eval $(call DefineBoostLibrary,signals,,))
321 $(eval $(call DefineBoostLibrary,system,,))
322 $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
323 $(eval $(call DefineBoostLibrary,timer,chrono))
324 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
325
326
327 define Host/Compile
328 # b2 does not provide a configure-script nor a Makefile
329 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
330 endef
331
332 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
333 TARGET_LDFLAGS += -pthread -lrt
334
335 TARGET_CFLAGS += \
336 $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
337 $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
338 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
339
340 ifneq ($(findstring mips,$(ARCH)),)
341 BOOST_ABI = o32
342 ifneq ($(findstring 64,$(ARCH)),)
343 BOOST_ABI = o64
344 endif
345 else ifneq ($(findstring arm,$(ARCH)),)
346 BOOST_ABI = aapcs
347 else ifeq ($(ARCH),aarch64)
348 BOOST_ABI = aapcs
349 else
350 BOOST_ABI = sysv
351 endif
352
353 comma := ,
354
355 define Build/Compile
356 $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
357 ( cd $(PKG_BUILD_DIR) ; \
358 echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(if $(CONFIG_boost-coroutine2),-std=c++14,)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
359 $(if $(CONFIG_PACKAGE_boost-python3), \
360 echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
361 tools/build/src/user-config.jam; \
362 ) \
363 $(if $(CONFIG_PACKAGE_boost-python), \
364 echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
365 tools/build/src/user-config.jam; \
366 ) \
367 b2 \
368 $(CONFIGURE_ARGS) \
369 --ignore-site-config \
370 --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
371 --disable-long-double \
372 $(if $(CONFIG_boost-variant-release), variant=release,) \
373 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
374 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
375 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
376 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
377 $(if $(CONFIG_boost-shared-libs),link=shared,) \
378 $(if $(CONFIG_boost-static-libs),link=static,) \
379 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
380 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
381 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
382 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
383 $(if $(CONFIG_boost-single-thread),threading=single,) \
384 threading=multi \
385 --without-mpi \
386 $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
387 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
388 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
389 $(foreach lib,$(BOOST_LIBS), \
390 $(if $(findstring python,$(lib)), \
391 $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
392 $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
393 ) \
394 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
395 boost.locale.iconv=off) \
396 \
397 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
398 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
399 install \
400 )
401 endef
402
403 define Build/InstallDev
404 $(INSTALL_DIR) \
405 $(1)/usr/include/boost/
406
407 $(CP) \
408 $(PKG_INSTALL_DIR)/include/boost/* \
409 $(1)/usr/include/boost/ \
410 # copies _all_ header files - independent of <--with-library>-argument above
411
412 $(INSTALL_DIR) $(1)/usr/lib
413 $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
414 $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
415 endef
416
417 define Host/Install
418 $(INSTALL_DIR) \
419 $(STAGING_DIR)/host/bin
420
421 $(CP) \
422 $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
423 $(STAGING_DIR)/host/bin/
424 endef
425
426 define Package/boost/Default/install
427 $(INSTALL_DIR) \
428 $(1)/usr/lib
429
430 $(FIND) \
431 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
432 endef
433
434 define Package/boost-test/install
435 $(INSTALL_DIR) \
436 $(1)/usr/lib
437
438 $(FIND) \
439 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
440
441 $(FIND) \
442 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
443 endef
444
445 define BuildBoostLibrary
446 define Package/boost-$(1)/install
447 $(call Package/boost/Default/install,$$(1),$(1))
448 endef
449
450 $$(eval $$(call BuildPackage,boost-$(1)))
451 endef
452
453 $(eval $(call HostBuild))
454
455 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
456 $(eval $(call BuildPackage,boost-test))
457 $(eval $(call BuildPackage,boost-libs))
458 $(eval $(call BuildPackage,boost))