From 3a43ab69923d8992af8a9125406265f60ebe7ebb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Sep 2009 18:54:15 -0600 Subject: [PATCH] IGN:Add WMF support to OS X build --- setup/installer/osx/app/main.py | 2 ++ setup/installer/osx/freeze.py | 31 ++++++++++++++++++++++++++++ src/calibre/trac/plugins/download.py | 1 + 3 files changed, 34 insertions(+) diff --git a/setup/installer/osx/app/main.py b/setup/installer/osx/app/main.py index 56ab04e7f6..d023dbcf00 100644 --- a/setup/installer/osx/app/main.py +++ b/setup/installer/osx/app/main.py @@ -10,6 +10,8 @@ import sys, os, shutil, plistlib, subprocess, glob, zipfile, tempfile, \ py_compile, stat, operator abspath, join, basename = os.path.abspath, os.path.join, os.path.basename +#TODO: WMF support in ImageMagick + l = {} exec open('setup.py').read() in l VERSION = l['VERSION'] diff --git a/setup/installer/osx/freeze.py b/setup/installer/osx/freeze.py index a0389b2ebd..985f7ccaf8 100644 --- a/setup/installer/osx/freeze.py +++ b/setup/installer/osx/freeze.py @@ -188,6 +188,31 @@ os.execv(python, args) self.fix_python_dependencies(deps) self.fix_misc_dependencies(deps) + def fix_image_magick_deps(self, root): + modules = [] + frameworks_dir = os.path.dirname(root) + for x in os.walk(root): + for f in x[-1]: + if f.endswith('.so'): + modules.append(os.path.join(x[0], f)) + deps = {} + for x in ('Core.1', 'Wand.1'): + modules.append(os.path.join(root, 'lib', 'libMagick%s.dylib'%x)) + x = modules[-1] + deps[os.path.join('/Users/kovid/ImageMagick/lib', + os.path.basename(x))] = '@executable_path/../Frameworks/ImageMagick/lib/'+os.path.basename(x) + subprocess.check_call(['install_name_tool', '-id', + '@executable_path/../Frameworks/ImageMagick/lib/'+os.path.basename(x), + x]) + for x in ('/usr/local/lib/libfreetype.6.dylib', + '/Volumes/sw/lib/libwmflite-0.2.7.dylib'): + deps[x] = '@executable_path/../Frameworks/'+ os.path.basename(x) + + for x in modules: + print 'Fixing deps in', x + for f, t in deps.items(): + subprocess.check_call(['install_name_tool', '-change', f, t, x]) + def run(self): py2app.run(self) @@ -252,11 +277,17 @@ os.execv(python, args) info('Adding ImageMagick') + libwmf = '/Volumes/sw/lib/libwmflite-0.2.7.dylib' + dest = os.path.join(frameworks_dir, os.path.basename(libwmf)) + shutil.copy2(libwmf, frameworks_dir) + nid = '@executable_path/../Frameworks/'+os.path.basename(dest) + subprocess.check_call(['install_name_tool', '-id', nid, dest]) dest = os.path.join(frameworks_dir, 'ImageMagick') if os.path.exists(dest): shutil.rmtree(dest) shutil.copytree(os.path.expanduser('~/ImageMagick'), dest, True) shutil.copyfile('/usr/local/lib/libpng12.0.dylib', os.path.join(dest, 'lib', 'libpng12.0.dylib')) + self.fix_image_magick_deps(dest) info('Installing prescipt') diff --git a/src/calibre/trac/plugins/download.py b/src/calibre/trac/plugins/download.py index 368553ac92..2962658097 100644 --- a/src/calibre/trac/plugins/download.py +++ b/src/calibre/trac/plugins/download.py @@ -21,6 +21,7 @@ DEPENDENCIES = [ ('dnspython', '1.6.0', 'dnspython', 'dnspython', 'dnspython', 'dnspython'), ('poppler-qt4', '0.10.6', 'poppler-qt4', 'poppler-qt4', 'poppler-qt4', 'poppler-qt4'), ('podofo', '0.7', 'podofo', 'podofo', 'podofo', 'podofo'), + ('libwmf', '0.2.8', 'libwmf', 'libwmf', 'libwmf', 'libwmf'), ]