recipe 3.2 KB

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