[jamming] Path specification (was: Majam - keeping jam up-to-date)
Kai Backman
kaib at google.com
Fri Aug 11 06:52:24 PDT 2006
Here is a two part solution:
1. Define a portable path format for use in jam, jambase and jamfile's
on all platforms
2. Add two modifiers, similar to what Alen has adopted, one for
converting native into portable ':~' and one to convert from portable
to native ':/'
Based on my quick reading of the OpenVMS links provided by John and
Tim a portable path could be defined as follows:
Absolute path:
"drive:/subpath1/subpath2/file.ext;v"
where drive: and ;v optional, leading / mandatory
Relative path:
"../subpath/file.ext;v"
where ;v optional, leading non-/ mandatory
--------------------------- Examples
To illustrate I'll temporarily adopt the fictional expansion
construct $("":MODIFIER) and '->' means evaluates to:
Win32:
$("C:\Program Files\Microsoft\":~)
-> "C:/Program Files/Microsoft/"
OBJS = "../../obj/foo.obj" "../../obj/bar.obj" ;
$(OBJS:/)
-> "..\..\obj\foo.obj" "..\..\obj\foo.obj"
notice how ':/' does -not- join the list
Unix:
$("/usr/bin/:/usr/local/bin":~)
-> "/usr/bin/" "usr/local/bin"
notice how ':~' splits the paths into a list
$("C:/var/www/foo.html;10":/)
-> "/var/www/foo.html"
with perhaps a warning about the discarded components?
VMS:
$("SYS$SYSDEVICE:[SYS0.SYSCOMMON.]LOGIN.COM;5":~)
-> "SYS$SYSDEVICE:/SYS0/SYSCOMMON/LOGIN.COM;5"
$("../data/output.bin":/)
-> "SYS$SYSDEVICE:[SYS0.DATA]OUTPUT.BIN"
assuming the default device and directory from above
--------------------------- Discussion
Benefits:
- Lets writers of Jam, Jambase and Jamfile's use a single portable
path specification.
- Explicit way to mangle between OS specific and portable
paths. Leaves open the option of using local paths as input for people
building on a single platform.
Open questions:
- Is the handling of ".." correct for VMS? I got the impression that
VMS doesn't have a concept of parent directory natively so the
resolution needs to happen explicitly?
- How should we handle mangling of large numbers of environment
variables like CC, INCLUDE and similar? Is it sufficient to explicitly
specify them in Jambase/Jamrules "CC=$(CC:~) ;" or do we need more
convenience?
- Would we like to include the $("") construct permanently to easy
input of local paths?
- What did I overlook?
I think the problem of building the default HDRS from native include
paths is tangential but separate from this issue and I can't see any
significant complications there.
Kai
--
Kai Backman, Software Engineer, kaib at google.com
More information about the jamming
mailing list