Use staticly build copies of zlib and bzip2 to build the OSX installer, that

way the resulting binaries have a better change of running on 10.3.

This patch also updates the search logic for sleepycat db3/4, without this
patch you cannot use a sleepycat build with a non-standard prefix; with this
you can (at least on OSX) if you add the prefix to CPPFLAGS/LDFLAGS at
configure-time. This change is needed to build the binary installer for OSX.
This commit is contained in:
Ronald Oussoren 2006-06-27 12:53:52 +00:00
parent 3249d00f4d
commit 9b8b619491
2 changed files with 91 additions and 40 deletions

View File

@ -67,6 +67,8 @@ DEPSRC=os.path.expanduser('~/Universal/other-sources')
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk" SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
#SDKPATH="/" #SDKPATH="/"
ARCHLIST=('i386', 'ppc',)
# Source directory (asume we're in Mac/BuildScript) # Source directory (asume we're in Mac/BuildScript)
SRCDIR=os.path.dirname( SRCDIR=os.path.dirname(
os.path.dirname( os.path.dirname(
@ -90,6 +92,26 @@ USAGE=textwrap.dedent("""\
# Instructions for building libraries that are necessary for building a # Instructions for building libraries that are necessary for building a
# batteries included python. # batteries included python.
LIBRARY_RECIPES=[ LIBRARY_RECIPES=[
dict(
name="Bzip2 1.0.3",
url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz",
configure=None,
install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')),
' -arch '.join(ARCHLIST),
SDKPATH,
),
),
dict(
name="ZLib 1.2.3",
url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
configure=None,
install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')),
' -arch '.join(ARCHLIST),
SDKPATH,
),
),
dict( dict(
# Note that GNU readline is GPL'd software # Note that GNU readline is GPL'd software
name="GNU Readline 5.1.4", name="GNU Readline 5.1.4",
@ -486,48 +508,49 @@ def buildRecipe(recipe, basedir, archList):
runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1), runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1),
shellQuote(fn),)) shellQuote(fn),))
configure_args = [ if configure is not None:
"--prefix=/usr/local", configure_args = [
"--enable-static", "--prefix=/usr/local",
"--disable-shared", "--enable-static",
#"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),), "--disable-shared",
] #"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),),
]
if 'configure_pre' in recipe: if 'configure_pre' in recipe:
args = list(recipe['configure_pre']) args = list(recipe['configure_pre'])
if '--disable-static' in args: if '--disable-static' in args:
configure_args.remove('--enable-static') configure_args.remove('--enable-static')
if '--enable-shared' in args: if '--enable-shared' in args:
configure_args.remove('--disable-shared') configure_args.remove('--disable-shared')
configure_args.extend(args) configure_args.extend(args)
if recipe.get('useLDFlags', 1): if recipe.get('useLDFlags', 1):
configure_args.extend([ configure_args.extend([
"CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
' -arch '.join(archList), ' -arch '.join(archList),
shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],),
"LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%(
shellQuote(SDKPATH)[1:-1], shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],), shellQuote(basedir)[1:-1],
"LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%( ' -arch '.join(archList)),
shellQuote(SDKPATH)[1:-1], ])
shellQuote(basedir)[1:-1], else:
' -arch '.join(archList)), configure_args.extend([
]) "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%(
else: ' -arch '.join(archList),
configure_args.extend([ shellQuote(SDKPATH)[1:-1],
"CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( shellQuote(basedir)[1:-1],),
' -arch '.join(archList), ])
shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],),
])
if 'configure_post' in recipe: if 'configure_post' in recipe:
configure_args = configure_args = list(recipe['configure_post']) configure_args = configure_args = list(recipe['configure_post'])
configure_args.insert(0, configure) configure_args.insert(0, configure)
configure_args = [ shellQuote(a) for a in configure_args ] configure_args = [ shellQuote(a) for a in configure_args ]
print "Running configure for %s"%(name,) print "Running configure for %s"%(name,)
runCommand(' '.join(configure_args) + ' 2>&1') runCommand(' '.join(configure_args) + ' 2>&1')
print "Running install for %s"%(name,) print "Running install for %s"%(name,)
runCommand('{ ' + install + ' ;} 2>&1') runCommand('{ ' + install + ' ;} 2>&1')
@ -550,7 +573,7 @@ def buildLibraries():
os.makedirs(os.path.join(universal, 'usr', 'local', 'include')) os.makedirs(os.path.join(universal, 'usr', 'local', 'include'))
for recipe in LIBRARY_RECIPES: for recipe in LIBRARY_RECIPES:
buildRecipe(recipe, universal, ('i386', 'ppc',)) buildRecipe(recipe, universal, ARCHLIST)
@ -997,7 +1020,7 @@ def main():
buildPythonDocs() buildPythonDocs()
fn = os.path.join(WORKDIR, "_root", "Applications", fn = os.path.join(WORKDIR, "_root", "Applications",
"MacPython %s"%(getVersion(),), "Update Shell Profile.command") "MacPython %s"%(getVersion(),), "Update Shell Profile.command")
shutil.copy("scripts/postflight.patch-profile", fn) patchFile("scripts/postflight.patch-profile", fn)
os.chmod(fn, 0755) os.chmod(fn, 0755)
folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%( folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%(

View File

@ -638,6 +638,24 @@ class PyBuildExt(build_ext):
db_inc_paths.append('/pkg/db-3.%d/include' % x) db_inc_paths.append('/pkg/db-3.%d/include' % x)
db_inc_paths.append('/opt/db-3.%d/include' % x) db_inc_paths.append('/opt/db-3.%d/include' % x)
# Add some common subdirectories for Sleepycat DB to the list,
# based on the standard include directories. This way DB3/4 gets
# picked up when it is installed in a non-standard prefix and
# the user has added that prefix into inc_dirs.
std_variants = []
for dn in inc_dirs:
std_variants.append(os.path.join(dn, 'db3'))
std_variants.append(os.path.join(dn, 'db4'))
for x in (0,1,2,3,4):
std_variants.append(os.path.join(dn, "db4%d"%x))
std_variants.append(os.path.join(dn, "db4.%d"%x))
for x in (2,3):
std_variants.append(os.path.join(dn, "db3%d"%x))
std_variants.append(os.path.join(dn, "db3.%d"%x))
db_inc_paths = std_variants + db_inc_paths
db_ver_inc_map = {} db_ver_inc_map = {}
class db_found(Exception): pass class db_found(Exception): pass
@ -940,13 +958,23 @@ class PyBuildExt(build_ext):
break break
if version >= version_req: if version >= version_req:
if (self.compiler.find_library_file(lib_dirs, 'z')): if (self.compiler.find_library_file(lib_dirs, 'z')):
if sys.platform == "darwin":
zlib_extra_link_args = ('-Wl,-search_paths_first',)
else:
zlib_extra_link_args = ()
exts.append( Extension('zlib', ['zlibmodule.c'], exts.append( Extension('zlib', ['zlibmodule.c'],
libraries = ['z']) ) libraries = ['z'],
extra_link_args = zlib_extra_link_args))
# Gustavo Niemeyer's bz2 module. # Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(lib_dirs, 'bz2')): if (self.compiler.find_library_file(lib_dirs, 'bz2')):
if sys.platform == "darwin":
bz2_extra_link_args = ('-Wl,-search_paths_first',)
else:
bz2_extra_link_args = ()
exts.append( Extension('bz2', ['bz2module.c'], exts.append( Extension('bz2', ['bz2module.c'],
libraries = ['bz2']) ) libraries = ['bz2'],
extra_link_args = bz2_extra_link_args) )
# Interface to the Expat XML parser # Interface to the Expat XML parser
# #