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