Mac Buildscript:
- be more strict about the build environment - update some 3th party libraries
This commit is contained in:
parent
77dff905ba
commit
0e258c5ea5
|
@ -10,7 +10,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
|
|||
Usage: see USAGE variable in the script.
|
||||
"""
|
||||
import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd
|
||||
import grp
|
||||
import grp, md5
|
||||
|
||||
INCLUDE_TIMESTAMP=1
|
||||
VERBOSE=1
|
||||
|
@ -31,6 +31,8 @@ except ImportError:
|
|||
def writePlist(plist, path):
|
||||
plist.write(path)
|
||||
|
||||
|
||||
|
||||
def shellQuote(value):
|
||||
"""
|
||||
Return the string value in a form that can safely be inserted into
|
||||
|
@ -62,7 +64,7 @@ WORKDIR="/tmp/_py"
|
|||
# The directory we'll use to store third-party sources. Set this to something
|
||||
# else if you don't want to re-fetch required libraries every time.
|
||||
DEPSRC=os.path.join(WORKDIR, 'third-party')
|
||||
DEPSRC=os.path.expanduser('~/Universal/other-sources')
|
||||
DEPSRC=os.path.expanduser('/tmp/other-sources')
|
||||
|
||||
# Location of the preferred SDK
|
||||
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
|
||||
|
@ -94,8 +96,9 @@ USAGE=textwrap.dedent("""\
|
|||
# batteries included python.
|
||||
LIBRARY_RECIPES=[
|
||||
dict(
|
||||
name="Bzip2 1.0.3",
|
||||
url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz",
|
||||
name="Bzip2 1.0.4",
|
||||
url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
|
||||
checksum='fc310b254f6ba5fbb5da018f04533688',
|
||||
configure=None,
|
||||
install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
|
||||
shellQuote(os.path.join(WORKDIR, 'libraries')),
|
||||
|
@ -106,6 +109,7 @@ LIBRARY_RECIPES=[
|
|||
dict(
|
||||
name="ZLib 1.2.3",
|
||||
url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
|
||||
checksum='debc62758716a169df9f62e6ab2bc634',
|
||||
configure=None,
|
||||
install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
|
||||
shellQuote(os.path.join(WORKDIR, 'libraries')),
|
||||
|
@ -118,6 +122,7 @@ LIBRARY_RECIPES=[
|
|||
name="GNU Readline 5.1.4",
|
||||
url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
|
||||
patchlevel='0',
|
||||
checksum='7ee5a692db88b30ca48927a13fd60e46',
|
||||
patches=[
|
||||
# The readline maintainers don't do actual micro releases, but
|
||||
# just ship a set of patches.
|
||||
|
@ -129,9 +134,9 @@ LIBRARY_RECIPES=[
|
|||
),
|
||||
|
||||
dict(
|
||||
name="SQLite 3.3.5",
|
||||
url="http://www.sqlite.org/sqlite-3.3.5.tar.gz",
|
||||
checksum='93f742986e8bc2dfa34792e16df017a6feccf3a2',
|
||||
name="SQLite 3.3.14",
|
||||
url="http://www.sqlite.org/sqlite-3.3.14.tar.gz",
|
||||
checksum='e1a4428a5cb17f28164731b72f06130a',
|
||||
configure_pre=[
|
||||
'--enable-threadsafe',
|
||||
'--enable-tempstore',
|
||||
|
@ -144,6 +149,7 @@ LIBRARY_RECIPES=[
|
|||
dict(
|
||||
name="NCurses 5.5",
|
||||
url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
|
||||
checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
|
||||
configure_pre=[
|
||||
"--without-cxx",
|
||||
"--without-ada",
|
||||
|
@ -172,6 +178,7 @@ LIBRARY_RECIPES=[
|
|||
dict(
|
||||
name="Sleepycat DB 4.4",
|
||||
url="http://downloads.sleepycat.com/db-4.4.20.tar.gz",
|
||||
checksum='d84dff288a19186b136b0daf7067ade3',
|
||||
#name="Sleepycat DB 4.3.29",
|
||||
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
|
||||
buildDir="build_unix",
|
||||
|
@ -321,6 +328,17 @@ def checkEnvironment():
|
|||
fatal("Please install the latest version of Xcode and the %s SDK"%(
|
||||
os.path.basename(SDKPATH[:-4])))
|
||||
|
||||
if os.path.exists('/sw'):
|
||||
fatal("Detected Fink, please remove before building Python")
|
||||
|
||||
if os.path.exists('/opt/local'):
|
||||
fatal("Detected MacPorts, please remove before building Python")
|
||||
|
||||
if not os.path.exists('/Library/Frameworks/Tcl.framework') or \
|
||||
not os.path.exists('/Library/Frameworks/Tk.framework'):
|
||||
|
||||
fatal("Please install a Universal Tcl/Tk framework in /Library from\n\thttp://tcltkaqua.sourceforge.net/")
|
||||
|
||||
|
||||
|
||||
def parseOptions(args = None):
|
||||
|
@ -457,6 +475,17 @@ def downloadURL(url, fname):
|
|||
except:
|
||||
pass
|
||||
|
||||
|
||||
def verifyChecksum(path, checksum):
|
||||
summer = md5.md5()
|
||||
fp = open(path, 'rb')
|
||||
block = fp.read(10240)
|
||||
while block:
|
||||
summer.update(block)
|
||||
block = fp.read(10240)
|
||||
|
||||
return summer.hexdigest() == checksum
|
||||
|
||||
def buildRecipe(recipe, basedir, archList):
|
||||
"""
|
||||
Build software using a recipe. This function does the
|
||||
|
@ -478,13 +507,15 @@ def buildRecipe(recipe, basedir, archList):
|
|||
os.mkdir(DEPSRC)
|
||||
|
||||
|
||||
if os.path.exists(sourceArchive):
|
||||
if os.path.exists(sourceArchive) and verifyChecksum(sourceArchive, recipe['checksum']):
|
||||
print "Using local copy of %s"%(name,)
|
||||
|
||||
else:
|
||||
print "Downloading %s"%(name,)
|
||||
downloadURL(url, sourceArchive)
|
||||
print "Archive for %s stored as %s"%(name, sourceArchive)
|
||||
if not verifyChecksum(sourceArchive, recipe['checksum']):
|
||||
fatal("Download for %s failed: bad checksum"%(url,))
|
||||
|
||||
print "Extracting archive for %s"%(name,)
|
||||
buildDir=os.path.join(WORKDIR, '_bld')
|
||||
|
@ -663,7 +694,6 @@ def buildPython():
|
|||
for dn in dirnames:
|
||||
os.chmod(os.path.join(dirpath, dn), 0775)
|
||||
os.chown(os.path.join(dirpath, dn), -1, gid)
|
||||
|
||||
|
||||
for fn in filenames:
|
||||
if os.path.islink(fn):
|
||||
|
@ -1010,6 +1040,7 @@ def setIcon(filePath, icnsPath):
|
|||
shellQuote(tmpPath),
|
||||
))
|
||||
|
||||
|
||||
def main():
|
||||
# First parse options and check if we can perform our work
|
||||
parseOptions()
|
||||
|
@ -1062,6 +1093,5 @@ def main():
|
|||
# And copy it to a DMG
|
||||
buildDMG()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue