recipe 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # Build recipe for ncurses.
  2. #
  3. # Copyright (c) 2016-2020 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. program=ncurses
  17. version=6.1-20200118
  18. pkgversion=$(echo $version | tr - _)
  19. release=2
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/libs"
  22. tarname=${program}-${version}.tgz
  23. termcap_file=termcap-20190609.src.gz
  24. # Remote source(s)
  25. fetch="
  26. http://invisible-mirror.net/archives/ncurses/current/$tarname
  27. http://invisible-mirror.net/archives/ncurses/current/$termcap_file
  28. "
  29. description="
  30. Emulation library of Curses.
  31. The Ncurses (new curses) library is a free software emulation of
  32. curses in System V Release 4.0. The ncurses code was developed
  33. under GNU/Linux. It has been in use for some time with OpenBSD
  34. as the system curses library, and on FreeBSD and NetBSD as an
  35. external package.
  36. The distribution includes the library and support utilities,
  37. including a terminfo compiler \"tic\", a decompiler \"infocmp\",
  38. clear, tput, tset, and a termcap conversion tool \"captoinfo\".
  39. "
  40. homepage=http://www.gnu.org/software/ncurses
  41. license=Custom
  42. # Source documentation
  43. docs="ANNOUNCE AUTHORS COPYING NEWS README TO-DO VERSION"
  44. docsdir="${docdir}/${program}-${pkgversion}"
  45. build()
  46. {
  47. set -e
  48. unpack "${tardir}/$tarname"
  49. cd "$srcdir"
  50. # Set sane permissions
  51. chmod -R u+w,go-w,a+rX-s .
  52. ./configure \
  53. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  54. $configure_args \
  55. --libdir=/usr/lib${libSuffix} \
  56. --mandir=$mandir \
  57. --enable-widec \
  58. --enable-symlinks \
  59. --enable-hard-tabs \
  60. --enable-xmc-glitch \
  61. --enable-colorfgbg \
  62. --enable-termcap \
  63. --enable-pc-files \
  64. --disable-rpath-hack \
  65. --disable-stripping \
  66. --with-pkg-config-libdir=/usr/lib${libSuffix}/pkgconfig \
  67. --with-shared \
  68. --with-gpm \
  69. --without-tests \
  70. --without-debug \
  71. --without-ada \
  72. --build="$(cc -dumpmachine)"
  73. make -j${jobs} V=1
  74. mkdir -p "${destdir}/usr/lib${libSuffix}/pkgconfig"
  75. make -j${jobs} DESTDIR="$destdir" install
  76. # Insert termcap file provided by Thomas E. Dickey
  77. mkdir -p "${destdir}/etc"
  78. zcat "${tardir}/$termcap_file" > "${destdir}/etc/termcap"
  79. chmod 644 "${destdir}/etc/termcap"
  80. unset termcap_file
  81. touch "${destdir}/etc/.graft-config"
  82. # Provide non-widec compatibility
  83. for name in ncurses form panel menu
  84. do
  85. rm -f "${destdir}/usr/lib${libSuffix}/lib${name}.so"
  86. echo "INPUT(-l${name}w)" > \
  87. "${destdir}/usr/lib${libSuffix}/lib${name}.so"
  88. echo "INPUT(-l${name}w)" > \
  89. "${destdir}/usr/lib${libSuffix}/lib${name}.a"
  90. (
  91. cd "${destdir}/usr/lib${libSuffix}/pkgconfig" && \
  92. ln -sf ${name}w.pc ${name}.pc
  93. )
  94. done
  95. major_version=$(echo $version | cut -f 1 -d .)
  96. for name in tic tinfo
  97. do
  98. echo "INPUT(libncursesw.so.${major_version})" > \
  99. "${destdir}/usr/lib${libSuffix}/lib${name}.so"
  100. ln -sf libncursesw.so.${major_version} \
  101. "${destdir}/usr/lib${libSuffix}/lib${name}.so.${major_version}"
  102. done
  103. unset major_version
  104. # Backward compatibility
  105. (
  106. cd "${destdir}/usr/lib${libSuffix}" || exit 2
  107. echo "INPUT(-lncursesw)" > libcursesw.so
  108. ln -sf libncurses.so libcurses.so
  109. ln -sf libncurses++w.a libncurses++.a
  110. )
  111. # Just in case
  112. ln -sf ncursesw6-config "${destdir}/usr/bin/ncurses6-config"
  113. # Compress and link man pages (if needed)
  114. if test -d "${destdir}/$mandir"
  115. then
  116. (
  117. cd "${destdir}/$mandir"
  118. find . -type f -exec lzip -9 '{}' +
  119. find . -type l | while read -r file
  120. do
  121. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  122. rm -- "$file"
  123. done
  124. )
  125. fi
  126. # Copy documentation
  127. mkdir -p "${destdir}${docsdir}"
  128. cp -p $docs "${destdir}${docsdir}/"
  129. }