amalgamated: use the toolchain script to find clang

Relying on clang++ existing is not safe because the CI only has
clang++-8 right now. Use the same script the toolchain uses to find the
right clang binary.

Change-Id: I8cd056cc3965e75943e20d2c588b7ee3498e79c0
diff --git a/tools/gen_amalgamated b/tools/gen_amalgamated
index 93274f9..a527b12 100755
--- a/tools/gen_amalgamated
+++ b/tools/gen_amalgamated
@@ -529,7 +529,16 @@
     """Returns an example command line for building the output source."""
     source = self._get_nice_path(output_prefix, '%s.cc')
     library = self._get_nice_path(output_prefix, 'lib%s.so')
-    build_cmd = ['clang++', source, '-o', library, '-shared'] + \
+
+    if sys.platform.startswith('linux'):
+      llvm_script = os.path.join(gn_utils.repo_root(), 'gn',
+                                 'standalone', 'toolchain',
+                                 'linux_find_llvm.py')
+      cxx = subprocess.check_output([llvm_script]).splitlines()[2]
+    else:
+      cxx = 'clang++'
+
+    build_cmd = [cxx, source, '-o', library, '-shared'] + \
         sorted(self.cflags) + sorted(self.ldflags)
     for lib in sorted(self.libs):
       build_cmd.append('-l%s' % lib)