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.

327 lines
9.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_59_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:=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. 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. true
  38. endef
  39. define Package/boost/description
  40. This package provides the Boost v1.59 libraries.
  41. Boost is a set of free, peer-reviewed, portable C++ source libraries.
  42. endef
  43. BOOST_LIBS =
  44. define Package/boost-libs
  45. $(call Package/boost/Default)
  46. TITLE+= (all libs)
  47. DEPENDS+= $(BOOST_DEPENDS)
  48. HIDDEN:=1
  49. endef
  50. define Package/boost-libs/description
  51. $(call Package/boost/description/Default)
  52. .
  53. This meta package contains only dependencies to the other libraries from
  54. the boost libraries collection.
  55. endef
  56. # Create a meta-package of dependent libraries (for ALL)
  57. define Package/boost-libs/install
  58. true
  59. endef
  60. define Package/boost/install
  61. true
  62. endef
  63. define Package/boost
  64. $(call Package/boost/Default)
  65. TITLE+= packages
  66. DEPENDS:=+ALL:boost-libs +ALL:boost-test
  67. endef
  68. define Package/boost/config
  69. menu "Select Boost Options"
  70. depends on PACKAGE_boost
  71. comment "Boost compilation options."
  72. config boost-static-libs
  73. bool "Static Libraries Only"
  74. help
  75. Static compile of all selected boost libraries.
  76. default n
  77. config boost-runtime-static
  78. bool "Use static version of C and C++ runtimes."
  79. help
  80. Determines if shared or static version of C and C++ runtimes should be used.
  81. default n
  82. select boost-static-libs
  83. config boost-multi-threading
  84. bool "Multithread Support"
  85. help
  86. Compile Boost libraries with multithread support.
  87. default y
  88. endmenu
  89. menu "Select Boost libraries"
  90. depends on PACKAGE_boost
  91. comment "Libraries"
  92. config boost-libs-all
  93. bool "Include all Boost libraries."
  94. select PACKAGE_boost-libs
  95. config boost-test-pkg
  96. bool "Boost test package."
  97. select PACKAGE_boost-test
  98. config boost-coroutine2
  99. bool "Boost couroutine2 support."
  100. select PACKAGE_boost-coroutine
  101. default n
  102. config boost-graph-parallel
  103. bool "Boost parallel graph support."
  104. select PACKAGE_boost-graph
  105. default n
  106. $(foreach lib,$(BOOST_LIBS), \
  107. config PACKAGE_boost-$(lib)
  108. prompt "Boost $(lib) library."
  109. )
  110. endmenu
  111. endef
  112. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  113. define Package/boost-test
  114. $(call Package/boost/Default)
  115. TITLE+= (test)
  116. HIDDEN:=1
  117. DEPENDS+=+boost-system +boost-timer
  118. endef
  119. define Build/Configure
  120. endef
  121. # 1: short name
  122. # 2: dependencies on other boost libraries (short name)
  123. # 3: dependencies on other packages
  124. define DefineBoostLibrary
  125. BOOST_DEPENDS+= +boost-$(1)
  126. BOOST_LIBS+= $(1)
  127. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  128. define Package/boost-$(1)
  129. $(call Package/boost/Default)
  130. TITLE+= ($(1))
  131. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  132. HIDDEN:=1
  133. endef
  134. define Package/boost-$(1)/description
  135. $(call Package/boost/description/Default)
  136. .
  137. This package contains the Boost $(1) library.
  138. endef
  139. endef
  140. $(eval $(call DefineBoostLibrary,atomic,system,))
  141. $(eval $(call DefineBoostLibrary,chrono,system,))
  142. $(eval $(call DefineBoostLibrary,container,,))
  143. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  144. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  145. $(eval $(call DefineBoostLibrary,date_time,,))
  146. #$(eval $(call DefineBoostLibrary,exception,,))
  147. $(eval $(call DefineBoostLibrary,filesystem,system,))
  148. $(eval $(call DefineBoostLibrary,graph,regex,))
  149. #$(eval $(call DefineBoostLibrary,graph_parallel,,))
  150. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  151. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS) +@BUILD_NLS))
  152. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  153. $(eval $(call DefineBoostLibrary,math,,))
  154. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  155. $(eval $(call DefineBoostLibrary,program_options,,))
  156. $(eval $(call DefineBoostLibrary,python,,+python))
  157. $(eval $(call DefineBoostLibrary,python3,,+python3))
  158. $(eval $(call DefineBoostLibrary,random,system,))
  159. $(eval $(call DefineBoostLibrary,regex,,))
  160. $(eval $(call DefineBoostLibrary,serialization,,))
  161. $(eval $(call DefineBoostLibrary,signals,,))
  162. $(eval $(call DefineBoostLibrary,system,,+@boost-multi-threading))
  163. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  164. $(eval $(call DefineBoostLibrary,timer,chrono))
  165. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  166. define Host/Compile
  167. # bjam does not provide a configure-script nor a Makefile
  168. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  169. endef
  170. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  171. TARGET_LDFLAGS += -pthread -lrt
  172. TARGET_CFLAGS += \
  173. $(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
  174. $(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
  175. $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  176. ifneq ($(findstring mips,$(ARCH)),)
  177. BOOST_ABI = o32
  178. ifneq ($(findstring 64,$(ARCH)),)
  179. BOOST_ABI = o64
  180. endif
  181. else ifneq ($(findstring arm,$(ARCH)),)
  182. BOOST_ABI = aapcs
  183. else ifeq ($(ARCH),aarch64)
  184. BOOST_ABI = aapcs
  185. else
  186. BOOST_ABI = sysv
  187. endif
  188. define Build/Compile
  189. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  190. ( cd $(PKG_BUILD_DIR) ; \
  191. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  192. $(if $(CONFIG_PACKAGE_boost-python3), \
  193. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  194. tools/build/src/user-config.jam; \
  195. ) \
  196. $(if $(CONFIG_PACKAGE_boost-python), \
  197. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  198. tools/build/src/user-config.jam; \
  199. ) \
  200. bjam \
  201. '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
  202. --ignore-site-config \
  203. --toolset=gcc-$(ARCH) --build-type=minimal --layout=system abi=$(BOOST_ABI) \
  204. --disable-long-double \
  205. $(if $(CONFIG_boost-static-libs),link=static,link=shared) \
  206. $(if $(CONFIG_boost-runtime-static),runtime-link=static,runtime-link=shared) \
  207. $(if $(CONFIG_boost-multi-threading),threading=multi,threading=single) \
  208. $(CONFIGURE_ARGS) \
  209. --without-mpi \
  210. $(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
  211. $(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
  212. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  213. $(foreach lib,$(BOOST_LIBS), \
  214. $(if $(findstring python,$(lib)), \
  215. $(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
  216. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
  217. ) \
  218. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  219. boost.locale.iconv=off) \
  220. \
  221. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  222. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  223. install \
  224. )
  225. endef
  226. define Build/InstallDev
  227. $(INSTALL_DIR) \
  228. $(1)/usr/include/boost/
  229. $(CP) \
  230. $(PKG_INSTALL_DIR)/include/boost/* \
  231. $(1)/usr/include/boost/ \
  232. # copies _all_ header files - independent of <--with-library>-argument above
  233. $(INSTALL_DIR) $(1)/usr/lib
  234. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  235. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  236. endef
  237. define Host/Install
  238. $(INSTALL_DIR) \
  239. $(STAGING_DIR_HOST)/bin
  240. $(CP) \
  241. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/bjam \
  242. $(STAGING_DIR_HOST)/bin/
  243. endef
  244. define Package/boost/Default/install
  245. $(INSTALL_DIR) \
  246. $(1)/usr/lib
  247. $(FIND) \
  248. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  249. endef
  250. define Package/boost-test/install
  251. $(INSTALL_DIR) \
  252. $(1)/usr/lib
  253. $(FIND) \
  254. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  255. $(FIND) \
  256. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  257. endef
  258. define BuildBoostLibrary
  259. define Package/boost-$(1)/install
  260. $(call Package/boost/Default/install,$$(1),$(1))
  261. endef
  262. $$(eval $$(call BuildPackage,boost-$(1)))
  263. endef
  264. $(eval $(call HostBuild))
  265. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  266. $(eval $(call BuildPackage,boost-test))
  267. $(eval $(call BuildPackage,boost-libs))
  268. $(eval $(call BuildPackage,boost))