mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
e818915fae
In our current Rust world, we have the following dependency structure: xul.so --------------------------+ | xul-gtest.so -+--> xul.a --------+-> gkrust | +--> gkrust-gtest This structure results in link errors with multiply-defined symbols between gkrust-gtest and gkrust with newer Rust releases when linking xul-gtest.so. So we have to do something different. Our new structure is: xul.so --------------------------+ | xul-gtest.so -+--> xul.a --------+-> gkrust --+-> gkrust-shared | | +--> gkrust-gtest --------------+ and we enforce that a given shared library can only have at most one Rust library that it depends on. Said Rust library is assumed to include all significant Rust dependencies of the dependent static libraries as well. (In the above structure, gkrust is simply a wrapper around gkrust-shared, so gkrust-gtest doesn't have to include gkrust as a dependency.)
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
# 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/.
|
|
|
|
'''Given a list of object files and library names, prints a library
|
|
descriptor to standard output'''
|
|
|
|
from __future__ import with_statement
|
|
import sys
|
|
import os
|
|
import expandlibs_config as conf
|
|
from expandlibs import LibDescriptor, isObject, ensureParentDir
|
|
from optparse import OptionParser
|
|
|
|
def generate(args):
|
|
desc = LibDescriptor()
|
|
for arg in args:
|
|
if isObject(arg):
|
|
if os.path.exists(arg):
|
|
desc['OBJS'].append(os.path.abspath(arg))
|
|
else:
|
|
raise Exception("File not found: %s" % arg)
|
|
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
|
|
if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
|
desc['LIBS'].append(os.path.abspath(arg))
|
|
else:
|
|
raise Exception("File not found: %s" % arg)
|
|
return desc
|
|
|
|
if __name__ == '__main__':
|
|
parser = OptionParser()
|
|
parser.add_option("-o", dest="output", metavar="FILE",
|
|
help="send output to the given file")
|
|
|
|
(options, args) = parser.parse_args()
|
|
if not options.output:
|
|
raise Exception("Missing option: -o")
|
|
|
|
ensureParentDir(options.output)
|
|
with open(options.output, 'w') as outfile:
|
|
print >>outfile, generate(args)
|