From 9b22251ddd0871381af00d6d3f7c4e63c87fc0f2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 23 Mar 2009 16:39:45 -0400 Subject: Recursively translate library names for bindmg --- acprep | 37 +++++++++++++++++++++++-------------- 1 file 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')) -- cgit v1.2.3