Merge pull request #1123 from teslamint/patch-2
[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_58_0
20 PKG_RELEASE:=4
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:=5a5d5614d9a07672e1ab2a250b5defc5
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 Boost provides free peer-reviewed portable C++ source libraries
48 endef
49
50 BOOST_LIBS =
51
52 define Package/boost-libs
53 $(call Package/boost/Default)
54 TITLE+= (all libs)
55 DEPENDS+= $(BOOST_DEPENDS)
56 HIDDEN:=1
57 endef
58
59 define Package/boost-libs/description
60 $(call Package/boost/description/Default)
61 .
62 This meta package contains only dependencies to the other libraries from
63 the boost libraries collection.
64 endef
65
66 # Create a meta-package of dependent libraries (for ALL)
67 define Package/boost-libs/install
68 true
69 endef
70
71 define Package/boost
72 $(call Package/boost/Default)
73 TITLE+= packages
74 DEPENDS:=+ALL:boost-libs +ALL:boost-test
75 endef
76
77 define Package/boost/config
78 menu "Select Boost libraries"
79 depends on PACKAGE_boost
80
81 config boost-libs-all
82 bool "Include all Boost libraries"
83 select PACKAGE_boost-libs
84
85 config boost-test-pkg
86 bool "Boost test package"
87 select PACKAGE_boost-test
88
89 comment "Libraries"
90
91 $(foreach lib,$(BOOST_LIBS), \
92 config PACKAGE_boost-$(lib)
93 prompt "Boost $(lib) library"
94
95 )
96
97 endmenu
98
99 endef
100
101 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
102
103 define Package/boost-test
104 $(call Package/boost/Default)
105 TITLE+= (test)
106 HIDDEN:=1
107 endef
108
109 define Build/Configure
110 endef
111
112 # 1: short name
113 # 2: dependencies on other boost libraries (short name)
114 # 3: dependencies on other packages
115 define DefineBoostLibrary
116
117 BOOST_DEPENDS+= +boost-$(1)
118 BOOST_LIBS+= $(1)
119
120 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
121
122 define Package/boost-$(1)
123 $(call Package/boost/Default)
124 TITLE+= ($(1))
125 DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
126 HIDDEN:=1
127 endef
128
129 define Package/boost-$(1)/description
130 $(call Package/boost/description/Default)
131 .
132 This package contains the Boost $(1) library.
133 endef
134 endef
135
136 $(eval $(call DefineBoostLibrary,atomic,system,))
137 $(eval $(call DefineBoostLibrary,chrono,system,))
138 $(eval $(call DefineBoostLibrary,container,,))
139 $(eval $(call DefineBoostLibrary,context,chrono system thread,))
140 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
141 $(eval $(call DefineBoostLibrary,date_time,,))
142 #$(eval $(call DefineBoostLibrary,exception,,))
143 $(eval $(call DefineBoostLibrary,filesystem,system,))
144 $(eval $(call DefineBoostLibrary,graph,regex,))
145 #$(eval $(call DefineBoostLibrary,graph_parallel,,))
146 $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
147 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS)))
148 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
149 $(eval $(call DefineBoostLibrary,math,,))
150 #$(eval $(call DefineBoostLibrary,mpi,,))
151 $(eval $(call DefineBoostLibrary,program_options,,))
152 $(eval $(call DefineBoostLibrary,random,system,))
153
154 # We need a beter way to provide this package, information regarding the Python packages
155 # such as Python version and directories locations.
156 # Python 2.7 version is for now hard-coded. Python 3 is (until this date) broken in the trunk tree.
157 $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
158 $(eval $(call DefineBoostLibrary,regex,,))
159 $(eval $(call DefineBoostLibrary,serialization,,))
160 $(eval $(call DefineBoostLibrary,signals,,))
161 $(eval $(call DefineBoostLibrary,system,,))
162 $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
163 $(eval $(call DefineBoostLibrary,timer,chrono))
164 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
165
166 define Host/Compile
167 # bjam does not provide a configure-script nor a Makefile
168 ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
169 endef
170
171 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
172 TARGET_LDFLAGS += -pthread -lrt
173
174
175 ifneq ($(findstring mips,$(ARCH)),)
176 BOOST_ABI = o32
177 ifneq ($(findstring 64,$(ARCH)),)
178 BOOST_ABI = o64
179 endif
180 else ifneq ($(findstring arm,$(ARCH)),)
181 BOOST_ABI = aapcs
182 else ifeq ($(ARCH),aarch64)
183 BOOST_ABI = aapcs
184 else
185 BOOST_ABI = sysv
186 endif
187
188
189 define Build/Compile
190 $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
191 ( cd $(PKG_BUILD_DIR) ; \
192 echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
193 $(if $(CONFIG_PACKAGE_boost-python), \
194 echo "using python : : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
195 tools/build/src/user-config.jam; \
196 ) \
197 bjam \
198 '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
199 --toolset=gcc-$(ARCH) --build-type=minimal --layout=system abi=$(BOOST_ABI) \
200 --disable-long-double \
201 $(CONFIGURE_ARGS) \
202 --without-mpi \
203 $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
204 $(foreach lib,$(BOOST_LIBS), \
205 $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib)) \
206 ) \
207 $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_UCLIBC),on,off), \
208 boost.locale.iconv=off) \
209 \
210 $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
211 -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
212 install \
213 )
214 endef
215
216 define Build/InstallDev
217 $(INSTALL_DIR) \
218 $(1)/usr/include/boost/
219
220 $(CP) \
221 $(PKG_INSTALL_DIR)/include/boost/* \
222 $(1)/usr/include/boost/ \
223 # copies _all_ header files - independent of <--with-library>-argument above
224
225 if [ -d $(PKG_INSTALL_DIR)/lib ]; then \
226 $(INSTALL_DIR) \
227 $(1)/usr/lib; \
228 $(CP) \
229 $(PKG_INSTALL_DIR)/lib/*.a \
230 $(1)/usr/lib/; \
231 $(CP) \
232 $(PKG_INSTALL_DIR)/lib/*.so* \
233 $(1)/usr/lib/; \
234 fi
235 endef
236
237 define Host/Install
238 $(INSTALL_DIR) \
239 $(STAGING_DIR_HOST)/bin
240
241 $(CP) \
242 $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/bjam \
243 $(STAGING_DIR_HOST)/bin/
244 endef
245
246 define Package/boost/Default/install
247 $(INSTALL_DIR) \
248 $(1)/usr/lib
249
250 $(CP) \
251 $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* \
252 $(1)/usr/lib/
253 endef
254
255 define Package/boost-test/install
256 $(INSTALL_DIR) \
257 $(1)/usr/lib
258
259 $(CP) \
260 $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* \
261 $(1)/usr/lib/
262
263 $(CP) \
264 $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* \
265 $(1)/usr/lib/
266 endef
267
268 define BuildBoostLibrary
269 define Package/boost-$(1)/install
270 $(call Package/boost/Default/install,$$(1),$(1))
271 endef
272
273 $$(eval $$(call BuildPackage,boost-$(1)))
274 endef
275
276 $(eval $(call HostBuild))
277
278 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
279 $(eval $(call BuildPackage,boost-test))
280
281 $(eval $(call BuildPackage,boost-libs))
282 $(eval $(call BuildPackage,boost))