cp python to python24 in prop to migrate to 2.5, if 2.5 succeeds completely, python24...
[openwrt/svn-archive/archive.git] / lang / python24 / patches / 000-cross-compile.patch
1 diff -uN Python-2.4.3.orig/Makefile.pre.in Python-2.4.3.cc/Makefile.pre.in
2 --- Python-2.4.3.orig/Makefile.pre.in 2006-03-13 07:08:41.000000000 -0600
3 +++ Python-2.4.3.cc/Makefile.pre.in 2006-10-13 14:47:12.000000000 -0500
4 @@ -162,6 +162,7 @@
5
6 PYTHON= python$(EXE)
7 BUILDPYTHON= python$(BUILDEXE)
8 +HOSTPYTHON= ./$(BUILDPYTHON)
9
10 # === Definitions added by makesetup ===
11
12 @@ -189,6 +190,8 @@
13 # Parser
14 PGEN= Parser/pgen$(EXE)
15
16 +HOSTPGEN= $(PGEN)
17 +
18 POBJS= \
19 Parser/acceler.o \
20 Parser/grammar1.o \
21 @@ -320,8 +323,8 @@
22 # Build the shared modules
23 sharedmods: $(BUILDPYTHON)
24 case $$MAKEFLAGS in \
25 - *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
26 - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
27 + *-s*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
28 + *) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
29 esac
30
31 # buildno should really depend on something like LIBRARY_SRC
32 @@ -442,8 +445,7 @@
33
34
35 $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
36 - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
37 -
38 + -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
39 $(PGEN): $(PGENOBJS)
40 $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
41
42 @@ -723,19 +725,19 @@
43 done
44 $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
45 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
46 - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
47 + $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
48 -d $(LIBDEST) -f \
49 -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
50 PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
51 - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
52 + $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
53 -d $(LIBDEST) -f \
54 -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
55 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
56 - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
57 + $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
58 -d $(LIBDEST)/site-packages -f \
59 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
60 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
61 - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
62 + $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
63 -d $(LIBDEST)/site-packages -f \
64 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
65
66 @@ -830,7 +832,8 @@
67 # Install the dynamically loadable modules
68 # This goes into $(exec_prefix)
69 sharedinstall:
70 - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
71 + CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
72 + $(HOSTPYTHON) -E $(srcdir)/setup.py install \
73 --prefix=$(prefix) \
74 --install-scripts=$(BINDIR) \
75 --install-platlib=$(DESTSHARED) \
76 diff -uN Python-2.4.3.orig/setup.py Python-2.4.3.cc/setup.py
77 --- Python-2.4.3.orig/setup.py 2006-03-23 13:07:46.000000000 -0600
78 +++ Python-2.4.3.cc/setup.py 2006-10-13 15:36:01.000000000 -0500
79 @@ -205,26 +205,30 @@
80 try:
81 imp.load_dynamic(ext.name, ext_filename)
82 except ImportError, why:
83 - self.announce('*** WARNING: renaming "%s" since importing it'
84 - ' failed: %s' % (ext.name, why), level=3)
85 - assert not self.inplace
86 - basename, tail = os.path.splitext(ext_filename)
87 - newname = basename + "_failed" + tail
88 - if os.path.exists(newname):
89 - os.remove(newname)
90 - os.rename(ext_filename, newname)
91 -
92 - # XXX -- This relies on a Vile HACK in
93 - # distutils.command.build_ext.build_extension(). The
94 - # _built_objects attribute is stored there strictly for
95 - # use here.
96 - # If there is a failure, _built_objects may not be there,
97 - # so catch the AttributeError and move on.
98 - try:
99 - for filename in self._built_objects:
100 - os.remove(filename)
101 - except AttributeError:
102 - self.announce('unable to remove files (ignored)')
103 + if os.environ.get('CROSS_COMPILE') != "yes":
104 + self.announce('*** WARNING: renaming "%s" since importing it'
105 + ' failed: %s' % (ext.name, why), level=3)
106 + assert not self.inplace
107 + basename, tail = os.path.splitext(ext_filename)
108 + newname = basename + "_failed" + tail
109 + if os.path.exists(newname):
110 + os.remove(newname)
111 + os.rename(ext_filename, newname)
112 +
113 + # XXX -- This relies on a Vile HACK in
114 + # distutils.command.build_ext.build_extension(). The
115 + # _built_objects attribute is stored there strictly for
116 + # use here.
117 + # If there is a failure, _built_objects may not be there,
118 + # so catch the AttributeError and move on.
119 + try:
120 + for filename in self._built_objects:
121 + os.remove(filename)
122 + except AttributeError:
123 + self.announce('unable to remove files (ignored)')
124 + else:
125 + self.announce('WARNING: "%s" failed importing, but we leave it because we are cross-compiling' % ext.name)
126 +
127 except:
128 exc_type, why, tb = sys.exc_info()
129 self.announce('*** WARNING: importing extension "%s" '