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 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 certain third-party libraries as necessary. It builds a complete
framework-based Python out-of-tree, installs it in a funny place with framework-based Python out-of-tree, installs it in a funny place with
$DESTROOT, massages that installation to remove .pyc files and such, creates $DESTROOT, massages that installation to remove .pyc files and such, creates
......
This diff is collapsed.
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
This diff is collapsed.
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160 {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf400
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;} \cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;} {\colortbl;\red255\green255\blue255;}
\paperw11905\paperh16837\margl1440\margr1440\vieww11180\viewh10860\viewkind0 {\*\expandedcolortbl;;}
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640 \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 \f0\fs24 \cf0 This package will install
\b Python $FULL_VERSION \b Python $FULL_VERSION
\b0 for \b0 for
\b Mac OS X $MACOSX_DEPLOYMENT_TARGET \b macOS $MACOSX_DEPLOYMENT_TARGET
\b0 .\ \b0 .\
\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0
\cf0 \
\b Python for Mac OS X \b Python for macOS
\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 \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 \b IDLE
\b0 .\ \b0 .\
\ \
\b NEW for Python 2.7.9: \b NEW in 2.7.15:
\b0 This package installs a version of \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 \f1 pip,
\f0 , the recommended tool for installing and managing Python packages. Type \f0 built-in OpenSSL 1.0.2 (click on
\f1 pip2.7 --help \f1 Install Certificates
\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 \f0 for root certificates)\
\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.\ \ No newline at end of file
\
\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
#!/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="../../.." ...@@ -12,6 +12,7 @@ SHARE_DOCDIR_TO_FWK="../../.."
# make link in /Applications/Python m.n/ for Finder users # make link in /Applications/Python m.n/ for Finder users
if [ -d "${APPDIR}" ]; then if [ -d "${APPDIR}" ]; then
ln -fhs "${FWK_DOCDIR}/index.html" "${APPDIR}/Python Documentation.html" ln -fhs "${FWK_DOCDIR}/index.html" "${APPDIR}/Python Documentation.html"
open "${APPDIR}" || true # open the applications folder
fi fi
# make share/doc link in framework for command line users # 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) ...@@ -11,7 +11,6 @@ LIBDEST=$(prefix)/lib/python$(VERSION)
UNIVERSALSDK=@UNIVERSALSDK@ UNIVERSALSDK=@UNIVERSALSDK@
builddir= ../.. builddir= ../..
PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
RUNSHARED= @RUNSHARED@ RUNSHARED= @RUNSHARED@
...@@ -71,10 +70,6 @@ IDLE.app: \ ...@@ -71,10 +70,6 @@ IDLE.app: \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \ --resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \ --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build 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 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 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 ...@@ -7,7 +7,7 @@ Python on Mac OS X README
Ronald Oussoren (2010-04), Ronald Oussoren (2010-04),
Ned Deily (2014-05) 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 This document provides a quick overview of some Mac OS X specific features in
the Python distribution. the Python distribution.
...@@ -44,10 +44,12 @@ OS X specific arguments to configure ...@@ -44,10 +44,12 @@ OS X specific arguments to configure
regular and framework builds. regular and framework builds.
The optional argument specifies which OS X SDK should be used to perform the 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 build. If xcodebuild is available and configured, this defaults to
on OS X 10.5 or later, you can specify ``/`` to use the installed system the Xcode default MacOS X SDK, otherwise ``/Developer/SDKs/MacOSX.10.4u.sdk``
headers rather than an SDK. As of OS X 10.9, you should install the optional if available or ``/`` if not. When building on OS X 10.5 or later, you can
system headers from the Command Line Tools component using ``xcode-select``:: 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 $ sudo xcode-select --install
...@@ -57,8 +59,9 @@ OS X specific arguments to configure ...@@ -57,8 +59,9 @@ OS X specific arguments to configure
* ``--with-universal-archs=VALUE`` * ``--with-universal-archs=VALUE``
Specify the kind of universal binary that should be created. This option is Specify the kind of universal binary that should be created. This option is
only valid when ``--enable-universalsdk`` is specified. 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 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 ...@@ -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 and the 10.4u SDK. Starting with Xcode 3 and OS X 10.5, more configurations are
available. 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 In general, universal builds depend on specific features provided by the
Apple-supplied compilers and other build tools included in Apple's Xcode Apple-supplied compilers and other build tools included in Apple's Xcode
development tools. You should install Xcode and the command line tools development tools. You should install Xcode and the command line tools
component appropriate for the OS X release you are running on. See the 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. for more information.
2.1 Flavors of universal binaries 2.1 Flavors of universal binaries
................................. .................................
It is possible to build a number of flavors of the universal binary build, 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 the default is a 32-bit only binary (i386 and ppc) in build environments that
Xcode 4, the build tools no longer support ppc. The flavor can be support ppc (10.4 with Xcode 2, 10.5 and 10.6 with Xcode 3) or an
specified using the option ``--with-universal-archs=VALUE``. The following 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: values are available:
* ``intel``: ``i386``, ``x86_64`` * ``intel``: ``i386``, ``x86_64``
* ``intel-32``: ``i386``
* ``intel-64``: ``x86_64``
* ``32-bit``: ``ppc``, ``i386`` * ``32-bit``: ``ppc``, ``i386``
* ``3-way``: ``i386``, ``x86_64``, ``ppc`` * ``3-way``: ``i386``, ``x86_64``, ``ppc``
...@@ -222,7 +225,7 @@ If you want Cocoa you need to get PyObjC. ...@@ -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 This directory contains a Makefile that will create a couple of python-related
applications (full-blown OS X .app applications, that is) in applications (full-blown OS X .app applications, that is) in
"/Applications/Python <VERSION>", and a hidden helper application Python.app "/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 /usr/local/bin. In addition it has a target "installmacsubtree" that installs
the relevant portions of the Mac subtree into the Python.framework. the relevant portions of the Mac subtree into the Python.framework.
...@@ -363,4 +366,4 @@ Resources ...@@ -363,4 +366,4 @@ Resources
* http://www.python.org/community/sigs/current/pythonmac-sig/ * 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.
This diff is collapsed.
...@@ -113,15 +113,21 @@ CONFIG_ARGS="$ac_configure_args" ...@@ -113,15 +113,21 @@ CONFIG_ARGS="$ac_configure_args"
AC_MSG_CHECKING([for --enable-universalsdk]) AC_MSG_CHECKING([for --enable-universalsdk])
AC_ARG_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 case $enableval in
yes) yes)
# 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=/Developer/SDKs/MacOSX10.4u.sdk enableval=/Developer/SDKs/MacOSX10.4u.sdk
if test ! -d "${enableval}" if test ! -d "${enableval}"
then then
enableval=/ enableval=/
fi fi
fi
;; ;;
esac esac
case $enableval in case $enableval in
...@@ -153,25 +159,34 @@ AC_SUBST(UNIVERSALSDK) ...@@ -153,25 +159,34 @@ AC_SUBST(UNIVERSALSDK)
AC_SUBST(ARCH_RUN_32BIT) AC_SUBST(ARCH_RUN_32BIT)
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" 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_SUBST(LIPO_32BIT_FLAGS)
AC_MSG_CHECKING(for --with-universal-archs) AC_MSG_CHECKING(for --with-universal-archs)
AC_ARG_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" 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, AC_ARG_WITH(framework-name,
AS_HELP_STRING([--with-framework-name=FRAMEWORK], AS_HELP_STRING([--with-framework-name=FRAMEWORK],
...@@ -1155,39 +1170,97 @@ yes) ...@@ -1155,39 +1170,97 @@ yes)
AC_MSG_RESULT($CC) AC_MSG_RESULT($CC)
fi fi
# Calculate the right deployment target for this build. 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 | \ cur_target_major=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
cur_target_minor=`sw_vers -productVersion | \ cur_target_minor=`sw_vers -productVersion | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
cur_target="${cur_target_major}.${cur_target_minor}" cur_target="${cur_target_major}.${cur_target_minor}"
if test ${cur_target_major} -eq 10 && \ if test ${cur_target_major} -eq 10 && \
test ${cur_target_minor} -ge 3 test ${cur_target_minor} -ge 3 && \
test ${cur_target_minor} -le 5
then then
# OS X 10.3 through 10.5
cur_target=10.3 cur_target=10.3
if test ${enable_universalsdk}; then if test ${enable_universalsdk}
if test "${UNIVERSAL_ARCHS}" = "all"; then then
# Ensure that the default platform for a case "$UNIVERSAL_ARCHS" in
# 4-way universal build is OSX 10.5, all|3-way|intel|64-bit)
# that's the first OS release where # These configurations were first supported in 10.5
# 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' cur_target='10.5'
fi ;;
esac
else else
if test `/usr/bin/arch` = "i386"; then if test `/usr/bin/arch` = "i386"
# On Intel macs default to a deployment then
# target of 10.4, that's the first OSX # 10.4 was the first release to support Intel archs
# release with Intel support.
cur_target="10.4" cur_target="10.4"
fi fi
fi fi
...@@ -1201,51 +1274,9 @@ yes) ...@@ -1201,51 +1274,9 @@ yes)
MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
export MACOSX_DEPLOYMENT_TARGET export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET='' EXPORT_MACOSX_DEPLOYMENT_TARGET=''
AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET)
if test "${enable_universalsdk}"; then # end of Darwin* tests
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
;; ;;
OSF*) OSF*)
BASECFLAGS="$BASECFLAGS -mieee" BASECFLAGS="$BASECFLAGS -mieee"
...@@ -2033,7 +2064,6 @@ case $ac_sys_system/$ac_sys_release in ...@@ -2033,7 +2064,6 @@ case $ac_sys_system/$ac_sys_release in
;; ;;
esac esac
#ARCH_RUN_32BIT="true"
fi fi
LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
...@@ -2198,9 +2228,6 @@ then ...@@ -2198,9 +2228,6 @@ then
fi fi
else else
# building for OS X 10.3 and later # 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' LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED" 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