summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xacprep37
1 files changed, 23 insertions, 14 deletions
diff --git a/acprep b/acprep
index 0cd6d5d8..c802efe9 100755
--- a/acprep
+++ b/acprep
@@ -1160,6 +1160,28 @@ class PrepareBuild(CommandLineApp):
# Packaging phases #
#########################################################################
+ def translate_file(self, path, dest):
+ dest_file = join(dest, basename(path))
+
+ self.log.debug("Translating file %s -> %s" % (path, dest_file))
+
+ if not exists(dest_file):
+ shutil.copyfile(path, dest_file)
+
+ for line in self.get_stdout('otool', '-L', dest_file).split('\n'):
+ match = re.search('/opt/local/lib/(.+?)\.dylib', line)
+ if not match:
+ continue
+
+ lib = match.group(0)
+ base = basename(lib)
+
+ if lib != path:
+ self.translate_file(lib, dest)
+
+ self.execute('install_name_tool', '-change', lib,
+ '@loader_path/' + base, dest_file)
+
def phase_bindmg(self, *args):
self.log.debug('Executing phase: bindmg')
@@ -1175,22 +1197,9 @@ class PrepareBuild(CommandLineApp):
try:
name = 'ledger-%s' % self.current_version()
dest = join(tempdir, name)
- ledger = join(dest, 'ledger')
os.makedirs(dest)
-
- shutil.copyfile(binary, ledger)
-
- for line in self.get_stdout('otool', '-L', ledger).split('\n'):
- match = re.search('/opt/local/lib/(.+?)\.dylib', line)
- if match:
- lib = match.group(0)
- base = os.path.basename(lib)
-
- shutil.copyfile(lib, join(dest, base))
-
- self.execute('install_name_tool', '-change', lib,
- '@loader_path/' + base, ledger)
+ self.translate_file(binary, dest)
self.execute('hdiutil', 'create', '-srcfolder', dest,
'-ov', join(cwd, name + '.dmg'))