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}
7 %{!?__python_ver:%define __python_ver EMPTY}
8 #define __python_ver 25
11 %define _default_patch_fuzz 2
13 %if "%{__python_ver}" != "EMPTY"
15 %define python python%{__python_ver}
16 %define tkinter tkinter%{__python_ver}
20 %define tkinter tkinter
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
31 Summary: MinGW Windows port of Python programming language
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)
41 BuildRequires: mingw32-filesystem >= 30
42 BuildRequires: mingw32-gcc
43 BuildRequires: mingw32-binutils
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
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
69 # Native dependencies.
72 BuildPrereq: /usr/bin/find
73 BuildPrereq: pkgconfig
76 # Required for cross-build.
77 BuildRequires: python = %{version}
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
104 # MinGW-specific patches.
105 # See: http://bugs.python.org/issue1597850
106 Patch1000: mingw32-python-2.5.2-cross.patch
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
115 This packages is the MinGW port of Python development tools and
120 %setup -q -n Python-%{version}
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
130 %patch8 -p1 -b .xmlrpc
132 # Try not disabling egg-infos, bz#414711
133 #patch50 -p1 -b .egginfo
134 %patch60 -p1 -b .db47
136 %if "%{_lib}" == "lib64"
137 %patch101 -p1 -b .lib64-regex
138 %patch102 -p1 -b .lib64
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
149 # 64bit, but not lib64 arches need this too...
150 %patch101 -p1 -b .lib64-regex
153 %patch260 -p1 -b .set_wakeup_fd
155 %patch999 -p1 -b .cve2007-4965
156 %patch998 -p0 -b .cve2008-2316
158 %patch1000 -p1 -b .mingw32
160 # This shouldn't be necesarry, but is right now (2.2a3)
161 find -name "*~" |xargs rm -f
165 export PKG_CONFIG_PATH="%{_mingw32_libdir}/pkgconfig"
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
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}"
180 export CROSS_ROOT=%{_mingw32_prefix}
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
187 # Automake is needed to get config.sub & config.guess.
188 automake --add-missing ||:
189 # Autoconf is needed because we patched configure.in.
193 --build=%_build --host=%{_mingw32_host} --target=%{_mingw32_target} \
194 --prefix=%{_mingw32_prefix} \
195 --enable-unicode=%{unicode} \
203 LD_LIBRARY_PATH=$topdir \
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 \
211 make -s OPT="$CFLAGS"
216 rm -rf $RPM_BUILD_ROOT
218 make DESTDIR=$RPM_BUILD_ROOT install
220 # Remove static libraries but DON'T remove *.dll.a files.
221 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libfoo.a
225 rm -rf $RPM_BUILD_ROOT
229 %defattr(-,root,root)
230 %{_mingw32_bindir}/foo.dll
231 %{_mingw32_libdir}/foo.dll.a
236 * Fri Oct 24 2008 Richard W.M. Jones <rjones@redhat.com> - 2.5.2-1
237 - Initial RPM release.