Boost logo

Boost-Build :

From: Christopher Currie (Christopher_at_[hidden])
Date: 2003-07-30 22:57:42


Attached is a preliminary toolset file for GCC on MacOS X. It's very
basic, it has no support for frameworks or bundles, but it builds the
'hello' and 'libraries' examples, and can build static and shared libraries.

This toolset requires a couple of patches in order to work properly. The
attached patch makes some improvements to the way toolset inheritance
works. A changelog for this patch is below.

Christopher

Changelog:

Fixes to toolset inheritance.

* new/generators.jam
(generator.constructor): Import property so clone works.
(register): Generate the correct toolset name.

* new/toolset.jam
Import generators so the inherit calls work.
(inherit-generators): Generate the correct new generator id.

 --------------080304010207060506070005 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="darwin.jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="darwin.jam"

# Copyright (C) Christopher Currie 2003. Permission to copy, use,
# modify, sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as to
# its suitability for any purpose.

import toolset : flags ;

toolset.register darwin ;
toolset.inherit darwin : gcc ;

rule init ( )
{

}

flags darwin.link.dll OPTIONS : -Wl,-dynamic -nostartfiles -Wl,-dylib -Wl,-ldylib1.o ;

actions link bind LIBRARIES
{
$(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST)
}

actions link.dll bind LIBRARIES
{
ld -dynamic -m -r -d -o "$(<:S=.lo)" "$(>)" \
&& \
$(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(<:S=.lo)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) \
&& \
rm -f "$(<:S=.lo)"
}

actions piecemeal archive
{
ar -r -s $(ARFLAGS) "$(<:T)" "$(>:T)"
}

 --------------080304010207060506070005 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="darwin.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="darwin.patch"

Index: new/generators.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/new/generators.jam,v
retrieving revision 1.51
diff -u -r1.51 generators.jam
--- new/generators.jam 3 Jul 2003 07:52:57 -0000 1.51
+++ new/generators.jam 31 Jul 2003 03:44:45 -0000
@@ -118,6 +118,7 @@
import sequence ;
import type ;
import virtual-target ;
+ import property ;

self.id = $(id) ;
self.composing = $(composing) ;
@@ -616,7 +617,21 @@

# Update the set of generators for toolset
local id = [ $(g).id ] ;
- .generators-for-toolset.$(id:S=) += $(g) ;
+
+ # Some generators have multiple periods in their name, so the
+ # normal $(id:S=) won't generate the right toolset name.
+ # e.g. if id = gcc.compile.c++, then
+ # .generators-for-toolset.$(id:S=) will append to
+ # .generators-for-toolset.gcc.compile, which is a separate
+ # value from .generators-for-toolset.gcc. Correcting this
+ # makes generator inheritance work properly.
+ # See also inherit-generators in module toolset
+ local base = $(id) ;
+ while $(base:S)
+ {
+ base = $(base:B) ;
+ }
+ .generators-for-toolset.$(base) += $(g) ;
}

# Creates new instance of the 'generator' class and registers it.
Index: new/toolset.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/new/toolset.jam,v
retrieving revision 1.19
diff -u -r1.19 toolset.jam
--- new/toolset.jam 11 Jun 2003 08:40:44 -0000 1.19
+++ new/toolset.jam 31 Jul 2003 03:44:46 -0000
@@ -10,6 +10,7 @@
import errors : error ;
import property ;
import path ;
+import generators ;

.flag-no = 1 ;

@@ -263,7 +264,22 @@
for local g in $(base-generators)
{
local id = [ $(g).id ] ;
- local new-id = $(id:B=$(toolset)) ;
+
+ # Some generator names have multiple periods in their name, so
+ # $(id:B=$(toolset)) doesn't generate the right new-id name.
+ # e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
+ # which is not what we want. Manually parse the base and suffix
+ # (if there's a better way to do this, I'd love to see it.)
+ # See also register in module generators.
+ local base = $(id) ;
+ local suffix = "" ;
+ while $(base:S)
+ {
+ suffix = $(base:S)$(suffix) ;
+ base = $(base:B) ;
+ }
+ local new-id = $(toolset)$(suffix) ;
+
generators.register [ $(g).clone $(new-id) : $(toolset) ] ;
}
}
@@ -317,4 +333,4 @@
local p = <b>0 <c>1 <d>2 <e>3 <f>4 ;
assert.result <c>1/<d>2/<e>3 : find-property-subset <c>1/<d>2/<e>3 <a>0/<b>0/<c>1 <d>2/<e>5 <a>9 : $(p) ;
assert.result : find-property-subset <a>0/<b>0/<c>9/<d>9/<e>5 <a>9 : $(p) ;
-}
\ No newline at end of file
+}
 --------------080304010207060506070005--


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