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