2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-20 02:32:13 +00:00

Create cross-platform linking for clang-linux. Update embarcadero to use its own named JAM_SEMAPHORE.

This commit is contained in:
Edward Diener
2020-04-15 22:12:45 -04:00
parent cc1245b9e3
commit 2627ef3a85
2 changed files with 88 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ import generators ;
import type ;
import numbers ;
import os ;
import property ;
feature.extend-subfeature toolset clang : platform : linux ;
@@ -206,34 +207,115 @@ SPACE = " " ;
rule link ( targets * : sources * : properties * ) {
SPACE on $(targets) = " " ;
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
local tosw ;
local pselect = [ property.select <target-os> : $(properties) ] ;
if $(pselect)
{
local tosv = [ feature.get-values <target-os> : $(pselect) ] ;
if $(tosv) = windows
{
tosw = 1 ;
}
}
else if [ os.name ] in NT
{
tosw = 1 ;
}
if $(tosw)
{
link-w $(targets) : $(sources) ;
}
else
{
link-o $(targets) : $(sources) ;
}
}
rule link.dll ( targets * : sources * : properties * ) {
SPACE on $(targets) = " " ;
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
local tosw ;
local pselect = [ property.select <target-os> : $(properties) ] ;
if $(pselect)
{
local tosv = [ feature.get-values <target-os> : $(pselect) ] ;
if $(tosv) = windows
{
tosw = 1 ;
}
}
else if [ os.name ] in NT
{
tosw = 1 ;
}
if $(tosw)
{
link.dll-w $(targets) : $(sources) ;
}
else
{
link.dll-o $(targets) : $(sources) ;
}
}
if [ os.name ] in NT
{
actions link bind LIBRARIES {
# All the links on Windows use a response file because of Windows line limit issues
# Target OS is not Windows, needs the RPATH stuff
actions link-o bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS)
}
# Target OS is not Windows, needs the RPATH and SONAME stuff
actions link.dll-o bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS)
}
# Target OS is Windows, does not need the RPATH stuff
actions link-w bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS)
}
actions link.dll bind LIBRARIES {
# Target OS is Windows, does not need the RPATH and SONAME stuff
actions link.dll-w bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" -shared @"@($(<[1]:T).rsp:E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP))" $(OPTIONS) $(USER_OPTIONS)
}
}
else
{
actions link bind LIBRARIES {
# None of the links on non-Windows need a response file
# Target OS is not Windows, needs the RPATH stuff
actions link-o bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
}
actions link.dll bind LIBRARIES {
# Target OS is not Windows, needs the RPATH and SONAME stuff
actions link.dll-o bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
}
# Target OS is Windows, does not need the RPATH stuff
actions link-w bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
}
# Target OS is Windows, does not need the RPATH and SONAME stuff
actions link.dll-w bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
}
}

View File

@@ -592,11 +592,11 @@ actions updated together piecemeal archive
}
rule link ( targets * : sources * : properties * ) {
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
JAM_SEMAPHORE on $(targets) = <s>embarcadero-link-semaphore ;
}
rule link.dll ( targets * : sources * : properties * ) {
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
JAM_SEMAPHORE on $(targets) = <s>embarcadero-link-semaphore ;
}
actions link bind LIBRARIES {