1 # Build recipe for python2.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2020 Matias Fonzo, <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
23 # Set 'outdir' for a nice and well-organized output directory
24 outdir="${outdir}/${arch}/python"
26 tarname=${program}-${version}.tgz
29 fetch=http://www.python.org/ftp/python/${version}/$tarname
34 Multi-paradigm programming language (v2).
36 Python is an interpreted, interactive object-oriented programming
37 language suitable (amongst other uses) for distributed application
38 development, scripting, numeric computing and system testing. Python
39 is often compared to Tcl, Perl, Java, JavaScript, Visual Basic or
43 homepage=http://www.python.org/
44 license="Python Software Foundation License"
46 # Source documentation
48 docsdir="${docdir}/${pkgname}-${version}"
54 unpack "${tardir}/$tarname"
58 # Set sane permissions
59 chmod -R u+w,go-w,a+rX-s .
61 # Use system libraries instead of the bundle ones
62 rm -rf Modules/expat Modules/zlib Modules/_ctypes/libffi*
64 ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" OPT="" \
66 --libdir=/usr/lib${libSuffix} \
69 --build="$(cc -dumpmachine)" \
72 --enable-unicode=ucs4 \
73 --with-ensurepip=yes \
80 make -j${jobs} DESTDIR="$destdir" install
82 # Include the Python tools under site-packages
83 TOOL_DIR=/usr/lib/python${short_version}/site-packages
87 # Do not clobber README file in site-packages directory
88 test -f README && mv -f README README.Tools
90 cp -rP ./* "${destdir}${TOOL_DIR}/"
93 # Make some useful symlinks at usr/bin
95 cd "${destdir}/usr/bin" || exit 2
97 ln -sf "${TOOL_DIR}/i18n/msgfmt.py" msgfmt.py
98 ln -sf "${TOOL_DIR}/i18n/pygettext.py" pygettext.py
99 ln -sf "${TOOL_DIR}/pynche/pynche" pynche
101 unset short_version TOOL_DIR
103 # Compress and link man pages (if needed)
104 if test -d "${destdir}/$mandir"
107 cd "${destdir}/$mandir"
108 find . -type f -exec lzip -9 '{}' +
109 find . -type l | while read -r file
111 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
118 mkdir -p "${destdir}${docsdir}"
119 cp -p $docs "${destdir}${docsdir}/"