recipe 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Build recipe for python3.
  2. #
  3. # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
  4. # Copyright (c) 2017-2021 Matias Fonzo, <selk@dragora.org>.
  5. #
  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
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  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.
  17. # Exit immediately on any error
  18. set -e
  19. program=Python
  20. version=3.9.1
  21. short_version="${version%.*}"
  22. release=2
  23. # Define a category for the output of the package name
  24. pkgcategory=python
  25. tarname=${program}-${version}.tgz
  26. # Remote source(s)
  27. fetch=https://www.python.org/ftp/python/${version}/$tarname
  28. pkgname=python3
  29. description="
  30. Multi-paradigm programming language (v3).
  31. Python is an interpreted, interactive object-oriented programming
  32. language suitable (amongst other uses) for distributed application
  33. development, scripting, numeric computing and system testing.
  34. Python is often compared to Tcl, Perl, Java, JavaScript, Visual
  35. Basic or Scheme.
  36. "
  37. homepage=https://www.python.org/
  38. license="Python Software Foundation License"
  39. # Source documentation
  40. docs="LICENSE README.rst"
  41. docsdir="${docdir}/${pkgname}-${version}"
  42. build()
  43. {
  44. unpack "${tardir}/$tarname"
  45. cd "$srcdir"
  46. # Set sane permissions
  47. chmod -R u+w,go-w,a+rX-s .
  48. # Use system libraries instead of the bundle ones
  49. rm -rf Modules/expat Modules/zlib Modules/_ctypes/libffi*
  50. ./configure $configure_args \
  51. --libdir=/usr/lib${libSuffix} \
  52. --mandir=$mandir \
  53. --docdir=$docsdir \
  54. --build="$(gcc -dumpmachine)" \
  55. --enable-shared \
  56. --enable-loadable-sqlite-extensions \
  57. --enable-ipv6 \
  58. --with-threads \
  59. --with-system-expat \
  60. --with-system-ffi \
  61. --with-ensurepip=yes \
  62. --with-dbmliborder=gdbm:ndbm \
  63. --build="$(gcc -dumpmachine)"
  64. make -j${jobs} V=1
  65. make -j${jobs} DESTDIR="$destdir" install
  66. # Make default symlink to invoke it as "python"
  67. ( cd "${destdir}/usr/bin" && ln -sf python3 python )
  68. # Include the Python tools under site-packages
  69. TOOL_DIR=/usr/lib/python${short_version}
  70. (
  71. cd Tools || exit 2
  72. # Do not clobber README file in site-packages directory
  73. test -f README && mv -f README README.Tools
  74. cp -rP ./* "${destdir}${TOOL_DIR}/"
  75. )
  76. # Make some useful symlinks at usr/bin
  77. (
  78. cd "${destdir}/usr/bin" || exit 2
  79. ln -sf "${TOOL_DIR}/i18n/msgfmt.py" msgfmt.py
  80. ln -sf "${TOOL_DIR}/i18n/pygettext.py" pygettext.py
  81. ln -sf "${TOOL_DIR}/pynche/pynche" pynche
  82. )
  83. unset -v short_version TOOL_DIR
  84. # Compress and link man pages (if needed)
  85. if test -d "${destdir}/$mandir"
  86. then
  87. (
  88. cd "${destdir}/$mandir"
  89. find . -type f -exec lzip -9 {} +
  90. find . -type l | while read -r file
  91. do
  92. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  93. rm -- "$file"
  94. done
  95. )
  96. fi
  97. # Copy documentation
  98. mkdir -p "${destdir}${docsdir}"
  99. cp -p $docs "${destdir}${docsdir}"
  100. }