recipe 3.2 KB

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