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.

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