lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

Makefile (14211B)


      1 #
      2 # Copyright (C) 2015-2017 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 # 
      9 # Original Boost 1.51 Makefile by Mirko Vogt <mirko@openwrt.org>
     10 # Dude, this "boost" is really one of the most crude stuff I ported yet.
     11 #
     12 
     13 
     14 include $(TOPDIR)/rules.mk
     15 include $(INCLUDE_DIR)/nls.mk
     16 include $(INCLUDE_DIR)/target.mk 
     17 
     18 PKG_NAME:=boost
     19 PKG_VERSION:=1.63.0
     20 PKG_SOURCE_VERSION:=1_63_0
     21 PKG_RELEASE:=2
     22 
     23 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
     24 PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
     25 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
     26 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
     27 PKG_MD5SUM:=beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0
     28 PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
     29 PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
     30 
     31 PKG_BUILD_PARALLEL:=0
     32 PKG_USE_MIPS16:=0
     33 
     34 include $(INCLUDE_DIR)/package.mk
     35 include $(INCLUDE_DIR)/host-build.mk
     36 
     37 
     38 define Package/boost/Default
     39   SECTION:=libs
     40   CATEGORY:=Libraries
     41   TITLE:=Boost C++ source library
     42   URL:=http://www.boost.org
     43   DEPENDS:=+libstdcpp +libpthread +librt
     44 endef
     45 
     46 define Package/boost/description
     47 This package provides the Boost v1.63 libraries.
     48 Boost is a set of free, peer-reviewed, portable C++ source libraries.
     49 
     50 -----------------------------------------------------------------------------
     51 |                                Warning                                    |
     52 | In order to build all of the Boost Libraries, it is necessary             |
     53 | to use, at least, GCC version 5 (C++14 support) and, it is necessary to   |
     54 | compile the kernel with Full Language Support.                            |
     55 | Without these requirerements, the following libs will not be available:   |
     56 | - Boost.Locale                                                            |
     57 | - Boost.Coroutine2                                                        |
     58 | - Boost.Fiber                                                             |
     59 -----------------------------------------------------------------------------
     60 
     61 This package provides the following run-time libraries:
     62  - atomic
     63  - chrono
     64  - container
     65  - context
     66  - coroutine (Deprecated - use Coroutine2)
     67  - - coroutine2 (Requires GCC v5 and up)
     68  - date_time
     69  - exception
     70  - filesystem
     71  - fiber (Requires GCC v5 and up)
     72  - graph
     73  - - graph-parallel
     74  - iostreams
     75  - locale (Requires kernel being compiled with full language support)
     76  - log
     77  - math
     78  - program_options
     79  - python
     80  - python3
     81  - random
     82  - regex
     83  - serialization
     84  - signals
     85  - system
     86  - thread
     87  - timer
     88  - wave
     89 
     90 There are many more header-only libraries supported by Boost.
     91 See more at http://www.boost.org/doc/libs/1_63_0/
     92 endef
     93 
     94 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
     95 
     96 BOOST_LIBS =
     97 
     98 define Package/boost-libs
     99 $(call Package/boost/Default)
    100   TITLE+= (all libs)
    101   DEPENDS+= $(BOOST_DEPENDS)
    102   HIDDEN:=1
    103 endef
    104 
    105 define Package/boost-libs/description
    106  This meta package contains only dependencies to the other libraries from
    107  the boost libraries collection.
    108 endef
    109 
    110 # Create a meta-package of dependent libraries (for ALL)
    111 define Package/boost-libs/install
    112   true
    113 endef
    114 
    115 define Package/boost/install
    116   true
    117 endef
    118 
    119 define Package/boost
    120   $(call Package/boost/Default)
    121   TITLE+= packages
    122 endef
    123 
    124 define Package/boost/config
    125 	menu "Select Boost Options"
    126 		depends on PACKAGE_boost
    127 		comment "Boost compilation options."
    128 
    129 		choice
    130 			prompt "Compile Boost libraries."
    131 				default boost-static-and-shared-libs
    132 				help
    133 					Choose which version to compile.
    134 					-> Shared:
    135 						- Only Shared libs will be compiled.
    136 					-> Static:
    137 						- Only Static libs will be compiled.
    138 					-> Both:
    139 						- Both Static and Shared libs will be compiled.
    140 
    141 			config boost-shared-libs
    142 				bool "Shared"
    143 			
    144 			config boost-static-libs
    145 				bool "Static"
    146 			
    147 			config boost-static-and-shared-libs
    148 				bool "Both"
    149 		endchoice
    150 
    151 		choice
    152 			prompt "Selects Boost Runtime linkage."
    153 			default boost-runtime-shared
    154 			help
    155 				Choose which C and C++ runtimes to use:
    156 				-> Use Shared runtimes.
    157 				-> Use Static runtimes.
    158 					- Not available if Shared libs are to be built.
    159 				-> Use both runtimes.
    160 					- Not available if Shared libs are to be built.
    161 					- Two separate versions of Boost are built, linking each to a different runtime. 
    162 					- This option requires "Use tagged names" option to be active.
    163 
    164 			config boost-runtime-shared
    165 				bool "Shared"
    166 
    167 			config boost-runtime-static
    168 				depends on @(!boost-shared-libs&&!boost-static-and-shared-libs)
    169 				bool "Static"		    	
    170 
    171 			config boost-runtime-static-and-shared
    172 				depends on @(boost-use-name-tags&&!boost-shared-libs&&!boost-static-and-shared-libs)
    173 				bool "Both"
    174 		endchoice
    175 
    176 		choice
    177 			prompt "Select a Variant."
    178 			default boost-variant-release
    179 			help
    180 				Chooses which boost variant should be selected:
    181 				-> Release: Optimizes Boost for release.
    182 					- Optimization: Speed;  Debug Symbols: Off; Inlining: Full; Runtime Debugging: Off.
    183 				-> Debug: 
    184 					- Optimization: Off; Debug Symbols: On; Inlining: Off; Runtime Debugging: On.
    185 				-> Profile:
    186 					- Profiling: On;  Debug Symbols: On.
    187 
    188 			config boost-variant-release
    189 				bool "Release"
    190 
    191 			config boost-variant-debug
    192 				bool "Debug"
    193 
    194 			config boost-variant-profile
    195 				bool "Profile"
    196 		endchoice
    197 
    198 		config boost-use-name-tags
    199 			bool "Use tagged names."
    200 			help 
    201 				Add name tags the lib files, to diferentiate each library version:
    202 				  "-mt" for multi-threading.
    203 				  "-d" for debugging.
    204 				  "-s" for runtime static link".
    205 				Might break compatibility with libraries that expect boost libs with default names.
    206 			default n
    207 
    208 		config boost-single-thread
    209 			depends on @boost-use-name-tags
    210 			bool "Single thread Support."
    211 			help 
    212 				Compile Boost libraries in single-thread mode.
    213 			default n
    214 			    
    215 		config boost-build-type-complete
    216 			depends on @boost-use-name-tags
    217 			bool "Complete Boost Build."
    218 			help 
    219 				Builds both release and debug libs. It will take much longer to compile.
    220 			default n
    221 	endmenu
    222 
    223 	menu "Select Boost libraries"
    224 		depends on PACKAGE_boost
    225 		comment "Libraries"
    226 
    227 		config boost-libs-all
    228 			bool "Include all Boost libraries."
    229 			default m if ALL
    230 			select PACKAGE_boost-libs
    231 			select boost-test-pkg
    232 			select boost-coroutine2
    233 			select boost-graph-parallel
    234 
    235 		config boost-test-pkg
    236 			bool "Boost test package."
    237 			default m if ALL
    238 			select PACKAGE_boost-test
    239 
    240 		config boost-coroutine2
    241 			depends on !@GCC_VERSION_4_8
    242 			bool "Boost couroutine2 support."
    243 			select PACKAGE_boost-coroutine
    244 			default n
    245 
    246 		config boost-graph-parallel
    247 			bool "Boost parallel graph support."
    248 			select PACKAGE_boost-graph
    249 			default n
    250 
    251 		$(foreach lib,$(BOOST_LIBS), \
    252 			config PACKAGE_boost-$(lib)
    253 			prompt "Boost $(lib) library."
    254 			default m if ALL
    255 			$(if $(findstring locale,$(lib)),depends on BUILD_NLS,)\
    256 			$(if $(findstring python,$(lib)),depends on PACKAGE_$(lib),)
    257 
    258 		)
    259 	endmenu
    260 
    261 endef
    262 
    263 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_boost-test
    264 
    265 define Package/boost-test
    266 	$(call Package/boost/Default)
    267 	TITLE+= (test)
    268 	HIDDEN:=1
    269 	DEPENDS+=+boost-system +boost-timer
    270 endef
    271 
    272 define Build/Configure
    273 endef
    274 
    275 # 1: short name
    276 # 2: dependencies on other boost libraries (short name)
    277 # 3: dependencies on other packages
    278 # 4: conditional/inward dependencies
    279 define DefineBoostLibrary
    280 
    281   BOOST_DEPENDS+= +$(if $(4),$(4):boost-$(1),boost-$(1))
    282   PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_boost-$(1)
    283 
    284   BOOST_LIBS+= $(1)
    285 
    286   define Package/boost-$(1)
    287     $(call Package/boost/Default)
    288     TITLE+= ($(1))
    289     DEPENDS+= $$(foreach lib,$(2),+boost-$$(lib)) $(3) $(if $(4),@$(4),)
    290     HIDDEN:=1
    291   endef
    292 
    293   define Package/boost-$(1)/description
    294    This package contains the Boost $(1) library.
    295   endef
    296 endef
    297 
    298 $(eval $(call DefineBoostLibrary,atomic,system,))
    299 $(eval $(call DefineBoostLibrary,chrono,system,))
    300 $(eval $(call DefineBoostLibrary,container,,))
    301 $(eval $(call DefineBoostLibrary,context,chrono system thread,))
    302 $(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
    303 $(eval $(call DefineBoostLibrary,date_time,,))
    304 #$(eval $(call DefineBoostLibrary,exception,,))
    305 $(eval $(call DefineBoostLibrary,fiber,coroutine,,))
    306 $(eval $(call DefineBoostLibrary,filesystem,system,))
    307 $(eval $(call DefineBoostLibrary,graph,regex,))
    308 $(eval $(call DefineBoostLibrary,iostreams,,+zlib))
    309 $(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
    310 $(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
    311 $(eval $(call DefineBoostLibrary,math,,))
    312 #$(eval $(call DefineBoostLibrary,mpi,,)) # OpenMPI does no exist in OpenWRT at this time.
    313 $(eval $(call DefineBoostLibrary,program_options,,))
    314 $(eval $(call DefineBoostLibrary,python,,,PACKAGE_python))
    315 $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
    316 $(eval $(call DefineBoostLibrary,random,system,))
    317 $(eval $(call DefineBoostLibrary,regex,,))
    318 $(eval $(call DefineBoostLibrary,serialization,,))
    319 $(eval $(call DefineBoostLibrary,signals,,))
    320 $(eval $(call DefineBoostLibrary,system,,))
    321 $(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
    322 $(eval $(call DefineBoostLibrary,timer,chrono))
    323 $(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
    324 
    325 
    326 define Host/Compile
    327 	# b2 does not provide a configure-script nor a Makefile
    328 	( cd $(HOST_BUILD_DIR)/tools/build/src/engine ; ./build.sh gcc )
    329 endef
    330 
    331 CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
    332 TARGET_LDFLAGS += -pthread -lrt
    333 
    334 TARGET_CFLAGS += \
    335 	$(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
    336 	$(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
    337 	$(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
    338 
    339 EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
    340 
    341 ifneq ($(findstring mips,$(ARCH)),)
    342     BOOST_ABI = o32
    343     ifneq ($(findstring 64,$(ARCH)),)
    344         BOOST_ABI = o64
    345     endif
    346 else ifneq ($(findstring arm,$(ARCH)),)
    347     BOOST_ABI = aapcs
    348 else ifeq ($(ARCH),aarch64)
    349     BOOST_ABI = aapcs
    350 else
    351     BOOST_ABI = sysv
    352 endif
    353 
    354 comma := ,
    355 
    356 define Build/Compile
    357 	$(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
    358 	( cd $(PKG_BUILD_DIR) ; \
    359 		echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
    360 		$(if $(CONFIG_PACKAGE_boost-python3), \
    361 			echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
    362 				tools/build/src/user-config.jam; \
    363 		) \
    364 		$(if $(CONFIG_PACKAGE_boost-python), \
    365 			echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python :	$(STAGING_DIR)/usr/include/python2.7/ ;" >> \
    366 				tools/build/src/user-config.jam; \
    367 		) \
    368 		b2 \
    369 			$(CONFIGURE_ARGS) \
    370 			--ignore-site-config \
    371 			--toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
    372 			--disable-long-double \
    373 			$(if $(CONFIG_boost-variant-release), variant=release,) \
    374 			$(if $(CONFIG_boost-variant-debug), variant=debug,) \
    375 			$(if $(CONFIG_boost-variant-profile), variant=profile,) \
    376 			$(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
    377 			$(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
    378 			$(if $(CONFIG_boost-shared-libs),link=shared,) \
    379 			$(if $(CONFIG_boost-static-libs),link=static,) \
    380 			$(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
    381 			$(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
    382 			$(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
    383 			$(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
    384 			$(if $(CONFIG_boost-single-thread),threading=single,) \
    385 			threading=multi \
    386 			--without-mpi \
    387 			$(if $(CONFIG_boost-coroutine2),,--without-coroutine2) \
    388 			$(if $(CONFIG_boost-graph-parallel),,--without-graph_parallel) \
    389 			$(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
    390 			$(foreach lib,$(BOOST_LIBS), \
    391 				$(if $(findstring python,$(lib)), \
    392 					$(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
    393 					$(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
    394 			) \
    395 			$(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
    396 				boost.locale.iconv=off) \
    397 			\
    398 			$(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
    399 				-sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
    400 			install \
    401 	)
    402 endef
    403 
    404 define Build/InstallDev
    405 	$(INSTALL_DIR) \
    406 		$(1)/usr/include/boost/
    407 
    408 	$(CP) \
    409 		$(PKG_INSTALL_DIR)/include/boost/* \
    410 		$(1)/usr/include/boost/ \
    411 		# copies _all_ header files - independent of <--with-library>-argument above
    412 
    413 	$(INSTALL_DIR) $(1)/usr/lib
    414 	$(CP) -v $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/ # copies all compiled archive files
    415 	$(FIND) $(PKG_INSTALL_DIR)/lib/ -name '*.so*' -exec $(CP) {} $(1)/usr/lib/ \; # copies all the shared objects files
    416 endef
    417 
    418 define Host/Install
    419 	$(INSTALL_DIR) \
    420 		$(STAGING_DIR_HOSTPKG)/bin
    421 
    422 	$(CP) \
    423 		$(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
    424 		$(STAGING_DIR_HOSTPKG)/bin/
    425 endef
    426 
    427 define Package/boost/Default/install
    428 	$(INSTALL_DIR) \
    429 		$(1)/usr/lib
    430 
    431 	$(FIND) \
    432 		$(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2).so*' -exec $(CP) {} $(1)/usr/lib/ \;
    433 	$(FIND) \
    434 		$(PKG_INSTALL_DIR)/lib/ -name 'libboost_$(2)_*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
    435 endef
    436 
    437 define Package/boost-test/install
    438 		$(INSTALL_DIR) \
    439 			$(1)/usr/lib
    440 
    441 		$(FIND) \
    442 			$(PKG_INSTALL_DIR)/lib/ -name 'libboost_unit_test_framework*.so*' -exec $(CP) {} $(1)/usr/lib/ \;
    443 		
    444 		$(FIND) \
    445 			$(PKG_INSTALL_DIR)/lib/ -name 'libboost_prg_exec_monitor*.so*' -exec $(CP) {} $(1)/usr/lib/ \;	
    446 endef
    447 
    448 define BuildBoostLibrary
    449   define Package/boost-$(1)/install
    450     $(call Package/boost/Default/install,$$(1),$(1))
    451   endef
    452 
    453   $$(eval $$(call BuildPackage,boost-$(1)))
    454 endef
    455 
    456 $(eval $(call HostBuild))
    457 
    458 $(foreach lib,$(BOOST_LIBS),$(eval $(call BuildBoostLibrary,$(lib))))
    459 $(eval $(call BuildPackage,boost-test))
    460 $(eval $(call BuildPackage,boost-libs))
    461 $(eval $(call BuildPackage,boost))