You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

385 lines
11 KiB

  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. # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
  9. # Dude, this "boost" is really one of the most crude stuff I ported yet.
  10. #
  11. include $(TOPDIR)/rules.mk
  12. include $(INCLUDE_DIR)/nls.mk
  13. include $(INCLUDE_DIR)/target.mk
  14. PKG_NAME:=boost
  15. PKG_VERSION:=1_59_0
  16. PKG_RELEASE:=6
  17. PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
  18. PKG_SOURCE_URL:=@SF/boost
  19. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)
  20. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_VERSION)
  21. PKG_MD5SUM:=51528a0e3b33d9e10aaa311d9eb451e3
  22. PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
  23. PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
  24. PKG_BUILD_DEPENDS += boost/host
  25. PKG_BUILD_PARALLEL:=0
  26. PKG_USE_MIPS16:=0
  27. include $(INCLUDE_DIR)/package.mk
  28. include $(INCLUDE_DIR)/host-build.mk
  29. define Package/boost/Default
  30. SECTION:=libs
  31. CATEGORY:=Libraries
  32. TITLE:=Boost C++ source library
  33. URL:=http://www.boost.org
  34. DEPENDS:=+libstdcpp +libpthread +librt
  35. endef
  36. define Package/boost/description/Default
  37. true
  38. endef
  39. define Package/boost/description
  40. This package provides the Boost v1.59 libraries.
  41. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  42. This package provides the following libraries:
  43. - atomic
  44. - chrono
  45. - container
  46. - context
  47. - coroutine
  48. - - coroutine2 (requires GCC v5 and up)
  49. - date_time
  50. - exception
  51. - filesystem
  52. - graph
  53. - - graph-parallel
  54. - iostreams
  55. - locale
  56. - log
  57. - math
  58. - program_options
  59. - python
  60. - python3
  61. - random
  62. - regex
  63. - serialization
  64. - signals
  65. - system
  66. - thread
  67. - timer
  68. - wave
  69. endef
  70. BOOST_LIBS =
  71. define Package/boost-libs
  72. $(call Package/boost/Default)
  73. TITLE+= (all libs)
  74. DEPENDS+= $(BOOST_DEPENDS)
  75. HIDDEN:=1
  76. endef
  77. define Package/boost-libs/description
  78. $(call Package/boost/description/Default)
  79. .
  80. This meta package contains only dependencies to the other libraries from
  81. the boost libraries collection.
  82. endef
  83. # Create a meta-package of dependent libraries (for ALL)
  84. define Package/boost-libs/install
  85. true
  86. endef
  87. define Package/boost/install
  88. true
  89. endef
  90. define Package/boost
  91. $(call Package/boost/Default)
  92. TITLE+= packages
  93. DEPENDS:=+ALL:boost-libs +ALL:boost-test
  94. endef
  95. define Package/boost/config
  96. menu "Select Boost Options"
  97. depends on PACKAGE_boost
  98. comment "Boost compilation options."
  99. config boost-static-libs
  100. bool "Compile Static Libraries"
  101. help
  102. Compile static version of all selected boost libraries.
  103. default n
  104. config boost-shared-libs
  105. bool "Compile Shared Libraries"
  106. help
  107. Compile shared version of all selected boost libraries.
  108. default y
  109. config boost-runtime-static
  110. bool "Use static version of C and C++ runtimes for static libraries."
  111. help
  112. Determines if shared or static version of C and C++ runtimes should be used for static libraries.
  113. default n
  114. select boost-static-libs
  115. config boost-runtime-shared
  116. bool "Use shared version of C and C++ runtimes for shared libraries."
  117. help
  118. Determines if shared or static version of C and C++ runtimes should be used for shared libraries.
  119. default n
  120. select boost-shared-libs
  121. config boost-multi-threading
  122. bool "Multithread Support"
  123. help
  124. Compile Boost libraries n multithread mode.
  125. default y
  126. config boost-single-thread
  127. bool "Single thread Support"
  128. help
  129. Compile Boost libraries in single-thread mode.
  130. default n
  131. config boost-with-debug
  132. bool "Boost Debug Support"
  133. help
  134. Compile Boost libraries with debug support.
  135. default n
  136. endmenu
  137. menu "Select Boost libraries"
  138. depends on PACKAGE_boost
  139. comment "Libraries"
  140. config boost-libs-all
  141. bool "Include all Boost libraries."
  142. select PACKAGE_boost-libs
  143. config boost-test-pkg
  144. bool "Boost test package."
  145. select PACKAGE_boost-test
  146. config boost-coroutine2
  147. depends on @GCC_USE_VERSION_5
  148. bool "Boost couroutine2 support."
  149. select PACKAGE_boost-coroutine
  150. default n
  151. config boost-graph-parallel
  152. bool "Boost parallel graph support."
  153. select PACKAGE_boost-graph
  154. default n
  155. $(foreach lib,$(BOOST_LIBS), \
  156. config PACKAGE_boost-$(lib)
  157. prompt "Boost $(lib) library."
  158. )
  159. endmenu
  160. endef
  161. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  162. define Package/boost-test
  163. $(call Package/boost/Default)
  164. TITLE+= (test)
  165. HIDDEN:=1
  166. DEPENDS+=+boost-system +boost-timer
  167. endef
  168. define Build/Configure
  169. endef
  170. # 1: short name
  171. # 2: dependencies on other boost libraries (short name)
  172. # 3: dependencies on other packages
  173. define DefineBoostLibrary
  174. BOOST_DEPENDS+= +boost-$(1)
  175. BOOST_LIBS+= $(1)
  176. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  177. define Package/boost-$(1)
  178. $(call Package/boost/Default)
  179. TITLE+= ($(1))
  180. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  181. HIDDEN:=1
  182. endef
  183. define Package/boost-$(1)/description
  184. $(call Package/boost/description/Default)
  185. .
  186. This package contains the Boost $(1) library.
  187. endef
  188. endef
  189. $(eval $(call DefineBoostLibrary,atomic,system,))
  190. $(eval $(call DefineBoostLibrary,chrono,system,))
  191. $(eval $(call DefineBoostLibrary,container,,))
  192. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  193. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  194. $(eval $(call DefineBoostLibrary,date_time,,))
  195. #$(eval $(call DefineBoostLibrary,exception,,))
  196. $(eval $(call DefineBoostLibrary,filesystem,system,))
  197. $(eval $(call DefineBoostLibrary,graph,regex,))
  198. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  199. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS) +@BUILD_NLS))
  200. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  201. $(eval $(call DefineBoostLibrary,math,,))
  202. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  203. $(eval $(call DefineBoostLibrary,program_options,,))
  204. $(eval $(call DefineBoostLibrary,python,,+CONFIG_boost_python:python))
  205. $(eval $(call DefineBoostLibrary,python3,,+CONFIG_boost_python3:python3))
  206. $(eval $(call DefineBoostLibrary,random,system,))
  207. $(eval $(call DefineBoostLibrary,regex,,))
  208. $(eval $(call DefineBoostLibrary,serialization,,))
  209. $(eval $(call DefineBoostLibrary,signals,,))
  210. $(eval $(call DefineBoostLibrary,system,,+@boost-multi-threading))
  211. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  212. $(eval $(call DefineBoostLibrary,timer,chrono))
  213. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  214. define Host/Compile
  215. # bjam does not provide a configure-script nor a Makefile
  216. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  217. endef
  218. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  219. TARGET_LDFLAGS += -pthread -lrt
  220. TARGET_CFLAGS += \
  221. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  222. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  223. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  224. ifneq ($(findstring mips,$(ARCH)),)
  225. BOOST_ABI = o32
  226. ifneq ($(findstring 64,$(ARCH)),)
  227. BOOST_ABI = o64
  228. endif
  229. else ifneq ($(findstring arm,$(ARCH)),)
  230. BOOST_ABI = aapcs
  231. else ifeq ($(ARCH),aarch64)
  232. BOOST_ABI = aapcs
  233. else
  234. BOOST_ABI = sysv
  235. endif
  236. define Build/Compile
  237. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  238. ( cd $(PKG_BUILD_DIR) ; \
  239. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  240. $(if $(CONFIG_PACKAGE_boost-python3), \
  241. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  242. tools/build/src/user-config.jam; \
  243. ) \
  244. $(if $(CONFIG_PACKAGE_boost-python), \
  245. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  246. tools/build/src/user-config.jam; \
  247. ) \
  248. bjam \
  249. '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
  250. --ignore-site-config \
  251. --toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
  252. --disable-long-double \
  253. --layout=tagged \
  254. $(if $(CONFIG_boost-with-debug),--build-type=complete,--build-type=minimal) \
  255. $(if $(CONFIG_boost-static-libs),link=static,) \
  256. $(if $(CONFIG_boost-runtime-static),runtime-link=static,runtime-link=shared) \
  257. $(if $(CONFIG_boost-shared-libs),link=shared,) \
  258. $(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
  259. $(if $(CONFIG_boost-single-thread),threading=single,) \
  260. $(if $(CONFIG_boost-multi-threading),threading=multi,) \
  261. $(CONFIGURE_ARGS) \
  262. --without-mpi \
  263. $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
  264. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  265. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  266. $(foreach lib,$(BOOST_LIBS), \
  267. $(if $(findstring python,$(lib)), \
  268. $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
  269. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
  270. ) \
  271. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  272. boost.locale.iconv=off) \
  273. \
  274. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  275. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  276. install \
  277. )
  278. endef
  279. define Build/InstallDev
  280. $(INSTALL_DIR) \
  281. $(1)/usr/include/boost/
  282. $(CP) \
  283. $(PKG_INSTALL_DIR)/include/boost/* \
  284. $(1)/usr/include/boost/ \
  285. # copies _all_ header files - independent of <--with-library>-argument above
  286. $(INSTALL_DIR) $(1)/usr/lib
  287. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  288. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  289. endef
  290. define Host/Install
  291. $(INSTALL_DIR) \
  292. $(STAGING_DIR_HOST)/bin
  293. $(CP) \
  294. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/bjam \
  295. $(STAGING_DIR_HOST)/bin/
  296. endef
  297. define Package/boost/Default/install
  298. $(INSTALL_DIR) \
  299. $(1)/usr/lib
  300. $(FIND) \
  301. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  302. endef
  303. define Package/boost-test/install
  304. $(INSTALL_DIR) \
  305. $(1)/usr/lib
  306. $(FIND) \
  307. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  308. $(FIND) \
  309. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  310. endef
  311. define BuildBoostLibrary
  312. define Package/boost-$(1)/install
  313. $(call Package/boost/Default/install,$$(1),$(1))
  314. endef
  315. $$(eval $$(call BuildPackage,boost-$(1)))
  316. endef
  317. $(eval $(call HostBuild))
  318. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  319. $(eval $(call BuildPackage,boost-test))
  320. $(eval $(call BuildPackage,boost-libs))
  321. $(eval $(call BuildPackage,boost))