recipes: python/python3: Upgraded to version 3.8.2
[dragora.git] / recipes / python / python3 / recipe
blob5ae38e3e966bc0ddd9d0bc59d737b0c2bba0c431
1 # Build recipe for python3.
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=3.8.2
20 short_version="${version%.*}"
21 release=1
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=python3
33 description="
34 Multi-paradigm programming language (v3).
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.
40 Python is often compared to Tcl, Perl, Java, JavaScript, Visual
41 Basic or Scheme.
44 homepage=http://www.python.org/
45 license="Python Software Foundation License"
47 # Source documentation
48 docs="LICENSE README.rst"
49 docsdir="${docdir}/${pkgname}-${version}"
51 build()
53     set -e
55     unpack "${tardir}/$tarname"
57     cd "$srcdir"
59     # Set sane permissions
60     chmod -R u+w,go-w,a+rX-s .
62     # Use system libraries instead of the bundle ones
63     rm -rf Modules/expat Modules/zlib Modules/_ctypes/libffi*
65     ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
66      $configure_args \
67      --libdir=/usr/lib${libSuffix} \
68      --mandir=$mandir \
69      --docdir=$docsdir \
70      --build="$(cc -dumpmachine)" \
71      --enable-shared \
72      --enable-loadable-sqlite-extensions \
73      --enable-ipv6 \
74      --with-ensurepip=yes \
75      --with-threads \
76      --with-valgrind \
77      --with-system-expat \
78      --with-system-ffi
80     make -j${jobs} V=1
81     make -j${jobs} DESTDIR="$destdir" install
83     # Include the Python tools under site-packages
84     TOOL_DIR=/usr/lib/python${short_version}
85     (
86         cd Tools || exit 2
88         # Do not clobber README file in site-packages directory
89         test -f README && mv -f README README.Tools
91         cp -rP ./* "${destdir}${TOOL_DIR}/"
92     )
94     # Make some useful symlinks at usr/bin
95     (
96         cd "${destdir}/usr/bin" || exit 2
98         ln -sf "${TOOL_DIR}/i18n/msgfmt.py" msgfmt${short_version}.py
99         ln -sf "${TOOL_DIR}/i18n/pygettext.py" pygettext${short_version}.py
100         ln -sf "${TOOL_DIR}/pynche/pynche" pynche${short_version}
101     )
102     unset short_version TOOL_DIR
104     # Compress and link man pages (if needed)
105     if test -d "${destdir}/$mandir"
106     then
107         (
108             cd "${destdir}/$mandir"
109             find . -type f -exec lzip -9 '{}' +
110             find . -type l | while read -r file
111             do
112                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
113                 rm -- "$file"
114             done
115         )
116     fi
118     # Copy documentation
119     mkdir -p "${destdir}${docsdir}"
121     for file in $docs
122     do
123         if test -e $file
124         then
125             cp -p $file "${destdir}${docsdir}"
126         fi
127     done