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.9 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:=2
  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. # 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. DEPENDS+=+boost-system +boost-timer
  88. endef
  89. define Build/Configure
  90. endef
  91. # 1: short name
  92. # 2: dependencies on other boost libraries (short name)
  93. # 3: dependencies on other packages
  94. define DefineBoostLibrary
  95. BOOST_DEPENDS+= +boost-$(1)
  96. BOOST_LIBS+= $(1)
  97. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  98. define Package/boost-$(1)
  99. $(call Package/boost/Default)
  100. TITLE+= ($(1))
  101. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  102. HIDDEN:=1
  103. endef
  104. define Package/boost-$(1)/description
  105. $(call Package/boost/description/Default)
  106. .
  107. This package contains the Boost $(1) library.
  108. endef
  109. endef
  110. $(eval $(call DefineBoostLibrary,atomic,system,))
  111. $(eval $(call DefineBoostLibrary,chrono,system,))
  112. $(eval $(call DefineBoostLibrary,container,,))
  113. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  114. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  115. $(eval $(call DefineBoostLibrary,date_time,,))
  116. #$(eval $(call DefineBoostLibrary,exception,,))
  117. $(eval $(call DefineBoostLibrary,filesystem,system,))
  118. $(eval $(call DefineBoostLibrary,graph,regex,))
  119. #$(eval $(call DefineBoostLibrary,graph_parallel,,))
  120. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  121. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS) +@BUILD_NLS))
  122. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  123. $(eval $(call DefineBoostLibrary,math,,))
  124. #$(eval $(call DefineBoostLibrary,mpi,,))
  125. $(eval $(call DefineBoostLibrary,program_options,,))
  126. $(eval $(call DefineBoostLibrary,random,system,))
  127. # We need a beter way to provide this package, information regarding the Python packages
  128. # such as Python version and directories locations.
  129. # Python 2.7 version is for now hard-coded. Python 3 is (until this date) broken in the trunk tree.
  130. $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
  131. $(eval $(call DefineBoostLibrary,regex,,))
  132. $(eval $(call DefineBoostLibrary,serialization,,))
  133. $(eval $(call DefineBoostLibrary,signals,,))
  134. $(eval $(call DefineBoostLibrary,system,,))
  135. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  136. $(eval $(call DefineBoostLibrary,timer,chrono))
  137. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  138. define Host/Compile
  139. # bjam does not provide a configure-script nor a Makefile
  140. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  141. endef
  142. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  143. TARGET_LDFLAGS += -pthread -lrt
  144. TARGET_CFLAGS += $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H)
  145. ifneq ($(findstring mips,$(ARCH)),)
  146. BOOST_ABI = o32
  147. ifneq ($(findstring 64,$(ARCH)),)
  148. BOOST_ABI = o64
  149. endif
  150. else ifneq ($(findstring arm,$(ARCH)),)
  151. BOOST_ABI = aapcs
  152. else ifeq ($(ARCH),aarch64)
  153. BOOST_ABI = aapcs
  154. else
  155. BOOST_ABI = sysv
  156. endif
  157. define Build/Compile
  158. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  159. ( cd $(PKG_BUILD_DIR) ; \
  160. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  161. $(if $(CONFIG_PACKAGE_boost-python), \
  162. echo "using python : : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  163. tools/build/src/user-config.jam; \
  164. ) \
  165. bjam \
  166. '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
  167. --toolset=gcc-$(ARCH) --build-type=minimal --layout=system abi=$(BOOST_ABI) \
  168. --disable-long-double \
  169. $(CONFIGURE_ARGS) \
  170. --without-mpi \
  171. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  172. $(foreach lib,$(BOOST_LIBS), \
  173. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib)) \
  174. ) \
  175. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_UCLIBC),on,off), \
  176. boost.locale.iconv=off) \
  177. \
  178. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  179. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  180. install \
  181. )
  182. endef
  183. define Build/InstallDev
  184. $(INSTALL_DIR) \
  185. $(1)/usr/include/boost/
  186. $(CP) \
  187. $(PKG_INSTALL_DIR)/include/boost/* \
  188. $(1)/usr/include/boost/ \
  189. # copies _all_ header files - independent of <--with-library>-argument above
  190. $(INSTALL_DIR) $(1)/usr/lib
  191. -$(CP) $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/
  192. -$(CP) $(PKG_INSTALL_DIR)/lib/*.so* $(1)/usr/lib/
  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))