]>
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 | |
255ac251 SS |
7 | major_ver = 3.6 |
8 | version = %{major_ver}.0 | |
9 | release = 1 | |
bf250edf MT |
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 | 65 | if [ "%{lib}" = "lib64" ]; then |
255ac251 | 66 | patch -Np1 -i %{DIR_SOURCE}/python-3.6.0-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 \ |
51630b1a MT |
86 | --enable-shared \ |
87 | --without-ensurepip | |
88 | ||
255ac251 SS |
89 | test |
90 | LD_LIBRARY_PATH=$(pwd) $(pwd)/python \ | |
91 | -m test.regrtest \ | |
92 | --verbose \ | |
93 | --findleaks \ | |
94 | -x test_distutils \ | |
95 | -x test_faulthandler \ | |
96 | -x test_gdb \ | |
97 | -x test_email \ | |
98 | -x test_subprocess \ | |
99 | -x test_float \ | |
100 | -x test_cmath \ | |
101 | -x test_asynchat \ | |
102 | -x test_asyncore | |
103 | ||
51630b1a MT |
104 | # # test_subprocess won't work on grsecurity-enabled kernels |
105 | # # test_float and test_cmath do not work on armv5tel (soft FPU) | |
255ac251 | 106 | end |
bf250edf MT |
107 | |
108 | install_cmds | |
109 | install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__ | |
110 | install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__ | |
111 | ||
112 | # Development tools | |
113 | mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3 | |
114 | install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools | |
115 | install Tools/README %{BUILDROOT}%{pylibdir}/Tools/ | |
116 | cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/ | |
117 | ||
118 | rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au | |
119 | ||
120 | # Switch all shebangs to refer to the specific Python version. | |
121 | LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \ | |
122 | -i "%{bindir}/python%{major_ver}" \ | |
123 | %{BUILDROOT} | |
124 | ||
125 | # Remove shebang lines from .py files that aren't executable, and | |
126 | # remove executability from .py files that don't have a shebang line: | |
127 | find %{BUILDROOT} -name \*.py \ | |
128 | \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \ | |
129 | -print -exec sed -i '1d' {} \; \) -o \( \ | |
130 | -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \ | |
131 | -exec chmod a-x {} \; \) \) | |
132 | ||
133 | # .xpm and .xbm files should not be executable: | |
134 | find %{BUILDROOT} \ | |
135 | \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \ | |
136 | -exec chmod a-x {} \; | |
137 | ||
138 | # Remove executable flag from files that shouldn't have it: | |
139 | chmod a-x \ | |
140 | %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \ | |
141 | %{BUILDROOT}%{pylibdir}/Tools/README | |
142 | ||
143 | # Get rid of DOS batch files: | |
144 | find %{BUILDROOT} -name \*.bat -exec rm {} \; | |
145 | ||
146 | # Get rid of backup files: | |
147 | find %{BUILDROOT}/ -name "*~" -exec rm -f {} \; | |
148 | rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt | |
149 | ||
150 | # Junk, no point in putting in -test sub-pkg | |
151 | rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py* | |
152 | ||
153 | # Fix end-of-line encodings: | |
154 | find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \; | |
155 | ||
156 | # Do bytecompilation with the newly installed interpreter. | |
157 | # compile *.pyo | |
158 | find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ | |
159 | LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ | |
160 | PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ | |
161 | 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:]]' || : | |
162 | # compile *.pyc | |
163 | find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ | |
164 | LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ | |
165 | PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ | |
166 | 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:]]' || : | |
167 | ||
168 | # Fixup permissions for shared libraries from non-standard 555 to standard 755: | |
169 | find %{BUILDROOT} -perm 555 -exec chmod 755 {} \; | |
170 | end | |
171 | end | |
172 | ||
173 | packages | |
174 | package %{name} | |
175 | # Define python-abi manually. | |
176 | provides | |
177 | python-abi = %{major_ver} | |
178 | end | |
179 | ||
180 | requires | |
181 | %{name}-libs = %{thisver} | |
182 | end | |
183 | end | |
184 | ||
185 | package %{name}-libs | |
186 | template LIBS | |
187 | ||
188 | requires | |
189 | expat >= 2.1.0 | |
190 | end | |
191 | ||
192 | files += %{dynload_dir} | |
193 | end | |
194 | ||
195 | package %{name}-devel | |
196 | template DEVEL | |
197 | ||
198 | requires += %{name}-libs = %{thisver} | |
199 | ||
200 | files += \ | |
201 | !%{libdir}/python*/config*/Makefile \ | |
202 | !%{includedir}/python*/pyconfig.h | |
203 | end | |
204 | ||
205 | package %{name}-test | |
206 | requires | |
207 | %{name} = %{thisver} | |
208 | end | |
209 | ||
210 | files | |
211 | %{pylibdir}/ctypes/test | |
212 | %{pylibdir}/distutils/testi | |
213 | %{pylibdir}/lib2to3/test | |
214 | %{pylibdir}/sqlite3/test | |
215 | %{pylibdir}/test | |
216 | %{pylibdir}/tkinter/test | |
217 | %{pylibdir}/unittest/test | |
218 | %{dynload_dir}/_ctypes_test* | |
219 | %{dynload_dir}/_testbuffer* | |
220 | %{dynload_dir}/_testcapi* | |
221 | end | |
222 | end | |
223 | ||
224 | package %{name}-tools | |
225 | requires | |
226 | %{name} = %{thisver} | |
227 | end | |
228 | ||
229 | files | |
230 | %{bindir}/python3-2to3 | |
231 | %{bindir}/2to3* | |
232 | %{bindir}/idle* | |
233 | %{pylibdir}/Tools | |
234 | end | |
235 | end | |
236 | ||
237 | package %{name}-debuginfo | |
238 | template DEBUGINFO | |
239 | end | |
240 | end |