OS X binary build: Switch to intel Leopard Qt 4.7.1 based binary build

This commit is contained in:
Kovid Goyal 2010-11-16 13:15:12 -07:00
parent 9177bda0bc
commit ab1795de9a
7 changed files with 37 additions and 65 deletions

View File

@ -13,9 +13,9 @@ from PyQt4 import pyqtconfig
from setup import isosx, iswindows, islinux
OSX_SDK = '/Developer/SDKs/MacOSX10.4u.sdk'
OSX_SDK = '/Developer/SDKs/MacOSX10.5.sdk'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.5'
NMAKE = RC = msvc = MT = win_inc = win_lib = win_ddk = None
if iswindows:
@ -124,7 +124,7 @@ elif isosx:
fc_inc = '/sw/include/fontconfig'
fc_lib = '/sw/lib'
poppler_inc_dirs = consolidate('POPPLER_INC_DIR',
'/sw/build/poppler-0.12.2/poppler:/sw/build/poppler-0.12.2')
'/sw/build/poppler-0.14.5/poppler:/sw/build/poppler-0.14.5')
popplerqt4_inc_dirs = poppler_inc_dirs + [poppler_inc_dirs[0]+'/qt4']
poppler_lib_dirs = consolidate('POPPLER_LIB_DIR',
'/sw/lib')

View File

@ -19,7 +19,7 @@ __all__ = [
'upload_user_manual', 'upload_to_mobileread', 'upload_demo',
'upload_to_sourceforge', 'upload_to_google_code',
'linux32', 'linux64', 'linux', 'linux_freeze', 'linux_freeze2',
'osx32_freeze', 'osx32', 'osx', 'rsync', 'push',
'osx32_freeze', 'osx', 'rsync', 'push',
'win32_freeze', 'win32', 'win',
'stage1', 'stage2', 'stage3', 'stage4', 'publish'
]
@ -84,9 +84,8 @@ linux_freeze = LinuxFreeze()
from setup.installer.linux.freeze2 import LinuxFreeze2
linux_freeze2 = LinuxFreeze2()
from setup.installer.osx import OSX, OSX32
from setup.installer.osx import OSX
osx = OSX()
osx32 = OSX32()
from setup.installer.osx.app.main import OSX32_Freeze
osx32_freeze = OSX32_Freeze()

View File

@ -186,7 +186,7 @@ if isfreebsd:
if isosx:
x, p = ('i386', 'ppc')
x, p = ('i386', 'x86_64')
archs = ['-arch', x, '-arch', p, '-isysroot',
OSX_SDK]
cflags.append('-D_OSX')
@ -339,7 +339,7 @@ class Build(Command):
obj_pat = 'release\\*.obj' if iswindows else '*.o'
objects = glob.glob(obj_pat)
if not objects or self.newer(objects, ext.sources+ext.headers):
archs = 'x86 ppc'
archs = 'x86 x86_64'
pro = textwrap.dedent('''\
TARGET = %s
TEMPLATE = lib

View File

@ -7,25 +7,14 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from setup import Command
from setup.installer import VMInstaller
class OSX(Command):
class OSX(VMInstaller):
description = 'Build OS X binary installers'
sub_commands = ['osx32']
def run(self, opts):
pass
class OSX32(VMInstaller):
description = 'Build 32 bit OS X binary installer'
description = 'Build OS X binary installer'
INSTALLER_EXT = 'dmg'
VM_NAME = 'leopard_build'
VM_NAME = 'osx_build'
VM = '/vmware/bin/%s'%VM_NAME
FREEZE_TEMPLATE = 'python -OO setup.py {freeze_command}'
FREEZE_COMMAND = 'osx32_freeze'

View File

@ -48,14 +48,14 @@ def compile_launcher_lib(contents_dir, gcc, base):
fd = join(contents_dir, 'Frameworks')
dest = join(fd, 'calibre-launcher.dylib')
src = join(base, 'util.c')
cmd = [gcc] + '-Wall -arch i386 -arch ppc -dynamiclib -std=gnu99'.split() + [src] + \
cmd = [gcc] + '-Wall -arch i386 -arch x86_64 -dynamiclib -std=gnu99'.split() + [src] + \
['-I'+base] + \
['-I/Library/Frameworks/Python.framework/Versions/Current/Headers'] + \
['-I/sw/python/Python.framework/Versions/Current/Headers'] + \
'-current_version 1.0 -compatibility_version 1.0'.split() + \
'-fvisibility=hidden -o'.split() + [dest] + \
['-install_name',
'@executable_path/../Frameworks/'+os.path.basename(dest)] + \
['-framework', 'Python', '-framework', 'CoreFoundation', '-headerpad_max_install_names']
['-F/sw/python', '-framework', 'Python', '-framework', 'CoreFoundation', '-headerpad_max_install_names']
info('\t'+' '.join(cmd))
sys.stdout.flush()
subprocess.check_call(cmd)
@ -88,7 +88,7 @@ def compile_launchers(contents_dir, xprograms, pyver):
fsrc = '/tmp/%s.c'%program
with open(fsrc, 'wb') as f:
f.write(psrc)
cmd = [gcc, '-Wall', '-arch', 'ppc', '-arch', 'i386',
cmd = [gcc, '-Wall', '-arch', 'x86_64', '-arch', 'i386',
'-I'+base, fsrc, lib, '-o', out,
'-headerpad_max_install_names']
info('\t'+' '.join(cmd))
@ -108,14 +108,6 @@ def flipwritable(fn, mode=None):
os.chmod(fn, stat.S_IWRITE | old_mode)
return old_mode
def thin(path):
try:
subprocess.check_call(['lipo', path, '-verify_arch', 'ppc64'])
info('\tThinning', path)
except:
return
else:
subprocess.check_call(['lipo', path, '-thin', 'x86_64', '-output', path])
STRIPCMD = ['/usr/bin/strip', '-x', '-S', '-']
def strip_files(files, argv_max=(256 * 1024)):
@ -200,7 +192,6 @@ class Py2App(object):
self.copy_site()
self.create_exe()
if not test_launchers:
#self.thin_to_x86_64()
self.strip_files()
ret = self.makedmg(self.build_dir, APPNAME+'-'+VERSION)
@ -212,19 +203,6 @@ class Py2App(object):
shutil.copytree('resources', os.path.join(self.resources_dir,
'resources'))
@flush
def thin_to_x86_64(self):
info('\nThinning to x86_64')
for y in (self.frameworks_dir, join(self.resources_dir, 'Python')):
for x in os.walk(y):
for f in x[-1]:
f = join(x[0], f)
if not os.path.isfile(f): continue
for t in ('.so', '.dylib', '/Python'):
if f.endswith(t):
thin(f)
break
@flush
def strip_files(self):
info('\nStripping files...')
@ -270,10 +248,10 @@ class Py2App(object):
continue
for y in (SW+'/lib/', '/usr/local/lib/', SW+'/qt/lib/',
'/opt/local/lib/',
'/Library/Frameworks/Python.framework/', SW+'/freetype/lib/'):
SW+'/python/Python.framework/', SW+'/freetype/lib/'):
if x.startswith(y):
if y == '/Library/Frameworks/Python.framework/':
y = '/Library/Frameworks/'
if y == SW+'/python/Python.framework/':
y = SW+'/python/'
yield x, x[len(y):]
break
@ -299,7 +277,7 @@ class Py2App(object):
@flush
def add_python_framework(self):
info('\nAdding Python framework')
src = join('/Library/Frameworks', 'Python.framework')
src = join('/sw/python', 'Python.framework')
x = join(self.frameworks_dir, 'Python.framework')
curr = os.path.realpath(join(src, 'Versions', 'Current'))
currd = join(x, 'Versions', basename(curr))
@ -314,7 +292,7 @@ class Py2App(object):
def add_qt_frameworks(self):
info('\nAdding Qt Framework')
for f in ('QtCore', 'QtGui', 'QtXml', 'QtNetwork', 'QtSvg', 'QtWebKit',
'QtXmlPatterns', 'phonon'):
'QtXmlPatterns'):
self.add_qt_framework(f)
for d in glob.glob(join(SW, 'qt', 'plugins', '*')):
shutil.copytree(d, join(self.contents_dir, 'MacOS', basename(d)))
@ -353,8 +331,8 @@ class Py2App(object):
shutil.copy2(f, dest)
self.fix_dependencies_in_lib(join(dest, basename(f)))
if 'podofo' in f:
self.change_dep('libpodofo.0.6.99.dylib',
self.FID+'/'+'libpodofo.0.6.99.dylib', join(dest, basename(f)))
self.change_dep('libpodofo.0.8.4.dylib',
self.FID+'/'+'libpodofo.0.8.4.dylib', join(dest, basename(f)))
@flush
@ -401,25 +379,27 @@ class Py2App(object):
@flush
def add_podofo(self):
info('\nAdding PoDoFo')
pdf = join(SW, 'lib', 'libpodofo.0.8.2.dylib')
pdf = join(SW, 'lib', 'libpodofo.0.8.4.dylib')
self.install_dylib(pdf)
@flush
def add_poppler(self):
info('\nAdding poppler')
for x in ('libpoppler.5.dylib', 'libpoppler-qt4.3.dylib'):
for x in ('libpoppler.7.dylib',):
self.install_dylib(os.path.join(SW, 'lib', x))
self.install_dylib(os.path.join(SW, 'bin', 'pdftohtml'), False)
@flush
def add_libjpeg(self):
info('\nAdding libjpeg')
self.install_dylib(os.path.join(SW, 'lib', 'libjpeg.7.dylib'))
self.install_dylib(os.path.join(SW, 'lib', 'libjpeg.8.dylib'))
@flush
def add_libpng(self):
info('\nAdding libpng')
self.install_dylib(os.path.join(SW, 'lib', 'libpng12.0.dylib'))
self.install_dylib(os.path.join(SW, 'lib', 'libpng.3.dylib'))
@flush
def add_fontconfig(self):
@ -449,7 +429,7 @@ class Py2App(object):
def add_imagemagick(self):
info('\nAdding ImageMagick')
for x in ('Wand', 'Core'):
self.install_dylib(os.path.join(SW, 'lib', 'libMagick%s.2.dylib'%x))
self.install_dylib(os.path.join(SW, 'lib', 'libMagick%s.4.dylib'%x))
idir = glob.glob(os.path.join(SW, 'lib', 'ImageMagick-*'))[-1]
dest = os.path.join(self.frameworks_dir, 'ImageMagick')
if os.path.exists(dest):
@ -463,7 +443,8 @@ class Py2App(object):
@flush
def add_misc_libraries(self):
for x in ('usb', 'unrar', 'readline.6.0', 'wmflite-0.2.7', 'chm.0'):
for x in ('usb', 'unrar', 'readline.6.1', 'wmflite-0.2.7', 'chm.0',
'sqlite3.0'):
info('\nAdding', x)
x = 'lib%s.dylib'%x
shutil.copy2(join(SW, 'lib', x), self.frameworks_dir)
@ -551,7 +532,7 @@ class Py2App(object):
@flush
def add_stdlib(self):
info('\nAdding python stdlib')
src = '/Library/Frameworks/Python.framework/Versions/Current/lib/python'
src = '/sw/python/Python.framework/Versions/Current/lib/python'
src += self.version_info
dest = join(self.resources_dir, 'Python', 'lib', 'python')
dest += self.version_info

View File

@ -37,7 +37,7 @@ Qt
Extract Qt sourcecode to C:\Qt\4.x.x. Run configure and make::
configure -opensource -release -qt-zlib -qt-gif -qt-libmng -qt-libpng -qt-libtiff -qt-libjpeg -release -platform win32-msvc2008 -no-qt3support -webkit -xmlpatterns -no-phonon -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -no-declarative -no-scripttools -no-audio-backend -no-multimedia -no-dbus -no-openvg -no-opengl -no-qt3support -confirm-license && nmake
configure -opensource -release -qt-zlib -qt-gif -qt-libmng -qt-libpng -qt-libtiff -qt-libjpeg -release -platform win32-msvc2008 -no-qt3support -webkit -xmlpatterns -no-phonon -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -no-declarative -no-scripttools -no-audio-backend -no-multimedia -no-dbus -no-openvg -no-opengl -no-qt3support -confirm-license -nomake examples -nomake demos -nomake docs && nmake
SIP
-----

View File

@ -53,8 +53,8 @@
#define NUKE(x) Py_XDECREF(x); x = NULL;
/* This function only works on 10.5 and later
static PyObject* send2trash(PyObject *self, PyObject *args)
/* This function only works on 10.5 and later. Pass in a unicode object as path */
static PyObject* usbobserver_send2trash(PyObject *self, PyObject *args)
{
UInt8 *utf8_chars;
FSRef fp;
@ -73,7 +73,7 @@ static PyObject* send2trash(PyObject *self, PyObject *args)
}
Py_RETURN_NONE;
}
*/
static PyObject*
usbobserver_get_iokit_string_property(io_service_t dev, CFStringRef prop) {
@ -323,6 +323,9 @@ static PyMethodDef usbobserver_methods[] = {
{"get_mounted_filesystems", usbobserver_get_mounted_filesystems, METH_VARARGS,
"Get mapping of mounted filesystems. Mapping is from BSD name to mount point."
},
{"send2trash", usbobserver_send2trash, METH_VARARGS,
"send2trash(unicode object) -> Send specified file/dir to trash"
},
{NULL, NULL, 0, NULL}
};