Bug 1059255 - Stop building stdc++compat as a real library. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 11 Sep 2014 12:19:28 +0900
changeset 204760 00ddd6873d65e2d9d9f96841eb05a0cca6d28d01
parent 204759 4ed9082b0bddd176fb0447be2478645fa9aa28ac
child 204761 1a7fb15552ab4505d54046cbfb560cbcc95c6d84
push idunknown
push userunknown
push dateunknown
Bug 1059255 - Stop building stdc++compat as a real library. r=mshal Incidentally, this makes the build fail because stdc++compat.o then appears twice on the libxul linkage command line. This, in turn, is because widget/xremoteclient creates both a program and an intermediate library for libxul. The Program() template adds stdc++compat to the directory data, which ends up being added to libxul as well. The same kind of issue arises when linking the gtest-enabled libxul. While eventually we'll be able to avoid those problems, it's not the case yet, so work around the issue by making expand-libs skip .desc files that appear multiple times.
--- a/build/unix/stdc++compat/Makefile.in
+++ b/build/unix/stdc++compat/Makefile.in
@@ -1,11 +1,10 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 include $(topsrcdir)/config/rules.mk
--- a/config/expandlibs.py
+++ b/config/expandlibs.py
@@ -99,16 +99,17 @@ class LibDescriptor(dict):
         '''Serializes the lib descriptor'''
         return '\n'.join('%s = %s' % (k, ' '.join(self[k])) for k in self.KEYS if len(self[k]))
 class ExpandArgs(list):
     def __init__(self, args):
         '''Creates a clone of the |args| list and performs file expansion on
         each item it contains'''
         super(ExpandArgs, self).__init__()
+        self._descs = set()
         for arg in args:
             self += self._expand(arg)
     def _expand(self, arg):
         '''Internal function doing the actual work'''
         (root, ext) = os.path.splitext(arg)
         if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
             return [relativize(arg)]
@@ -119,18 +120,22 @@ class ExpandArgs(list):
         if os.path.exists(dll):
             return [relativize(dll)]
         if os.path.exists(arg):
             return [relativize(arg)]
         return self._expand_desc(arg)
     def _expand_desc(self, arg):
         '''Internal function taking care of lib descriptor expansion only'''
-        if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
-            with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
+        desc = os.path.abspath(arg + conf.LIBS_DESC_SUFFIX)
+        if os.path.exists(desc):
+            if desc in self._descs:
+                return []
+            self._descs.add(desc)
+            with open(desc, 'r') as f:
                 desc = LibDescriptor(f.readlines())
             objs = [relativize(o) for o in desc['OBJS']]
             for lib in desc['LIBS']:
                 objs += self._expand(lib)
             return objs
         return [arg]
 if __name__ == '__main__':