Commit 028332d0 authored by Ronald Oussoren's avatar Ronald Oussoren

Mac Buildscript:

- be more strict about the build environment
- update some 3th party libraries
parent a2aaa100
...@@ -10,7 +10,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4) ...@@ -10,7 +10,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
Usage: see USAGE variable in the script. Usage: see USAGE variable in the script.
""" """
import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd
import grp import grp, md5
INCLUDE_TIMESTAMP=1 INCLUDE_TIMESTAMP=1
VERBOSE=1 VERBOSE=1
...@@ -31,6 +31,8 @@ except ImportError: ...@@ -31,6 +31,8 @@ except ImportError:
def writePlist(plist, path): def writePlist(plist, path):
plist.write(path) plist.write(path)
def shellQuote(value): def shellQuote(value):
""" """
Return the string value in a form that can safely be inserted into Return the string value in a form that can safely be inserted into
...@@ -62,7 +64,7 @@ WORKDIR="/tmp/_py" ...@@ -62,7 +64,7 @@ WORKDIR="/tmp/_py"
# The directory we'll use to store third-party sources. Set this to something # 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. # else if you don't want to re-fetch required libraries every time.
DEPSRC=os.path.join(WORKDIR, 'third-party') 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 # Location of the preferred SDK
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk" SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
...@@ -94,8 +96,9 @@ USAGE=textwrap.dedent("""\ ...@@ -94,8 +96,9 @@ USAGE=textwrap.dedent("""\
# batteries included python. # batteries included python.
LIBRARY_RECIPES=[ LIBRARY_RECIPES=[
dict( dict(
name="Bzip2 1.0.3", name="Bzip2 1.0.4",
url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz", url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
checksum='fc310b254f6ba5fbb5da018f04533688',
configure=None, configure=None,
install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')), shellQuote(os.path.join(WORKDIR, 'libraries')),
...@@ -106,6 +109,7 @@ LIBRARY_RECIPES=[ ...@@ -106,6 +109,7 @@ LIBRARY_RECIPES=[
dict( dict(
name="ZLib 1.2.3", name="ZLib 1.2.3",
url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz", url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
checksum='debc62758716a169df9f62e6ab2bc634',
configure=None, configure=None,
install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
shellQuote(os.path.join(WORKDIR, 'libraries')), shellQuote(os.path.join(WORKDIR, 'libraries')),
...@@ -118,6 +122,7 @@ LIBRARY_RECIPES=[ ...@@ -118,6 +122,7 @@ LIBRARY_RECIPES=[
name="GNU Readline 5.1.4", name="GNU Readline 5.1.4",
url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" , url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
patchlevel='0', patchlevel='0',
checksum='7ee5a692db88b30ca48927a13fd60e46',
patches=[ patches=[
# The readline maintainers don't do actual micro releases, but # The readline maintainers don't do actual micro releases, but
# just ship a set of patches. # just ship a set of patches.
...@@ -129,9 +134,9 @@ LIBRARY_RECIPES=[ ...@@ -129,9 +134,9 @@ LIBRARY_RECIPES=[
), ),
dict( dict(
name="SQLite 3.3.5", name="SQLite 3.3.14",
url="http://www.sqlite.org/sqlite-3.3.5.tar.gz", url="http://www.sqlite.org/sqlite-3.3.14.tar.gz",
checksum='93f742986e8bc2dfa34792e16df017a6feccf3a2', checksum='e1a4428a5cb17f28164731b72f06130a',
configure_pre=[ configure_pre=[
'--enable-threadsafe', '--enable-threadsafe',
'--enable-tempstore', '--enable-tempstore',
...@@ -144,6 +149,7 @@ LIBRARY_RECIPES=[ ...@@ -144,6 +149,7 @@ LIBRARY_RECIPES=[
dict( dict(
name="NCurses 5.5", name="NCurses 5.5",
url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz", url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
configure_pre=[ configure_pre=[
"--without-cxx", "--without-cxx",
"--without-ada", "--without-ada",
...@@ -172,6 +178,7 @@ LIBRARY_RECIPES=[ ...@@ -172,6 +178,7 @@ LIBRARY_RECIPES=[
dict( dict(
name="Sleepycat DB 4.4", name="Sleepycat DB 4.4",
url="http://downloads.sleepycat.com/db-4.4.20.tar.gz", url="http://downloads.sleepycat.com/db-4.4.20.tar.gz",
checksum='d84dff288a19186b136b0daf7067ade3',
#name="Sleepycat DB 4.3.29", #name="Sleepycat DB 4.3.29",
#url="http://downloads.sleepycat.com/db-4.3.29.tar.gz", #url="http://downloads.sleepycat.com/db-4.3.29.tar.gz",
buildDir="build_unix", buildDir="build_unix",
...@@ -321,6 +328,17 @@ def checkEnvironment(): ...@@ -321,6 +328,17 @@ def checkEnvironment():
fatal("Please install the latest version of Xcode and the %s SDK"%( fatal("Please install the latest version of Xcode and the %s SDK"%(
os.path.basename(SDKPATH[:-4]))) 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): def parseOptions(args = None):
...@@ -457,6 +475,17 @@ def downloadURL(url, fname): ...@@ -457,6 +475,17 @@ def downloadURL(url, fname):
except: except:
pass 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): def buildRecipe(recipe, basedir, archList):
""" """
Build software using a recipe. This function does the Build software using a recipe. This function does the
...@@ -478,13 +507,15 @@ def buildRecipe(recipe, basedir, archList): ...@@ -478,13 +507,15 @@ def buildRecipe(recipe, basedir, archList):
os.mkdir(DEPSRC) 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,) print "Using local copy of %s"%(name,)
else: else:
print "Downloading %s"%(name,) print "Downloading %s"%(name,)
downloadURL(url, sourceArchive) downloadURL(url, sourceArchive)
print "Archive for %s stored as %s"%(name, 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,) print "Extracting archive for %s"%(name,)
buildDir=os.path.join(WORKDIR, '_bld') buildDir=os.path.join(WORKDIR, '_bld')
...@@ -664,7 +695,6 @@ def buildPython(): ...@@ -664,7 +695,6 @@ def buildPython():
os.chmod(os.path.join(dirpath, dn), 0775) os.chmod(os.path.join(dirpath, dn), 0775)
os.chown(os.path.join(dirpath, dn), -1, gid) os.chown(os.path.join(dirpath, dn), -1, gid)
for fn in filenames: for fn in filenames:
if os.path.islink(fn): if os.path.islink(fn):
continue continue
...@@ -1010,6 +1040,7 @@ def setIcon(filePath, icnsPath): ...@@ -1010,6 +1040,7 @@ def setIcon(filePath, icnsPath):
shellQuote(tmpPath), shellQuote(tmpPath),
)) ))
def main(): def main():
# First parse options and check if we can perform our work # First parse options and check if we can perform our work
parseOptions() parseOptions()
...@@ -1062,6 +1093,5 @@ def main(): ...@@ -1062,6 +1093,5 @@ def main():
# And copy it to a DMG # And copy it to a DMG
buildDMG() buildDMG()
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment