Boost logo

Boost-Build :

From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2006-11-16 00:59:07


Rene Rivera wrote:
> I'll see how much farther I can get without using a rule.

OK, I think the attached additional patch produces the
desired/equivalent results (except for the warning messages). The
root/Jamfile.v2 patch is just to show the other bits of code using this
obsoletes.

I tested (virtually) both doing builds, and running tests. In both cases
targets that depended on ones with <build>no conditionally added to them
where skipped. (AFAICT)

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/Jamfile.v2,v
retrieving revision 1.50
diff -u -r1.50 Jamfile.v2
--- Jamfile.v2 10 Nov 2006 17:30:49 -0000 1.50
+++ Jamfile.v2 16 Nov 2006 05:28:20 -0000
@@ -133,12 +133,8 @@
         debug release
         <threading>single <threading>multi
         <link>shared <link>static
+ <runtime-link>shared <runtime-link>static
         ;
-
- if [ os.name ] = NT
- {
- default-build += <runtime-link>shared <runtime-link>static ;
- }
 }
 else
 {
@@ -155,12 +151,6 @@
       # Used to encode variant in target name. See the
       # 'tag' rule below.
       <tag>@$(__name__).tag
- # This property combination is dangerous.
- # Ideally, we'd add constaint to default build,
- # so that user can build with property combination
- # by hand. But we don't have any 'constaint' mechanism
- # for default-build, so disable such builds in requirements.
- <link>shared,<runtime-link>static:<build>no
             
     : usage-requirements <include>.
     : build-dir bin.v2
Index: tools/build/v2/tools/gcc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v
retrieving revision 1.87
diff -u -r1.87 gcc.jam
--- tools/build/v2/tools/gcc.jam 30 Oct 2006 08:35:33 -0000 1.87
+++ tools/build/v2/tools/gcc.jam 16 Nov 2006 05:39:32 -0000
@@ -376,69 +376,23 @@
     "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
-# The class which check that we don't try to use
-# the <runtime-link>static property while creating or using shared library,
-# since it's not supported by gcc/libc.
-class gcc-linking-generator : unix-linking-generator
-{
- rule run ( project name ? : property-set : sources + )
- {
- #~ TODO: Replace this with the use of a target-os property.
- local no-static-link = ;
- if [ modules.peek : UNIX ]
- {
- switch [ modules.peek : JAMUNAME ]
- {
- case * : no-static-link = true ;
- }
- }
-
- local properties = [ $(property-set).raw ] ;
- local reason ;
- if $(no-static-link) && <runtime-link>static in $(properties)
- {
- if <link>shared in $(properties)
- {
- reason =
- "On gcc, DLL can't be build with '<runtime-link>static'." ;
- }
- else if [ type.is-derived $(self.target-types[1]) EXE ]
- {
- for local s in $(sources)
- {
- local type = [ $(s).type ] ;
- if $(type) && [ type.is-derived $(type) SHARED_LIB ]
- {
- reason =
- "On gcc, using DLLS together with the"
- "<runtime-link>static options is not possible " ;
- }
- }
- }
- }
- if $(reason)
- {
- ECHO warning:
- $(reason) ;
- ECHO warning:
- "It's suggested to use '<runtime-link>static' together"
- "with the '<link>static'." ;
- return ;
- }
- else
- {
- return [ unix-linking-generator.run $(project) $(name)
- : $(property-set) : $(sources) ] ;
- }
- }
-}
-
-generators.register [ new gcc-linking-generator gcc.link : LIB OBJ : EXE
- : <toolset>gcc ] ;
-
-generators.register [ new gcc-linking-generator gcc.link.dll : LIB OBJ : SHARED_LIB
- : <toolset>gcc ] ;
-
+generators.register-linker gcc.link
+ : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>gcc ;
+generators.register-linker gcc.link.dll
+ : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>gcc ;
+
+toolset.add-requirements
+ ## The static libstd++ runtime on Unix/Linux is dangerous when using
+ ## shared objects. Currently this both prevents building DLLs with the
+ ## static runtime, and it's dependents.
+ <toolset>gcc,<target-os>unix,<runtime-link>static,<link>shared:<build>no
+ <toolset>gcc,<target-os>linux,<runtime-link>static,<link>shared:<build>no
+
+ ## Even though MinGW allows specifying a static runtime, it's just an alias
+ ## for the single dynamic runtime. So it's better to not build the static runtime
+ ## in the first place.
+ <toolset>gcc,<toolset-gcc:flavor>mingw,<target-os>windows,<runtime-link>static:<build>no
+ ;
 
 # Declare flags for linking
 # First, the common flags


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk