[Python-checkins] r79117 - in python/branches/release31-maint: Mac/Makefile.in Mac/README configure.in

benjamin.peterson python-checkins at python.org
Fri Mar 19 22:38:46 CET 2010


Author: benjamin.peterson
Date: Fri Mar 19 22:38:46 2010
New Revision: 79117

Log:
port r78813 from trunk fixing #8089

Modified:
   python/branches/release31-maint/Mac/Makefile.in
   python/branches/release31-maint/Mac/README
   python/branches/release31-maint/configure.in

Modified: python/branches/release31-maint/Mac/Makefile.in
==============================================================================
--- python/branches/release31-maint/Mac/Makefile.in	(original)
+++ python/branches/release31-maint/Mac/Makefile.in	Fri Mar 19 22:38:46 2010
@@ -144,12 +144,14 @@
 		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
 
 pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
-	$(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
-		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
+	$(CC) $(LDFLAGS) -o pythonw-tmp.o $(srcdir)/Tools/pythonw.c \
+		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"' ;\
+	lipo  @LIPO_32BIT_FLAGS@ -output $@  pythonw-tmp.o ; rm pythonw-tmp.o
 
 pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
-	$(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
-		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
+	$(CC) $(LDFLAGS) -o pythonw-tmp.o $(srcdir)/Tools/pythonw.c \
+		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"' ;\
+	lipo  @LIPO_64BIT_FLAGS@ -output $@  pythonw-tmp.o ; rm pythonw-tmp.o
 
 install_PythonLauncher:
 	cd PythonLauncher && make install DESTDIR=$(DESTDIR)
@@ -206,8 +208,8 @@
 	rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
 
 install_Python4way: install_Python
-	lipo  -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
-	lipo  -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
+	lipo  @LIPO_32BIT_FLAGS@ -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
+	lipo  @LIPO_64BIT_FLAGS@ -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
 
 
 

Modified: python/branches/release31-maint/Mac/README
==============================================================================
--- python/branches/release31-maint/Mac/README	(original)
+++ python/branches/release31-maint/Mac/README	Fri Mar 19 22:38:46 2010
@@ -5,6 +5,39 @@
 This document provides a quick overview of some Mac OS X specific features in
 the Python distribution.
 
+Mac-specific arguments to configure
+===================================
+
+* ``--enable-framework``
+
+  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 
+  information on frameworks.
+
+* ``--with-framework-name=NAME``
+
+  Specify the name for the python framework, defaults to ``Python``. This option
+  is only valid when ``--enable-framework`` is specified.
+
+* ``--enable-universalsdk[=PATH]``
+
+  Create a universal binary build of of Python. This can be used with both
+  regular and framework builds.
+
+  The optional argument specifies with OSX SDK should be used to perform the
+  build. This defaults to ``/Developer/SDKs/MacOSX.10.4u.sdk``, specify 
+  ``/`` when building on a 10.5 system, especially when building 64-bit code.
+
+  See the section _`Building and using a universal binary of Python on Mac OS X`
+  for more information.
+
+* ``--with-universal-archs=VALUE``
+
+  Specify the kind of universal binary that should be created. This option is 
+  only valid when ``--enable-universalsdk`` is specified.
+
+  
 
 Building and using a universal binary of Python on Mac OS X
 ===========================================================
@@ -31,6 +64,34 @@
 with Xcode 2.1 (or later). You also have to install the 10.4u SDK when 
 installing Xcode.
 
+The option ``--enable-universalsdk`` has an optional argument to specify an
+SDK, which defaults to the 10.4u SDK. When you build on OSX 10.5 or later 
+you can use the system headers instead of an SDK::
+
+  $ ./configure --enable-universalsdk=/
+
+2.1 Flavours of universal binaries
+..................................
+
+It is possible to build a number of flavours of the universal binary build,
+the default is a 32-bit only binary (i386 and ppc). The flavour can be
+specified using the option ``--with-universal-archs=VALUE``. The following
+values are available:
+
+  * ``32-bit``:   ``ppc``, ``i386``
+
+  * ``64-bit``:   ``ppc64``, ``x86_64``
+
+  * ``all``:      ``ppc``, ``ppc64``, ``i386``, ``x86_64``
+
+  * ``3-way``:	  ``ppc``, ``i386`` and ``x86_64``
+
+  * ``intel``:	  ``i386``, ``x86_64``
+
+To build a universal binary that includes a 64-bit architecture you must build
+on a system running OSX 10.5 or later. The ``all`` flavour can only be build on
+OSX 10.5.
+
 
 Building and using a framework-based Python on Mac OS X.
 ========================================================
@@ -48,7 +109,7 @@
 
 A second reason for using frameworks is that they put Python-related items in
 only two places: "/Library/Framework/Python.framework" and 
-"/Applications/MacPython 2.6".  This simplifies matters for users installing 
+"/Applications/MacPython m.n".  This simplifies matters for users installing 
 Python from a binary distribution if they want to get rid of it again. Moreover,
 due to the way frameworks work a user without admin privileges can install a 
 binary distribution in his or her home directory without recompilation.
@@ -75,40 +136,34 @@
 
 This directory contains a Makefile that will create a couple of python-related
 applications (fullblown OSX .app applications, that is) in
-"/Applications/MacPython 2.6", and a hidden helper application Python.app 
+"/Applications/MacPython m.n", and a hidden helper application Python.app 
 inside the Python.framework, and unix tools "python" and "pythonw" into 
 /usr/local/bin.  In addition it has a target "installmacsubtree" that installs 
 the relevant portions of the Mac subtree into the Python.framework.
 
 It is normally invoked indirectly through the main Makefile, as the last step
-in the sequence
-
- 1. ./configure --enable-framework
+in the sequence::
 
- 2. make
- 
- 3. make install
+ $ ./configure --enable-framework
+ $ make
+ $ make install
 
 This sequence will put the framework in /Library/Framework/Python.framework,
-the applications in "/Applications/MacPython 2.6" and the unix tools in 
+the applications in "/Applications/MacPython m.n" and the unix tools in 
 /usr/local/bin.
 
+It is possible to select a different name for the framework using the configure 
+option ``--with-framework-name=NAME``. This makes it possible to have several
+parallel installs of a Python framework.
+
 Installing in another place, for instance $HOME/Library/Frameworks if you have
 no admin privileges on your machine, has only been tested very lightly. This
 can be done by configuring with --enable-framework=$HOME/Library/Frameworks.
-The other two directories, "/Applications/MacPython-2.6" and /usr/local/bin, 
+The other two directories, "/Applications/MacPython-m.n" and /usr/local/bin, 
 will then also be deposited in $HOME. This is sub-optimal for the unix tools, 
 which you would want in $HOME/bin, but there is no easy way to fix this right 
 now.
 
-If you want to install some part, but not all, read the main Makefile. The
-frameworkinstall is composed of a couple of sub-targets that install the
-framework itself, the Mac subtree, the applications and the unix tools.
-
-There is an extra target frameworkinstallextras that is not part of the
-normal frameworkinstall which installs the Demo and Tools directories
-into "/Applications/MacPython 2.6", this is useful for binary distributions.
-
 What do all these programs do?
 ===============================
 
@@ -123,6 +178,11 @@
 script to set runtime options. These options can be set once and for all
 through PythonLauncher's preferences dialog.
 
+"BuildApplet.app" creates an applet from a Python script. Drop the script on it
+and out comes a full-featured MacOS application. There is much more to this,
+to be supplied later. Some useful (but outdated) info can be found in
+Mac/Demo.
+
 The commandline scripts /usr/local/bin/python and pythonw can be used to run
 non-GUI and GUI python scripts from the command line, respectively.
 

Modified: python/branches/release31-maint/configure.in
==============================================================================
--- python/branches/release31-maint/configure.in	(original)
+++ python/branches/release31-maint/configure.in	Fri Mar 19 22:38:46 2010
@@ -120,6 +120,8 @@
 AC_SUBST(ARCH_RUN_32BIT)
 
 UNIVERSAL_ARCHS="32-bit"
+AC_SUBST(LIPO_32BIT_FLAGS)
+AC_SUBST(LIPO_64BIT_FLAGS)
 AC_MSG_CHECKING(for --with-universal-archs)
 AC_ARG_WITH(universal-archs,
     AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
@@ -175,14 +177,16 @@
 		PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
 		FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
 		FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure "
-		if test "$UNIVERSAL_ARCHS" = "all"
-		then
+		case "${UNIVERSAL_ARCHS}" in
+		all|3-way|intel)
 			FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
 			FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
-		else
+			;;
+		*)
 			FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
 			FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
-		fi
+			;;
+		esac
 
 		if test "x${prefix}" = "xNONE" ; then
 			FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
@@ -913,24 +917,30 @@
 	    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=""
+		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
 
 	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
-		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
 		   ARCH_RUN_32BIT="true"
+		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
 
 	         elif test "$UNIVERSAL_ARCHS" = "all" ; then
-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
 		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+		   LIPO_32BIT_FLAGS="-extract i386 -extract ppc7400"
+		   LIPO_64BIT_FLAGS="-extract x86_64 -extract ppc64"
 
 	         elif test "$UNIVERSAL_ARCHS" = "intel" ; then
-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
 		   ARCH_RUN_32BIT="/usr/bin/arch -i386"
+		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+		   LIPO_32BIT_FLAGS="-extract i386"
+		   LIPO_64BIT_FLAGS="-extract x86_64"
 
 	         elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
 		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+		   LIPO_32BIT_FLAGS="-extract i386 -extract ppc7400"
+		   LIPO_64BIT_FLAGS="-extract x86_64"
 
 		 else
 	           AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])


More information about the Python-checkins mailing list