boost/ocaml/python - all NON-WORKING at the moment.
[fedora-mingw.git] / python / mingw32-python.spec
1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
6
7 %{!?__python_ver:%define __python_ver EMPTY}
8 #define __python_ver 25
9 %define unicode ucs4
10
11 %define _default_patch_fuzz     2
12
13 %if "%{__python_ver}" != "EMPTY"
14 %define main_python 0
15 %define python python%{__python_ver}
16 %define tkinter tkinter%{__python_ver}
17 %else
18 %define main_python 1
19 %define python python
20 %define tkinter tkinter
21 %endif
22
23 %define pybasever 2.5
24 %define tools_dir %{_libdir}/python%{pybasever}/Tools
25 %define demo_dir %{_libdir}/python%{pybasever}/Demo
26 %define doc_tools_dir %{_libdir}/python%{pybasever}/Doc/tools
27
28 Name:           mingw32-python
29 Version:        2.5.2
30 Release:        1%{?dist}
31 Summary:        MinGW Windows port of Python programming language
32
33 License:        Python
34 Group:          Development/Libraries
35 URL:            http://www.python.org/
36 Source0:        http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
37 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
38
39 BuildArch:      noarch
40
41 BuildRequires:  mingw32-filesystem >= 30
42 BuildRequires:  mingw32-gcc
43 BuildRequires:  mingw32-binutils
44
45 # Only some of these deps have been ported to MinGW so far.  The
46 # rest are listed here as they appear in the native python spec,
47 # just so remember them.
48 BuildPrereq:    mingw32-readline
49 BuildPrereq:    mingw32-openssl
50 #BuildPrereq:    gmp-devel
51 #BuildPrereq:    ncurses-devel  <- doesn't exist for MinGW
52 BuildPrereq:    mingw32-pdcurses
53 BuildPrereq:    mingw32-gdbm
54 BuildPrereq:    mingw32-zlib
55 #BuildPrereq:    expat-devel
56 #BuildPrereq:    libGL-devel
57 #BuildPrereq:    tk
58 #BuildPrereq:    tix
59 BuildPrereq:    mingw32-gcc-c++
60 #BuildPrereq:    libX11-devel
61 #BuildPrereq:    glibc-devel <- no equivalent for MinGW
62 #BuildPrereq:    tcl-devel
63 #BuildPrereq:    tk-devel
64 #BuildPrereq:    tix-devel
65 BuildPrereq:    mingw32-bzip2
66 BuildPrereq:    mingw32-sqlite
67 #BuildPrereq:    db4-devel >= 4.7
68
69 # Native dependencies.
70 BuildPrereq:    bzip2
71 BuildPrereq:    tar
72 BuildPrereq:    /usr/bin/find
73 BuildPrereq:    pkgconfig
74 BuildPrereq:    autoconf
75
76 # Required for cross-build.
77 BuildRequires:  python = %{version}
78
79 # Patches from native Fedora package.
80 Patch0: python-2.5-config.patch
81 Patch1: Python-2.2.1-pydocnogui.patch
82 Patch2: python-2.3.4-pydocnodoc.patch
83 Patch3: python-2.4.1-canonicalize.patch
84 Patch4: python-2.5-cflags.patch
85 Patch5: python-2.5.1-ctypes-exec-stack.patch
86 Patch6: python-2.5.1-plural-fix.patch
87 Patch7: python-2.5.1-sqlite-encoding.patch
88 Patch8: python-2.5-xmlrpclib-marshal-objects.patch
89 Patch9: python-2.5-tkinter.patch
90 Patch10: python-2.5.2-binutils-no-dep.patch
91 Patch11: python-2.5.1-codec-ascii-tolower.patch
92 Patch12: python-2.5.1-pysqlite.patch
93 Patch13: python-2.5.1-socketmodule-constants.patch
94 Patch14: python-2.5.1-socketmodule-constants2.patch
95 Patch15: python-2.5.1-listdir.patch
96 #Patch50: python-2.5-disable-egginfo.patch
97 Patch60: python-2.5.2-db47.patch
98 Patch101: python-2.3.4-lib64-regex.patch
99 Patch102: python-2.5-lib64.patch
100 Patch260: python-2.5.2-set_wakeup_fd4.patch
101 Patch999: python-2.5.CVE-2007-4965-int-overflow.patch
102 Patch998: python-2.5-CVE-2008-2316.patch
103
104 # MinGW-specific patches.
105 # See: http://bugs.python.org/issue1597850
106 Patch1000: mingw32-python-2.5.2-cross.patch
107
108
109 %description
110 Python is an interpreted, interactive, object-oriented programming
111 language often compared to Tcl, Perl, Scheme or Java. Python includes
112 modules, classes, exceptions, very high level dynamic data types and
113 dynamic typing.
114
115 This packages is the MinGW port of Python development tools and
116 libraries.
117
118
119 %prep
120 %setup -q -n Python-%{version}
121
122 %patch0 -p1 -b .rhconfig
123 %patch1 -p1 -b .no_gui
124 %patch2 -p1 -b .no-doc
125 %patch3 -p1 -b .canonicalize
126 %patch4 -p1 -b .cflags
127 %patch5 -p1 -b .ctypesexec
128 %patch6 -p1 -b .plural
129 %patch7 -p1
130 %patch8 -p1 -b .xmlrpc
131
132 # Try not disabling egg-infos, bz#414711
133 #patch50 -p1 -b .egginfo
134 %patch60 -p1 -b .db47
135
136 %if "%{_lib}" == "lib64"
137 %patch101 -p1 -b .lib64-regex
138 %patch102 -p1 -b .lib64
139 %endif
140
141 %patch10 -p1 -b .binutils-no-dep
142 %patch11 -p1 -b .ascii-tolower
143 %patch12 -p1 -b .pysqlite-2.3.3-minimal
144 %patch13 -p1 -b .socketmodule
145 %patch14 -p1 -b .socketmodule
146 %patch15 -p1 -b .socketmodule
147
148 %ifarch alpha ia64
149 # 64bit, but not lib64 arches need this too...
150 %patch101 -p1 -b .lib64-regex
151 %endif
152
153 %patch260 -p1 -b .set_wakeup_fd
154
155 %patch999 -p1 -b .cve2007-4965
156 %patch998 -p0 -b .cve2008-2316
157
158 %patch1000 -p1 -b .mingw32
159
160 # This shouldn't be necesarry, but is right now (2.2a3)
161 find -name "*~" |xargs rm -f
162
163
164 %build
165 export PKG_CONFIG_PATH="%{_mingw32_libdir}/pkgconfig"
166
167 # *_FOR_BUILD refer to the build compiler (for building intermediate
168 # tools), not the cross-compiler.
169 export CC_FOR_BUILD=gcc
170 export PYTHON_FOR_BUILD=/usr/bin/python
171
172 export CFLAGS="%{_mingw32_cflags} -D_GNU_SOURCE `pkg-config --cflags openssl`"
173 export LDFLAGS="`pkg-config --libs-only-L openssl`"
174 export CXXFLAGS="%{_mingw32_cflags} -m32 -D_GNU_SOURCE"
175 export OPT="%{_mingw32_cflags} -D_GNU_SOURCE"
176 export LINKCC="%{_mingw32_cc}"
177 export LDSHARED="%{_mingw32_cc}"
178 export BLDSHARED="%{_mingw32_cc}"
179
180 export CROSS_ROOT=%{_mingw32_prefix}
181
182 # Export these to avoid failing a cross-test in configure:
183 export ac_cv_file__dev_ptmx=no
184 export ac_cv_file__dev_ptc=no
185 export ac_cv_printf_zd_format=yes
186
187 # Automake is needed to get config.sub & config.guess.
188 automake --add-missing ||:
189 # Autoconf is needed because we patched configure.in.
190 autoconf
191
192 ./configure \
193   --build=%_build --host=%{_mingw32_host} --target=%{_mingw32_target} \
194   --prefix=%{_mingw32_prefix} \
195   --enable-unicode=%{unicode} \
196   --enable-shared
197 #  --enable-ipv6
198
199 make OPT="$CFLAGS"
200 # %{?_smp_mflags}
201
202 topdir=`pwd`
203 LD_LIBRARY_PATH=$topdir \
204   $topdir/python \
205     Tools/scripts/pathfix.py -i "%{_bindir}/env python%{pybasever}" .
206 # Rebuild with new python
207 # We need a link to a versioned python in the build directory
208 ln -s python python%{pybasever}
209 LD_LIBRARY_PATH=$topdir \
210   PATH=$PATH:$topdir \
211   make -s OPT="$CFLAGS"
212 # %{?_smp_mflags}
213
214
215 %install
216 rm -rf $RPM_BUILD_ROOT
217 exit 1
218 make DESTDIR=$RPM_BUILD_ROOT install
219
220 # Remove static libraries but DON'T remove *.dll.a files.
221 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libfoo.a
222
223
224 %clean
225 rm -rf $RPM_BUILD_ROOT
226
227
228 %files
229 %defattr(-,root,root)
230 %{_mingw32_bindir}/foo.dll
231 %{_mingw32_libdir}/foo.dll.a
232 # etc.
233
234
235 %changelog
236 * Fri Oct 24 2008 Richard W.M. Jones <rjones@redhat.com> - 2.5.2-1
237 - Initial RPM release.