recipes: python/python3: Upgraded to version 3.8.2
[dragora.git] / recipes / python / python2 / recipe
blob1d7136457eca658ba91f8f4c8a3173ff197249c5
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.
18 program=Python
19 version=2.7.17
20 short_version=2.7
21 release=2
23 # Set 'outdir' for a nice and well-organized output directory
24 outdir="${outdir}/${arch}/python"
26 tarname=${program}-${version}.tgz
28 # Remote source(s)
29 fetch=http://www.python.org/ftp/python/${version}/$tarname
31 pkgname=python2
33 description="
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
40 Scheme.
43 homepage=http://www.python.org/
44 license="Python Software Foundation License"
46 # Source documentation
47 docs="LICENSE README"
48 docsdir="${docdir}/${pkgname}-${version}"
50 build()
52     set -e
54     unpack "${tardir}/$tarname"
56     cd "$srcdir"
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="" \
65      $configure_args \
66      --libdir=/usr/lib${libSuffix} \
67      --mandir=$mandir \
68      --docdir=$docsdir \
69      --build="$(cc -dumpmachine)" \
70      --enable-shared \
71      --enable-ipv6 \
72      --enable-unicode=ucs4 \
73      --with-ensurepip=yes \
74      --with-threads \
75      --with-valgrind \
76      --with-system-expat \
77      --with-system-ffi
79     make -j${jobs} V=1
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
84     (
85         cd Tools || exit 2
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}/"
91     )
93     # Make some useful symlinks at usr/bin
94     (
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
100     )
101     unset short_version TOOL_DIR
103     # Compress and link man pages (if needed)
104     if test -d "${destdir}/$mandir"
105     then
106         (
107             cd "${destdir}/$mandir"
108             find . -type f -exec lzip -9 '{}' +
109             find . -type l | while read -r file
110             do
111                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
112                 rm -- "$file"
113             done
114         )
115     fi
117     # Copy documentation
118     mkdir -p "${destdir}${docsdir}"
119     cp -p $docs "${destdir}${docsdir}/"