recipe 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Build recipe for xterm.
  2. #
  3. # Copyright (c) 2017-2019, 2021-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=xterm
  19. version=370
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=x-apps
  23. tarname=${program}-${version}.tgz
  24. # Remote source(s)
  25. fetch=https://invisible-mirror.net/archives/xterm/$tarname
  26. description="
  27. Terminal emulator for X.
  28. The xterm program is a terminal emulator for the X Window System.
  29. It provides DEC VT102 and Tektronix 4014 compatible terminals for
  30. programs that can't use the window system directly.
  31. "
  32. homepage=https://invisible-island.net/xterm
  33. license=Custom
  34. # Source documentation
  35. docs="NEWS README README.i18n THANKS"
  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. # Patch taken from Alpine Linux (Thanks!)
  44. # https://git.alpinelinux.org/cgit/aports/tree/community/xterm/posix-ptys.patch
  45. patch -p1 < "${worktree}/patches/xterm/posix-ptys.patch"
  46. # These commands modify the terminal description so that the
  47. # Backspace key is expected to send the character with ASCII
  48. # code 127. This is done for consistency with the Linux console.
  49. # Thanks to Beyond Linux From Scratch!
  50. sed -i '/v0/{n;s/new:/new:kb=^?:/}' termcap && \
  51. printf '\tkbs=\\177,\n' >> terminfo
  52. ./configure CPPFLAGS="$QICPPFLAGS" \
  53. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  54. TERMINFO=/usr/share/terminfo \
  55. $configure_args \
  56. --libdir=/usr/lib${libSuffix} \
  57. --mandir=$mandir \
  58. --enable-exec-xterm \
  59. --enable-256-color \
  60. --enable-88-color \
  61. --enable-luit \
  62. --enable-wide-chars \
  63. --enable-dabbrev \
  64. --enable-setgid \
  65. --enable-imake \
  66. --disable-setuid \
  67. --disable-full-tgetent \
  68. --with-pcre2 \
  69. --with-app-defaults=/etc/X11/app-defaults \
  70. --with-tty-group=tty \
  71. --with-x \
  72. --build="$(gcc -dumpmachine)"
  73. make -j${jobs} V=1
  74. make -j${jobs} DESTDIR="$destdir" install
  75. # Conflicts with files provided by ncurses
  76. #make -j${jobs} DESTDIR="$destdir" install-ti
  77. # Append extra information.
  78. #
  79. # In order for xterm to follow the locale settings in the
  80. # environment, use TrueType fonts, and follow the GNU/Linux
  81. # convention about the code sent by the Backspace key, we add
  82. # the following definitions
  83. cat << EOF >> "${destdir}/etc/X11/app-defaults/XTerm"
  84. *VT100*locale: true
  85. *VT100*faceName: Monospace
  86. *VT100*faceSize: 14
  87. *backarrowKeyIsErase: true
  88. *ptyInitialErase: true
  89. EOF
  90. # To handle config files via graft(1)
  91. touch "${destdir}/etc/X11/app-defaults/.graft-config"
  92. # Include desktop entries
  93. mkdir -p "${destdir}/usr/share/applications"
  94. cp -p xterm.desktop uxterm.desktop \
  95. "${destdir}/usr/share/applications/"
  96. # Compress and link man pages (if needed)
  97. if test -d "${destdir}/$mandir"
  98. then
  99. (
  100. cd "${destdir}/$mandir"
  101. find . -type f -exec lzip -9 {} +
  102. find . -type l | while read -r file
  103. do
  104. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  105. rm -- "$file"
  106. done
  107. )
  108. fi
  109. # Copy documentation
  110. mkdir -p "${destdir}/$docsdir"
  111. cp -p $docs "${destdir}/$docsdir"
  112. }