Skip to content

Commit

Permalink
No vendor < 2.081
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightSentinel committed Aug 28, 2020
1 parent b65805e commit ef78291
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -998,21 +998,38 @@ void processEnvironment()
if (hostDmdInfo.status) // Failed, JSON output currently not supported for GDC
{
env["HOST_DMD_KIND"] = "gdc";
env["HOST_DMD_VERSION"] = "v2.079";
env["HOST_DMD_VERSION"] = "v2.076";
}
else
{
// Reads the content of a single field without parsing the entire JSON
/// Reads the content of a single field without parsing the entire JSON
alias get = field => hostDmdInfo.output
.findSplitAfter(field ~ `" : "`)[1]
.findSplitBefore(`"`)[0];

env["HOST_DMD_KIND"] = [
"Digital Mars D": "dmd",
"LDC": "ldc",
"GNU D": "gdc"
][get(`vendor`)];
env["HOST_DMD_VERSION"] = get(`version`)[1 .. "vX.XXX.X".length];
const ver = env["HOST_DMD_VERSION"] = get(`version`)[1 .. "vX.XXX.X".length];

// Vendor was introduced in 2.080
if (ver < "2.080.1")
{
auto name = get("binary").baseName().stripExtension();
if (name == "ldmd2")
name = "ldc";
else if (name == "gdmd")
name = "gdc";
else
enforce(name == "dmd", "Unknown compiler: " ~ name);

env["HOST_DMD_KIND"] = name;
}
else
{
env["HOST_DMD_KIND"] = [
"Digital Mars D": "dmd",
"LDC": "ldc",
"GNU D": "gdc"
][get(`vendor`)];
}
}

env["DMD_PATH"] = env["G"].buildPath("dmd").exeName;
Expand Down

0 comments on commit ef78291

Please sign in to comment.