mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
Darwin improvements.
Patch from Andre Hentz. * v2/build/toolset.jam (inherit-flags): Take an extra parameter describing properties that should not be inherited. * v2/build/type.jam (register-suffixes): Removed local qualifier. * v2/test/BoostBuild.py (prepare_suffix_map): Add .dylib if OS is Darwin. (Tester::_init_): path to bjam on Darwin. * v2/test/prebuilt.py make sure $toolset is expanded correctly. * v2/test/prebuilt/project-root.jam use $toolset instead of gcc. * v2/test/prebuilt/ext/project-root.jam use $toolset instead of gcc. * v2/test/prebuilt/ext/Jamfile2.jam handle extension .dylib. * v2/test/prebuilt/ext/Jamfile2.jam handle extension .dylib. * v2/tools/darwin.jam inline call to toolset.inherit. filter <debug-symbols>off because -s is not accepted for dlls. speficy that .dylib files are of type SHARED_LIB. (actions link): pass -s for static linkage. (actions link.dll): pass -L flag with path to libraries. (actions archive): -c inhibits warning. [SVN r22332]
This commit is contained in:
@@ -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 <debug-symbols>on and
|
||||
# <debug-symbols>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))
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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 :
|
||||
:
|
||||
: <include>release
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -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 :
|
||||
:
|
||||
: <include>release
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
|
||||
import gcc ;
|
||||
import $toolset ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
|
||||
import gcc ;
|
||||
import $toolset ;
|
||||
|
||||
@@ -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 : <debug-symbols>off ;
|
||||
toolset.inherit-rules darwin : gcc ;
|
||||
flags darwin.link ST_OPTIONS <debug-symbols>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 : <toolset>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 <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)"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user