-
-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Darwin @xxx
placeholders in dll-path
#335
Changes from all commits
6fe6d56
fb57e8d
fcd07f5
714d91e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,6 +552,12 @@ rule translate-indirect-value ( rulename : context-module ) | |
|
||
} | ||
|
||
local translate-path-rules ; | ||
rule add-toolset-translate-path-rule ( tpr ) | ||
{ | ||
translate-path-rules += $(tpr) ; | ||
} | ||
|
||
# Equivalent to a calling all of: | ||
# translate-path | ||
# translate-indirect | ||
|
@@ -561,7 +567,7 @@ rule translate-indirect-value ( rulename : context-module ) | |
# | ||
rule translate ( properties * : project-id : project-location : context-module ) | ||
{ | ||
local translate-path-rule = [ MATCH "^<translate-path>[@](.*)$" : "$(properties)" ] ; | ||
translate-path-rules += [ MATCH "^<translate-path>[@](.*)$" : "$(properties)" ] ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having this be global will have the effect of a compounding effect of multiple redundant translate rules being added. The rules could also not be related to the particular targets as they are global and will be run for all target and toolsets, not just the darwin one, if one happens to build with multiple toolsets at once. Hence this needs to be a plain |
||
local result ; | ||
for local p in $(properties) | ||
{ | ||
|
@@ -610,10 +616,17 @@ rule translate ( properties * : project-id : project-location : context-module ) | |
{ | ||
if path in $(attributes) | ||
{ | ||
if $(translate-path-rule) | ||
# Iterate through each translate path rule in turn, | ||
# until one returns a successful translation. | ||
for local tpr in $(translate-path-rules) | ||
{ | ||
value = [ $(translate-path-rule) $(feature) $(property:G=) : $(properties) : $(project-id) : $(project-location) ] ; | ||
value = [ $(tpr) $(feature) $(property:G=) : $(properties) : $(project-id) : $(project-location) ] ; | ||
if $(value) | ||
{ | ||
break ; | ||
} | ||
} | ||
# If no translate path rule intervened, continue with usual translation. | ||
Comment on lines
+619
to
+629
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks fine. |
||
if ! $(value) | ||
{ | ||
value = [ translate-path-value $(property:G=) : $(project-location) ] ; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import common ; | |
import generators ; | ||
import path : basename ; | ||
import version ; | ||
import property ; | ||
import property-set ; | ||
import regex ; | ||
import errors ; | ||
|
@@ -451,6 +452,40 @@ flags darwin.link FORCE_LOAD <force-load> ; | |
# uncomment to see what libtool is doing under the hood | ||
#~ flags darwin.link.dll OPTIONS : -Wl,-v ; | ||
|
||
# Darwin specific translate-rule; | ||
# ------------------------------- | ||
# Catch the Darwin-specific "@xxx" placeholders (see 'man dyld') in <dll-path> | ||
# properties, and return them as they are. | ||
# (I.e. signal to caller to NOT translate them to the filesystem.) | ||
# For all other values return nothing. | ||
# (I.e. signal to caller to continue with translation as usual.) | ||
# This is called from 'property.translate' - See documentation for 'translate-path' feature. | ||
rule at-placeholder-translate-path-rule ( feature value : properties * : project-id : project-location ) | ||
{ | ||
local rv ; | ||
|
||
if $(feature) = "<dll-path>" | ||
{ | ||
# These '@xxx' placeholders are specified and processed by 'dyld'; | ||
# (See 'man dyld'). | ||
# As each of these is to be replaced by 'dyld' with a root path, | ||
# they are only expected - and therefore tested here - as root paths. | ||
switch $(value) | ||
{ | ||
case @executable_path* : rv = $(value) ; | ||
case @loader_path* : rv = $(value) ; | ||
case @rpath* : rv = $(value) ; | ||
} | ||
} | ||
|
||
return $(rv) ; | ||
} | ||
# Import the 'at-placeholder-translate-path-rule' into the global namespace | ||
# as 'darwin.at-placeholder-translate-path-rule'. | ||
IMPORT $(__name__) : at-placeholder-translate-path-rule : : darwin.at-placeholder-translate-path-rule ; | ||
# Add the above exported name to the list of translate path rules for property.translate. | ||
property.add-toolset-translate-path-rule darwin.at-placeholder-translate-path-rule ; | ||
|
||
Comment on lines
+483
to
+488
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This you need to replace with an appropriate call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, scratch all that.. I see now how |
||
# set up the -F option to include the paths to any frameworks used. | ||
local rule prepare-framework-path ( target + ) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this globally has some serious side effects (see the comment in translate rule). There's a better way to achieve a similar "global" effect with
toolset.add-requirements
but without the drawbacks.