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.

308 lines
8.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:=4
  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. $(foreach lib,$(BOOST_LIBS), \
  99. config PACKAGE_boost-$(lib)
  100. prompt "Boost $(lib) library"
  101. )
  102. endmenu
  103. endef
  104. PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
  105. define Package/boost-test
  106. $(call Package/boost/Default)
  107. TITLE+= (test)
  108. HIDDEN:=1
  109. DEPENDS+=+boost-system +boost-timer
  110. endef
  111. define Build/Configure
  112. endef
  113. # 1: short name
  114. # 2: dependencies on other boost libraries (short name)
  115. # 3: dependencies on other packages
  116. define DefineBoostLibrary
  117. BOOST_DEPENDS+= +boost-$(1)
  118. BOOST_LIBS+= $(1)
  119. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
  120. define Package/boost-$(1)
  121. $(call Package/boost/Default)
  122. TITLE+= ($(1))
  123. DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3)
  124. HIDDEN:=1
  125. endef
  126. define Package/boost-$(1)/description
  127. $(call Package/boost/description/Default)
  128. .
  129. This package contains the Boost $(1) library.
  130. endef
  131. endef
  132. $(eval $(call DefineBoostLibrary,atomic,system,))
  133. $(eval $(call DefineBoostLibrary,chrono,system,))
  134. $(eval $(call DefineBoostLibrary,container,,))
  135. $(eval $(call DefineBoostLibrary,context,chrono system thread,))
  136. $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
  137. $(eval $(call DefineBoostLibrary,date_time,,))
  138. #$(eval $(call DefineBoostLibrary,exception,,))
  139. $(eval $(call DefineBoostLibrary,filesystem,system,))
  140. $(eval $(call DefineBoostLibrary,graph,regex,))
  141. #$(eval $(call DefineBoostLibrary,graph_parallel,,))
  142. $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
  143. $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS) +@BUILD_NLS))
  144. $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
  145. $(eval $(call DefineBoostLibrary,math,,))
  146. #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
  147. $(eval $(call DefineBoostLibrary,program_options,,))
  148. $(eval $(call DefineBoostLibrary,random,system,))
  149. $(eval $(call DefineBoostLibrary,python,,+PACKAGE_boost-python:python))
  150. $(eval $(call DefineBoostLibrary,python3,,+PACKAGE_boost-python3:python3))
  151. $(eval $(call DefineBoostLibrary,regex,,))
  152. $(eval $(call DefineBoostLibrary,serialization,,))
  153. $(eval $(call DefineBoostLibrary,signals,,))
  154. $(eval $(call DefineBoostLibrary,system,,+@boost-multi-threading))
  155. $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
  156. $(eval $(call DefineBoostLibrary,timer,chrono))
  157. $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
  158. define Host/Compile
  159. # bjam does not provide a configure-script nor a Makefile
  160. ( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
  161. endef
  162. CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
  163. TARGET_LDFLAGS += -pthread -lrt
  164. TARGET_CFLAGS += $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
  165. ifneq ($(findstring mips,$(ARCH)),)
  166. BOOST_ABI = o32
  167. ifneq ($(findstring 64,$(ARCH)),)
  168. BOOST_ABI = o64
  169. endif
  170. else ifneq ($(findstring arm,$(ARCH)),)
  171. BOOST_ABI = aapcs
  172. else ifeq ($(ARCH),aarch64)
  173. BOOST_ABI = aapcs
  174. else
  175. BOOST_ABI = sysv
  176. endif
  177. define Build/Compile
  178. $(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
  179. ( cd $(PKG_BUILD_DIR) ; \
  180. echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
  181. $(if $(CONFIG_PACKAGE_boost-python3), \
  182. echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
  183. tools/build/src/user-config.jam; \
  184. ) \
  185. $(if $(CONFIG_PACKAGE_boost-python), \
  186. echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python2 : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
  187. tools/build/src/user-config.jam; \
  188. ) \
  189. bjam \
  190. '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
  191. --ignore-site-config \
  192. --toolset=gcc-$(ARCH) --build-type=minimal --layout=system abi=$(BOOST_ABI) \
  193. --disable-long-double \
  194. $(if $(CONFIG_boost-static-libs),link=static,link=shared) \
  195. $(if $(CONFIG_boost-runtime-static),runtime-link=static,runtime-link=shared) \
  196. $(if $(CONFIG_boost-multi-threading),threading=multi,threading=single) \
  197. $(CONFIGURE_ARGS) \
  198. --without-mpi \
  199. $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
  200. $(foreach lib,$(BOOST_LIBS), \
  201. $(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib)) \
  202. ) \
  203. $(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
  204. boost.locale.iconv=off) \
  205. \
  206. $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
  207. -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
  208. install \
  209. )
  210. endef
  211. define Build/InstallDev
  212. $(INSTALL_DIR) \
  213. $(1)/usr/include/boost/
  214. $(CP) \
  215. $(PKG_INSTALL_DIR)/include/boost/* \
  216. $(1)/usr/include/boost/ \
  217. # copies _all_ header files - independent of <--with-library>-argument above
  218. $(INSTALL_DIR) $(1)/usr/lib
  219. $(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
  220. $(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
  221. endef
  222. define Host/Install
  223. $(INSTALL_DIR) \
  224. $(STAGING_DIR_HOST)/bin
  225. $(CP) \
  226. $(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/bjam \
  227. $(STAGING_DIR_HOST)/bin/
  228. endef
  229. define Package/boost/Default/install
  230. $(INSTALL_DIR) \
  231. $(1)/usr/lib
  232. $(FIND) \
  233. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  234. endef
  235. define Package/boost-test/install
  236. $(INSTALL_DIR) \
  237. $(1)/usr/lib
  238. $(FIND) \
  239. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  240. $(FIND) \
  241. $(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
  242. endef
  243. define BuildBoostLibrary
  244. define Package/boost-$(1)/install
  245. $(call Package/boost/Default/install,$$(1),$(1))
  246. endef
  247. $$(eval $$(call BuildPackage,boost-$(1)))
  248. endef
  249. $(eval $(call HostBuild))
  250. $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
  251. $(eval $(call BuildPackage,boost-test))
  252. $(eval $(call BuildPackage,boost-libs))
  253. $(eval $(call BuildPackage,boost))