summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcerbero/tools/osxrelocator.py16
-rw-r--r--cerbero/tools/osxuniversalgenerator.py2
2 files changed, 13 insertions, 5 deletions
diff --git a/cerbero/tools/osxrelocator.py b/cerbero/tools/osxrelocator.py
index 4f2cc440..85b788cd 100755
--- a/cerbero/tools/osxrelocator.py
+++ b/cerbero/tools/osxrelocator.py
@@ -49,8 +49,8 @@ class OSXRelocator(object):
def relocate_dir(self, dirname):
self.parse_dir(os.path.join(self.root, dirname))
- def relocate_file(self, object_file):
- self.change_libs_path(object_file)
+ def relocate_file(self, object_file, original_file=None):
+ self.change_libs_path(object_file, original_file)
def change_id(self, object_file, id=None):
id = id or object_file.replace(self.lib_prefix, '@rpath')
@@ -60,8 +60,16 @@ class OSXRelocator(object):
cmd = [INT_CMD, '-id', id, object_file]
shell.new_call(cmd, fail=False, logfile=self.logfile)
- def change_libs_path(self, object_file):
- depth = len(object_file.split('/')) - len(self.root.split('/')) - 1
+ def change_libs_path(self, object_file, original_file=None):
+ # @object_file: the actual file location
+ # @original_file: where the file will end up in the output directory
+ # structure and the basis of how to calculate rpath entries. This may
+ # be different from where the file is currently located e.g. when
+ # creating a fat binary from copy of the original file in a temporary
+ # location.
+ if original_file is None:
+ original_file = object_file
+ depth = len(original_file.split('/')) - len(self.lib_prefix.split('/')) - 1
p_depth = '/..' * depth
rpaths = ['.']
rpaths += ['@loader_path' + p_depth, '@executable_path' + p_depth]
diff --git a/cerbero/tools/osxuniversalgenerator.py b/cerbero/tools/osxuniversalgenerator.py
index 19a72072..e1e056f3 100644
--- a/cerbero/tools/osxuniversalgenerator.py
+++ b/cerbero/tools/osxuniversalgenerator.py
@@ -116,7 +116,7 @@ class OSXUniversalGenerator(object):
False, logfile=self.logfile)
# since we are using a temporary file, we must force the library id
# name to real one and not based on the filename
- relocator.relocate_file(tmp.name)
+ relocator.relocate_file(tmp.name, f)
relocator.change_id(tmp.name, id=f.replace(prefix_to_replace, self.output_root))
cmd = [self.LIPO_CMD, '-create'] + [f.name for f in tmp_inputs] + ['-output', output]
shell.new_call(cmd)