]>
Commit | Line | Data |
---|---|---|
bf250edf MT |
1 | ############################################################################### |
2 | # IPFire.org - An Open Source Firewall Solution # | |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
4 | ############################################################################### | |
5 | ||
6 | name = python3 | |
05f64a9f MT |
7 | major_ver = 3.4 |
8 | version = %{major_ver}.3 | |
bf250edf MT |
9 | release = 1 |
10 | thisapp = Python-%{version} | |
11 | ||
12 | groups = Development/Languages | |
13 | url = http://www.python.org | |
14 | license = Python | |
15 | summary = Version 3 of the Python programming language. | |
16 | ||
17 | description | |
18 | Python is an interpreted, interactive, object-oriented programming | |
19 | language often compared to Tcl, Perl, Scheme or Java. Python includes | |
20 | modules, classes, exceptions, very high level dynamic data types and | |
21 | dynamic typing. Python supports interfaces to many system calls and | |
22 | libraries, as well as to various windowing systems. | |
23 | end | |
24 | ||
25 | source_dl = http://python.org/ftp/python/%{version}/ | |
26 | sources = %{thisapp}.tar.xz | |
27 | ||
28 | pylibdir = %{libdir}/python%{major_ver} | |
29 | dynload_dir= %{pylibdir}/lib-dynload | |
30 | ||
31 | build | |
32 | requires | |
33 | autoconf | |
34 | automake | |
35 | bzip2 | |
36 | bzip2-devel | |
bf250edf MT |
37 | expat-devel >= 2.1.0 |
38 | findutils | |
39 | gdbm-devel >= 1.10 | |
40 | gcc-c++ | |
41 | glibc-devel | |
42 | gmp-devel | |
05f64a9f | 43 | libdb-devel |
bf250edf MT |
44 | libffi-devel |
45 | libGL-devel | |
46 | libX11-devel | |
47 | ncurses-devel | |
48 | openssl-devel | |
49 | pkg-config | |
50 | readline-devel | |
51 | sqlite-devel | |
52 | tar | |
53 | tcl-devel | |
54 | util-linux | |
55 | xz-devel | |
56 | zlib-devel | |
57 | end | |
58 | ||
59 | export CFLAGS += -D_GNU_SOURCE -fwrapv | |
60 | export CXXFLAGS += -D_GNU_SOURCE -fwrapv | |
61 | export OPT = %{CFLAGS} | |
62 | export LINKCC = gcc | |
63 | ||
64 | prepare_cmds | |
05f64a9f MT |
65 | if [ "%{lib}" = "lib64" ]; then |
66 | patch -Np1 -i %{DIR_SOURCE}/python-3.4.3-lib64.patch | |
bf250edf MT |
67 | fi |
68 | ||
69 | # Remove embedded copies of expat and libffi | |
70 | rm -rf Modules/{expat,zlib} | |
71 | rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx} | |
72 | ||
73 | # Make all source files owned by root. | |
74 | chown root.root -R . | |
75 | ||
76 | autoreconf --force | |
77 | end | |
78 | ||
79 | configure_options += \ | |
80 | --enable-ipv6 \ | |
81 | --with-computed-gotos=yes \ | |
82 | --with-dbmliborder=gdbm:ndbm:bdb \ | |
83 | --with-system-expat \ | |
84 | --with-system-ffi \ | |
05f64a9f | 85 | --enable-loadable-sqlite-extensions \ |
bf250edf MT |
86 | --enable-shared |
87 | ||
05f64a9f MT |
88 | test |
89 | LD_LIBRARY_PATH=$(pwd) $(pwd)/python \ | |
90 | -m test.regrtest \ | |
91 | --verbose \ | |
92 | --findleaks \ | |
93 | -x test_distutils \ | |
94 | -x test_faulthandler \ | |
95 | -x test_gdb \ | |
96 | -x test_email \ | |
97 | -x test_subprocess \ | |
98 | -x test_float \ | |
99 | -x test_cmath \ | |
100 | -x test_asynchat \ | |
101 | -x test_asyncore | |
102 | ||
103 | # test_subprocess won't work on grsecurity-enabled kernels | |
104 | # test_float and test_cmath do not work on armv5tel (soft FPU) | |
105 | end | |
bf250edf MT |
106 | |
107 | install_cmds | |
108 | install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__ | |
109 | install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__ | |
110 | ||
111 | # Development tools | |
112 | mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3 | |
113 | install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools | |
114 | install Tools/README %{BUILDROOT}%{pylibdir}/Tools/ | |
115 | cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/ | |
116 | ||
117 | rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au | |
118 | ||
119 | # Switch all shebangs to refer to the specific Python version. | |
120 | LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \ | |
121 | -i "%{bindir}/python%{major_ver}" \ | |
122 | %{BUILDROOT} | |
123 | ||
124 | # Remove shebang lines from .py files that aren't executable, and | |
125 | # remove executability from .py files that don't have a shebang line: | |
126 | find %{BUILDROOT} -name \*.py \ | |
127 | \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \ | |
128 | -print -exec sed -i '1d' {} \; \) -o \( \ | |
129 | -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \ | |
130 | -exec chmod a-x {} \; \) \) | |
131 | ||
132 | # .xpm and .xbm files should not be executable: | |
133 | find %{BUILDROOT} \ | |
134 | \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \ | |
135 | -exec chmod a-x {} \; | |
136 | ||
137 | # Remove executable flag from files that shouldn't have it: | |
138 | chmod a-x \ | |
139 | %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \ | |
140 | %{BUILDROOT}%{pylibdir}/Tools/README | |
141 | ||
142 | # Get rid of DOS batch files: | |
143 | find %{BUILDROOT} -name \*.bat -exec rm {} \; | |
144 | ||
145 | # Get rid of backup files: | |
146 | find %{BUILDROOT}/ -name "*~" -exec rm -f {} \; | |
147 | rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt | |
148 | ||
149 | # Junk, no point in putting in -test sub-pkg | |
150 | rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py* | |
151 | ||
152 | # Fix end-of-line encodings: | |
153 | find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \; | |
154 | ||
155 | # Do bytecompilation with the newly installed interpreter. | |
156 | # compile *.pyo | |
157 | find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ | |
158 | LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ | |
159 | PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ | |
160 | xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2]) for f in sys.argv[1:]]' || : | |
161 | # compile *.pyc | |
162 | find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ | |
163 | LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ | |
164 | PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ | |
165 | xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2], optimize=0) for f in sys.argv[1:]]' || : | |
166 | ||
167 | # Fixup permissions for shared libraries from non-standard 555 to standard 755: | |
168 | find %{BUILDROOT} -perm 555 -exec chmod 755 {} \; | |
169 | end | |
170 | end | |
171 | ||
172 | packages | |
173 | package %{name} | |
174 | # Define python-abi manually. | |
175 | provides | |
176 | python-abi = %{major_ver} | |
177 | end | |
178 | ||
179 | requires | |
180 | %{name}-libs = %{thisver} | |
181 | end | |
182 | end | |
183 | ||
184 | package %{name}-libs | |
185 | template LIBS | |
186 | ||
187 | requires | |
188 | expat >= 2.1.0 | |
189 | end | |
190 | ||
191 | files += %{dynload_dir} | |
192 | end | |
193 | ||
194 | package %{name}-devel | |
195 | template DEVEL | |
196 | ||
197 | requires += %{name}-libs = %{thisver} | |
198 | ||
199 | files += \ | |
200 | !%{libdir}/python*/config*/Makefile \ | |
201 | !%{includedir}/python*/pyconfig.h | |
202 | end | |
203 | ||
204 | package %{name}-test | |
205 | requires | |
206 | %{name} = %{thisver} | |
207 | end | |
208 | ||
209 | files | |
210 | %{pylibdir}/ctypes/test | |
211 | %{pylibdir}/distutils/testi | |
212 | %{pylibdir}/lib2to3/test | |
213 | %{pylibdir}/sqlite3/test | |
214 | %{pylibdir}/test | |
215 | %{pylibdir}/tkinter/test | |
216 | %{pylibdir}/unittest/test | |
217 | %{dynload_dir}/_ctypes_test* | |
218 | %{dynload_dir}/_testbuffer* | |
219 | %{dynload_dir}/_testcapi* | |
220 | end | |
221 | end | |
222 | ||
223 | package %{name}-tools | |
224 | requires | |
225 | %{name} = %{thisver} | |
226 | end | |
227 | ||
228 | files | |
229 | %{bindir}/python3-2to3 | |
230 | %{bindir}/2to3* | |
231 | %{bindir}/idle* | |
232 | %{pylibdir}/Tools | |
233 | end | |
234 | end | |
235 | ||
236 | package %{name}-debuginfo | |
237 | template DEBUGINFO | |
238 | end | |
239 | end |