Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57484 - trunk/tools/build/v2/tools
From: ghost_at_[hidden]
Date: 2009-11-08 08:54:59


Author: vladimir_prus
Date: 2009-11-08 08:54:58 EST (Sun, 08 Nov 2009)
New Revision: 57484
URL: http://svn.boost.org/trac/boost/changeset/57484

Log:
Detect, and produce proper diagnostics for '10.6 and ppc64 does not work'.

Thanks to Boris Dušek for testing this patch.

Text files modified:
   trunk/tools/build/v2/tools/darwin.jam | 154 ++++++++++++++++++++++++++++++---------
   1 files changed, 119 insertions(+), 35 deletions(-)

Modified: trunk/tools/build/v2/tools/darwin.jam
==============================================================================
--- trunk/tools/build/v2/tools/darwin.jam (original)
+++ trunk/tools/build/v2/tools/darwin.jam 2009-11-08 08:54:58 EST (Sun, 08 Nov 2009)
@@ -16,6 +16,10 @@
 import common ;
 import generators ;
 import path : basename ;
+import version ;
+import property-set ;
+import regex ;
+import errors ;
 
 ## Use a framework.
 feature framework : : free ;
@@ -64,7 +68,7 @@
 
 type.set-generated-target-suffix PCH : <toolset>darwin : gch ;
 
-toolset.inherit-rules darwin : gcc ;
+toolset.inherit-rules darwin : gcc : localize ;
 toolset.inherit-flags darwin : gcc
   : <runtime-link>static
      <architecture>arm/<address-model>32
@@ -86,6 +90,17 @@
 #
 rule init ( version ? : command * : options * : requirement * )
 {
+ # First time around, figure what is host OSX version
+ if ! $(.host-osx-version)
+ {
+ .host-osx-version = [ MATCH "^([0-9.]+)"
+ : [ SHELL "/usr/bin/sw_vers -productVersion" ] ] ;
+ if $(.debug-configuration)
+ {
+ ECHO notice: OSX version on this machine is $(.host-osx-version) ;
+ }
+ }
+
     # - The root directory of the tool install.
     local root = [ feature.get-values <root> : $(options) ] ;
     
@@ -125,6 +140,8 @@
         version ?= $(real-version) ;
     }
     
+ .real-version.$(version) = $(real-version) ;
+
     # - Define the condition for this toolset instance.
     local condition =
         [ common.check-init-parameters darwin $(requirement) : version $(version) ] ;
@@ -288,10 +305,105 @@
 generators.register-c-compiler darwin.compile.m : OBJECTIVE_C : OBJ : <toolset>darwin ;
 generators.register-c-compiler darwin.compile.mm : OBJECTIVE_CPP : OBJ : <toolset>darwin ;
 
-rule compile.m
+rule setup-address-model ( targets * : sources * : properties * )
+{
+ local ps = [ property-set.create $(properties) ] ;
+ local arch = [ $(ps).get <architecture> ] ;
+ local address-model = [ $(ps).get <address-model> ] ;
+ local osx-version = [ $(ps).get <macosx-version> ] ;
+ local gcc-version = [ $(ps).get <toolset-darwin:version> ] ;
+ gcc-version = $(.real-version.$(gcc-version)) ;
+ local options ;
+
+ local support-ppc64 = 1 ;
+
+ osx-version ?= $(.host-osx-version) ;
+
+ if $(osx-version) && ! [ version.version-less [ regex.split $(osx-version) \\. ] : 10 6 ]
+ {
+ # When targeting 10.6:
+ # - gcc 4.2 will give a compiler errir if ppc64 compilation is requested
+ # - gcc 4.0 will compile fine, somehow, but then fail at link time
+ support-ppc64 = ;
+ }
+
+ switch $(arch)
+ {
+ case combined :
+ {
+ if $(address-model) = 32_64 {
+ if $(support-ppc64) {
+ options = -arch i386 -arch ppc -arch x86_64 -arch ppc64 ;
+ } else {
+ # Build 3-way binary
+ options = -arch i386 -arch ppc -arch x86_64 ;
+ }
+ } else if $(address-model) = 64 {
+ if $(support-ppc64) {
+ options = -arch x86_64 -arch ppc64 ;
+ } else {
+ errors.user-error "64-bit PPC compilation is not supported when targeting OSX 10.6 or later" ;
+ }
+ } else {
+ options = -arch i386 -arch ppc ;
+ }
+ }
+
+ case x86 :
+ {
+ if $(address-model) = 32_64 {
+ options = -arch i386 -arch x86_64 ;
+ } else if $(address-model) = 64 {
+ options = -arch x86_64 ;
+ } else {
+ options = -arch i386 ;
+ }
+ }
+
+ case power :
+ {
+ if ! $(support-ppc64)
+ && ( $(address-model) = 32_64 || $(address-model) = 64 )
+ {
+ errors.user-error "64-bit PPC compilation is not supported when targeting OSX 10.6 or later" ;
+ }
+
+ if $(address-model) = 32_64 {
+ options = -arch ppc -arch ppc64 ;
+ } else if $(address-model) = 64 {
+ options = -arch ppc64 ;
+ } else {
+ options = -arch ppc ;
+ }
+ }
+
+ case arm :
+ {
+ options = -arch armv6 ;
+ }
+ }
+
+ if $(options)
+ {
+ OPTIONS on $(targets) += $(options) ;
+ }
+}
+
+rule setup-threading ( targets * : sources * : properties * )
+{
+ gcc.setup-threading $(targets) : $(sources) : $(properties) ;
+}
+
+rule setup-fpic ( targets * : sources * : properties * )
+{
+ gcc.setup-fpic $(targets) : $(sources) : $(properties) ;
+}
+
+rule compile.m ( targets * : sources * : properties * )
 {
     LANG on $(<) = "-x objective-c" ;
     gcc.setup-fpic $(targets) : $(sources) : $(properties) ;
+ setup-arch-addr-flags $(targets) : $(sources) : $(properties) ;
 }
 
 actions compile.m
@@ -303,6 +415,7 @@
 {
     LANG on $(<) = "-x objective-c++" ;
     gcc.setup-fpic $(targets) : $(sources) : $(properties) ;
+ setup-arch-addr-flags $(targets) : $(sources) : $(properties) ;
 }
 
 actions compile.mm
@@ -310,37 +423,6 @@
     "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
-# Add option selection for combined and specific architecture combinations.
-
-local rule arch-addr-flags ( toolset variable
- : architecture : address-model + : values + : default ? )
-{
- if $(default)
- {
- flags $(toolset) $(variable)
- <architecture>$(architecture)/<address-model>
- : $(values) ;
- }
- flags $(toolset) $(variable)
- <architecture>/<address-model>$(address-model)
- <architecture>$(architecture)/<address-model>$(address-model)
- : $(values) ;
-}
-
-arch-addr-flags darwin OPTIONS : combined : 32 : -arch i386 -arch ppc : default ;
-arch-addr-flags darwin OPTIONS : combined : 64 : -arch x86_64 -arch ppc64 ;
-arch-addr-flags darwin OPTIONS : combined : 32_64 : -arch i386 -arch ppc -arch x86_64 -arch ppc64 ;
-
-arch-addr-flags darwin OPTIONS : x86 : 32 : -arch i386 : default ;
-arch-addr-flags darwin OPTIONS : x86 : 64 : -arch x86_64 ;
-arch-addr-flags darwin OPTIONS : x86 : 32_64 : -arch i386 -arch x86_64 ;
-
-arch-addr-flags darwin OPTIONS : power : 32 : -arch ppc : default ;
-arch-addr-flags darwin OPTIONS : power : 64 : -arch ppc64 ;
-arch-addr-flags darwin OPTIONS : power : 32_64 : -arch ppc -arch ppc64 ;
-
-arch-addr-flags darwin OPTIONS : arm : 32 : -arch armv6 : default ;
-
 # Set the max header padding to allow renaming of libs for installation.
 flags darwin.link.dll OPTIONS : -headerpad_max_install_names ;
 
@@ -383,8 +465,9 @@
     }
 }
 
-rule link
+rule link ( targets * : sources * : properties * )
 {
+ setup-address-model $(targets) : $(sources) : $(properties) ;
     prepare-framework-path $(<) ;
 }
 
@@ -398,8 +481,9 @@
     $(NEED_STRIP)"$(.STRIP)" $(NEED_STRIP)-S $(NEED_STRIP)-x $(NEED_STRIP)"$(<)"
 }
 
-rule link.dll
+rule link.dll ( targets * : sources * : properties * )
 {
+ setup-address-model $(targets) : $(sources) : $(properties) ;
     prepare-framework-path $(<) ;
 }
 


Boost-Commit 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