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