summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-23 16:39:45 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-23 16:39:45 -0400
commit9b22251ddd0871381af00d6d3f7c4e63c87fc0f2 (patch)
tree1434c5ab40a983527dc9a050d043e526af6a110e
parentdda7c3a58ab73a567e26f160ffa0b87bacb7db50 (diff)
downloadfork-ledger-9b22251ddd0871381af00d6d3f7c4e63c87fc0f2.tar.gz
fork-ledger-9b22251ddd0871381af00d6d3f7c4e63c87fc0f2.tar.bz2
fork-ledger-9b22251ddd0871381af00d6d3f7c4e63c87fc0f2.zip
Recursively translate library names for bindmg
-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'))