Merge.
[fedora-mingw.git] / python3 / mingw32-python3.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 %define py3kdate 20081210
8
9 %define unicode ucs4
10
11 %define pybasever 3.1
12 %define tools_dir %{_libdir}/python%{pybasever}/Tools
13 %define demo_dir %{_libdir}/python%{pybasever}/Demo
14 %define doc_tools_dir %{_libdir}/python%{pybasever}/Doc/tools
15
16 Name:           mingw32-python3
17 Version:        3.1
18 Release:        0.2.svn%{py3kdate}.%{?dist}
19 Summary:        MinGW Windows port of Python 3 programming language
20
21 License:        Python
22 Group:          Development/Libraries
23 URL:            http://www.python.org/
24 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
25 BuildArch:      noarch
26
27 # Created by:
28 # svn co http://svn.python.org/projects/python/branches/py3k py3k
29 # tar --exclude .svn -zcf /tmp/py3k-%{py3kdate}.tar.gz py3k
30 Source0:        py3k-%{py3kdate}.tar.gz
31
32 # These are needed by ./configure when cross-compiling.
33 Source1000:     config.guess
34 Source1001:     config.sub
35
36 # The Python configure.in uses AC_STRUCT_ST_BLOCKS which wants a
37 # replacement fileblocks.c file if stat.st_blocks doesn't exist.
38 # We could use 'lib/fileblocks.c' from Gnulib (under GPL), but
39 # instead an empty file will do.  (Thanks Jim Meyering).
40 Source1002:     fileblocks.c
41
42 # Basic cross-compilation patch, mainly derived from
43 # http://bugs.python.org/issue1597850
44 Patch1000:      mingw32-python-3.1-cross-build.patch
45
46 # Windows has setlocale but not LC_CTYPE.
47 Patch1001:      mingw32-python-3.1-lc_ctype.patch
48
49 # Get posix module working.
50 Patch1002:      mingw32-python-3.1-posixmodule.patch
51
52 # Get miscellaneous modules working.
53 Patch1003:      mingw32-python-3.1-misc-modules.patch
54
55 # Get pwdmodule working (only barely functional on Windows).
56 Patch1004:      mingw32-python-3.1-pwdmodule.patch
57
58 BuildRequires:  mingw32-filesystem >= 40
59 BuildRequires:  mingw32-gcc
60 BuildRequires:  mingw32-binutils
61
62 # Only some of these deps have been ported to MinGW so far.  The
63 # rest are listed here as they appear in the native python spec,
64 # just so remember them.
65 BuildPrereq:    mingw32-readline
66 BuildPrereq:    mingw32-openssl
67 #BuildPrereq:    gmp-devel
68 #BuildPrereq:    ncurses-devel  <- doesn't exist for MinGW
69 BuildPrereq:    mingw32-pdcurses
70 BuildPrereq:    mingw32-gdbm
71 BuildPrereq:    mingw32-zlib
72 BuildPrereq:    mingw32-expat
73 #BuildPrereq:    libGL-devel
74 #BuildPrereq:    tk
75 #BuildPrereq:    tix
76 BuildPrereq:    mingw32-gcc-c++
77 #BuildPrereq:    libX11-devel <- no equivalent for MinGW
78 #BuildPrereq:    glibc-devel <- no equivalent for MinGW
79 #BuildPrereq:    tcl-devel
80 #BuildPrereq:    tk-devel
81 #BuildPrereq:    tix-devel
82 BuildPrereq:    mingw32-bzip2
83 BuildPrereq:    mingw32-sqlite
84 #BuildPrereq:    db4-devel >= 4.7
85
86 # Native dependencies.
87 BuildPrereq:    bzip2
88 BuildPrereq:    tar
89 BuildPrereq:    /usr/bin/find
90 BuildPrereq:    pkgconfig
91 BuildPrereq:    autoconf
92
93 # Will be required for cross-build.
94 #BuildRequires:  python = %{version}
95
96
97 %description
98 Python is an interpreted, interactive, object-oriented programming
99 language often compared to Tcl, Perl, Scheme or Java. Python includes
100 modules, classes, exceptions, very high level dynamic data types and
101 dynamic typing.
102
103 This packages is the MinGW port of the CPython interpreter,
104 development tools and libraries.
105
106
107 %prep
108 %setup -q -n py3k
109
110 %patch1000 -p0
111 %patch1001 -p0
112 %patch1002 -p0
113 %patch1003 -p0
114 %patch1004 -p0
115
116 cp %{SOURCE1000} .
117 cp %{SOURCE1001} .
118 cp %{SOURCE1002} Python/
119
120 autoreconf
121
122
123 %build
124 # Export these to avoid failing a cross-test in configure:
125 export ac_cv_file__dev_ptmx=no
126 export ac_cv_file__dev_ptc=no
127 export ac_cv_printf_zd_format=yes
128
129 %{_mingw32_configure} \
130   --enable-unicode=%{unicode} \
131   --enable-shared
132 #  --enable-ipv6
133
134 make OPT="%{_mingw32_cflags}"
135
136 exit 1
137
138 topdir=`pwd`
139 LD_LIBRARY_PATH=$topdir \
140   $topdir/python \
141     Tools/scripts/pathfix.py -i "%{_bindir}/env python%{pybasever}" .
142 # Rebuild with new python
143 # We need a link to a versioned python in the build directory
144 ln -s python python%{pybasever}
145 LD_LIBRARY_PATH=$topdir \
146   PATH=$PATH:$topdir \
147   make -s OPT="$CFLAGS"
148 # %{?_smp_mflags}
149
150
151 %install
152 rm -rf $RPM_BUILD_ROOT
153 exit 1
154 make DESTDIR=$RPM_BUILD_ROOT install
155
156 # Remove static libraries but DON'T remove *.dll.a files.
157 rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libfoo.a
158
159
160 %clean
161 rm -rf $RPM_BUILD_ROOT
162
163
164 %files
165 %defattr(-,root,root)
166 %doc XXX
167 %{_mingw32_bindir}/foo.dll
168 %{_mingw32_libdir}/foo.dll.a
169 # etc.
170
171
172 %changelog
173 * Fri Feb 20 2009 Richard W.M. Jones <rjones@redhat.com> - 3.1-0.2.svn20081210.
174 - Rebuild for mingw32-gcc 4.4
175
176 * Fri Oct 24 2008 Richard W.M. Jones <rjones@redhat.com> - 2.5.2-1
177 - Initial RPM release.