Merge pull request #3289 from cshore/pull-request-msmtp-scripts
[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:=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_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_DEPENDS += boost/host
32 PKG_BUILD_PARALLEL:=0
33 PKG_USE_MIPS16:=0
34
35 include $(INCLUDE_DIR)/package.mk
36 include $(INCLUDE_DIR)/host-build.mk
37
38
39 define Package/boost/Default
40 SECTION:=libs
41 CATEGORY:=Libraries
42 TITLE:=Boost C++ source library
43 URL:=http://www.boost.org
44 DEPENDS:=+libstdcpp +libpthread +librt
45 endef
46
47 define Package/boost/description
48 This package provides the Boost v1.62 libraries.
49 Boost is a set of free, peer-reviewed, portable C++ source libraries.
50
51 -----------------------------------------------------------------------------
52 | Warning |
53 | In order to build all of the Boost Libraries, it is necessary |
54 | to use, at least, GCC version 5 (C++14 support) and, it is necessary to |
55 | compile the kernel with Full Language Support. |
56 | Without these requirerements, the following libs will not be available: |
57 | - Boost.Locale |
58 | - Boost.Coroutine2 |
59 | - Boost.Fiber |
60 -----------------------------------------------------------------------------
61
62 This package provides the following run-time libraries:
63 - atomic
64 - chrono
65 - container
66 - context
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) - BROKEN
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
85 - signals
86 - system
87 - thread
88 - timer
89 - wave
90
91 There are many more header-only libraries supported by Boost.
92 See more at http://www.boost.org/doc/libs/1_62_0/
93 endef
94
95 BOOST_LIBS =
96
97 define Package/boost-libs
98 $(call Package/boost/Default)
99 TITLE+= (all libs)
100 DEPENDS+= $(BOOST_DEPENDS)
101 HIDDEN:=1
102 endef
103
104 define Package/boost-libs/description
105 This meta package contains only dependencies to the other libraries from
106 the boost libraries collection.
107 endef
108
109 # Create a meta-package of dependent libraries (for ALL)
110 define Package/boost-libs/install
111 true
112 endef
113
114 define Package/boost/install
115 true
116 endef
117
118
119 define Package/boost
120 $(call Package/boost/Default)
121 TITLE+= packages
122 DEPENDS:=+ALL:boost-libs +ALL:boost-test
123 endef
124
125 define Package/boost/config
126 menu "Select Boost Options"
127 depends on PACKAGE_boost
128 comment "Boost compilation options."
129
130 choice
131 prompt "Compile Boost libraries."
132 default boost-static-and-shared-libs
133 help
134 Choose which version to compile.
135 -> Shared:
136 - Only Shared libs will be compiled.
137 -> Static:
138 - Only Static libs will be compiled.
139 -> Both:
140 - Both Static and Shared libs will be compiled.
141
142 config boost-shared-libs
143 bool "Shared"
144
145 config boost-static-libs
146 bool "Static"
147
148 config boost-static-and-shared-libs
149 bool "Both"
150 endchoice
151
152 choice
153 prompt "Selects Boost Runtime linkage."
154 default boost-runtime-shared
155 help
156 Choose which C and C++ runtimes to use:
157 -> Use Shared runtimes.
158 -> Use Static runtimes.
159 - Not available if Shared libs are to be built.
160 -> Use both runtimes.
161 - Not available if Shared libs are to be built.
162 - Two separate versions of Boost are built, linking each to a different runtime.
163 - This option requires "Use tagged names" option to be active.
164
165 config boost-runtime-shared
166 bool "Shared"
167
168 config boost-runtime-static
169 depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
170 bool "Static"
171
172 config boost-runtime-static-and-shared
173 depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
174 bool "Both"
175 endchoice
176
177 choice
178 prompt "Select a Variant."
179 default boost-variant-release
180 help
181 Chooses which boost variant should be selected:
182 -> Release: Optimizes Boost for release.
183 - Optimization: Speed; Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
184 -> Debug:
185 - Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
186 -> Profile:
187 - Profiling: On; Debug Symbols: On.
188
189 config boost-variant-release
190 bool "Release"
191
192 config boost-variant-debug
193 bool "Debug"
194
195 config boost-variant-profile
196 bool "Profile"
197 endchoice
198
199 config boost-use-name-tags
200 bool "Use tagged names."
201 help
202 Add name tags the lib files, to diferentiate each library version:
203 "-mt" for multi-threading.
204 "-d" for debugging.
205 "-s" for runtime static link".
206 Might break compatibility with libraries that expect boost libs with default names.
207 default n
208
209 config boost-single-thread
210 depends on @boost-use-name-tags
211 bool "Single thread Support."
212 help
213 Compile Boost libraries in single-thread mode.
214 default n
215
216 config boost-build-type-complete
217 depends on @boost-use-name-tags
218 bool "Complete Boost Build."
219 help
220 Builds both release and debug libs. It will take much longer to compile.
221 default n
222 endmenu
223
224 menu "Select Boost libraries"
225 depends on PACKAGE_boost
226 comment "Libraries"
227
228 config boost-libs-all
229 bool "Include all Boost libraries."
230 select PACKAGE_boost-libs
231 select boost-test-pkg
232 select boost-coroutine2
233 select boost-graph-parallel
234
235 config boost-test-pkg
236 bool "Boost test package."
237 select PACKAGE_boost-test
238
239 config boost-coroutine2
240 depends on !@GCC_VERSION_4_8
241 bool "Boost couroutine2 support."
242 select PACKAGE_boost-coroutine
243 default n
244
245 config boost-graph-parallel
246 bool "Boost parallel graph support."
247 select PACKAGE_boost-graph
248 default n
249
250 $(foreach lib,$(BOOST_LIBS), \
251 config PACKAGE_boost-$(lib)
252 prompt "Boost $(lib) library."
253 $(if $(findstring locale,$(lib)),depends on BUILD_NLS,)
254 $(if $(findstring fiber,$(lib)),depends on BROKEN,)
255 )
256 endmenu
257
258 endef
259
260 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
261
262 define Package/boost-test
263 $(call Package/boost/Default)
264 TITLE+= (test)
265 HIDDEN:=1
266 DEPENDS+=+boost-system +boost-timer
267 endef
268
269 define Build/Configure
270 endef
271
272 # 1: short name
273 # 2: dependencies on other boost libraries (short name)
274 # 3: dependencies on other packages
275 define DefineBoostLibrary
276
277 BOOST_DEPENDS+= +boost-$(1)
278 BOOST_LIBS+= $(1)
279
280 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
281
282 define Package/boost-$(1)
283 $(call Package/boost/Default)
284 TITLE+= ($(1))
285 DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
286 HIDDEN:=1
287 endef
288
289 define Package/boost-$(1)/description
290 This package contains the Boost $(1) library.
291 endef
292 endef
293
294
295 $(eval $(call DefineBoostLibrary,atomic,system,))
296 $(eval $(call DefineBoostLibrary,chrono,system,))
297 $(eval $(call DefineBoostLibrary,container,,))
298 $(eval $(call DefineBoostLibrary,context,chrono system thread,))
299 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
300 $(eval $(call DefineBoostLibrary,date_time,,))
301 #$(eval $(call DefineBoostLibrary,exception,,))
302 $(eval $(call DefineBoostLibrary,fiber,coroutine,@BROKEN))
303 $(eval $(call DefineBoostLibrary,filesystem,system,))
304 $(eval $(call DefineBoostLibrary,graph,regex,))
305 $(eval $(call DefineBoostLibrary,iostreams,,+PACKAGE_boost-iostreams:zlib))
306 $(eval $(call DefineBoostLibrary,locale,system,@BUILD_NLS $(ICONV_DEPENDS)))
307 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
308 $(eval $(call DefineBoostLibrary,math,,))
309 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
310 $(eval $(call DefineBoostLibrary,program_options,,))
311 $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
312 $(eval $(call DefineBoostLibrary,python3,,+PACKAGE_boost-python3:python3))
313 $(eval $(call DefineBoostLibrary,random,system,))
314 $(eval $(call DefineBoostLibrary,regex,,))
315 $(eval $(call DefineBoostLibrary,serialization,,))
316 $(eval $(call DefineBoostLibrary,signals,,))
317 $(eval $(call DefineBoostLibrary,system,,))
318 $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
319 $(eval $(call DefineBoostLibrary,timer,chrono))
320 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
321
322
323 define Host/Compile
324 # b2 does not provide a configure-script nor a Makefile
325 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
326 endef
327
328 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
329 TARGET_LDFLAGS += -pthread -lrt
330
331 TARGET_CFLAGS += \
332 $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
333 $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
334 $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
335
336 ifneq ($(findstring mips,$(ARCH)),)
337 BOOST_ABI = o32
338 ifneq ($(findstring 64,$(ARCH)),)
339 BOOST_ABI = o64
340 endif
341 else ifneq ($(findstring arm,$(ARCH)),)
342 BOOST_ABI = aapcs
343 else ifeq ($(ARCH),aarch64)
344 BOOST_ABI = aapcs
345 else
346 BOOST_ABI = sysv
347 endif
348
349 comma := ,
350
351 define Build/Compile
352 $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
353 ( cd $(PKG_BUILD_DIR) ; \
354 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 ; \
355 $(if $(CONFIG_PACKAGE_boost-python3), \
356 echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
357 tools/build/src/user-config.jam; \
358 ) \
359 $(if $(CONFIG_PACKAGE_boost-python), \
360 echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
361 tools/build/src/user-config.jam; \
362 ) \
363 b2 \
364 $(CONFIGURE_ARGS) \
365 --ignore-site-config \
366 --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
367 --disable-long-double \
368 $(if $(CONFIG_boost-variant-release), variant=release,) \
369 $(if $(CONFIG_boost-variant-debug), variant=debug,) \
370 $(if $(CONFIG_boost-variant-profile), variant=profile,) \
371 $(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
372 $(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
373 $(if $(CONFIG_boost-shared-libs),link=shared,) \
374 $(if $(CONFIG_boost-static-libs),link=static,) \
375 $(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
376 $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
377 $(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
378 $(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
379 $(if $(CONFIG_boost-single-thread),threading=single,) \
380 threading=multi \
381 --without-mpi \
382 $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
383 $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
384 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
385 $(foreach lib,$(BOOST_LIBS), \
386 $(if $(findstring python,$(lib)), \
387 $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
388 $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
389 ) \
390 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
391 boost.locale.iconv=off) \
392 \
393 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
394 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
395 install \
396 )
397 endef
398
399 define Build/InstallDev
400 $(INSTALL_DIR) \
401 $(1)/usr/include/boost/
402
403 $(CP) \
404 $(PKG_INSTALL_DIR)/include/boost/* \
405 $(1)/usr/include/boost/ \
406 # copies _all_ header files - independent of <--with-library>-argument above
407
408 $(INSTALL_DIR) $(1)/usr/lib
409 $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
410 $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
411 endef
412
413 define Host/Install
414 $(INSTALL_DIR) \
415 $(STAGING_DIR)/host/bin
416
417 $(CP) \
418 $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
419 $(STAGING_DIR)/host/bin/
420 endef
421
422 define Package/boost/Default/install
423 $(INSTALL_DIR) \
424 $(1)/usr/lib
425
426 $(FIND) \
427 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
428 endef
429
430 define Package/boost-test/install
431 $(INSTALL_DIR) \
432 $(1)/usr/lib
433
434 $(FIND) \
435 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
436
437 $(FIND) \
438 $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
439 endef
440
441 define BuildBoostLibrary
442 define Package/boost-$(1)/install
443 $(call Package/boost/Default/install,$$(1),$(1))
444 endef
445
446 $$(eval $$(call BuildPackage,boost-$(1)))
447 endef
448
449 $(eval $(call HostBuild))
450
451 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
452 $(eval $(call BuildPackage,boost-test))
453 $(eval $(call BuildPackage,boost-libs))
454 $(eval $(call BuildPackage,boost))