gcc 4.8.1 made it to Debian Sid
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Wed Jul 10 03:24:12 PDT 2013
On 07/10/2013 02:07 AM, H. S. Teoh wrote:
> Comments / flames / pull requests welcome. ;-)
string findGDC(string argv0)
{
// FIXME: this does not work 100% of the time.
auto c = match(baseName(argv0), `^(.*-)?g?dmd(-.*)?$`).captures;
auto targetPrefix = c[1];
auto gdcDir = absolutePath(dirName(argv0));
return buildNormalizedPath(gdcDir, targetPrefix ~ "gdc" ~ c[2]);
}
The "obvious" solution is to have a gdmd.conf file which specifies what gdc
executable to use and where to find it. This should get round problems such as
gdc being installed in /opt/gdc/bin and gdmd being in /usr/local/bin.
The default would be to select the gdc used to actually build gdmd, with an
option to configure for alternative locations.
findGDC() should probably prioritize in this order:
* If there's a gdmd.conf, use the gdcDir specified. There probably
needs to be a search priority of where to find the .conf file.
* If not, use which gdc to identify what gdc to call
(and possibly display a warning that there's no gdmd.conf?)
On a related note, can you clarify what the issues are with findScriptPath ... ?
string findScriptPath(string argv0)
{
// FIXME: this is not 100% reliable; we need equivalent functionality to
// Perl's FindBin.
return absolutePath(dirName(argv0));
}
More information about the D.gnu
mailing list