2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00

* tools/borland.jam (init): Rewrite.

* tools/common.jam (get-absolute-tool-path): New rule.


[SVN r23164]
This commit is contained in:
Vladimir Prus
2004-06-23 08:10:25 +00:00
parent ee91fd2b96
commit d8dbd13bd1
2 changed files with 32 additions and 48 deletions

View File

@@ -18,53 +18,20 @@ import common ;
toolset.register borland ;
feature.subfeature toolset borland : version ;
# Installation root to use for versionless toolset
.root = "" ;
STDHDRS = ;
STDLIBPATH = ;
rule init ( version ? : root ? )
rule init ( version ? : command ? )
{
# If version is not provided, change the global variable
# It would probably be better to introduce 'unspecified' version
# and set flags on <toolset>borland-unspecified, but,
# default values are not applied to subfeatures.
if ! $(version)
{
if ! $(root)
{
# versionless and rootless, we assume the user has bcc in the path
# so we try and find it, and set up the paths accordingly
import regex ;
import modules ;
local bcc = [ GLOB [ modules.peek : Path ] [ modules.peek : PATH ] : bcc32.exe ] ;
root = $(bcc[1]:D) ; root = $(root:P) ;
}
if $(root)
{
toolset.flags borland.compile STDHDRS <toolset>borland : $(root)/include/ ;
toolset.flags borland.link STDLIBPATH <toolset>borland : $(root)/lib ;
toolset.flags borland .root <toolset>borland : $(root)/bin/ ;
}
}
else
{
feature.extend-subfeature toolset borland : version : $(version) ;
local condition = <toolset>borland-$(version) ;
toolset.flags borland.compile STDHDRS $(condition) : $(root)/include/ ;
toolset.flags borland.link STDLIBPATH $(condition) : $(root)/lib/ ;
root = $(root)/bin/ ;
root ?= "" ;
toolset.flags borland .root $(condition) : $(root) ;
}
# strange that this return is needed, because if absent the
# unversioned/unrooted case doesn't work at all
return ;
local condition = [ common.check-init-parameters borland :
version $(version) ] ;
local command = [ common.get-invocation-command borland : bcc32.exe
: $(command) ] ;
local root = [ common.get-absolute-tool-path $(command) ] ;
root = $(root:D) ;
toolset.flags borland.compile STDHDRS $(condition) : $(root)/include/ ;
toolset.flags borland.link STDLIBPATH $(condition) : $(root)/lib ;
toolset.flags borland .root $(condition) : $(root)/bin/ ;
}

View File

@@ -129,6 +129,23 @@ rule get-invocation-command (
return $(command) ;
}
# Given an invocation command returned by 'get-invocation-command',
# return the absolute path to the command. This works even if commnad
# has not path element and is present in PATH.
rule get-absolute-tool-path ( command )
{
if $(command:D)
{
return $(command:D) ;
}
else
{
local m = [ GLOB [ modules.peek : PATH Path path ] : $(command) $(command).exe ] ;
return $(m[1]:D) ;
}
}
# Attempts to find tool (binary) named 'name' in PATH and in 'additiona-paths'.
# If found in path, returns 'name'.
@@ -137,14 +154,14 @@ rule get-invocation-command (
# Otherwise, returns empty string.
rule find-tool ( name : additional-paths * )
{
local m = [ GLOB [ modules.peek : PATH Path path ] : $(name) ] ;
local m = [ GLOB [ modules.peek : PATH Path path ] : $(name) $(name).exe ] ;
if $(m)
{
return $(name) ;
}
else
{
return [ path.glob $(additional-paths) : $(name) ] ;
return [ path.glob $(additional-paths) : $(name) $(name).exe ] ;
}
}