recipe 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Build recipe for readline.
  2. #
  3. # Copyright (c) 2016-2019, 2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Exit immediately on any error
  17. set -e
  18. program=readline
  19. version=8.1
  20. release=3
  21. # Define a category for the output of the package name
  22. pkgcategory=libs
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch=ftp://ftp.gnu.org/gnu/readline/$tarname
  26. description="
  27. A library with line-editing capabilities.
  28. GNU readline is a software library created and maintained by the
  29. GNU Project. It is licensed under the GPL, and used in projects
  30. such as GNU bash. It provides line-editing capabilities.
  31. "
  32. homepage=https://www.gnu.org/software/readline
  33. license=GPLv3+
  34. # Source documentation
  35. docs="CHANGELOG CHANGES COPYING NEWS README USAGE"
  36. docsdir="${docdir}/${program}-${version}"
  37. build()
  38. {
  39. unpack "${tardir}/$tarname"
  40. cd "$srcdir"
  41. # Set sane permissions
  42. chmod -R u+w,go-w,a+rX-s .
  43. # Apply patches from upstream
  44. for file in "${worktree}"/patches/readline/readline81-???*
  45. do
  46. if test -f "$file"
  47. then
  48. patch -Np0 -i "$file"
  49. fi
  50. done
  51. # To avoid underlink against -lncursesw
  52. patch -Np1 -i "${worktree}/patches/readline/readline-ncurses-link.patch"
  53. # Reinstalling Readline will cause the old libraries to be moved to
  54. # <libraryname>.old, this avoid printing a harmful message about
  55. # the static libraries (thanks to LFS)
  56. sed -i '/MV.*old/d' Makefile.in
  57. sed -i '/{OLDSUFF}/c:' support/shlib-install
  58. ./configure CPPFLAGS="$QICPPFLAGS" \
  59. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  60. $configure_args \
  61. --libdir=/usr/lib${libSuffix} \
  62. --infodir=$infodir \
  63. --mandir=$mandir \
  64. --docdir=$docsdir \
  65. --enable-static=yes \
  66. --enable-shared=yes \
  67. --build="$(gcc -dumpmachine)"
  68. make -j${jobs} V=1
  69. make -j${jobs} V=1 DESTDIR="$destdir" install
  70. # Copy our custom inputrc file
  71. mkdir -p "${destdir}/etc"
  72. cp -p "${worktree}/archive/readline/etc/inputrc" "${destdir}/etc/"
  73. chmod 644 "${destdir}/etc/inputrc"
  74. touch "${destdir}/etc/.graft-config"
  75. # Compress info documents deleting index file for the package
  76. if test -d "${destdir}/$infodir"
  77. then
  78. rm -f "${destdir}/${infodir}/dir"
  79. lzip -9 "${destdir}/${infodir}"/*
  80. fi
  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. }