From ef5cf26daf93d6f89dc290150f9cd4043685df84 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Jul 2021 09:11:09 +0200 Subject: Adjust Emscripten Clang version to account for unreleased snapshots --- libbuild2/cc/guess.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index b7fd28c..298d081 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -2309,7 +2309,7 @@ namespace build2 const strings* c_lo, const strings* x_lo, guess_result&& gr, sha256& cs) { - // This function handles vanialla Clang, including its clang-cl variant, + // This function handles vanilla Clang, including its clang-cl variant, // as well as Apple and Emscripten variants. // // The clang-cl variant appears to be a very thin wrapper over the @@ -2501,6 +2501,22 @@ namespace build2 }); var_ver = extract_version (gr.signature, false, "Emscripten"); + + // The official Emscripten distributions routinely use unreleased + // Clang snapshots which nevertheless have the next release version + // (which means it's actually somewhere between the previous release + // and the next release). On the other hand, distributions like Debian + // package it to use their Clang package which normally has the + // accurate version. So here we will try to detect the former and + // similar to the Apple case we will conservatively adjust it to the + // previous release. + // + if (gr.type_signature.find ("googlesource") != string::npos) + { + if (ver.patch != 0) ver.patch--; + else if (ver.minor != 0) ver.minor--; + else ver.major--; + } } // Figure out the target architecture. -- cgit v1.1