diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-07-25 14:43:17 +0200 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-08-08 13:02:29 +0200 |
commit | aa4c811c0c1444c5073bdd37601144d74f5d979e (patch) | |
tree | a55efc5e714f8553ff90a05f21c76955ee775763 | |
parent | 9a8b8487d0d142e39152a928322532106be09a63 (diff) |
osxuniversalgenerator: relocate properly universal objects
-rw-r--r-- | cerbero/tools/osxuniversalgenerator.py | 8 | ||||
-rw-r--r-- | test/test_cerbero_tools_osxuniversalgenerator.py | 23 |
2 files changed, 29 insertions, 2 deletions
diff --git a/cerbero/tools/osxuniversalgenerator.py b/cerbero/tools/osxuniversalgenerator.py index 381f4202..aaee804a 100644 --- a/cerbero/tools/osxuniversalgenerator.py +++ b/cerbero/tools/osxuniversalgenerator.py @@ -22,6 +22,7 @@ import subprocess import shutil from cerbero.utils import shell +from cerbero.tools.osxrelocator import OSXRelocator file_types = [ @@ -84,10 +85,13 @@ class OSXUniversalGenerator(object): os.mkdir(self.output_root) self.parse_dirs(input_roots) - def create_universal_file(self, output, inputlist): + def create_universal_file(self, output, inputlist, dirs): cmd = '%s -create %s -output %s' % (self.LIPO_CMD, ' '.join(inputlist), output) self._call(cmd) + relocator = OSXRelocator (self.output_root, dirs[0], self.output_root, + False) + relocator.relocate_file(output) def get_file_type(self, filepath): cmd = '%s -bh "%s"' % (self.FILE_CMD, filepath) @@ -137,7 +141,7 @@ class OSXUniversalGenerator(object): elif action == 'merge': if not os.path.exists(output_dir): os.makedirs(output_dir) - self.create_universal_file(output_file, full_filepaths) + self.create_universal_file(output_file, full_filepaths, dirs) elif action == 'skip': pass #just pass else: diff --git a/test/test_cerbero_tools_osxuniversalgenerator.py b/test/test_cerbero_tools_osxuniversalgenerator.py index b33ba977..4fc74637 100644 --- a/test/test_cerbero_tools_osxuniversalgenerator.py +++ b/test/test_cerbero_tools_osxuniversalgenerator.py @@ -24,6 +24,7 @@ import os from cerbero.config import Architecture from cerbero.utils import shell from cerbero.tools.osxuniversalgenerator import OSXUniversalGenerator +from cerbero.tools.osxrelocator import OSXRelocator TEST_APP = '''\ @@ -172,3 +173,25 @@ class OSXUniversalGeneratorTest(unittest.TestCase): pc_file = os.path.join(self.tmp, Architecture.UNIVERSAL, 'test.pc') self.assertEquals(open(pc_file).readline(), os.path.join(self.tmp, Architecture.UNIVERSAL, 'lib', 'test')) + + def testMergedLibraryPaths(self): + def check_prefix(path): + if self.tmp not in path: + return + self.assertTrue(uni_prefix in path) + self.assertTrue(x86_prefix not in path) + self.assertTrue(x86_64_prefix not in path) + + self._compile(Architecture.X86) + self._compile(Architecture.X86_64) + self._check_compiled_files() + uni_prefix = os.path.join(self.tmp, Architecture.UNIVERSAL) + x86_prefix = os.path.join(self.tmp, Architecture.X86) + x86_64_prefix = os.path.join(self.tmp, Architecture.X86_64) + gen = OSXUniversalGenerator(uni_prefix) + gen.merge_dirs([x86_prefix, x86_64_prefix]) + libfoo = os.path.join(self.tmp, Architecture.UNIVERSAL, 'lib', 'libfoo.so') + libname = OSXRelocator.library_id_name(libfoo) + check_prefix(libname) + for p in OSXRelocator.list_shared_libraries(libfoo): + check_prefix(p) |