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
# 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"
# 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')),
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')),
# Note that GNU readline is GPL'd software
name="GNU Readline 5.1.4",
url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
+ checksum="7ee5a692db88b30ca48927a13fd60e46",
patchlevel='0',
patches=[
# The readline maintainers don't do actual micro releases, but
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",
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",
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):
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
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')