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.

277 lines
7.3 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_57_0
  16. PKG_RELEASE:=3
  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:=25f9a8ac28beeb5ab84aa98510305299
  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,,))
  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. $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
  122. $(eval $(call DefineBoostLibrary,regex,,))
  123. $(eval $(call DefineBoostLibrary,serialization,,))
  124. $(eval $(call DefineBoostLibrary,signals,,))
  125. $(eval $(call DefineBoostLibrary,system,,))
  126. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  127. $(eval $(call DefineBoostLibrary,timer,chrono))
  128. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  129. define Host/Compile
  130. # bjam does not provide a configure-script nor a Makefile
  131. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  132. endef
  133. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  134. TARGET_LDFLAGS += -pthread -lrt
  135. ifneq ($(findstring mips,$(ARCH)),)
  136. BOOST_ABI = o32
  137. ifneq ($(findstring 64,$(ARCH)),)
  138. BOOST_ABI = o64
  139. endif
  140. else ifneq ($(findstring arm,$(ARCH)),)
  141. BOOST_ABI = aapcs
  142. else ifeq ($(ARCH),aarch64)
  143. BOOST_ABI = aapcs
  144. else
  145. BOOST_ABI = sysv
  146. endif
  147. define Build/Compile
  148. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  149. ( cd $(PKG_BUILD_DIR) ; \
  150. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  151. $(if $(CONFIG_PACKAGE_boost-python), \
  152. echo "using python : : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  153. tools/build/src/user-config.jam; \
  154. ) \
  155. bjam \
  156. '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
  157. --toolset=gcc-$(ARCH) --build-type=minimal --layout=system abi=$(BOOST_ABI) \
  158. --disable-long-double \
  159. $(CONFIGURE_ARGS) \
  160. --without-mpi \
  161. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  162. $(foreach lib,$(BOOST_LIBS), \
  163. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib)) \
  164. ) \
  165. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_UCLIBC),on,off), \
  166. boost.locale.iconv=off) \
  167. \
  168. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  169. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  170. install \
  171. )
  172. endef
  173. define Build/InstallDev
  174. $(INSTALL_DIR) \
  175. $(1)/usr/include/boost/
  176. $(CP) \
  177. $(PKG_INSTALL_DIR)/include/boost/* \
  178. $(1)/usr/include/boost/ \
  179. # copies _all_ header files - independent of <--with-library>-argument above
  180. if [ -d $(PKG_INSTALL_DIR)/lib ]; then \
  181. $(INSTALL_DIR) \
  182. $(1)/usr/lib; \
  183. $(CP) \
  184. $(PKG_INSTALL_DIR)/lib/*.a \
  185. $(1)/usr/lib/; \
  186. $(CP) \
  187. $(PKG_INSTALL_DIR)/lib/*.so* \
  188. $(1)/usr/lib/; \
  189. fi
  190. endef
  191. define Host/Install
  192. $(INSTALL_DIR) \
  193. $(STAGING_DIR_HOST)/bin
  194. $(CP) \
  195. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/bjam \
  196. $(STAGING_DIR_HOST)/bin/
  197. endef
  198. define Package/boost/Default/install
  199. $(INSTALL_DIR) \
  200. $(1)/usr/lib
  201. $(CP) \
  202. $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* \
  203. $(1)/usr/lib/
  204. endef
  205. define Package/boost-test/install
  206. $(INSTALL_DIR) \
  207. $(1)/usr/lib
  208. $(CP) \
  209. $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* \
  210. $(1)/usr/lib/
  211. $(CP) \
  212. $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* \
  213. $(1)/usr/lib/
  214. endef
  215. define BuildBoostLibrary
  216. define Package/boost-$(1)/install
  217. $(call Package/boost/Default/install,$$(1),$(1))
  218. endef
  219. $$(eval $$(call BuildPackage,boost-$(1)))
  220. endef
  221. $(eval $(call HostBuild))
  222. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  223. $(eval $(call BuildPackage,boost-test))
  224. $(eval $(call BuildPackage,boost-libs))
  225. $(eval $(call BuildPackage,boost))