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.
20 short_version="${version%.*}"
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 (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
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}"
55 unpack "${tardir}/$tarname"
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" \
67 --libdir=/usr/lib${libSuffix} \
70 --build="$(cc -dumpmachine)" \
72 --enable-loadable-sqlite-extensions \
74 --with-ensurepip=yes \
81 make -j${jobs} DESTDIR="$destdir" install
83 # Include the Python tools under site-packages
84 TOOL_DIR=/usr/lib/python${short_version}
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}/"
94 # Make some useful symlinks at usr/bin
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}
102 unset short_version TOOL_DIR
104 # Compress and link man pages (if needed)
105 if test -d "${destdir}/$mandir"
108 cd "${destdir}/$mandir"
109 find . -type f -exec lzip -9 '{}' +
110 find . -type l | while read -r file
112 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
119 mkdir -p "${destdir}${docsdir}"
125 cp -p $file "${destdir}${docsdir}"