mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Merged revisions 88004,88006,88235 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88004 | ned.deily | 2011-01-14 20:44:12 -0800 (Fri, 14 Jan 2011) | 4 lines #10907: Update OS X installer build README to better reflect current build practices. ........ r88006 | ned.deily | 2011-01-14 21:29:12 -0800 (Fri, 14 Jan 2011) | 6 lines #10843: Update third-party library versions used in OS X 32-bit installer builds: bzip2 1.0.6, readline 6.1.2, SQLite 3.7.4 (with FTS3/FTS4 and RTREE enabled), and ncursesw 5.5 (wide-char support enabled). ........ r88235 | ned.deily | 2011-01-29 10:56:28 -0800 (Sat, 29 Jan 2011) | 5 lines Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with the system-provided Python. Also, properly guard a new Python 3 only installer build step so that build-installer.py can stay compatible with the 2.7 version. (with release manager approval for 3.2rc2) ........
This commit is contained in:
parent
2a6f4b3327
commit
53c460d5fb
3 changed files with 219 additions and 94 deletions
|
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python
|
||||
"""
|
||||
This script is used to build the "official unofficial" universal build on
|
||||
Mac OS X. It requires Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK to do its
|
||||
work. 64-bit or four-way universal builds require at least OS X 10.5 and
|
||||
the 10.5 SDK.
|
||||
This script is used to build "official" universal installers on Mac OS X.
|
||||
It requires at least Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK for
|
||||
32-bit builds. 64-bit or four-way universal builds require at least
|
||||
OS X 10.5 and the 10.5 SDK.
|
||||
|
||||
Please ensure that this script keeps working with Python 2.3, to avoid
|
||||
bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
|
||||
Please ensure that this script keeps working with Python 2.5, to avoid
|
||||
bootstrap issues (/usr/bin/python is Python 2.5 on OSX 10.5). Sphinx,
|
||||
which is used to build the documentation, currently requires at least
|
||||
Python 2.4.
|
||||
|
||||
Usage: see USAGE variable in the script.
|
||||
"""
|
||||
|
|
@ -40,16 +42,19 @@ def grepValue(fn, variable):
|
|||
if ln.startswith(variable):
|
||||
value = ln[len(variable):].strip()
|
||||
return value[1:-1]
|
||||
raise RuntimeError, "Cannot find variable %s" % variable[:-1]
|
||||
|
||||
def getVersion():
|
||||
return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION')
|
||||
|
||||
def getVersionTuple():
|
||||
return tuple([int(n) for n in getVersion().split('.')])
|
||||
|
||||
def getFullVersion():
|
||||
fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h')
|
||||
for ln in open(fn):
|
||||
if 'PY_VERSION' in ln:
|
||||
return ln.split()[-1][1:-1]
|
||||
|
||||
raise RuntimeError, "Cannot find full version??"
|
||||
|
||||
# The directory we'll use to create the build (will be erased and recreated)
|
||||
|
|
@ -114,6 +119,8 @@ target_cc_map = {
|
|||
|
||||
CC = target_cc_map[DEPTARGET]
|
||||
|
||||
PYTHON_3 = getVersionTuple() >= (3, 0)
|
||||
|
||||
USAGE = textwrap.dedent("""\
|
||||
Usage: build_python [options]
|
||||
|
||||
|
|
@ -139,9 +146,9 @@ def library_recipes():
|
|||
if DEPTARGET < '10.5':
|
||||
result.extend([
|
||||
dict(
|
||||
name="Bzip2 1.0.5",
|
||||
url="http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz",
|
||||
checksum='3c15a0c8d1d3ee1c46a1634d00617b1a',
|
||||
name="Bzip2 1.0.6",
|
||||
url="http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
|
||||
checksum='00b516f4704d4a7cb50a1d97e6e8e15b',
|
||||
configure=None,
|
||||
install='make install CC=%s PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
|
||||
CC,
|
||||
|
|
@ -164,29 +171,33 @@ def library_recipes():
|
|||
),
|
||||
dict(
|
||||
# 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',
|
||||
name="GNU Readline 6.1.2",
|
||||
url="http://ftp.gnu.org/pub/gnu/readline/readline-6.1.tar.gz" ,
|
||||
checksum='fc2f7e714fe792db1ce6ddc4c9fb4ef3',
|
||||
patchlevel='0',
|
||||
patches=[
|
||||
# The readline maintainers don't do actual micro releases, but
|
||||
# just ship a set of patches.
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001',
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002',
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003',
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-001',
|
||||
'http://ftp.gnu.org/pub/gnu/readline/readline-6.1-patches/readline61-002',
|
||||
]
|
||||
),
|
||||
dict(
|
||||
name="SQLite 3.6.11",
|
||||
url="http://www.sqlite.org/sqlite-3.6.11.tar.gz",
|
||||
checksum='7ebb099696ab76cc6ff65dd496d17858',
|
||||
name="SQLite 3.7.4",
|
||||
url="http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz",
|
||||
checksum='8f0c690bfb33c3cbbc2471c3d9ba0158',
|
||||
configure_env=('CFLAGS="-Os'
|
||||
' -DSQLITE_ENABLE_FTS3'
|
||||
' -DSQLITE_ENABLE_FTS3_PARENTHESIS'
|
||||
' -DSQLITE_ENABLE_RTREE'
|
||||
' -DSQLITE_TCL=0'
|
||||
'"'),
|
||||
configure_pre=[
|
||||
'--enable-threadsafe',
|
||||
'--enable-tempstore',
|
||||
'--enable-shared=no',
|
||||
'--enable-static=yes',
|
||||
'--disable-tcl',
|
||||
'--disable-readline',
|
||||
'--disable-dependency-tracking',
|
||||
]
|
||||
),
|
||||
dict(
|
||||
|
|
@ -194,6 +205,7 @@ def library_recipes():
|
|||
url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
|
||||
checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
|
||||
configure_pre=[
|
||||
"--enable-widec",
|
||||
"--without-cxx",
|
||||
"--without-ada",
|
||||
"--without-progs",
|
||||
|
|
@ -220,24 +232,26 @@ def library_recipes():
|
|||
),
|
||||
])
|
||||
|
||||
result.extend([
|
||||
dict(
|
||||
name="Sleepycat DB 4.7.25",
|
||||
url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
|
||||
checksum='ec2b87e833779681a0c3a814aa71359e',
|
||||
buildDir="build_unix",
|
||||
configure="../dist/configure",
|
||||
configure_pre=[
|
||||
'--includedir=/usr/local/include/db4',
|
||||
]
|
||||
),
|
||||
])
|
||||
if not PYTHON_3:
|
||||
result.extend([
|
||||
dict(
|
||||
name="Sleepycat DB 4.7.25",
|
||||
url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
|
||||
checksum='ec2b87e833779681a0c3a814aa71359e',
|
||||
buildDir="build_unix",
|
||||
configure="../dist/configure",
|
||||
configure_pre=[
|
||||
'--includedir=/usr/local/include/db4',
|
||||
]
|
||||
),
|
||||
])
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# Instructions for building packages inside the .mpkg.
|
||||
def pkg_recipes():
|
||||
unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
|
||||
result = [
|
||||
dict(
|
||||
name="PythonFramework",
|
||||
|
|
@ -308,7 +322,7 @@ def pkg_recipes():
|
|||
topdir="/Library/Frameworks/Python.framework",
|
||||
source="/empty-dir",
|
||||
required=False,
|
||||
selected='selected',
|
||||
selected=unselected_for_python3,
|
||||
),
|
||||
]
|
||||
|
||||
|
|
@ -326,7 +340,7 @@ def pkg_recipes():
|
|||
topdir="/Library/Frameworks/Python.framework",
|
||||
source="/empty-dir",
|
||||
required=False,
|
||||
selected='selected',
|
||||
selected=unselected_for_python3,
|
||||
)
|
||||
)
|
||||
return result
|
||||
|
|
@ -393,6 +407,9 @@ def checkEnvironment():
|
|||
Check that we're running on a supported system.
|
||||
"""
|
||||
|
||||
if sys.version_info[0:2] < (2, 4):
|
||||
fatal("This script must be run with Python 2.4 or later")
|
||||
|
||||
if platform.system() != 'Darwin':
|
||||
fatal("This script should be run on a Mac OS X 10.4 (or later) system")
|
||||
|
||||
|
|
@ -412,15 +429,16 @@ def checkEnvironment():
|
|||
# to install a newer patch level.
|
||||
|
||||
for framework in ['Tcl', 'Tk']:
|
||||
fw = dict(lower=framework.lower(),
|
||||
upper=framework.upper(),
|
||||
cap=framework.capitalize())
|
||||
fwpth = "Library/Frameworks/%(cap)s.framework/%(lower)sConfig.sh" % fw
|
||||
sysfw = os.path.join('/System', fwpth)
|
||||
#fw = dict(lower=framework.lower(),
|
||||
# upper=framework.upper(),
|
||||
# cap=framework.capitalize())
|
||||
#fwpth = "Library/Frameworks/%(cap)s.framework/%(lower)sConfig.sh" % fw
|
||||
fwpth = 'Library/Frameworks/Tcl.framework/Versions/Current'
|
||||
sysfw = os.path.join(SDKPATH, 'System', fwpth)
|
||||
libfw = os.path.join('/', fwpth)
|
||||
usrfw = os.path.join(os.getenv('HOME'), fwpth)
|
||||
version = "%(upper)s_VERSION" % fw
|
||||
if getTclTkVersion(libfw, version) != getTclTkVersion(sysfw, version):
|
||||
#version = "%(upper)s_VERSION" % fw
|
||||
if os.readlink(libfw) != os.readlink(sysfw):
|
||||
fatal("Version of %s must match %s" % (libfw, sysfw) )
|
||||
if os.path.exists(usrfw):
|
||||
fatal("Please rename %s to avoid possible dynamic load issues."
|
||||
|
|
@ -690,6 +708,9 @@ def buildRecipe(recipe, basedir, archList):
|
|||
configure_args.insert(0, configure)
|
||||
configure_args = [ shellQuote(a) for a in configure_args ]
|
||||
|
||||
if 'configure_env' in recipe:
|
||||
configure_args.insert(0, recipe['configure_env'])
|
||||
|
||||
print "Running configure for %s"%(name,)
|
||||
runCommand(' '.join(configure_args) + ' 2>&1')
|
||||
|
||||
|
|
@ -745,9 +766,9 @@ def buildPython():
|
|||
shutil.rmtree(buildDir)
|
||||
if os.path.exists(rootDir):
|
||||
shutil.rmtree(rootDir)
|
||||
os.mkdir(buildDir)
|
||||
os.mkdir(rootDir)
|
||||
os.mkdir(os.path.join(rootDir, 'empty-dir'))
|
||||
os.makedirs(buildDir)
|
||||
os.makedirs(rootDir)
|
||||
os.makedirs(os.path.join(rootDir, 'empty-dir'))
|
||||
curdir = os.getcwd()
|
||||
os.chdir(buildDir)
|
||||
|
||||
|
|
@ -767,18 +788,20 @@ def buildPython():
|
|||
print "Running configure..."
|
||||
runCommand("%s -C --enable-framework --enable-universalsdk=%s "
|
||||
"--with-universal-archs=%s "
|
||||
"%s "
|
||||
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
|
||||
"OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%(
|
||||
shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
|
||||
UNIVERSALARCHS,
|
||||
(' ', '--with-computed-gotos ')[PYTHON_3],
|
||||
shellQuote(WORKDIR)[1:-1],
|
||||
shellQuote(WORKDIR)[1:-1]))
|
||||
|
||||
print "Running make"
|
||||
runCommand("make")
|
||||
|
||||
print "Running make frameworkinstall"
|
||||
runCommand("make frameworkinstall DESTDIR=%s"%(
|
||||
print "Running make install"
|
||||
runCommand("make install DESTDIR=%s"%(
|
||||
shellQuote(rootDir)))
|
||||
|
||||
print "Running make frameworkinstallextras"
|
||||
|
|
@ -817,12 +840,33 @@ def buildPython():
|
|||
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP)
|
||||
os.chown(p, -1, gid)
|
||||
|
||||
if PYTHON_3:
|
||||
LDVERSION=None
|
||||
VERSION=None
|
||||
ABIFLAGS=None
|
||||
|
||||
fp = open(os.path.join(buildDir, 'Makefile'), 'r')
|
||||
for ln in fp:
|
||||
if ln.startswith('VERSION='):
|
||||
VERSION=ln.split()[1]
|
||||
if ln.startswith('ABIFLAGS='):
|
||||
ABIFLAGS=ln.split()[1]
|
||||
if ln.startswith('LDVERSION='):
|
||||
LDVERSION=ln.split()[1]
|
||||
fp.close()
|
||||
|
||||
LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
|
||||
LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
|
||||
config_suffix = '-' + LDVERSION
|
||||
else:
|
||||
config_suffix = '' # Python 2.x
|
||||
|
||||
# We added some directories to the search path during the configure
|
||||
# phase. Remove those because those directories won't be there on
|
||||
# the end-users system.
|
||||
path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework',
|
||||
'Versions', version, 'lib', 'python%s'%(version,),
|
||||
'config', 'Makefile')
|
||||
'config' + config_suffix, 'Makefile')
|
||||
fp = open(path, 'r')
|
||||
data = fp.read()
|
||||
fp.close()
|
||||
|
|
@ -847,7 +891,11 @@ def buildPython():
|
|||
|
||||
os.chdir(curdir)
|
||||
|
||||
|
||||
if PYTHON_3:
|
||||
# Remove the 'Current' link, that way we don't accidently mess
|
||||
# with an already installed version of python 2
|
||||
os.unlink(os.path.join(rootDir, 'Library', 'Frameworks',
|
||||
'Python.framework', 'Versions', 'Current'))
|
||||
|
||||
def patchFile(inPath, outPath):
|
||||
data = fileContents(inPath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue