recipe 4.9 KB

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