Bug 1264132 - Use `$gcc_dir/bin/gcc -print-libgcc-file-name` to find the libraries and headers to copy in the clang package. r=ehsan
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 13 Apr 2016 08:00:11 +0900
changeset 293271 e02a840a52f6df6a2a046b11c5a89caa444829be
parent 293270 bba8a0264e24d8c5231d12ecfd518a2ede9d255b
child 293272 23aad06080afc4980fe516ac98cdc1d315b67115
push id75154
push usermh@glandium.org
push dateThu, 14 Apr 2016 23:18:18 +0000
treeherdermozilla-inbound@e02a840a52f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1264132
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264132 - Use `$gcc_dir/bin/gcc -print-libgcc-file-name` to find the libraries and headers to copy in the clang package. r=ehsan
build/build-clang/build-clang.py
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -110,30 +110,31 @@ def mkdir_p(path):
     try:
         os.makedirs(path)
     except OSError as e:
         if e.errno != errno.EEXIST or not os.path.isdir(path):
             raise
 
 
 def install_libgcc(gcc_dir, clang_dir):
-        libgcc_dir = glob.glob(os.path.join(gcc_dir, "lib", "gcc",
-                                            "x86_64-*linux-gnu",
-                                            "[0-9]*"))[0]
-        clang_lib_dir = os.path.join(clang_dir, "lib", "gcc",
-                                     "x86_64-unknown-linux-gnu",
-                                     os.path.basename(libgcc_dir))
-        mkdir_p(clang_lib_dir)
-        copy_dir_contents(libgcc_dir, clang_lib_dir)
-        libgcc_dir = os.path.join(gcc_dir, "lib64")
-        clang_lib_dir = os.path.join(clang_dir, "lib")
-        copy_dir_contents(libgcc_dir, clang_lib_dir)
-        include_dir = os.path.join(gcc_dir, "include")
-        clang_include_dir = os.path.join(clang_dir, "include")
-        copy_dir_contents(include_dir, clang_include_dir)
+    out = subprocess.check_output([os.path.join(gcc_dir, "bin", "gcc"),
+                                   '-print-libgcc-file-name'])
+
+    libgcc_dir = os.path.dirname(out.rstrip())
+    clang_lib_dir = os.path.join(clang_dir, "lib", "gcc",
+                                 "x86_64-unknown-linux-gnu",
+                                 os.path.basename(libgcc_dir))
+    mkdir_p(clang_lib_dir)
+    copy_dir_contents(libgcc_dir, clang_lib_dir)
+    libgcc_dir = os.path.join(gcc_dir, "lib64")
+    clang_lib_dir = os.path.join(clang_dir, "lib")
+    copy_dir_contents(libgcc_dir, clang_lib_dir)
+    include_dir = os.path.join(gcc_dir, "include")
+    clang_include_dir = os.path.join(clang_dir, "include")
+    copy_dir_contents(include_dir, clang_include_dir)
 
 
 def svn_co(source_dir, url, directory, revision):
     run_in(source_dir, ["svn", "co", "-r", revision, url, directory])
 
 
 def svn_update(directory, revision):
     run_in(directory, ["svn", "update", "-r", revision])