From c626b60a29c51a90c3a1454401cc8989c25444e9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Feb 2011 23:51:50 -0700 Subject: [PATCH] Linux binary build: Fix ImageMagick trying to load system modules instead of bundled modules --- setup/installer/linux/freeze2.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/setup/installer/linux/freeze2.py b/setup/installer/linux/freeze2.py index be6f3ad6e5..9dd7df04f8 100644 --- a/setup/installer/linux/freeze2.py +++ b/setup/installer/linux/freeze2.py @@ -7,7 +7,7 @@ __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' import sys, os, shutil, platform, subprocess, stat, py_compile, glob, \ - textwrap, tarfile + textwrap, tarfile, re from setup import Command, modules, basenames, functions, __version__, \ __appname__ @@ -120,6 +120,21 @@ class LinuxFreeze(Command): self.magick_base = os.path.basename(im) dest = self.j(self.lib_dir, self.magick_base) shutil.copytree(im, dest, ignore=shutil.ignore_patterns('*.a')) + from calibre import walk + for x in walk(dest): + if x.endswith('.la'): + raw = open(x).read() + raw = re.sub('libdir=.*', '', raw) + open(x, 'wb').write(raw) + + dest = self.j(dest, 'config') + src = self.j(MAGICK_PREFIX, 'share', self.magick_base, 'config') + for x in glob.glob(src+'/*'): + d = self.j(dest, os.path.basename(x)) + if os.path.isdir(x): + shutil.copytree(x, d) + else: + shutil.copyfile(x, d) def compile_mount_helper(self): self.info('Compiling mount helper...')