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.

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