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

Special case processing of RPATH, so that '$ORIGIN' can be used

Fixes #3479


[SVN r59765]
This commit is contained in:
Vladimir Prus
2010-02-20 11:03:58 +00:00
parent c67fd2cd66
commit 8faba6ab29

View File

@@ -799,6 +799,23 @@ rule init-link-flags ( toolset linker condition )
} }
} }
# Enclose the RPATH variable on 'targets' in (double) quotes,
# unless it's already enclosed in single quotes.
# This special casing is done because it's common to pass
# '$ORIGIN' to linker -- and it has to have single quotes
# to prevent expansion by shell -- and if we add double
# quotes then preventing properties of single quotes disappear.
rule quote-rpath ( targets * )
{
local r = [ on $(targets[1]) return $(RPATH) ] ;
if ! [ MATCH "('.*')" : $(r) ]
{
r = "\"$(r)\"" ;
ECHO "Yeah" $(r) ;
}
RPATH on $(targets) = $(r) ;
}
# Declare actions for linking. # Declare actions for linking.
rule link ( targets * : sources * : properties * ) rule link ( targets * : sources * : properties * )
{ {
@@ -809,11 +826,12 @@ rule link ( targets * : sources * : properties * )
# parallel is just slower. For now, serialize only gcc links, it might be a # parallel is just slower. For now, serialize only gcc links, it might be a
# good idea to serialize all links. # good idea to serialize all links.
JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
quote-rpath $(targets) ;
} }
actions link bind LIBRARIES actions link bind LIBRARIES
{ {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-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) "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-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)
} }
@@ -871,12 +889,13 @@ rule link.dll ( targets * : sources * : properties * )
setup-address-model $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ;
SPACE on $(targets) = " " ; SPACE on $(targets) = " " ;
JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
quote-rpath $(targets) ;
} }
# Differs from 'link' above only by -shared. # Differs from 'link' above only by -shared.
actions link.dll bind LIBRARIES actions link.dll bind LIBRARIES
{ {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(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) "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(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)
} }
rule setup-threading ( targets * : sources * : properties * ) rule setup-threading ( targets * : sources * : properties * )