summaryrefslogtreecommitdiff
path: root/data/python/cross.diff
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-01-09 22:21:43 +0000
committerJay Freeman <saurik@saurik.com>2008-01-09 22:21:43 +0000
commit35ef70353227e4dff60fc36437f08293be752b25 (patch)
tree806d29fe3d68433a1c971336dff58863918b2709 /data/python/cross.diff
parent03880b546d794abafd6dab3eed876dbefe06c174 (diff)
Factored out --enable-{static=no,shared=yes}, did some extreme porting on pkg-config and libtool, added support for numerous X libraries and a few X applications, and got a solid build of Python with a bunch of modules (compiled as a shared library with the right extensions ;P).
git-svn-id: http://svn.telesphoreo.org/trunk@12 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/python/cross.diff')
-rw-r--r--data/python/cross.diff429
1 files changed, 429 insertions, 0 deletions
diff --git a/data/python/cross.diff b/data/python/cross.diff
new file mode 100644
index 000000000..8edb2153c
--- /dev/null
+++ b/data/python/cross.diff
@@ -0,0 +1,429 @@
+diff -r -u BuildPython-2.5.1/configure.in Python-2.5.1/configure.in
+--- BuildPython-2.5.1/configure.in 2007-03-12 10:50:51.000000000 +0000
++++ Python-2.5.1/configure.in 2008-01-09 06:54:17.000000000 +0000
+@@ -165,7 +165,7 @@
+ AC_MSG_CHECKING(MACHDEP)
+ if test -z "$MACHDEP"
+ then
+- ac_sys_system=`uname -s`
++ ac_sys_system=Darwin
+ if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
+ -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
+ ac_sys_release=`uname -v`
+@@ -247,6 +247,8 @@
+
+ esac
+
++define_xopen_source=no
++
+ if test $define_xopen_source = yes
+ then
+ # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
+@@ -1420,7 +1422,6 @@
+ echo '+ Continuing in 10 seconds to let you to ponder. +'
+ echo '+ +'
+ echo '====================================================================='
+- sleep 10
+ fi
+ AC_MSG_RESULT($SO)
+ AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
+@@ -1473,7 +1474,7 @@
+ Darwin/*)
+ # Use -undefined dynamic_lookup whenever possible (10.3 and later).
+ # This allows an extension to be used in any Python
+- cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
++ cur_target=10.5
+ if test ${cur_target} '>' 10.2; then
+ cur_target=10.3
+ fi
+@@ -3367,41 +3368,6 @@
+ AC_MSG_RESULT(no)
+ fi
+
+-AC_MSG_CHECKING(for %zd printf() format support)
+-AC_TRY_RUN([#include <stdio.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-int main()
+-{
+- char buffer[256];
+-
+-#ifdef HAVE_SSIZE_T
+-typedef ssize_t Py_ssize_t;
+-#elif SIZEOF_VOID_P == SIZEOF_LONG
+-typedef long Py_ssize_t;
+-#else
+-typedef int Py_ssize_t;
+-#endif
+-
+- if(sprintf(buffer, "%zd", (size_t)123) < 0)
+- return 1;
+-
+- if (strcmp(buffer, "123"))
+- return 1;
+-
+- if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
+- return 1;
+-
+- if (strcmp(buffer, "-123"))
+- return 1;
+-
+- return 0;
+-}],
+-[AC_MSG_RESULT(yes)
+- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+- AC_MSG_RESULT(no))
+-
+ AC_CHECK_TYPE(socklen_t,,
+ AC_DEFINE(socklen_t,int,
+ Define to `int' if <sys/socket.h> does not define.),[
+diff -r -u BuildPython-2.5.1/Include/pyport.h Python-2.5.1/Include/pyport.h
+--- BuildPython-2.5.1/Include/pyport.h 2006-10-02 15:24:01.000000000 +0000
++++ Python-2.5.1/Include/pyport.h 2008-01-09 00:19:23.000000000 +0000
+@@ -731,7 +731,7 @@
+ * rather than waiting for integer multiplication to trigger bogus
+ * overflows.
+ */
+-#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
++//#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
+ #endif
+
+ #ifdef __cplusplus
+diff -r -u BuildPython-2.5.1/Modules/_ctypes/cfield.c Python-2.5.1/Modules/_ctypes/cfield.c
+--- BuildPython-2.5.1/Modules/_ctypes/cfield.c 2007-03-22 19:43:37.000000000 +0000
++++ Python-2.5.1/Modules/_ctypes/cfield.c 2008-01-09 06:52:12.000000000 +0000
+@@ -1642,7 +1642,7 @@
+ struct _ffi_type **elements;
+ } ffi_type;
+ */
+-
++#if 0
+ /* align and size are bogus for void, but they must not be zero */
+ ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID };
+
+@@ -1664,5 +1664,5 @@
+ /* ffi_type ffi_type_longdouble */
+
+ ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER };
+-
++#endif
+ /*---------------- EOF ----------------*/
+diff -r -u BuildPython-2.5.1/Modules/getaddrinfo.c Python-2.5.1/Modules/getaddrinfo.c
+--- BuildPython-2.5.1/Modules/getaddrinfo.c 2003-08-17 21:28:39.000000000 +0000
++++ Python-2.5.1/Modules/getaddrinfo.c 2008-01-09 06:40:37.000000000 +0000
+@@ -38,7 +38,7 @@
+ * - PF_UNSPEC case would be handled in getipnodebyname() with the AI_ALL flag.
+ */
+
+-#if 0
++#if 1
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+diff -r -u BuildPython-2.5.1/Modules/mmapmodule.c Python-2.5.1/Modules/mmapmodule.c
+--- BuildPython-2.5.1/Modules/mmapmodule.c 2006-08-22 13:57:07.000000000 +0000
++++ Python-2.5.1/Modules/mmapmodule.c 2008-01-09 06:40:01.000000000 +0000
+@@ -36,6 +36,7 @@
+ #ifdef UNIX
+ #include <sys/mman.h>
+ #include <sys/stat.h>
++#include <sys/fcntl.h>
+
+ #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
+ static int
+diff -r -u BuildPython-2.5.1/setup.py Python-2.5.1/setup.py
+--- BuildPython-2.5.1/setup.py 2007-02-14 12:53:41.000000000 +0000
++++ Python-2.5.1/setup.py 2008-01-09 06:48:07.000000000 +0000
+@@ -206,46 +206,16 @@
+ ext_filename = os.path.join(
+ self.build_lib,
+ self.get_ext_filename(self.get_ext_fullname(ext.name)))
+- try:
+- imp.load_dynamic(ext.name, ext_filename)
+- except ImportError, why:
+- self.announce('*** WARNING: renaming "%s" since importing it'
+- ' failed: %s' % (ext.name, why), level=3)
+- assert not self.inplace
+- basename, tail = os.path.splitext(ext_filename)
+- newname = basename + "_failed" + tail
+- if os.path.exists(newname):
+- os.remove(newname)
+- os.rename(ext_filename, newname)
+-
+- # XXX -- This relies on a Vile HACK in
+- # distutils.command.build_ext.build_extension(). The
+- # _built_objects attribute is stored there strictly for
+- # use here.
+- # If there is a failure, _built_objects may not be there,
+- # so catch the AttributeError and move on.
+- try:
+- for filename in self._built_objects:
+- os.remove(filename)
+- except AttributeError:
+- self.announce('unable to remove files (ignored)')
+- except:
+- exc_type, why, tb = sys.exc_info()
+- self.announce('*** WARNING: importing extension "%s" '
+- 'failed with %s: %s' % (ext.name, exc_type, why),
+- level=3)
+
+ def get_platform(self):
+- # Get value of sys.platform
+- for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
+- if sys.platform.startswith(platform):
+- return platform
+- return sys.platform
++ return 'darwin'
+
+ def detect_modules(self):
++ sysroot = os.getenv('PKG_ROOT')
++
+ # Ensure that /usr/local is always used
+- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++ add_dir_to_list(self.compiler.library_dirs, sysroot + '/usr/local/lib')
++ add_dir_to_list(self.compiler.include_dirs, sysroot + '/usr/local/include')
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
+@@ -294,10 +264,10 @@
+ # if a file is found in one of those directories, it can
+ # be assumed that no additional -I,-L directives are needed.
+ lib_dirs = self.compiler.library_dirs + [
+- '/lib64', '/usr/lib64',
+- '/lib', '/usr/lib',
++ sysroot + '/lib64', sysroot + '/usr/lib64',
++ sysroot + '/lib', sysroot + '/usr/lib',
+ ]
+- inc_dirs = self.compiler.include_dirs + ['/usr/include']
++ inc_dirs = self.compiler.include_dirs + [sysroot + '/usr/include']
+ exts = []
+
+ config_h = sysconfig.get_config_h_filename()
+@@ -476,7 +446,7 @@
+ if find_file('readline/rlconf.h', inc_dirs, []) is None:
+ do_readline = False
+ if do_readline:
+- if sys.platform == 'darwin':
++ if self.get_platform() == 'darwin':
+ # In every directory on the search path search for a dynamic
+ # library and then a static library, instead of first looking
+ # for dynamic libraries on the entiry path.
+@@ -496,11 +466,11 @@
+ elif self.compiler.find_library_file(lib_dirs, 'curses'):
+ readline_libs.append('curses')
+ elif self.compiler.find_library_file(lib_dirs +
+- ['/usr/lib/termcap'],
++ [sysroot + '/usr/lib/termcap'],
+ 'termcap'):
+ readline_libs.append('termcap')
+ exts.append( Extension('readline', ['readline.c'],
+- library_dirs=['/usr/lib/termcap'],
++ library_dirs=[sysroot + '/usr/lib/termcap'],
+ extra_link_args=readline_extra_link_args,
+ libraries=readline_libs) )
+ if platform not in ['mac']:
+@@ -520,20 +490,20 @@
+ depends = ['socketmodule.h']) )
+ # Detect SSL support for the socket module (via _ssl)
+ search_for_ssl_incs_in = [
+- '/usr/local/ssl/include',
+- '/usr/contrib/ssl/include/'
++ sysroot + '/usr/local/ssl/include',
++ sysroot + '/usr/contrib/ssl/include/'
+ ]
+ ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+ search_for_ssl_incs_in
+ )
+ if ssl_incs is not None:
+ krb5_h = find_file('krb5.h', inc_dirs,
+- ['/usr/kerberos/include'])
++ [sysroot + '/usr/kerberos/include'])
+ if krb5_h:
+ ssl_incs += krb5_h
+ ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+- ['/usr/local/ssl/lib',
+- '/usr/contrib/ssl/lib/'
++ [sysroot + '/usr/local/ssl/lib',
++ sysroot + '/usr/contrib/ssl/lib/'
+ ] )
+
+ if (ssl_incs is not None and
+@@ -613,30 +583,30 @@
+ # construct a list of paths to look for the header file in on
+ # top of the normal inc_dirs.
+ db_inc_paths = [
+- '/usr/include/db4',
+- '/usr/local/include/db4',
+- '/opt/sfw/include/db4',
+- '/sw/include/db4',
+- '/usr/include/db3',
+- '/usr/local/include/db3',
+- '/opt/sfw/include/db3',
+- '/sw/include/db3',
++ sysroot + '/usr/include/db4',
++ sysroot + '/usr/local/include/db4',
++ sysroot + '/opt/sfw/include/db4',
++ sysroot + '/sw/include/db4',
++ sysroot + '/usr/include/db3',
++ sysroot + '/usr/local/include/db3',
++ sysroot + '/opt/sfw/include/db3',
++ sysroot + '/sw/include/db3',
+ ]
+ # 4.x minor number specific paths
+ for x in (0,1,2,3,4,5):
+- db_inc_paths.append('/usr/include/db4%d' % x)
+- db_inc_paths.append('/usr/include/db4.%d' % x)
+- db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
+- db_inc_paths.append('/usr/local/include/db4%d' % x)
+- db_inc_paths.append('/pkg/db-4.%d/include' % x)
+- db_inc_paths.append('/opt/db-4.%d/include' % x)
++ db_inc_paths.append(sysroot + '/usr/include/db4%d' % x)
++ db_inc_paths.append(sysroot + '/usr/include/db4.%d' % x)
++ db_inc_paths.append(sysroot + '/usr/local/BerkeleyDB.4.%d/include' % x)
++ db_inc_paths.append(sysroot + '/usr/local/include/db4%d' % x)
++ db_inc_paths.append(sysroot + '/pkg/db-4.%d/include' % x)
++ db_inc_paths.append(sysroot + '/opt/db-4.%d/include' % x)
+ # 3.x minor number specific paths
+ for x in (3,):
+- db_inc_paths.append('/usr/include/db3%d' % x)
+- db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x)
+- db_inc_paths.append('/usr/local/include/db3%d' % x)
+- db_inc_paths.append('/pkg/db-3.%d/include' % x)
+- db_inc_paths.append('/opt/db-3.%d/include' % x)
++ db_inc_paths.append(sysroot + '/usr/include/db3%d' % x)
++ db_inc_paths.append(sysroot + '/usr/local/BerkeleyDB.3.%d/include' % x)
++ db_inc_paths.append(sysroot + '/usr/local/include/db3%d' % x)
++ db_inc_paths.append(sysroot + '/pkg/db-3.%d/include' % x)
++ db_inc_paths.append(sysroot + '/opt/db-3.%d/include' % x)
+
+ # Add some common subdirectories for Sleepycat DB to the list,
+ # based on the standard include directories. This way DB3/4 gets
+@@ -746,12 +716,12 @@
+ # We hunt for #define SQLITE_VERSION "n.n.n"
+ # We need to find >= sqlite version 3.0.8
+ sqlite_incdir = sqlite_libdir = None
+- sqlite_inc_paths = [ '/usr/include',
+- '/usr/include/sqlite',
+- '/usr/include/sqlite3',
+- '/usr/local/include',
+- '/usr/local/include/sqlite',
+- '/usr/local/include/sqlite3',
++ sqlite_inc_paths = [ sysroot + '/usr/include',
++ sysroot + '/usr/include/sqlite',
++ sysroot + '/usr/include/sqlite3',
++ sysroot + '/usr/local/include',
++ sysroot + '/usr/local/include/sqlite',
++ sysroot + '/usr/local/include/sqlite3',
+ ]
+ MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
+ MIN_SQLITE_VERSION = ".".join([str(x)
+@@ -806,13 +776,13 @@
+ '_sqlite/util.c', ]
+
+ sqlite_defines = []
+- if sys.platform != "win32":
++ if self.get_platform() != "win32":
+ sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
+ else:
+ sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
+
+
+- if sys.platform == 'darwin':
++ if self.get_platform() == 'darwin':
+ # In every directory on the search path search for a dynamic
+ # library and then a static library, instead of first looking
+ # for dynamic libraries on the entiry path.
+@@ -837,7 +807,7 @@
+ # accidentally building this module with a later version of the
+ # underlying db library. May BSD-ish Unixes incorporate db 1.85
+ # symbols into libc and place the include file in /usr/include.
+- f = "/usr/include/db.h"
++ f = sysroot + "/usr/include/db.h"
+ if os.path.exists(f):
+ data = open(f).read()
+ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
+@@ -962,7 +932,7 @@
+ break
+ if version >= version_req:
+ if (self.compiler.find_library_file(lib_dirs, 'z')):
+- if sys.platform == "darwin":
++ if self.get_platform() == "darwin":
+ zlib_extra_link_args = ('-Wl,-search_paths_first',)
+ else:
+ zlib_extra_link_args = ()
+@@ -972,7 +942,7 @@
+
+ # Gustavo Niemeyer's bz2 module.
+ if (self.compiler.find_library_file(lib_dirs, 'bz2')):
+- if sys.platform == "darwin":
++ if self.get_platform() == "darwin":
+ bz2_extra_link_args = ('-Wl,-search_paths_first',)
+ else:
+ bz2_extra_link_args = ()
+@@ -1175,7 +1145,7 @@
+ # For 8.4a2, the X11 headers are not included. Rather than include a
+ # complicated search, this is a hard-coded path. It could bail out
+ # if X11 libs are not found...
+- include_dirs.append('/usr/X11R6/include')
++ include_dirs.append(sysroot + '/usr/X11R6/include')
+ frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
+
+ ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
+@@ -1217,7 +1187,7 @@
+ # Check for the include files on Debian and {Free,Open}BSD, where
+ # they're put in /usr/include/{tcl,tk}X.Y
+ dotversion = version
+- if '.' not in dotversion and "bsd" in sys.platform.lower():
++ if '.' not in dotversion and "bsd" in self.get_platform().lower():
+ # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
+ # but the include subdirs are named like .../include/tcl8.3.
+ dotversion = dotversion[:-1] + '.' + dotversion[-1]
+@@ -1244,19 +1214,19 @@
+
+ # Check for various platform-specific directories
+ if platform == 'sunos5':
+- include_dirs.append('/usr/openwin/include')
+- added_lib_dirs.append('/usr/openwin/lib')
+- elif os.path.exists('/usr/X11R6/include'):
+- include_dirs.append('/usr/X11R6/include')
+- added_lib_dirs.append('/usr/X11R6/lib64')
+- added_lib_dirs.append('/usr/X11R6/lib')
+- elif os.path.exists('/usr/X11R5/include'):
+- include_dirs.append('/usr/X11R5/include')
+- added_lib_dirs.append('/usr/X11R5/lib')
++ include_dirs.append(sysroot + '/usr/openwin/include')
++ added_lib_dirs.append(sysroot + '/usr/openwin/lib')
++ elif os.path.exists(sysroot + '/usr/X11R6/include'):
++ include_dirs.append(sysroot + '/usr/X11R6/include')
++ added_lib_dirs.append(sysroot + '/usr/X11R6/lib64')
++ added_lib_dirs.append(sysroot + '/usr/X11R6/lib')
++ elif os.path.exists(sysroot + '/usr/X11R5/include'):
++ include_dirs.append(sysroot + '/usr/X11R5/include')
++ added_lib_dirs.append(sysroot + '/usr/X11R5/lib')
+ else:
+ # Assume default location for X11
+- include_dirs.append('/usr/X11/include')
+- added_lib_dirs.append('/usr/X11/lib')
++ include_dirs.append(sysroot + '/usr/X11/include')
++ added_lib_dirs.append(sysroot + '/usr/X11/lib')
+
+ # If Cygwin, then verify that X is installed before proceeding
+ if platform == 'cygwin':
+@@ -1363,13 +1333,13 @@
+ '_ctypes/malloc_closure.c']
+ depends = ['_ctypes/ctypes.h']
+
+- if sys.platform == 'darwin':
++ if self.get_platform() == 'darwin':
+ sources.append('_ctypes/darwin/dlfcn_simple.c')
+ include_dirs.append('_ctypes/darwin')
+ # XXX Is this still needed?
+ ## extra_link_args.extend(['-read_only_relocs', 'warning'])
+
+- elif sys.platform == 'sunos5':
++ elif self.get_platform() == 'sunos5':
+ # XXX This shouldn't be necessary; it appears that some
+ # of the assembler code is non-PIC (i.e. it has relocations
+ # when it shouldn't. The proper fix would be to rewrite