diff --git a/v2/build/toolset.jam b/v2/build/toolset.jam index 762a1f55e..dd5936be4 100644 --- a/v2/build/toolset.jam +++ b/v2/build/toolset.jam @@ -11,6 +11,7 @@ import errors : error ; import property ; import path ; import generators ; +import set : difference ; .flag-no = 1 ; @@ -288,29 +289,38 @@ rule inherit-generators ( toolset : base ) } } -rule inherit-flags ( toolset : base ) +# properties listed in prohibited-properties won't +# be inherited. Note that on and +# off are two different properties +rule inherit-flags ( toolset : base : prohibited-properties * ) { for local f in $(.module-flags.$(base)) { local rule-or-module = $(.rule-or-module.$(f)) ; - local rule_ = [ MATCH "[^.]*\.(.*)" : $(rule-or-module) ] ; - local new-rule-or-module ; - if $(rule_) + if [ set.difference + $(.$(rule-or-module).condition.$(f)) : + $(prohibited-properties) + ] { - new-rule-or-module = $(toolset).$(rule_) ; - } - else - { - new-rule-or-module = $(toolset) ; - } + local rule_ = [ MATCH "[^.]*\.(.*)" : $(rule-or-module) ] ; + local new-rule-or-module ; + if $(rule_) + { + new-rule-or-module = $(toolset).$(rule_) ; + } + else + { + new-rule-or-module = $(toolset) ; + } - add-flag - $(new-rule-or-module) - : $(.$(rule-or-module).match-type.$(f)) - : $(.$(rule-or-module).variable.$(f)) - : $(.$(rule-or-module).condition.$(f)) - : $(.$(rule-or-module).values.$(f)) - ; + add-flag + $(new-rule-or-module) + : $(.$(rule-or-module).match-type.$(f)) + : $(.$(rule-or-module).variable.$(f)) + : $(.$(rule-or-module).condition.$(f)) + : $(.$(rule-or-module).values.$(f)) + ; + } } } diff --git a/v2/build/type.jam b/v2/build/type.jam index 4ccc20438..6bd2ec6e6 100644 --- a/v2/build/type.jam +++ b/v2/build/type.jam @@ -107,7 +107,7 @@ rule type-from-rule-name ( main-target-name ) # Specifies that targets with suffix from 'suffixes' has the type 'type'. # If different type is already specified for any of syffixes, # issues an error. -local rule register-suffixes ( suffixes + : type ) +rule register-suffixes ( suffixes + : type ) { for local s in $(suffixes) { diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index f4f77948a..588848043 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -31,6 +31,9 @@ def prepare_suffix_map(toolset): if toolset in ["gcc"]: suffixes['.lib'] = '.a' # static libs have '.a' suffix with mingw... suffixes['.obj'] = '.o' + if os.uname()[0] == 'Darwin': + suffixes['.dll'] = '.dylib' + @@ -90,6 +93,8 @@ class Tester(TestCmd.TestCmd): jam_build_dir = "bin.linuxx86" elif os.uname()[0] == 'SunOS': jam_build_dir = "bin.solaris" + elif os.uname()[0] == 'Darwin': + jam_build_dir = "bin.macosxppc" else: raise "Don't know directory where jam is build for this system: " + os.name + "/" + os.uname()[0] else: diff --git a/v2/test/prebuilt.py b/v2/test/prebuilt.py index 6cf734db5..5f367eb56 100644 --- a/v2/test/prebuilt.py +++ b/v2/test/prebuilt.py @@ -7,6 +7,8 @@ t = Tester() t.set_tree('prebuilt') +t.expand_toolset("ext/project-root.jam") +t.expand_toolset("project-root.jam") # First, build the external project t.run_build_system("debug release", subdir="ext") diff --git a/v2/test/prebuilt/ext/Jamfile2 b/v2/test/prebuilt/ext/Jamfile2 index 0fcc301e7..f116f81cd 100644 --- a/v2/test/prebuilt/ext/Jamfile2 +++ b/v2/test/prebuilt/ext/Jamfile2 @@ -13,7 +13,10 @@ if [ modules.peek : OS ] in CYGWIN NT dll-suffix = lib ; } } - +if $toolset = darwin +{ + dll-suffix = dylib ; +} project ext ; @@ -28,4 +31,4 @@ lib a : : : release ; - \ No newline at end of file + diff --git a/v2/test/prebuilt/ext/Jamfile3 b/v2/test/prebuilt/ext/Jamfile3 index c3aff784f..c4d9a4201 100644 --- a/v2/test/prebuilt/ext/Jamfile3 +++ b/v2/test/prebuilt/ext/Jamfile3 @@ -17,6 +17,11 @@ if [ modules.peek : OS ] in CYGWIN NT dll-suffix = lib ; } } +if $toolset = darwin +{ + dll-suffix = dylib ; +} + project ext ; @@ -35,4 +40,4 @@ lib a : : : release ; - \ No newline at end of file + diff --git a/v2/test/prebuilt/ext/project-root.jam b/v2/test/prebuilt/ext/project-root.jam index be01ebeeb..1abafda7d 100644 --- a/v2/test/prebuilt/ext/project-root.jam +++ b/v2/test/prebuilt/ext/project-root.jam @@ -1,2 +1,2 @@ -import gcc ; \ No newline at end of file +import $toolset ; diff --git a/v2/test/prebuilt/project-root.jam b/v2/test/prebuilt/project-root.jam index be01ebeeb..1abafda7d 100644 --- a/v2/test/prebuilt/project-root.jam +++ b/v2/test/prebuilt/project-root.jam @@ -1,2 +1,2 @@ -import gcc ; \ No newline at end of file +import $toolset ; diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index af8225034..eedff4492 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -12,7 +12,14 @@ import toolset : flags ; import type ; toolset.register darwin ; -toolset.inherit darwin : gcc ; +import gcc ; +toolset.inherit-generators darwin : gcc ; +# we can't pass -s to ld unless we also pass -static +# so we removed -s completly from OPTIONS and add it +# to ST_OPTIONS +toolset.inherit-flags darwin : gcc : off ; +toolset.inherit-rules darwin : gcc ; +flags darwin.link ST_OPTIONS off : -s ; # No additional initialization should be necessary rule init ( ) @@ -22,6 +29,8 @@ rule init ( ) # Darwin has a different shared library suffix type.set-generated-target-suffix SHARED_LIB : darwin : dylib ; +# we need to be able to tell the type of .dylib files +type.register-suffixes dylib : SHARED_LIB ; feature framework : : free ; @@ -37,7 +46,7 @@ flags darwin.link FRAMEWORK ; actions link bind LIBRARIES { - $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) + $(NAME:E=g++) $(ST_OPTIONS) $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) } rule link.dll @@ -47,11 +56,11 @@ rule link.dll actions link.dll bind LIBRARIES { - $(NAME:E=g++) -dynamiclib $(OPTIONS) -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) + $(NAME:E=g++) -dynamiclib $(OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) } actions piecemeal archive { - ar -r -s $(ARFLAGS) "$(<:T)" "$(>:T)" + ar -c -r -s $(ARFLAGS) "$(<:T)" "$(>:T)" }