Index: build/toolset.jam =================================================================== --- build/toolset.jam (revision 57269) +++ build/toolset.jam (working copy) @@ -449,7 +449,7 @@ } -rule inherit-rules ( toolset : base ) +rule inherit-rules ( toolset : base : localize ? ) { # It appears that "action" creates a local rule. local base-generators = [ generators.generators-for-toolset $(base) ] ; @@ -459,8 +459,8 @@ rules += [ MATCH "[^.]*\.(.*)" : [ $(g).rule-name ] ] ; } rules = [ sequence.unique $(rules) ] ; - IMPORT $(base) : $(rules) : $(toolset) : $(rules) ; - IMPORT $(base) : $(rules) : : $(toolset).$(rules) ; + IMPORT $(base) : $(rules) : $(toolset) : $(rules) : $(localize) ; + IMPORT $(toolset) : $(rules) : : $(toolset).$(rules) ; } Index: tools/darwin.jam =================================================================== --- tools/darwin.jam (revision 57269) +++ tools/darwin.jam (working copy) @@ -16,6 +16,9 @@ import common ; import generators ; import path : basename ; +import version ; +import property-set ; +import regex ; ## Use a framework. feature framework : : free ; @@ -60,7 +63,7 @@ type.set-generated-target-suffix PCH : darwin : gch ; -toolset.inherit-rules darwin : gcc ; +toolset.inherit-rules darwin : gcc : localize ; toolset.inherit-flags darwin : gcc : static arm/32 @@ -121,6 +124,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) ] ; @@ -265,10 +270,102 @@ generators.register-c-compiler darwin.compile.m : OBJECTIVE_C : OBJ : darwin ; generators.register-c-compiler darwin.compile.mm : OBJECTIVE_CPP : OBJ : darwin ; -rule compile.m +rule setup-address-model ( targets * : sources * : properties * ) { + local ps = [ property-set.create $(properties) ] ; + local arch = [ $(ps).get ] ; + local address-model = [ $(ps).get ] ; + local osx-version = [ $(ps).get ] ; + local gcc-version = [ $(ps).get ] ; + gcc-version = $(.real-version.$(gcc-version)) ; + local options ; + + local support-ppc64 = 1 ; + if $(osx-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 @@ -280,6 +377,7 @@ { LANG on $(<) = "-x objective-c++" ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + setup-arch-addr-flags $(targets) : $(sources) : $(properties) ; } actions compile.mm @@ -287,37 +385,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)/ - : $(values) ; - } - flags $(toolset) $(variable) - /$(address-model) - $(architecture)/$(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 ;