Added Python (Thanks to Beholder) - it fails to build properly using my build system,
so there's a precompiled binary included, with a hack in Android.mk to make it work on NDK r4b
This commit is contained in:
78
project/jni/python/src/Mac/BuildScript/README.txt
Normal file
78
project/jni/python/src/Mac/BuildScript/README.txt
Normal file
@@ -0,0 +1,78 @@
|
||||
Building a MacPython distribution
|
||||
=================================
|
||||
|
||||
The ``build-install.py`` script creates MacPython distributions, including
|
||||
sleepycat db4, sqlite3 and readline support. 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
|
||||
an Installer package from the installation plus other files in ``resources``
|
||||
and ``scripts`` and placed that on a ``.dmg`` disk image.
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
* A MacOS X 10.4 (or later)
|
||||
|
||||
* XCode 2.2 (or later), with the universal SDK
|
||||
|
||||
* No Fink (in ``/sw``) or DarwinPorts (in ``/opt/local``), those could
|
||||
interfere with the build.
|
||||
|
||||
* The documentation for the release must be available on python.org
|
||||
because it is included in the installer.
|
||||
|
||||
|
||||
The Recipe
|
||||
----------
|
||||
|
||||
Here are the steps you need to follow to build a MacPython installer:
|
||||
|
||||
* Run ``./build-installer.py``. Optionally you can pass a number of arguments
|
||||
to specify locations of various files. Please see the top of
|
||||
``build-installer.py`` for its usage.
|
||||
|
||||
Running this script takes some time, I will not only build Python itself
|
||||
but also some 3th-party libraries that are needed for extensions.
|
||||
|
||||
* When done the script will tell you where the DMG image is (by default
|
||||
somewhere in ``/tmp/_py``).
|
||||
|
||||
Building a 4-way universal installer
|
||||
....................................
|
||||
|
||||
It is also possible to build a 4-way universal installer that runs on
|
||||
OSX Leopard or later::
|
||||
|
||||
$ ./build-installer.py --dep-target=10.5 --universal-archs=all --sdk=/
|
||||
|
||||
This requires that the deployment target is 10.5 (or later), and hence
|
||||
also that your building on at least OSX 10.5.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
The resulting binaries should work on MacOSX 10.3.9 or later. I usually run
|
||||
the installer on a 10.3.9, a 10.4.x PPC and a 10.4.x Intel system and then
|
||||
run the testsuite to make sure.
|
||||
|
||||
|
||||
Announcements
|
||||
-------------
|
||||
|
||||
(This is mostly of historic interest)
|
||||
|
||||
When all is done, announcements can be posted to at least the following
|
||||
places:
|
||||
- pythonmac-sig@python.org
|
||||
- python-dev@python.org
|
||||
- python-announce@python.org
|
||||
- archivist@info-mac.org
|
||||
- adcnews@apple.com
|
||||
- news@macnn.com
|
||||
- http://www.macupdate.com
|
||||
- http://guide.apple.com/usindex.lasso
|
||||
- http://www.apple.com/downloads/macosx/submit
|
||||
- http://www.versiontracker.com/ (userid Jack.Jansen@oratrix.com)
|
||||
- http://www.macshareware.net (userid jackjansen)
|
||||
|
||||
Also, check out Stephan Deibels http://pythonology.org/market contact list
|
||||
1064
project/jni/python/src/Mac/BuildScript/build-installer.py
Normal file
1064
project/jni/python/src/Mac/BuildScript/build-installer.py
Normal file
File diff suppressed because it is too large
Load Diff
36
project/jni/python/src/Mac/BuildScript/ncurses-5.5.patch
Normal file
36
project/jni/python/src/Mac/BuildScript/ncurses-5.5.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
diff -r -u ncurses-5.5-orig/test/Makefile.in ncurses-5.5/test/Makefile.in
|
||||
--- ncurses-5.5-orig/test/Makefile.in 2006-03-24 12:47:40.000000000 +0100
|
||||
+++ ncurses-5.5/test/Makefile.in 2006-03-24 12:47:50.000000000 +0100
|
||||
@@ -75,7 +75,7 @@
|
||||
MATH_LIB = @MATH_LIB@
|
||||
|
||||
LD = @LD@
|
||||
-LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC) $(CFLAGS)
|
||||
+LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC)
|
||||
|
||||
usFLAGS = @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@
|
||||
|
||||
diff -ru ncurses-5.5-orig/ncurses/tinfo/read_entry.c ncurses-5.5/ncurses/tinfo/read_entry.c
|
||||
--- ncurses-5.5-orig/ncurses/tinfo/read_entry.c 2004-01-11 02:57:05.000000000 +0100
|
||||
+++ ncurses-5.5/ncurses/tinfo/read_entry.c 2006-03-25 22:49:39.000000000 +0100
|
||||
@@ -474,7 +474,7 @@
|
||||
}
|
||||
|
||||
/* truncate the terminal name to prevent buffer overflow */
|
||||
- (void) sprintf(ttn, "%c/%.*s", *tn, (int) sizeof(ttn) - 3, tn);
|
||||
+ (void) sprintf(ttn, "%x/%.*s", *tn, (int) sizeof(ttn) - 3, tn);
|
||||
|
||||
/* This is System V behavior, in conjunction with our requirements for
|
||||
* writing terminfo entries.
|
||||
diff -ru ncurses-5.5-orig/configure ncurses-5.5/configure
|
||||
--- ncurses-5.5-orig/configure 2005-09-24 23:50:50.000000000 +0200
|
||||
+++ ncurses-5.5/configure 2006-03-26 22:24:59.000000000 +0200
|
||||
@@ -5027,7 +5027,7 @@
|
||||
darwin*)
|
||||
EXTRA_CFLAGS="-no-cpp-precomp"
|
||||
CC_SHARED_OPTS="-dynamic"
|
||||
- MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@'
|
||||
+ MK_SHARED_LIB='$(CC) $(CFLAGS) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@'
|
||||
test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
|
||||
cf_cv_shlib_version_infix=yes
|
||||
;;
|
||||
30
project/jni/python/src/Mac/BuildScript/resources/ReadMe.txt
Normal file
30
project/jni/python/src/Mac/BuildScript/resources/ReadMe.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
This package will install MacPython $FULL_VERSION for Mac OS X
|
||||
$MACOSX_DEPLOYMENT_TARGET for the following
|
||||
architecture(s): $ARCHITECTURES.
|
||||
|
||||
Separate installers are available for older versions
|
||||
of Mac OS X, see the homepage, below.
|
||||
|
||||
Installation requires approximately $INSTALL_SIZE MB of disk
|
||||
space, ignore the message that it will take zero bytes.
|
||||
|
||||
You must install onto your current boot disk, even
|
||||
though the installer does not enforce this, otherwise
|
||||
things will not work.
|
||||
|
||||
MacPython consists of the Python programming language
|
||||
interpreter, plus a set of programs to allow easy
|
||||
access to it for Mac users including an integrated development
|
||||
environment, IDLE, plus a set of pre-built extension modules
|
||||
that open up specific Macintosh technologies to Python programs.
|
||||
|
||||
The installer puts the applications in "Python $VERSION"
|
||||
in your Applications folder, command-line tools in
|
||||
/usr/local/bin and the underlying machinery in
|
||||
$PYTHONFRAMEWORKINSTALLDIR.
|
||||
|
||||
More information on MacPython can be found at
|
||||
http://www.python.org/download/mac/.
|
||||
|
||||
More information on Python in general can be found at
|
||||
http://www.python.org.
|
||||
18
project/jni/python/src/Mac/BuildScript/resources/Welcome.rtf
Normal file
18
project/jni/python/src/Mac/BuildScript/resources/Welcome.rtf
Normal file
@@ -0,0 +1,18 @@
|
||||
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
|
||||
{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww9920\viewh10660\viewkind0
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
|
||||
|
||||
\f0\fs24 \cf0 This package will install
|
||||
\f1\b MacPython $FULL_VERSION
|
||||
\f0\b0 for
|
||||
\f1\b Mac OS X $MACOSX_DEPLOYMENT_TARGET
|
||||
\f0\b0 .\
|
||||
\
|
||||
MacPython consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac users including an integrated development environment \b IDLE\b0 plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs.\
|
||||
\
|
||||
See the ReadMe file for more information.\
|
||||
\
|
||||
\
|
||||
This package will by default update your shell profile to ensure that this version of Python is on the search path of your shell. Please deselect the "Shell profile updater" package on the package customization screen if you want to avoid this modification. Double-click \b Update Shell Profile\b0 at any time to make $FULL_VERSION the default Python.}
|
||||
BIN
project/jni/python/src/Mac/BuildScript/resources/background.jpg
Normal file
BIN
project/jni/python/src/Mac/BuildScript/resources/background.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
PYVER="@PYVER@"
|
||||
|
||||
if [ -d /Developer/Documentation ]; then
|
||||
if [ ! -d /Developer/Documentation/Python ]; then
|
||||
mkdir -p /Developer/Documentation/Python
|
||||
fi
|
||||
|
||||
ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@"
|
||||
fi
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Recompile the .py files.
|
||||
#
|
||||
|
||||
PYVER="@PYVER@"
|
||||
FWK="/Library/Frameworks/Python.framework/Versions/@PYVER@"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/lib/python${PYVER}"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt -O \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/lib/python${PYVER}"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/Mac/Tools"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt -O \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/Mac/Tools"
|
||||
|
||||
|
||||
chown -R admin "${FWK}"
|
||||
chmod -R g+w "${FWK}"
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "This script will update your shell profile when the 'bin' directory"
|
||||
echo "of python is not early enough of the PATH of your shell."
|
||||
echo "These changes will be effective only in shell windows that you open"
|
||||
echo "after running this script."
|
||||
|
||||
PYVER="@PYVER@"
|
||||
PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/@PYVER@"
|
||||
|
||||
if [ `id -ur` = 0 ]; then
|
||||
# Run from the installer, do some trickery to fetch the information
|
||||
# we need.
|
||||
theShell="`finger $USER | grep Shell: | head -1 | awk '{ print $NF }'`"
|
||||
|
||||
else
|
||||
theShell="${SHELL}"
|
||||
fi
|
||||
|
||||
# Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH.
|
||||
BSH="`basename "${theShell}"`"
|
||||
case "${BSH}" in
|
||||
bash|ksh|sh|*csh)
|
||||
if [ `id -ur` = 0 ]; then
|
||||
P=`su - ${USER} -c 'echo A-X-4-X@@$PATH@@X-4-X-A' | grep 'A-X-4-X@@.*@@X-4-X-A' | sed -e 's/^A-X-4-X@@//g' -e 's/@@X-4-X-A$//g'`
|
||||
else
|
||||
P="`(exec -l ${theShell} -c 'echo $PATH')`"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Sorry, I don't know how to patch $BSH shells"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now ensure that our bin directory is on $P and before /usr/bin at that
|
||||
for elem in `echo $P | tr ':' ' '`
|
||||
do
|
||||
if [ "${elem}" == "${PYTHON_ROOT}/bin" ]; then
|
||||
echo "All right, you're a python lover already"
|
||||
exit 0
|
||||
elif [ "${elem}" == "/usr/bin" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
|
||||
case "${BSH}" in
|
||||
*csh)
|
||||
if [ -f "${HOME}/.tcshrc" ]; then
|
||||
RC="${HOME}/.tcshrc"
|
||||
else
|
||||
RC="${HOME}/.cshrc"
|
||||
fi
|
||||
# Create backup copy before patching
|
||||
if [ -f "${RC}" ]; then
|
||||
cp -fp "${RC}" "${RC}.pysave"
|
||||
fi
|
||||
echo "" >> "${RC}"
|
||||
echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}"
|
||||
echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}"
|
||||
echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}"
|
||||
if [ `id -ur` = 0 ]; then
|
||||
chown "${USER}" "${RC}"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
bash)
|
||||
if [ -e "${HOME}/.bash_profile" ]; then
|
||||
PR="${HOME}/.bash_profile"
|
||||
elif [ -e "${HOME}/.bash_login" ]; then
|
||||
PR="${HOME}/.bash_login"
|
||||
elif [ -e "${HOME}/.profile" ]; then
|
||||
PR="${HOME}/.profile"
|
||||
else
|
||||
PR="${HOME}/.bash_profile"
|
||||
fi
|
||||
;;
|
||||
*sh)
|
||||
PR="${HOME}/.profile"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create backup copy before patching
|
||||
if [ -f "${PR}" ]; then
|
||||
cp -fp "${PR}" "${PR}.pysave"
|
||||
fi
|
||||
echo "" >> "${PR}"
|
||||
echo "# Setting PATH for MacPython ${PYVER}" >> "${PR}"
|
||||
echo "# The orginal version is saved in `basename ${PR}`.pysave" >> "${PR}"
|
||||
echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}"
|
||||
echo 'export PATH' >> "${PR}"
|
||||
if [ `id -ur` = 0 ]; then
|
||||
chown "${USER}" "${PR}"
|
||||
fi
|
||||
exit 0
|
||||
26
project/jni/python/src/Mac/BuildScript/seticon.m
Normal file
26
project/jni/python/src/Mac/BuildScript/seticon.m
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Simple tool for setting an icon on a file.
|
||||
*/
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "Usage: seticon ICON TARGET");
|
||||
return 1;
|
||||
}
|
||||
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString* iconPath = [NSString stringWithUTF8String:argv[1]];
|
||||
NSString* filePath = [NSString stringWithUTF8String:argv[2]];
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
[[NSWorkspace sharedWorkspace]
|
||||
setIcon: [[NSImage alloc] initWithContentsOfFile: iconPath]
|
||||
forFile: filePath
|
||||
options: 0];
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user