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