From 997b0f87db652f151a41dd323703f5951c3d230d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 4 Apr 2006 23:16:13 +0000 Subject: [PATCH] Add support for STLport 5.x release. [SVN r33531] --- src/tools/stlport.jam | 155 ++++++++++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 58 deletions(-) diff --git a/src/tools/stlport.jam b/src/tools/stlport.jam index a9db490d3..f70c7407d 100644 --- a/src/tools/stlport.jam +++ b/src/tools/stlport.jam @@ -1,5 +1,6 @@ -# (C) Copyright Gennadiy Rozental 2002. -# (C) Copyright Vladimir Prus 2003. +# (C) Copyright Gennadiy Rozental 2002. +# (C) Copyright Vladimir Prus 2003. +# (C) Copyright Rene Rivera 2006. # Permission to copy, use, # modify, sell and distribute this software is granted provided this # copyright notice appears in all copies. This software is provided @@ -22,7 +23,7 @@ # on used toolset. # Also, finish various flags: # -# This is copied from V1 toolset, "+" means "impelemnted" +# This is copied from V1 toolset, "+" means "implemented" #+flags $(CURR_TOOLSET) DEFINES off : _STLP_NO_OWN_IOSTREAMS=1 _STLP_HAS_NO_NEW_IOSTREAMS=1 ; #+flags $(CURR_TOOLSET) DEFINES off : _STLP_NO_EXTENSIONS=1 ; # flags $(CURR_TOOLSET) DEFINES off : _STLP_NO_ANACHRONISMS=1 ; @@ -37,7 +38,7 @@ import feature : feature subfeature ; import project ; import "class" : new ; import targets ; -import property-set ; +import property-set ; import common ; # Make this module into a project. @@ -68,7 +69,7 @@ subfeature stdlib stlport : extensions : noext : optional propagated ; # STLport debug allocation -- NOT YET SUPPORTED #subfeature stdlib stlport : debug-alloc : off on ; -# Declare a special target class to handle the creation of search-lib-target +# Declare a special target class to handle the creation of search-lib-target # instances for STLport. We need a special class, because otherwise we'll have # - declare prebuilt targets for all possible toolsets. And by the time 'init' # is called we don't even know the list of toolsets that are registered @@ -78,16 +79,17 @@ subfeature stdlib stlport : extensions : noext : optional propagated ; class stlport-target-class : basic-target { import feature project type errors generators ; - import set : difference ; - - rule __init__ ( project : headers ? : libraries ? : version ? ) + import set : difference ; + + rule __init__ ( project : headers ? : libraries + : version ? ) { basic-target.__init__ stlport : $(project) ; self.headers = $(headers) ; self.libraries = $(libraries) ; self.version = $(version) ; + self.version.5 = [ MATCH "^(5[.][^.]+).*" : $(version) ] ; } - + rule match ( property-set ) { # Override the rule which detects if this basic-target is @@ -97,29 +99,39 @@ class stlport-target-class : basic-target # requirements, but then stlport-$(version) would show in # the common properties, causing recursive building of ourselfs. + local matched ; if [ $(property-set).get ] = $(self.version) { - return stlport-$(self.version) ; - } - else - { - return no-match ; + if $(self.version.5) + { + # And for STLport 5.x multi-threading is required. + if [ $(property-set).get ] = multi + { + matched = stlport-$(self.version) ; + } + } + else + { + matched = stlport-$(self.version) ; + } } + matched ?= no-match ; + + return $(matched) ; } - + rule generate ( property-set ) { # Since this target is built with stlport, it will also # have /stlport//stlport in requirements, which will # cause a loop in main target references. Remove that property # manually. - + property-set = [ property-set.create [ difference [ $(property-set).raw ] : /stlport//stlport stlport ] ] ; return [ basic-target.generate $(property-set) ] ; } - - + rule construct ( name : source-targets * : property-set ) { # Deduce the name of stlport library, based on toolset and @@ -128,96 +140,123 @@ class stlport-target-class : basic-target local hostios = [ feature.get-values : $(raw) ] ; local toolset = [ feature.get-values : $(raw) ] ; - - # We don't need libraries if host istreams are used. For - # msvc, automatic library selection will be used. - if ! $(hostios) && $(toolset) != msvc - { - local debug = [ feature.get-values : $(raw) ] ; + if $(self.version.5) + { + # Version 5.x + # STLport host IO streams no longer supported. So we always + # need libraries. + + # name: stlport(stl)?[dg]?.M.R + local name = stlport ; + if [ feature.get-values : $(raw) ] = "on" + { + name += stl ; + switch $(toolset) + { + case gcc* : name += g ; + case darwin* : name += g ; + case * : name += d ; + } + } + name += .$(self.version.5) ; + + return [ generators.construct + $(self.project) $(name:J=) : SEARCHED_LIB : $(property-set) ] ; + } + else if ! $(hostios) && $(toolset) != msvc + { + # We don't need libraries if host istreams are used. For + # msvc, automatic library selection will be used. + + # name: stlport_(_stldebug)? local name = stlport ; name = $(name)_$(toolset) ; - if $(debug) = "on" + if [ feature.get-values : $(raw) ] = "on" { name = $(name)_stldebug ; } - - return [ generators.construct $(self.project) $(name) : SEARCHED_LIB - : $(property-set) ] ; + + return [ generators.construct + $(self.project) $(name) : SEARCHED_LIB : $(property-set) ] ; } else { return [ property-set.empty ] ; - } + } } - + rule compute-usage-requirements ( subvariant ) { - local usage-requirements ; - usage-requirements += - $(self.headers) - $(self.libraries) - $(self.libraries) - ; - + local usage-requirements = + $(self.headers) + $(self.libraries) + $(self.libraries) + ; + local rproperties = [ $(subvariant).build-properties ] ; # CONSIDER: should this "if" sequence be replaced with # some use of 'property-map' class? if [ $(rproperties).get ] = "on" { - usage-requirements += _STLP_DEBUG=1 - _STLP_DEBUG_UNINITIALIZED=1 ; + usage-requirements += + _STLP_DEBUG=1 + _STLP_DEBUG_UNINITIALIZED=1 ; } - if [ $(rproperties).get ] = "on" + if [ $(rproperties).get ] = "on" { - usage-requirements += _STLP_USE_DYNAMIC_LIB=1 ; + usage-requirements += + _STLP_USE_DYNAMIC_LIB=1 ; } if [ $(rproperties).get ] = noext { - usage-requirements += _STLP_NO_EXTENSIONS=1 ; + usage-requirements += + _STLP_NO_EXTENSIONS=1 ; } if [ $(rproperties).get ] = hostios { - usage-requirements += _STLP_NO_OWN_IOSTREAMS=1 - _STLP_HAS_NO_NEW_IOSTREAMS=1 ; + usage-requirements += + _STLP_NO_OWN_IOSTREAMS=1 + _STLP_HAS_NO_NEW_IOSTREAMS=1 ; } - + return [ property-set.create $(usage-requirements) ] ; - } + } } -rule stlport-target ( headers ? : libraries ? : version ? ) +rule stlport-target ( headers ? : libraries + : version ? ) { local project = [ project.current ] ; - + targets.main-target-alternative - [ new stlport-target-class $(project) : $(headers) : $(libraries) + [ new stlport-target-class $(project) : $(headers) : $(libraries) : $(version) ] ; } local .version-subfeature-defined ; -# Initialize stlport support. -rule init ( version ? : - headers # Location of header files - libraries ? # Location of libraries - ) +# Initialize stlport support. +rule init ( + version ? : + headers # Location of header files + libraries * # Location of libraries, lib and bin subdirs of STLport. + ) { # FIXME: need to use common.check-init-parameters here. # At the moment, that rule always tries to define subfeature # of the 'toolset' feature, while we need to define subfeature # of stlport, so tweaks to check-init-parameters are needed. if $(version) - { + { if ! $(.version-subfeature-defined) - { + { feature.subfeature stdlib stlport : version : : propagated ; .version-subfeature-defined = true ; - } + } feature.extend-subfeature stdlib stlport : version : $(version) ; } - + # Declare the main target for this STLPort version. stlport-target $(headers) : $(libraries) : $(version) ; }