Commit ee8e4b61 authored by Ned Deily's avatar Ned Deily Committed by GitHub

[2.7] Backport macOS universal build and installer fixes from 3.6. (GH-6469)

These include:

- bpo-32726: Provide an additional, more modern macOS installer variant that
  supports macOS 10.9+ systems in 64-bit mode only. Upgrade the supplied
  third-party libraries to OpenSSL 1.0.2n and SQLite 3.22.0. The 10.9+
  installer now supplies its own private copy of Tcl/Tk 8.6.8.

- bpo-24414: Default macOS deployment target is now set by ``configure`` to
  the build system's OS version (as is done by Python 3), not ``10.4``;
  override with, for example, ``./configure MACOSX_DEPLOYMENT_TARGET=10.4``.

- bpo-19019: All 2.7 macOS installer variants now supply their own version
  of ``OpenSSL 1.0.2``; the Apple-supplied SSL libraries and root
  certificates are not longer used.  The ``Installer Certificate`` command
  in ``/Applications/Python 2.7`` may be used to download and install a
  default set of root certificates from the third-party ``certifi`` package.

- bpo-11485: python.org macOS Pythons no longer supply a default SDK value
  (e.g. ``-isysroot /``) or specific compiler version default (e.g.
  ``gcc-4.2``) when building extension modules.  Use ``CC``, ``SDKROOT``,
  and ``DEVELOPER_DIR`` environment variables to override compilers or to
  use an SDK.  See Apple's ``xcrun`` man page for more info.

- prepare for pending Apple removal of 32-bit support in future macOS release
parent a61f5da5
Building a Python Mac OS X distribution
=======================================
The ``build-install.py`` script creates Python distributions, including
WARNING
-------
The instructions in this README are incomplete and not up-to-date.
In particular, they do not explain how to create a modern flat installer
package from the now obsolete bundle-format installer package produced
by ``build-installer.py``.
The ``build-installer.py`` script creates Python distributions, including
certain third-party libraries as necessary. It builds a complete
framework-based Python out-of-tree, installs it in a funny place with
$DESTROOT, massages that installation to remove .pyc files and such, creates
......
#!/usr/bin/env python
"""
This script is used to build "official" universal installers on Mac OS X.
It requires at least Mac OS X 10.5, Xcode 3, 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.
This script is used to build "official" universal installers on macOS.
NEW for 3.6.5:
- support Intel 64-bit-only () and 32-bit-only installer builds
- build and link with private Tcl/Tk 8.6 for 10.9+ builds
- deprecate use of explicit SDK (--sdk-path=) since all but the oldest
versions of Xcode support implicit setting of an SDK via environment
variables (SDKROOT and friends, see the xcrun man page for more info).
The SDK stuff was primarily needed for building universal installers
for 10.4; so as of 3.6.5, building installers for 10.4 is no longer
supported with build-installer.
- use generic "gcc" as compiler (CC env var) rather than "gcc-4.2"
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. However, as of Python 3.4.1, Doc builds require an external
sphinx-build and the current versions of Sphinx now require at least
Python 2.6.
In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script
requires an installed third-party version of
Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5
bootstrap issues (/usr/bin/python is Python 2.5 on OSX 10.5). Doc builds
use current versions of Sphinx and require a reasonably current python3.
Sphinx and dependencies are installed into a venv using the python3's pip
so will fetch them from PyPI if necessary. Since python3 is now used for
Sphinx, build-installer.py should also be converted to use python3!
For 10.9 or greater deployment targets, build-installer builds and links
with its own copy of Tcl/Tk 8.5 and the rest of this paragraph does not
apply. Otherwise, build-installer requires an installed third-party version
of Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5
(for 10.6 or later) installed in /Library/Frameworks. When installed,
the Python built by this script will attempt to dynamically link first to
Tcl and Tk frameworks in /Library/Frameworks if available otherwise fall
back to the ones in /System/Library/Framework. For the build, we recommend
installing the most recent ActiveTcl 8.4 or 8.5 version.
32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5
and the installation of additional components, such as a newer Python
(2.5 is needed for Python parser updates) and for the documentation
build either svn (pre-3.4.1) or sphinx-build (3.4.1 and later).
installing the most recent ActiveTcl 8.5 or 8.4 version, depending
on the deployment target. The actual version linked to depends on the
path of /Library/Frameworks/{Tcl,Tk}.framework/Versions/Current.
Usage: see USAGE variable in the script.
"""
......@@ -101,6 +107,7 @@ def getFullVersion():
FW_PREFIX = ["Library", "Frameworks", "Python.framework"]
FW_VERSION_PREFIX = "--undefined--" # initialized in parseOptions
FW_SSL_DIRECTORY = "--undefined--" # initialized in parseOptions
# The directory we'll use to create the build (will be erased and recreated)
WORKDIR = "/tmp/_py"
......@@ -110,32 +117,19 @@ WORKDIR = "/tmp/_py"
DEPSRC = os.path.join(WORKDIR, 'third-party')
DEPSRC = os.path.expanduser('~/Universal/other-sources')
# Location of the preferred SDK
### There are some issues with the SDK selection below here,
### The resulting binary doesn't work on all platforms that
### it should. Always default to the 10.4u SDK until that
### issue is resolved.
###
##if int(os.uname()[2].split('.')[0]) == 8:
## # Explicitly use the 10.4u (universal) SDK when
## # building on 10.4, the system headers are not
## # useable for a universal build
## SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
##else:
## SDKPATH = "/"
SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
universal_opts_map = { '32-bit': ('i386', 'ppc',),
'64-bit': ('x86_64', 'ppc64',),
'intel': ('i386', 'x86_64'),
'intel-32': ('i386',),
'intel-64': ('x86_64',),
'3-way': ('ppc', 'i386', 'x86_64'),
'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
default_target_map = {
'64-bit': '10.5',
'3-way': '10.5',
'intel': '10.5',
'intel-32': '10.4',
'intel-64': '10.5',
'all': '10.5',
}
......@@ -153,23 +147,23 @@ SRCDIR = os.path.dirname(
))))
# $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
DEPTARGET = '10.3'
DEPTARGET = '10.5'
def getDeptargetTuple():
return tuple([int(n) for n in DEPTARGET.split('.')[0:2]])
def getTargetCompilers():
target_cc_map = {
'10.3': ('gcc-4.0', 'g++-4.0'),
'10.4': ('gcc-4.0', 'g++-4.0'),
'10.5': ('gcc-4.2', 'g++-4.2'),
'10.6': ('gcc-4.2', 'g++-4.2'),
'10.5': ('gcc', 'g++'),
'10.6': ('gcc', 'g++'),
}
return target_cc_map.get(DEPTARGET, ('clang', 'clang++') )
return target_cc_map.get(DEPTARGET, ('gcc', 'g++') )
CC, CXX = getTargetCompilers()
PYTHON_3 = getVersionMajorMinor() >= (3, 0)
PYTHON_2 = getVersionMajorMinor()[0] == 2
PYTHON_3 = getVersionMajorMinor()[0] == 3
USAGE = textwrap.dedent("""\
Usage: build_python [options]
......@@ -179,9 +173,9 @@ USAGE = textwrap.dedent("""\
-b DIR
--build-dir=DIR: Create build here (default: %(WORKDIR)r)
--third-party=DIR: Store third-party sources here (default: %(DEPSRC)r)
--sdk-path=DIR: Location of the SDK (default: %(SDKPATH)r)
--sdk-path=DIR: Location of the SDK (deprecated, use SDKROOT env variable)
--src-dir=DIR: Location of the Python sources (default: %(SRCDIR)r)
--dep-target=10.n OS X deployment target (default: %(DEPTARGET)r)
--dep-target=10.n macOS deployment target (default: %(DEPTARGET)r)
--universal-archs=x universal architectures (options: %(UNIVERSALOPTS)r, default: %(UNIVERSALARCHS)r)
""")% globals()
......@@ -193,6 +187,11 @@ USAGE = textwrap.dedent("""\
# '/Library/Frameworks/Tk.framework/Versions/8.5/Tk']
EXPECTED_SHARED_LIBS = {}
# Are we building and linking with our own copy of Tcl/TK?
# For now, do so if deployment target is 10.9+.
def internalTk():
return getDeptargetTuple() >= (10, 9)
# List of names of third party software built with this installer.
# The names will be inserted into the rtf version of the License.
THIRD_PARTY_LIBS = []
......@@ -206,61 +205,27 @@ def library_recipes():
LT_10_5 = bool(getDeptargetTuple() < (10, 5))
if not (10, 5) < getDeptargetTuple() < (10, 10):
# The OpenSSL libs shipped with OS X 10.5 and earlier are
# hopelessly out-of-date and do not include Apple's tie-in to
# the root certificates in the user and system keychains via TEA
# that was introduced in OS X 10.6. Note that this applies to
# programs built and linked with a 10.5 SDK even when run on
# newer versions of OS X.
#
# Dealing with CAs is messy. For now, just supply a
# local libssl and libcrypto for the older installer variants
# (e.g. the python.org 10.5+ 32-bit-only installer) that use the
# same default ssl certfile location as the system libs do:
# /System/Library/OpenSSL/cert.pem
# Then at least TLS connections can be negotiated with sites that
# use sha-256 certs like python.org, assuming the proper CA certs
# have been supplied. The default CA cert management issues for
# 10.5 and earlier builds are the same as before, other than it is
# now more obvious with cert checking enabled by default in the
# standard library.
#
# For builds with 10.6 through 10.9 SDKs,
# continue to use the deprecated but
# less out-of-date Apple 0.9.8 libs for now. While they are less
# secure than using an up-to-date 1.0.1 version, doing so
# avoids the big problems of forcing users to have to manage
# default CAs themselves, thanks to the Apple libs using private TEA
# APIs for cert validation from keychains if validation using the
# standard OpenSSL locations (/System/Library/OpenSSL, normally empty)
# fails.
#
# Since Apple removed the header files for the deprecated system
# OpenSSL as of the Xcode 7 release (for OS X 10.10+), we do not
# have much choice but to build our own copy here, too.
# Since Apple removed the header files for the deprecated system
# OpenSSL as of the Xcode 7 release (for OS X 10.10+), we do not
# have much choice but to build our own copy here, too.
result.extend([
result.extend([
dict(
name="OpenSSL 1.0.2k",
url="https://www.openssl.org/source/openssl-1.0.2k.tar.gz",
checksum='f965fc0bf01bf882b31314b61391ae65',
patches=[
"openssl_sdk_makedepend.patch",
],
name="OpenSSL 1.0.2n",
url="https://www.openssl.org/source/openssl-1.0.2n.tar.gz",
checksum='13bdc1b1d1ff39b6fd42a255e74676a4',
buildrecipe=build_universal_openssl,
configure=None,
install=None,
),
])
])
# Disable for now
if False: # if getDeptargetTuple() > (10, 5):
if internalTk():
result.extend([
dict(
name="Tcl 8.5.15",
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tcl8.5.15-src.tar.gz",
checksum='f3df162f92c69b254079c4d0af7a690f',
name="Tcl 8.6.8",
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tcl8.6.8-src.tar.gz",
checksum='81656d3367af032e0ae6157eff134f89',
buildDir="unix",
configure_pre=[
'--enable-shared',
......@@ -270,15 +235,15 @@ def library_recipes():
useLDFlags=False,
install='make TCL_LIBRARY=%(TCL_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.6'%(getVersion())),
},
),
dict(
name="Tk 8.5.15",
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_5/tk8.5.15-src.tar.gz",
checksum='55b8e33f903210a4e1c8bce0f820657f',
name="Tk 8.6.8",
url="ftp://ftp.tcl.tk/pub/tcl//tcl8_6/tk8.6.8-src.tar.gz",
checksum='5e0faecba458ee1386078fb228d008ba',
patches=[
"issue19373_tk_8_5_15_source.patch",
"tk868_on_10_8_10_9.patch",
],
buildDir="unix",
configure_pre=[
......@@ -290,8 +255,8 @@ def library_recipes():
useLDFlags=False,
install='make TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s && make install TCL_LIBRARY=%(TCL_LIBRARY)s TK_LIBRARY=%(TK_LIBRARY)s DESTDIR=%(DESTDIR)s'%{
"DESTDIR": shellQuote(os.path.join(WORKDIR, 'libraries')),
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.5'%(getVersion())),
"TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.5'%(getVersion())),
"TCL_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tcl8.6'%(getVersion())),
"TK_LIBRARY": shellQuote('/Library/Frameworks/Python.framework/Versions/%s/lib/tk8.6'%(getVersion())),
},
),
])
......@@ -299,9 +264,9 @@ def library_recipes():
if PYTHON_3:
result.extend([
dict(
name="XZ 5.0.5",
url="http://tukaani.org/xz/xz-5.0.5.tar.gz",
checksum='19d924e066b6fff0bc9d1981b4e53196',
name="XZ 5.2.3",
url="http://tukaani.org/xz/xz-5.2.3.tar.gz",
checksum='ef68674fb47a8b8e741b34e429d86e9d',
configure_pre=[
'--disable-dependency-tracking',
]
......@@ -344,12 +309,14 @@ def library_recipes():
),
),
dict(
name="SQLite 3.8.3.1",
url="http://www.sqlite.org/2014/sqlite-autoconf-3080301.tar.gz",
checksum='509ff98d8dc9729b618b7e96612079c6',
name="SQLite 3.22.0",
url="https://www.sqlite.org/2018/sqlite-autoconf-3220000.tar.gz",
checksum='96b5648d542e8afa6ab7ffb8db8ddc3d',
extra_cflags=('-Os '
'-DSQLITE_ENABLE_FTS5 '
'-DSQLITE_ENABLE_FTS4 '
'-DSQLITE_ENABLE_FTS3_PARENTHESIS '
'-DSQLITE_ENABLE_JSON1 '
'-DSQLITE_ENABLE_RTREE '
'-DSQLITE_TCL=0 '
'%s' % ('','-DSQLITE_WITHOUT_ZONEMALLOC ')[LT_10_5]),
......@@ -370,11 +337,10 @@ def library_recipes():
url="http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
checksum='00b516f4704d4a7cb50a1d97e6e8e15b',
configure=None,
install='make install CC=%s CXX=%s, PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
install='make install CC=%s CXX=%s, PREFIX=%s/usr/local/ CFLAGS="-arch %s"'%(
CC, CXX,
shellQuote(os.path.join(WORKDIR, 'libraries')),
' -arch '.join(ARCHLIST),
SDKPATH,
),
),
dict(
......@@ -382,11 +348,10 @@ def library_recipes():
url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
checksum='debc62758716a169df9f62e6ab2bc634',
configure=None,
install='make install CC=%s CXX=%s, prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
install='make install CC=%s CXX=%s, prefix=%s/usr/local/ CFLAGS="-arch %s"'%(
CC, CXX,
shellQuote(os.path.join(WORKDIR, 'libraries')),
' -arch '.join(ARCHLIST),
SDKPATH,
),
),
dict(
......@@ -433,8 +398,7 @@ def pkg_recipes():
source="/Library/Frameworks/Python.framework",
readme="""\
This package installs Python.framework, that is the python
interpreter and the standard library. This also includes Python
wrappers for lots of Mac OS X API's.
interpreter and the standard library.
""",
postflight="scripts/postflight.framework",
selected='selected',
......@@ -511,24 +475,6 @@ def pkg_recipes():
),
]
if getDeptargetTuple() < (10, 4) and not PYTHON_3:
result.append(
dict(
name="PythonSystemFixes",
long_name="Fix system Python",
readme="""\
This package updates the system python installation on
Mac OS X 10.3 to ensure that you can build new python extensions
using that copy of python after installing this version.
""",
postflight="../Tools/fixapplepython23.py",
topdir="/Library/Frameworks/Python.framework",
source="/empty-dir",
required=False,
selected=unselected_for_python3,
)
)
return result
def fatal(msg):
......@@ -593,55 +539,54 @@ 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 sys.version_info[0:2] < (2, 5):
fatal("This script must be run with Python 2.5 (or later)")
if platform.system() != 'Darwin':
fatal("This script should be run on a Mac OS X 10.4 (or later) system")
fatal("This script should be run on a macOS 10.5 (or later) system")
if int(platform.release().split('.')[0]) < 8:
fatal("This script should be run on a Mac OS X 10.4 (or later) system")
if not os.path.exists(SDKPATH):
fatal("Please install the latest version of Xcode and the %s SDK"%(
os.path.basename(SDKPATH[:-4])))
fatal("This script should be run on a macOS 10.5 (or later) system")
# Because we only support dynamic load of only one major/minor version of
# Tcl/Tk, if we are not using building and using our own private copy of
# Tcl/Tk, ensure:
# 1. there are no user-installed frameworks of Tcl/Tk with version
# higher than the Apple-supplied system version in
# SDKROOT/System/Library/Frameworks
# 2. there is a user-installed framework (usually ActiveTcl) in (or linked
# in) SDKROOT/Library/Frameworks with the same version as the system
# version. This allows users to choose to install a newer patch level.
frameworks = {}
for framework in ['Tcl', 'Tk']:
fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
sysfw = os.path.join(SDKPATH, 'System', fwpth)
libfw = os.path.join(SDKPATH, fwpth)
usrfw = os.path.join(os.getenv('HOME'), fwpth)
frameworks[framework] = os.readlink(sysfw)
if not os.path.exists(libfw):
fatal("Please install a link to a current %s %s as %s so "
"the user can override the system framework."
% (framework, frameworks[framework], libfw))
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."
% usrfw)
if frameworks['Tcl'] != frameworks['Tk']:
fatal("The Tcl and Tk frameworks are not the same version.")
# add files to check after build
EXPECTED_SHARED_LIBS['_tkinter.so'] = [
"/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
% frameworks['Tcl'],
"/Library/Frameworks/Tk.framework/Versions/%s/Tk"
% frameworks['Tk'],
]
# 1. there is a user-installed framework (usually ActiveTcl) in (or linked
# in) SDKROOT/Library/Frameworks. As of Python 3.6.5, we no longer
# enforce that the version of the user-installed framework also
# exists in the system-supplied Tcl/Tk frameworks. Time to support
# Tcl/Tk 8.6 even if Apple does not.
if not internalTk():
frameworks = {}
for framework in ['Tcl', 'Tk']:
fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
libfw = os.path.join('/', fwpth)
usrfw = os.path.join(os.getenv('HOME'), fwpth)
frameworks[framework] = os.readlink(libfw)
if not os.path.exists(libfw):
fatal("Please install a link to a current %s %s as %s so "
"the user can override the system framework."
% (framework, frameworks[framework], libfw))
if os.path.exists(usrfw):
fatal("Please rename %s to avoid possible dynamic load issues."
% usrfw)
if frameworks['Tcl'] != frameworks['Tk']:
fatal("The Tcl and Tk frameworks are not the same version.")
print(" -- Building with external Tcl/Tk %s frameworks"
% frameworks['Tk'])
# add files to check after build
EXPECTED_SHARED_LIBS['_tkinter.so'] = [
"/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
% frameworks['Tcl'],
"/Library/Frameworks/Tk.framework/Versions/%s/Tk"
% frameworks['Tk'],
]
else:
print(" -- Building private copy of Tcl/Tk")
print("")
# Remove inherited environment variables which might influence build
environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
......@@ -663,17 +608,19 @@ def checkEnvironment():
base_path = base_path + ':' + OLD_DEVELOPER_TOOLS
os.environ['PATH'] = base_path
print("Setting default PATH: %s"%(os.environ['PATH']))
# Ensure we have access to sphinx-build.
# You may have to create a link in /usr/bin for it.
runCommand('sphinx-build --version')
if PYTHON_2:
# Ensure we have access to sphinx-build.
# You may have to define SDK_TOOLS_BIN and link to it there,
runCommand('sphinx-build --version')
def parseOptions(args=None):
"""
Parse arguments and update global settings.
"""
global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET
global WORKDIR, DEPSRC, SRCDIR, DEPTARGET
global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC, CXX
global FW_VERSION_PREFIX
global FW_SSL_DIRECTORY
if args is None:
args = sys.argv[1:]
......@@ -703,7 +650,7 @@ def parseOptions(args=None):
DEPSRC=v
elif k in ('--sdk-path',):
SDKPATH=v
print(" WARNING: --sdk-path is no longer supported")
elif k in ('--src-dir',):
SRCDIR=v
......@@ -719,7 +666,7 @@ def parseOptions(args=None):
if deptarget is None:
# Select alternate default deployment
# target
DEPTARGET = default_target_map.get(v, '10.3')
DEPTARGET = default_target_map.get(v, '10.5')
else:
raise NotImplementedError(v)
......@@ -728,17 +675,16 @@ def parseOptions(args=None):
SRCDIR=os.path.abspath(SRCDIR)
WORKDIR=os.path.abspath(WORKDIR)
SDKPATH=os.path.abspath(SDKPATH)
DEPSRC=os.path.abspath(DEPSRC)
CC, CXX = getTargetCompilers()
FW_VERSION_PREFIX = FW_PREFIX[:] + ["Versions", getVersion()]
FW_SSL_DIRECTORY = FW_VERSION_PREFIX[:] + ["etc", "openssl"]
print("-- Settings:")
print(" * Source directory: %s" % SRCDIR)
print(" * Build directory: %s" % WORKDIR)
print(" * SDK location: %s" % SDKPATH)
print(" * Third-party source: %s" % DEPSRC)
print(" * Deployment target: %s" % DEPTARGET)
print(" * Universal archs: %s" % str(ARCHLIST))
......@@ -870,20 +816,19 @@ def build_universal_openssl(basedir, archList):
"enable-tlsext",
"no-ssl2",
"no-ssl3",
"no-ssl3-method",
# "enable-unit-test",
"shared",
"--install_prefix=%s"%shellQuote(archbase),
"--prefix=%s"%os.path.join("/", *FW_VERSION_PREFIX),
"--openssldir=/System/Library/OpenSSL",
"--openssldir=%s"%os.path.join("/", *FW_SSL_DIRECTORY),
]
if no_asm:
configure_opts.append("no-asm")
runCommand(" ".join(["perl", "Configure"]
+ arch_opts[arch] + configure_opts))
runCommand("make depend OSX_SDK=%s" % SDKPATH)
runCommand("make all OSX_SDK=%s" % SDKPATH)
runCommand("make install_sw OSX_SDK=%s" % SDKPATH)
runCommand("make depend")
runCommand("make all")
runCommand("make install_sw")
# runCommand("make test")
return
......@@ -1042,27 +987,24 @@ def buildRecipe(recipe, basedir, archList):
if recipe.get('useLDFlags', 1):
configure_args.extend([
"CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s "
"CFLAGS=%s-mmacosx-version-min=%s -arch %s "
"-I%s/usr/local/include"%(
recipe.get('extra_cflags', ''),
DEPTARGET,
' -arch '.join(archList),
shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],),
"LDFLAGS=-mmacosx-version-min=%s -isysroot %s -L%s/usr/local/lib -arch %s"%(
"LDFLAGS=-mmacosx-version-min=%s -L%s/usr/local/lib -arch %s"%(
DEPTARGET,
shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],
' -arch '.join(archList)),
])
else:
configure_args.extend([
"CFLAGS=%s-mmacosx-version-min=%s -arch %s -isysroot %s "
"CFLAGS=%s-mmacosx-version-min=%s -arch %s "
"-I%s/usr/local/include"%(
recipe.get('extra_cflags', ''),
DEPTARGET,
' -arch '.join(archList),
shellQuote(SDKPATH)[1:-1],
shellQuote(basedir)[1:-1],),
])
......@@ -1107,7 +1049,7 @@ def buildLibraries():
def buildPythonDocs():
# This stores the documentation as Resources/English.lproj/Documentation
# inside the framwork. pydoc and IDLE will pick it up there.
# inside the framework. pydoc and IDLE will pick it up there.
print("Install python documentation")
rootDir = os.path.join(WORKDIR, '_root')
buildDir = os.path.join('../../Doc')
......@@ -1115,8 +1057,14 @@ def buildPythonDocs():
curDir = os.getcwd()
os.chdir(buildDir)
runCommand('make clean')
# Assume sphinx-build is on our PATH, checked in checkEnvironment
runCommand('make html')
if PYTHON_2:
# Python 2 doc builds do not use blurb nor do they have a venv target.
# Assume sphinx-build is on our PATH, checked in checkEnvironment
runCommand('make html')
else:
# Create virtual environment for docs builds with blurb and sphinx
runCommand('make venv')
runCommand('make html PYTHON=venv/bin/python')
os.chdir(curDir)
if not os.path.exists(docdir):
os.mkdir(docdir)
......@@ -1139,10 +1087,6 @@ def buildPython():
curdir = os.getcwd()
os.chdir(buildDir)
# Not sure if this is still needed, the original build script
# claims that parts of the install assume python.exe exists.
os.symlink('python', os.path.join(buildDir, 'python.exe'))
# Extract the version from the configure file, needed to calculate
# several paths.
version = getVersion()
......@@ -1153,16 +1097,22 @@ def buildPython():
os.environ['DYLD_LIBRARY_PATH'] = os.path.join(WORKDIR,
'libraries', 'usr', 'local', 'lib')
print("Running configure...")
runCommand("%s -C --enable-framework --enable-universalsdk=%s "
runCommand("%s -C --enable-framework --enable-universalsdk=/ "
"--with-universal-archs=%s "
"%s "
"%s "
"%s "
"%s "
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
"CFLAGS='-g -I%s/libraries/usr/local/include' 2>&1"%(
shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
shellQuote(os.path.join(SRCDIR, 'configure')),
UNIVERSALARCHS,
(' ', '--with-computed-gotos ')[PYTHON_3],
(' ', '--without-ensurepip ')[PYTHON_3],
(' ', "--with-tcltk-includes='-I%s/libraries/usr/local/include'"%(
shellQuote(WORKDIR)[1:-1],))[internalTk()],
(' ', "--with-tcltk-libs='-L%s/libraries/usr/local/lib -ltcl8.6 -ltk8.6'"%(
shellQuote(WORKDIR)[1:-1],))[internalTk()],
shellQuote(WORKDIR)[1:-1],
shellQuote(WORKDIR)[1:-1]))
......@@ -1197,21 +1147,31 @@ def buildPython():
del os.environ['DYLD_LIBRARY_PATH']
print("Copying required shared libraries")
if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')):
runCommand("mv %s/* %s"%(
shellQuote(os.path.join(
build_lib_dir = os.path.join(
WORKDIR, 'libraries', 'Library', 'Frameworks',
'Python.framework', 'Versions', getVersion(),
'lib')),
shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks',
'Python.framework', 'Versions', getVersion(),
'lib'))))
'Python.framework', 'Versions', getVersion(), 'lib')
fw_lib_dir = os.path.join(
WORKDIR, '_root', 'Library', 'Frameworks',
'Python.framework', 'Versions', getVersion(), 'lib')
if internalTk():
# move Tcl and Tk pkgconfig files
runCommand("mv %s/pkgconfig/* %s/pkgconfig"%(
shellQuote(build_lib_dir),
shellQuote(fw_lib_dir) ))
runCommand("rm -r %s/pkgconfig"%(
shellQuote(build_lib_dir), ))
runCommand("mv %s/* %s"%(
shellQuote(build_lib_dir),
shellQuote(fw_lib_dir) ))
path_to_lib = os.path.join(rootDir, 'Library', 'Frameworks',
'Python.framework', 'Versions',
version, 'lib', 'python%s'%(version,))
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
frmDirVersioned = os.path.join(frmDir, 'Versions', version)
path_to_lib = os.path.join(frmDirVersioned, 'lib', 'python%s'%(version,))
# create directory for OpenSSL certificates
sslDir = os.path.join(frmDirVersioned, 'etc', 'openssl')
os.makedirs(sslDir)
print("Fix file modes")
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
gid = grp.getgrnam('admin').gr_gid
shared_lib_error = False
......@@ -1261,6 +1221,8 @@ def buildPython():
LDVERSION = LDVERSION.replace('$(VERSION)', VERSION)
LDVERSION = LDVERSION.replace('$(ABIFLAGS)', ABIFLAGS)
config_suffix = '-' + LDVERSION
if getVersionMajorMinor() >= (3, 6):
config_suffix = config_suffix + '-darwin'
else:
config_suffix = '' # Python 2.x
......@@ -1286,7 +1248,7 @@ def buildPython():
fp.write(data)
fp.close()
# fix _sysconfigdata if it exists
# fix _sysconfigdata
#
# TODO: make this more robust! test_sysconfig_module of
# distutils.tests.test_sysconfig.SysconfigTestCase tests that
......@@ -1300,28 +1262,31 @@ def buildPython():
# _sysconfigdata.py).
import pprint
path = os.path.join(path_to_lib, '_sysconfigdata.py')
if os.path.exists(path):
fp = open(path, 'r')
data = fp.read()
fp.close()
# create build_time_vars dict
exec(data)
vars = {}
for k, v in build_time_vars.items():
if type(v) == type(''):
for p in (include_path, lib_path):
v = v.replace(' ' + p, '')
v = v.replace(p + ' ', '')
vars[k] = v
fp = open(path, 'w')
# duplicated from sysconfig._generate_posix_vars()
fp.write('# system configuration generated and used by'
' the sysconfig module\n')
fp.write('build_time_vars = ')
pprint.pprint(vars, stream=fp)
fp.close()
if getVersionMajorMinor() >= (3, 6):
# XXX this is extra-fragile
path = os.path.join(path_to_lib, '_sysconfigdata_m_darwin_darwin.py')
else:
path = os.path.join(path_to_lib, '_sysconfigdata.py')
fp = open(path, 'r')
data = fp.read()
fp.close()
# create build_time_vars dict
exec(data)
vars = {}
for k, v in build_time_vars.items():
if type(v) == type(''):
for p in (include_path, lib_path):
v = v.replace(' ' + p, '')
v = v.replace(p + ' ', '')
vars[k] = v
fp = open(path, 'w')
# duplicated from sysconfig._generate_posix_vars()
fp.write('# system configuration generated and used by'
' the sysconfig module\n')
fp.write('build_time_vars = ')
pprint.pprint(vars, stream=fp)
fp.close()
# Add symlinks in /usr/local/bin, using relative links
usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin')
......@@ -1648,6 +1613,8 @@ def main():
patchFile("resources/ReadMe.rtf", fn)
fn = os.path.join(folder, "Update Shell Profile.command")
patchScript("scripts/postflight.patch-profile", fn)
fn = os.path.join(folder, "Install Certificates.command")
patchScript("resources/install_certificates.command", fn)
os.chmod(folder, STAT_0o755)
setIcon(folder, "../Icons/Python Folder.icns")
......
Issue #19373: Patch to Tk 8.5.15 to correct refresh problem on OS x 10.9.
From upstream checkin https://core.tcl.tk/tk/info/5a5abf71f9
--- tk8.5.15/macosx/tkMacOSXDraw.c 2013-09-16 09:41:21.000000000 -0700
+++ Tk_Source_Code-5a5abf71f9fdb0da/macosx/tkMacOSXDraw.c 2013-10-27 13:27:00.000000000 -0700
@@ -1688,6 +1688,7 @@
{
if (dcPtr->context) {
CGContextSynchronize(dcPtr->context);
+ [[dcPtr->view window] setViewsNeedDisplay:YES];
[[dcPtr->view window] enableFlushWindow];
if (dcPtr->focusLocked) {
[dcPtr->view unlockFocus];
# HG changeset patch
#
# using openssl 1.0.2k
#
# - support building with an OS X SDK
diff Configure
diff --git a/Configure b/Configure
--- a/Configure
+++ b/Configure
@@ -642,12 +642,12 @@
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-"debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-ppc-cc","cc:-arch ppc -isysroot \$(OSX_SDK) -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-ppc-cc","cc:-arch ppc64 -isysroot \$(OSX_SDK) -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-i386-cc","cc:-arch i386 -isysroot \$(OSX_SDK) -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"debug-darwin-i386-cc","cc:-arch i386 -isysroot \$(OSX_SDK) -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin64-x86_64-cc","cc:-arch x86_64 -isysroot \$(OSX_SDK) -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"debug-darwin64-x86_64-cc","cc:-arch x86_64 -isysroot \$(OSX_SDK) -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
# iPhoneOS/iOS
"iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
@@ -1728,8 +1728,7 @@
s/^AR=\s*ar/AR= $ar/;
s/^RANLIB=.*/RANLIB= $ranlib/;
s/^RC=.*/RC= $windres/;
- s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
- s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $ecc eq "gcc" || $ecc eq "clang";
+ s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/;
}
s/^CFLAG=.*$/CFLAG= $cflags/;
s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf200
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 LucidaGrande-Bold;\f2\fnil\fcharset0 LucidaGrande;
\f3\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww10540\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\fs28 \cf0 Congratulations!
\fs24
\f1\b\fs28 Python $FULL_VERSION for macOS $MACOSX_DEPLOYMENT_TARGET
\f2\b0 was successfully installed.
\fs24 \
\
One more thing: to verify the identity of secure network connections, this Python needs a set of SSL root certificates. You can download and install a current curated set from {\field{\*\fldinst{HYPERLINK "https://pypi.org/project/certifi/"}}{\fldrslt the Certifi project}} by double-clicking on the
\f3 Install Certificates
\f2 icon in {\field{\*\fldinst{HYPERLINK "file://localhost/Applications/Python%20$VERSION/"}}{\fldrslt the Finder window}}. See {\field{\*\fldinst{HYPERLINK "file://localhost/Applications/Python%20$VERSION/ReadMe.rtf"}}{\fldrslt the
\f3 ReadMe
\f2 file}} for more information.\
}
\ No newline at end of file
{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf750
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf400
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww15240\viewh15540\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\fs24 \cf0 This package will install Python $FULL_VERSION for Mac OS X $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): $ARCHITECTURES.\
\f0\fs24 \cf0 This package will install Python $FULL_VERSION for macOS $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): $ARCHITECTURES.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul \ulc0 Which installer variant should I use?
\b \cf0 \ul \ulc0 Which installer variant should I use? [CHANGED in 2.7.15]
\b0 \ulnone \
\
Python.org provides two installer variants for download: one that installs a
\i 64-bit/32-bit Intel
\i0 Python capable of running on
\i Mac OS X 10.6 (Snow Leopard)
\b **NEW**
\b0 With Python 2.7.15, the python.org website now provides two installer variants for download: one that installs a
\i 64-bit-only
\i0 Python capable of running on
\i macOS 10.9 (Mavericks)
\i0 or later; and one that installs a
\i 32-bit-only (Intel and PPC)
\i 64-bit/32-bit Intel
\i0 Python capable of running on
\i Mac OS X 10.5 (Leopard)
\i0 or later. This ReadMe was installed with the
\i macOS 10.6 (Snow Leopard)
\i0 or later. (This ReadMe was installed with the
\i $MACOSX_DEPLOYMENT_TARGET
\i0 variant. Unless you are installing to an 10.5 system or you need to build applications that can run on 10.5 systems, use the 10.6 variant if possible. There are some additional operating system functions that are supported starting with 10.6 and you may see better performance using 64-bit mode. By default, Python will automatically run in 64-bit mode if your system supports it. Also see
\i Certificate verification and OpenSSL
\i0 below. The Pythons installed by these installers are built with private copies of some third-party libraries not included with or newer than those in OS X itself. The list of these libraries varies by installer variant and is included at the end of the License.rtf file.
\i0 variant.) Previous Python 2.7.x releases provided the 10.6 or later installer and a 10.5 or later 32-bit-only variant. If you are running on macOS 10.9 or later and if you have no need for compatibility with older systems, use the 10.9 variant. Use the 10.6 variant if you are running on macOS 10.6 through 10.8, if you need to maintain compatibility with previous 2.7.x releases, or if you want to produce standalone applications that can run on systems from 10.6. The Pythons installed by these installers are built with private copies of some third-party libraries not included with or newer than those in macOS itself. The list of these libraries varies by installer variant and is included at the end of the
\f1 License.rtf
\f0 file.\
\b \ul \
Certificate verification and OpenSSL_[CHANGED in 2.7.15]\
\b0 \ulnone \
This variant of Python 2.7 now includes its own private copy of OpenSSL 1.0.2. Unlike previous releases, the deprecated Apple-supplied OpenSSL libraries are no longer used. This also means that the trust certificates in system and user keychains managed by the
\i Keychain Access
\i0 application and the
\i security
\i0 command line utility are no longer used as defaults by the Python
\f1 ssl
\f0 module. A sample command script is included in
\f1 /Applications/Python 2.7
\f0 to install a curated bundle of default root certificates from the third-party
\f1 certifi
\f0 package ({\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi/certifi"}}{\fldrslt https://pypi.python.org/pypi/certifi}}). Click on
\f1 Install Certificates
\f0 to run it. If you choose to use
\f1 certifi
\f0 , you should consider subscribing to the{\field{\*\fldinst{HYPERLINK "https://certifi.io/en/latest/"}}{\fldrslt project's email update service}} to be notified when the certificate bundle is updated.\
\
The bundled
\f1 pip
\f0 included with the Python 2.7 installer has its own default certificate store for verifying download connections.\
\
Update your version of Tcl/Tk to use IDLE or other Tk applications
\b \ul Using IDLE or other Tk applications [NEW/CHANGED in 2.7.15]
\b0 \ulnone \
\
To use IDLE or other programs that use the Tkinter graphical user interface toolkit, you need to install a newer third-party version of the
The 10.9+ installer variant comes with its own private version of Tcl/Tk 8.6. It does not use system-supplied or third-party supplied versions of Tcl/Tk.\
\
For the 10.6+ variant, you continue to need to install a newer third-party version of the
\i Tcl/Tk
\i0 frameworks. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of
\i0 8.5 (not 8.6) frameworks to use IDLE or other programs that use the Tkinter graphical user interface toolkit. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of
\i Tcl/Tk
\i0 for this version of Python and of Mac OS X.\
\i0 for this version of Python and of macOS.\
\b \ul \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 Packages installed with the system Python 2.7 are no longer searched for\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [CHANGED for Python 2.7.13]
\b0 \
Binary installer support for Mac OS X 10.5 and earlier discontinued [CHANGED for Python 2.7.15]
\b0 \ulnone \
\
As of Python 2.7.15, binary installers from python.org no longer support Mac OS X 10.5 (Leopard) systems. Binary installer support for Mac OS X 10.3.9 (Panther) and 10.4.x (Tiger) systems was previously dropped in Python 2.7.9. Mac OS X 10.5 was originally released by Apple in 2007 and last updated in 2009 and was the last OS X release for PPC machines (G4 and G5). If needed, it is still possible to build Python from source for 10.3.9, 10.4, or 10.5.\
\
\b \ul Packages installed with the system Python 2.7 are no longer searched for [CHANGED for Python 2.7.13]
\b0 \ulnone \
\
As of Python 2.7.0, user-installed Python 2.7 versions from python.org installers added the system-wide site-packages directory for the Apple-supplied Python 2.7 to the end of their search path. This meant that packages installed with the system Python 2.7 could also be used by the user-installed Python 2.7. While sometimes convenient, this also often caused confusion with the implicit coupling between the two Python instances. Separately, as of macOS 10.12, Apple changed the layout of the system site-packages directory,
\f1 /Library/Python/2.7/site-packages
......@@ -53,36 +84,27 @@ As of Python 2.7.0, user-installed Python 2.7 versions from python.org installer
\f1 sys.path
\f0 . If you are using a package with both a user-installed Python 2.7 and the system Python 2.7, you will now need to ensure that separate copies of the package are installed for each instance.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul Installing on OS X 10.8 (Mountain Lion) or later systems\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [CHANGED for Python 2.7.9]
\b0 \
\b \ul Installing on OS X 10.8 (Mountain Lion) or later systems [CHANGED for Python 2.7.9]
\b0 \ulnone \
\
As of Python 2.7.9, installer packages from python.org are now compatible with the Gatekeeper security feature introduced in OS X 10.8. Downloaded packages can now be directly installed by double-clicking with the default system security settings. Python.org installer packages for OS X are signed with the Developer ID of the builder, as identified on {\field{\*\fldinst{HYPERLINK "https://www.python.org/downloads/"}}{\fldrslt the download page}} for this release. To inspect the digital signature of the package, click on the lock icon in the upper right corner of the
As of Python 2.7.9, installer packages from python.org are now compatible with the Gatekeeper security feature introduced in OS X 10.8. Downloaded packages can now be directly installed by double-clicking with the default system security settings. Python.org installer packages for macOS are signed with the Developer ID of the builder, as identified on {\field{\*\fldinst{HYPERLINK "https://www.python.org/downloads/"}}{\fldrslt the download page}} for this release. To inspect the digital signature of the package, click on the lock icon in the upper right corner of the
\i Install Python
\i0 installer window. Refer to Apple\'92s support pages for {\field{\*\fldinst{HYPERLINK "http://support.apple.com/kb/ht5290"}}{\fldrslt more information on Gatekeeper}}.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul Simplified web-based installs\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [NEW for Python 2.7.9]
\b0 \
\b \ul Simplified web-based installs [NEW for Python 2.7.9]
\b0 \ulnone \
\
With the change to the newer flat format installer package, the download file now has a
\f1 .pkg
\f0 extension as it is no longer necessary to embed the installer within a disk image (
\f1 .dmg
\f0 ) container. If you download the Python installer through a web browser, the OS X installer application may open automatically to allow you to perform the install. If your browser settings do not allow automatic open, double click on the downloaded installer file.\
\f0 ) container. If you download the Python installer through a web browser, the macOS installer application may open automatically to allow you to perform the install. If your browser settings do not allow automatic open, double click on the downloaded installer file.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul New Installation Options and Defaults\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [NEW for Python 2.7.9]
\b0 \
\b \ul New Installation Options and Defaults [NEW for Python 2.7.9]
\b0 \ulnone \
\
The Python installer now includes an option to automatically install or upgrade
\f1 pip
......@@ -96,74 +118,8 @@ The Python installer now includes an option to automatically install or upgrade
\i Release Notes
\i0 link for this release at {\field{\*\fldinst{HYPERLINK "https://www.python.org/downloads/"}}{\fldrslt https://www.python.org/downloads/}}.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul Certificate verification and OpenSSL\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [CHANGED for Python 2.7.9]
\b0 \
\
Python 2.7.9 includes a number of network security enhancements that have been approved for inclusion in Python 2.7 maintenance releases. {\field{\*\fldinst{HYPERLINK "https://www.python.org/dev/peps/pep-0476/"}}{\fldrslt PEP 476}} changes several standard library modules, like
\i httplib
\i0 ,
\i urllib2
\i0 , and
\i xmlrpclib
\i0 , to by default verify certificates presented by servers over secure (TLS) connections. The verification is performed by the OpenSSL libraries that Python is linked to. Prior to 2.7.9, the python.org installers dynamically linked with Apple-supplied OpenSSL libraries shipped with OS X. OS X provides a multiple level security framework that stores trust certificates in system and user keychains managed by the
\i Keychain Access
\i0 application and the
\i security
\i0 command line utility.\
\
For OS X 10.5, Apple provides
\i OpenSSL 0.9.7
\i0 libraries. This version of Apple's OpenSSL
\b does not
\b0 use the certificates from the system security framework, even when used on newer versions of OS X. Instead it consults a traditional OpenSSL concatenated certificate file (
\i cafile
\i0 ) or certificate directory (
\i capath
\i0 ), located in
\f1 /System/Library/OpenSSL
\f0 . These directories are typically empty and not managed by OS X; you must manage them yourself or supply your own SSL contexts. OpenSSL 0.9.7 is obsolete by current security standards, lacking a number of important features found in later versions. Among the problems this causes is the inability to verify higher-security certificates now used by python.org services, including
\i t{\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi"}}{\fldrslt he Python Package Index, PyPI}}
\i0 . To solve this problem, as of 2.7.9 the
\i 10.5+ 32-bit-only python.org variant
\i0 is linked with a private copy of
\i OpenSSL 1.0
\i0 ; it consults the same default certificate directory,
\f1 /System/Library/OpenSSL
\f0 . As before, it is still necessary to manage certificates yourself when you use this Python variant and, with certificate verification now enabled by default, you may now need to take additional steps to ensure your Python programs have access to CA certificates you trust. If you use this Python variant to build standalone applications with third-party tools like {\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi/py2app/"}}{\fldrslt
\f1 py2app}}, you may now need to bundle CA certificates in them or otherwise supply non-default SSL contexts.\
\
For OS X 10.6+, Apple also provides
\i OpenSSL
\i0
\i 0.9.8 libraries
\i0 . Apple's 0.9.8 version includes an important additional feature: if a certificate cannot be verified using the manually administered certificates in
\f1 /System/Library/OpenSSL
\f0 , the certificates managed by the system security framework In the user and system keychains are also consulted (using Apple private APIs). For this reason, for 2.7.9 the
\i 64-bit/32-bit 10.6+ python.org variant
\i0 continues to be dynamically linked with Apple's OpenSSL 0.9.8 since it was felt that the loss of the system-provided certificates and management tools outweighs the additional security features provided by newer versions of OpenSSL. This will likely change in future releases of the python.org installers as Apple has deprecated use of the system-supplied OpenSSL libraries. If you do need features from newer versions of OpenSSL, there are third-party OpenSSL wrapper packages available through
\i PyPI
\i0 .\
\
The bundled
\f1 pip
\f0 included with 2.7.9 has its own default certificate store for verifying download connections.\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul \
Binary installer support for OS X 10.4 and 10.3.9 discontinued\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \ulnone [CHANGED for Python 2.7.9]
\b0 \
\
As previously announced, binary installers for Python 2.7.9 from python.org no longer support Mac OS X 10.3.9 (Panther) and 10.4.x (Tiger) systems. These systems were last updated by Apple in 2005 and 2007. As of 2.7.9, the 32-bit-only installer supports PPC and Intel Macs running OS X 10.5 (Leopard). 10.5 was the last OS X release for PPC machines (G4 and G5). The 64-/32-bit installer configuration remains unchanged and should normally be used on OS X 10.6 (Snow Leopard) and later systems. This aligns Python 2.7.x installer configurations with those currently provided with Python 3.x. If needed, it is still possible to build Python from source for 10.3.9 and 10.4.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\b \cf0 \ul Python 3 and Python 2 Co-existence\
\b \ul Python 3 and Python 2 Co-existence\
\b0 \ulnone \
Python.org Python 2.7 and 3.x versions can both be installed on your system and will not conflict. Python 2.7 command names contain a 2 or no digit:
......@@ -190,6 +146,9 @@ Python.org Python 2.7 and 3.x versions can both be installed on your system and
\f1 idle3
\f0 ,
\f1 pip3
\f0 , etc.\
\f0 , etc. Also, installing a python.org Python 2.7 does not alter or remove any Apple-supplied system Pythons, found in
\f1 /usr/bin
\f0 .\
\
\
}
\ No newline at end of file
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf400
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
\paperw11905\paperh16837\margl1440\margr1440\vieww11180\viewh10860\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640
{\*\expandedcolortbl;;}
\paperw11905\paperh16837\margl1440\margr1440\vieww13360\viewh10920\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\fs24 \cf0 This package will install
\b Python $FULL_VERSION
\b0 for
\b Mac OS X $MACOSX_DEPLOYMENT_TARGET
\b macOS $MACOSX_DEPLOYMENT_TARGET
\b0 .\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0
\cf0 \
\b Python for Mac OS X
\b0 consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac OS X users including an integrated development environment
\b Python for macOS
\b0 consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for macOS users including an integrated development environment
\b IDLE
\b0 .\
\
\b NEW for Python 2.7.9:
\b0 This package installs a version of
\f1 pip
\f0 , the recommended tool for installing and managing Python packages. Type
\f1 pip2.7 --help
\f0 for an overview. 2.7.9 also includes a number of network security enhancements that may require changes to your Python applications. See the
\f1 ReadMe
\f0 file and {\field{\*\fldinst{HYPERLINK "https://docs.python.org/2/whatsnew/2.7.html#new-features-added-to-python-2-7-maintenance-releases"}}{\fldrslt the Python documentation}} for more information.\
\
\b IMPORTANT:
\b0
\b IDLE
\b0 and other programs using the
\b tkinter
\b0 graphical user interface toolkit require specific versions of the
\b Tcl/Tk
\b0 platform independent windowing toolkit. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information on supported and recommended versions of Tcl/Tk for this version of Python and Mac OS X.}
\ No newline at end of file
\b NEW in 2.7.15:
\b0 two installer variants (10.9+ 64-bit-only, 10.6+ 64-/32-bit), built-in Tcl/Tk 8.6 support in the 10.9+ variant (no additional third-party downloads!), updated
\f1 pip,
\f0 built-in OpenSSL 1.0.2 (click on
\f1 Install Certificates
\f0 for root certificates)\
}
\ No newline at end of file
#!/bin/sh
/Library/Frameworks/Python.framework/Versions/@PYVER@/bin/python@PYVER@ << "EOF"
# install_certifi.py
#
# sample script to install or update a set of default Root Certificates
# for the ssl module. Uses the certificates provided by the certifi package:
# https://pypi.python.org/pypi/certifi
import os
import os.path
import ssl
import stat
import subprocess
import sys
STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
| stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
| stat.S_IROTH | stat.S_IXOTH )
def main():
openssl_dir, openssl_cafile = os.path.split(
ssl.get_default_verify_paths().openssl_cafile)
print(" -- pip install --upgrade certifi")
subprocess.check_call([sys.executable,
"-E", "-s", "-m", "pip", "install", "--upgrade", "certifi"])
import certifi
# change working directory to the default SSL directory
os.chdir(openssl_dir)
relpath_to_certifi_cafile = os.path.relpath(certifi.where())
print(" -- removing any existing file or link")
try:
os.remove(openssl_cafile)
except OSError:
pass
print(" -- creating symlink to certifi certificate bundle")
os.symlink(relpath_to_certifi_cafile, openssl_cafile)
print(" -- setting permissions")
os.chmod(openssl_cafile, STAT_0o775)
print(" -- update complete")
if __name__ == '__main__':
main()
EOF
......@@ -12,6 +12,7 @@ SHARE_DOCDIR_TO_FWK="../../.."
# make link in /Applications/Python m.n/ for Finder users
if [ -d "${APPDIR}" ]; then
ln -fhs "${FWK_DOCDIR}/index.html" "${APPDIR}/Python Documentation.html"
open "${APPDIR}" || true # open the applications folder
fi
# make share/doc link in framework for command line users
......
Fix build failure with +quartz variant on OS X 10.8 and 10.9.
Even though Gestalt was deprecated in OS X 10.8, it should work fine
through OS X 10.9, and its replacement NSOperatingSystemVersion was
not introduced until OS X 10.10.
Patch from MacPorts project and reported upstream:
https://trac.macports.org/ticket/55649
--- tk8.6.8/macosx/tkMacOSXXStubs.c.orig 2017-12-06 09:25:08.000000000 -0600
+++ tk8.6.8-patched/macosx/tkMacOSXXStubs.c 2018-01-06 19:34:17.000000000 -0600
@@ -175,7 +175,7 @@
{
int major, minor, patch;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
Gestalt(gestaltSystemVersionMajor, (SInt32*)&major);
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor);
Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch);
......@@ -11,7 +11,6 @@ LIBDEST=$(prefix)/lib/python$(VERSION)
UNIVERSALSDK=@UNIVERSALSDK@
builddir= ../..
PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
RUNSHARED= @RUNSHARED@
......@@ -71,10 +70,6 @@ IDLE.app: \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build
ifneq ($(LIPO_32BIT_FLAGS),)
rm "IDLE.app/Contents/MacOS/Python"
lipo $(LIPO_32BIT_FLAGS) -output "IDLE.app/Contents/MacOS/Python" "$(BUILDPYTHON)"
endif
Info.plist: $(srcdir)/Info.plist.in
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
......
......@@ -7,7 +7,7 @@ Python on Mac OS X README
Ronald Oussoren (2010-04),
Ned Deily (2014-05)
:Version: 2.7.7
:Version: 2.7.15
This document provides a quick overview of some Mac OS X specific features in
the Python distribution.
......@@ -19,7 +19,7 @@ OS X specific arguments to configure
If this argument is specified the build will create a Python.framework rather
than a traditional Unix install. See the section
_`Building and using a framework-based Python on Mac OS X` for more
_`Building and using a framework-based Python on Mac OS X` for more
information on frameworks.
If the optional directory argument is specified the framework is installed
......@@ -44,10 +44,12 @@ OS X specific arguments to configure
regular and framework builds.
The optional argument specifies which OS X SDK should be used to perform the
build. This defaults to ``/Developer/SDKs/MacOSX.10.4u.sdk``. When building
on OS X 10.5 or later, you can specify ``/`` to use the installed system
headers rather than an SDK. As of OS X 10.9, you should install the optional
system headers from the Command Line Tools component using ``xcode-select``::
build. If xcodebuild is available and configured, this defaults to
the Xcode default MacOS X SDK, otherwise ``/Developer/SDKs/MacOSX.10.4u.sdk``
if available or ``/`` if not. When building on OS X 10.5 or later, you can
specify ``/`` to use the installed system headers rather than an SDK. As of
OS X 10.9, you should install the optional system headers from the Command
Line Tools component using ``xcode-select``::
$ sudo xcode-select --install
......@@ -56,10 +58,11 @@ OS X specific arguments to configure
* ``--with-universal-archs=VALUE``
Specify the kind of universal binary that should be created. This option is
only valid when ``--enable-universalsdk`` is specified.
Specify the kind of universal binary that should be created. This option is
only valid when ``--enable-universalsdk`` is specified. The default is
``32-bit`` if a building with a SDK that supports PPC, otherwise defaults
to ``intel``.
Building and using a universal binary of Python on Mac OS X
===========================================================
......@@ -91,30 +94,30 @@ unix build. Universal builds were first supported with OS X 10.4 with Xcode 2.1
and the 10.4u SDK. Starting with Xcode 3 and OS X 10.5, more configurations are
available.
The option ``--enable-universalsdk`` has an optional argument to specify an
SDK, which defaults to the 10.4u SDK. When you build on OS X 10.5 or later
you can use the system headers instead of an SDK::
$ ./configure --enable-universalsdk=/
In general, universal builds depend on specific features provided by the
Apple-supplied compilers and other build tools included in Apple's Xcode
development tools. You should install Xcode and the command line tools
component appropriate for the OS X release you are running on. See the
Python Developer's Guide (http://docs.python.org/devguide/setup.html)
Python Developer's Guide (https://devguide.python.org/setup/)
for more information.
2.1 Flavors of universal binaries
.................................
It is possible to build a number of flavors of the universal binary build,
the default is a 32-bit only binary (i386 and ppc). Note that starting with
Xcode 4, the build tools no longer support ppc. The flavor can be
specified using the option ``--with-universal-archs=VALUE``. The following
the default is a 32-bit only binary (i386 and ppc) in build environments that
support ppc (10.4 with Xcode 2, 10.5 and 10.6 with Xcode 3) or an
Intel-32/-64-bit binary (i386 and X86_64) in build environments that do not
support ppc (Xcode 4 on 10.6 and later systems). The flavor can be specified
using the configure option ``--with-universal-archs=VALUE``. The following
values are available:
* ``intel``: ``i386``, ``x86_64``
* ``intel-32``: ``i386``
* ``intel-64``: ``x86_64``
* ``32-bit``: ``ppc``, ``i386``
* ``3-way``: ``i386``, ``x86_64``, ``ppc``
......@@ -178,14 +181,14 @@ Building and using a framework-based Python on Mac OS X.
--------------------------------------------------------------------------
The main reason is because you want to create GUI programs in Python. With the
exception of X11/XDarwin-based GUI toolkits all GUI programs need to be run
exception of X11/XDarwin-based GUI toolkits all GUI programs need to be run
from a Mac OS X application bundle (".app").
While it is technically possible to create a .app without using frameworks you
will have to do the work yourself if you really want this.
A second reason for using frameworks is that they put Python-related items in
only two places: "/Library/Framework/Python.framework" and
only two places: "/Library/Framework/Python.framework" and
"/Applications/Python <VERSION>" where ``<VERSION>`` can be e.g. "3.4",
"2.7", etc. This simplifies matters for users installing
Python from a binary distribution if they want to get rid of it again. Moreover,
......@@ -222,7 +225,7 @@ If you want Cocoa you need to get PyObjC.
This directory contains a Makefile that will create a couple of python-related
applications (full-blown OS X .app applications, that is) in
"/Applications/Python <VERSION>", and a hidden helper application Python.app
inside the Python.framework, and unix tools "python" and "pythonw" into
inside the Python.framework, and unix tools including "python" into
/usr/local/bin. In addition it has a target "installmacsubtree" that installs
the relevant portions of the Mac subtree into the Python.framework.
......@@ -232,11 +235,11 @@ in the sequence
1. ./configure --enable-framework
2. make
3. make install
This sequence will put the framework in ``/Library/Framework/Python.framework``,
the applications in ``/Applications/Python <VERSION>`` and the unix tools in
the applications in ``/Applications/Python <VERSION>`` and the unix tools in
``/usr/local/bin``.
Installing in another place, for instance ``$HOME/Library/Frameworks`` if you
......@@ -313,7 +316,7 @@ All of this is normally done completely isolated in /tmp/_py, so it does not
use your normal build directory nor does it install into /.
Because of the way the script locates the files it needs you have to run it
from within the BuildScript directory. The script accepts a number of
from within the BuildScript directory. The script accepts a number of
command-line arguments, run it with --help for more information.
Configure warnings
......@@ -363,4 +366,4 @@ Resources
* http://www.python.org/community/sigs/current/pythonmac-sig/
* http://docs.python.org/devguide/
* https://devguide.python.org/
python.org macOS Pythons no longer supply a default SDK value (e.g.
``-isysroot /``) or specific compiler version default (e.g. ``gcc-4.2``)
when building extension modules. Use ``CC``, ``SDKROOT``, and
``DEVELOPER_DIR`` environment variables to override compilers or to use an
SDK. See Apple's ``xcrun`` man page for more info.
All 2.7 macOS installer variants now supply their own version of ``OpenSSL
1.0.2``; the Apple-supplied SSL libraries and root certificates are not
longer used. The ``Installer Certificate`` command in
``/Applications/Python 2.7`` may be used to download and install a default
set of root certificates from the third-party ``certifi`` package.
Default macOS deployment target is now set by ``configure`` to the build
system's OS version (as is done by Python 3), not ``10.4``; override with,
for example, ``./configure MACOSX_DEPLOYMENT_TARGET=10.4``.
Provide an additional, more modern macOS installer variant that supports
macOS 10.9+ systems in 64-bit mode only. Upgrade the supplied third-party
libraries to OpenSSL 1.0.2n and SQLite 3.22.0. The 10.9+ installer now
supplies its own private copy of Tcl/Tk 8.6.8.
......@@ -1457,7 +1457,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-universalsdk[=SDKDIR]
Build against Mac OS X 10.4u SDK (ppc/i386)
Build fat binary against Mac OS X SDK
--enable-framework[=INSTALLDIR]
Build (MacOSX|Darwin) framework
--enable-shared disable/enable building shared python library
......@@ -1477,7 +1477,8 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-universal-archs=ARCH
select architectures for universal build ("32-bit",
"64-bit", "3-way", "intel" or "all")
"64-bit", "3-way", "intel", "intel-32", "intel-64",
or "all")
--with-framework-name=FRAMEWORK
specify an alternate name of the framework built
with --enable-framework
......@@ -3039,10 +3040,16 @@ if test "${enable_universalsdk+set}" = set; then :
enableval=$enable_universalsdk;
case $enableval in
yes)
enableval=/Developer/SDKs/MacOSX10.4u.sdk
if test ! -d "${enableval}"
# Locate the best usable SDK, see Mac/README.txt for more
# information
enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
then
enableval=/
enableval=/Developer/SDKs/MacOSX10.4u.sdk
if test ! -d "${enableval}"
then
enableval=/
fi
fi
;;
esac
......@@ -3081,7 +3088,20 @@ fi
ARCH_RUN_32BIT=""
# For backward compatibility reasons we prefer to select '32-bit' if available,
# otherwise use 'intel'
UNIVERSAL_ARCHS="32-bit"
if test "`uname -s`" = "Darwin"
then
if test -n "${UNIVERSALSDK}"
then
if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
then
UNIVERSAL_ARCHS="intel"
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-universal-archs" >&5
$as_echo_n "checking for --with-universal-archs... " >&6; }
......@@ -3089,24 +3109,18 @@ $as_echo_n "checking for --with-universal-archs... " >&6; }
# Check whether --with-universal-archs was given.
if test "${with_universal_archs+set}" = set; then :
withval=$with_universal_archs;
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
$as_echo "$withval" >&6; }
UNIVERSAL_ARCHS="$withval"
if test "${enable_universalsdk}" ; then
:
else
as_fn_error $? "--with-universal-archs without --enable-universalsdk. See Mac/README" "$LINENO" 5
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 32-bit" >&5
$as_echo "32-bit" >&6; }
fi
if test -n "${UNIVERSALSDK}"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${UNIVERSAL_ARCHS}" >&5
$as_echo "${UNIVERSAL_ARCHS}" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Check whether --with-framework-name was given.
......@@ -6084,119 +6098,137 @@ $as_echo "$ac_cv_no_strict_aliasing_ok" >&6; }
SCO_SV*)
BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${CC}" = gcc
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
# is there any other compiler on Darwin besides gcc?
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${CC}" = gcc
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5
$as_echo_n "checking which compiler should be used... " >&6; }
case "${UNIVERSALSDK}" in
*/MacOSX10.4u.sdk)
# Build using 10.4 SDK, force usage of gcc when the
# compiler is gcc, otherwise the user will get very
# confusing error messages when building on OSX 10.6
CC=gcc-4.0
CPP=cpp-4.0
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
case "${UNIVERSALSDK}" in
*/MacOSX10.4u.sdk)
# Build using 10.4 SDK, force usage of gcc when the
# compiler is gcc, otherwise the user will get very
# confusing error messages when building on OSX 10.6
CC=gcc-4.0
CPP=cpp-4.0
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
fi
# Calculate the right deployment target for this build.
#
cur_target_major=`sw_vers -productVersion | \
sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'`
cur_target_minor=`sw_vers -productVersion | \
sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'`
cur_target="${cur_target_major}.${cur_target_minor}"
if test ${cur_target_major} -eq 10 && \
test ${cur_target_minor} -ge 3
then
cur_target=10.3
if test ${enable_universalsdk}; then
if test "${UNIVERSAL_ARCHS}" = "all"; then
# Ensure that the default platform for a
# 4-way universal build is OSX 10.5,
# that's the first OS release where
# 4-way builds make sense.
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "intel"; then
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
cur_target='10.5'
fi
else
if test `/usr/bin/arch` = "i386"; then
# On Intel macs default to a deployment
# target of 10.4, that's the first OSX
# release with Intel support.
cur_target="10.4"
fi
fi
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
# environment with a value that is the same as what we'll use
# in the Makefile to ensure that we'll get the same compiler
# environment during configure and build time.
MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test "${enable_universalsdk}"; then
UNIVERSAL_ARCH_FLAGS=""
if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
ARCH_RUN_32BIT=""
LIPO_32BIT_FLAGS=""
elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
elif test "$UNIVERSAL_ARCHS" = "all" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
elif test "$UNIVERSAL_ARCHS" = "intel" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386"
elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
else
as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
fi
CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
if test "${UNIVERSALSDK}" != "/"
then
CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
fi
fi
fi
if test "${enable_universalsdk}"
then
case "$UNIVERSAL_ARCHS" in
32-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
64-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
all)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386"
;;
intel-32)
UNIVERSAL_ARCH_FLAGS="-arch i386"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
intel-64)
UNIVERSAL_ARCH_FLAGS="-arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
3-way)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
*)
as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
;;
esac
if test "${UNIVERSALSDK}" != "/"
then
CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
else
CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}"
fi
fi
;;
# Calculate an appropriate deployment target for this build:
# The deployment target value is used explicitly to enable certain
# features are enabled (such as builtin libedit support for readline)
# through the use of Apple's Availability Macros and is used as a
# component of the string returned by distutils.get_platform().
#
# Use the value from:
# 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified
# 2. the operating system version of the build machine if >= 10.6
# 3. If running on OS X 10.3 through 10.5, use the legacy tests
# below to pick either 10.3, 10.4, or 10.5 as the target.
# 4. If we are running on OS X 10.2 or earlier, good luck!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which MACOSX_DEPLOYMENT_TARGET to use" >&5
$as_echo_n "checking which MACOSX_DEPLOYMENT_TARGET to use... " >&6; }
cur_target_major=`sw_vers -productVersion | \
sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'`
cur_target_minor=`sw_vers -productVersion | \
sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'`
cur_target="${cur_target_major}.${cur_target_minor}"
if test ${cur_target_major} -eq 10 && \
test ${cur_target_minor} -ge 3 && \
test ${cur_target_minor} -le 5
then
# OS X 10.3 through 10.5
cur_target=10.3
if test ${enable_universalsdk}
then
case "$UNIVERSAL_ARCHS" in
all|3-way|intel|64-bit)
# These configurations were first supported in 10.5
cur_target='10.5'
;;
esac
else
if test `/usr/bin/arch` = "i386"
then
# 10.4 was the first release to support Intel archs
cur_target="10.4"
fi
fi
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
# environment with a value that is the same as what we'll use
# in the Makefile to ensure that we'll get the same compiler
# environment during configure and build time.
MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACOSX_DEPLOYMENT_TARGET" >&5
$as_echo "$MACOSX_DEPLOYMENT_TARGET" >&6; }
# end of Darwin* tests
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
;;
......@@ -6399,7 +6431,6 @@ if test "$Py_OPT" = 'true' ; then
# compile working code using it and both test_distutils and test_gdb are
# broken when you do managed to get a toolchain that works with it. People
# who want LTO need to use --with-lto themselves.
Py_LTO='true'
DEF_MAKE_ALL_RULE="profile-opt"
REQUIRE_PGO="yes"
DEF_MAKE_RULE="build_all"
......@@ -8441,7 +8472,6 @@ fi
;;
esac
#ARCH_RUN_32BIT="true"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
......@@ -8618,9 +8648,6 @@ then
fi
else
# building for OS X 10.3 and later
if test "${enable_universalsdk}"; then
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
......
......@@ -113,14 +113,20 @@ CONFIG_ARGS="$ac_configure_args"
AC_MSG_CHECKING([for --enable-universalsdk])
AC_ARG_ENABLE(universalsdk,
AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build fat binary against Mac OS X SDK]),
[
case $enableval in
yes)
enableval=/Developer/SDKs/MacOSX10.4u.sdk
if test ! -d "${enableval}"
# Locate the best usable SDK, see Mac/README.txt for more
# information
enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
then
enableval=/
enableval=/Developer/SDKs/MacOSX10.4u.sdk
if test ! -d "${enableval}"
then
enableval=/
fi
fi
;;
esac
......@@ -137,7 +143,7 @@ AC_ARG_ENABLE(universalsdk,
fi
;;
esac
],[
UNIVERSALSDK=
enable_universalsdk=
......@@ -153,25 +159,34 @@ AC_SUBST(UNIVERSALSDK)
AC_SUBST(ARCH_RUN_32BIT)
ARCH_RUN_32BIT=""
# For backward compatibility reasons we prefer to select '32-bit' if available,
# otherwise use 'intel'
UNIVERSAL_ARCHS="32-bit"
if test "`uname -s`" = "Darwin"
then
if test -n "${UNIVERSALSDK}"
then
if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
then
UNIVERSAL_ARCHS="intel"
fi
fi
fi
AC_SUBST(LIPO_32BIT_FLAGS)
AC_MSG_CHECKING(for --with-universal-archs)
AC_ARG_WITH(universal-archs,
AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]),
AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")]),
[
AC_MSG_RESULT($withval)
UNIVERSAL_ARCHS="$withval"
if test "${enable_universalsdk}" ; then
:
else
AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
fi
],
[
AC_MSG_RESULT(32-bit)
])
[])
if test -n "${UNIVERSALSDK}"
then
AC_MSG_RESULT(${UNIVERSAL_ARCHS})
else
AC_MSG_RESULT(no)
fi
AC_ARG_WITH(framework-name,
AS_HELP_STRING([--with-framework-name=FRAMEWORK],
......@@ -1136,117 +1151,133 @@ yes)
SCO_SV*)
BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${CC}" = gcc
then
AC_MSG_CHECKING(which compiler should be used)
case "${UNIVERSALSDK}" in
*/MacOSX10.4u.sdk)
# Build using 10.4 SDK, force usage of gcc when the
# compiler is gcc, otherwise the user will get very
# confusing error messages when building on OSX 10.6
CC=gcc-4.0
CPP=cpp-4.0
;;
esac
AC_MSG_RESULT($CC)
fi
# Calculate the right deployment target for this build.
#
cur_target_major=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
cur_target_minor=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
cur_target="${cur_target_major}.${cur_target_minor}"
if test ${cur_target_major} -eq 10 && \
test ${cur_target_minor} -ge 3
then
cur_target=10.3
if test ${enable_universalsdk}; then
if test "${UNIVERSAL_ARCHS}" = "all"; then
# Ensure that the default platform for a
# 4-way universal build is OSX 10.5,
# that's the first OS release where
# 4-way builds make sense.
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "intel"; then
cur_target='10.5'
elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
cur_target='10.5'
fi
else
if test `/usr/bin/arch` = "i386"; then
# On Intel macs default to a deployment
# target of 10.4, that's the first OSX
# release with Intel support.
cur_target="10.4"
fi
fi
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
# environment with a value that is the same as what we'll use
# in the Makefile to ensure that we'll get the same compiler
# environment during configure and build time.
MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test "${enable_universalsdk}"; then
UNIVERSAL_ARCH_FLAGS=""
if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
ARCH_RUN_32BIT=""
LIPO_32BIT_FLAGS=""
elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
elif test "$UNIVERSAL_ARCHS" = "all" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
elif test "$UNIVERSAL_ARCHS" = "intel" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386"
elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
else
AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
fi
CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
if test "${UNIVERSALSDK}" != "/"
then
CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
fi
fi
# is there any other compiler on Darwin besides gcc?
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${CC}" = gcc
then
AC_MSG_CHECKING(which compiler should be used)
case "${UNIVERSALSDK}" in
*/MacOSX10.4u.sdk)
# Build using 10.4 SDK, force usage of gcc when the
# compiler is gcc, otherwise the user will get very
# confusing error messages when building on OSX 10.6
CC=gcc-4.0
CPP=cpp-4.0
;;
esac
AC_MSG_RESULT($CC)
fi
if test "${enable_universalsdk}"
then
case "$UNIVERSAL_ARCHS" in
32-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
64-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
all)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386"
;;
intel-32)
UNIVERSAL_ARCH_FLAGS="-arch i386"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
intel-64)
UNIVERSAL_ARCH_FLAGS="-arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT=""
;;
3-way)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
*)
AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
;;
esac
if test "${UNIVERSALSDK}" != "/"
then
CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
else
CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}"
fi
fi
;;
# Calculate an appropriate deployment target for this build:
# The deployment target value is used explicitly to enable certain
# features are enabled (such as builtin libedit support for readline)
# through the use of Apple's Availability Macros and is used as a
# component of the string returned by distutils.get_platform().
#
# Use the value from:
# 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified
# 2. the operating system version of the build machine if >= 10.6
# 3. If running on OS X 10.3 through 10.5, use the legacy tests
# below to pick either 10.3, 10.4, or 10.5 as the target.
# 4. If we are running on OS X 10.2 or earlier, good luck!
AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use)
cur_target_major=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
cur_target_minor=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
cur_target="${cur_target_major}.${cur_target_minor}"
if test ${cur_target_major} -eq 10 && \
test ${cur_target_minor} -ge 3 && \
test ${cur_target_minor} -le 5
then
# OS X 10.3 through 10.5
cur_target=10.3
if test ${enable_universalsdk}
then
case "$UNIVERSAL_ARCHS" in
all|3-way|intel|64-bit)
# These configurations were first supported in 10.5
cur_target='10.5'
;;
esac
else
if test `/usr/bin/arch` = "i386"
then
# 10.4 was the first release to support Intel archs
cur_target="10.4"
fi
fi
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
# environment with a value that is the same as what we'll use
# in the Makefile to ensure that we'll get the same compiler
# environment during configure and build time.
MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET)
# end of Darwin* tests
;;
OSF*)
BASECFLAGS="$BASECFLAGS -mieee"
;;
......@@ -2033,7 +2064,6 @@ case $ac_sys_system/$ac_sys_release in
;;
esac
#ARCH_RUN_32BIT="true"
fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
......@@ -2198,9 +2228,6 @@ then
fi
else
# building for OS X 10.3 and later
if test "${enable_universalsdk}"; then
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
......
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