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.

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