ex-vi.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #!/bin/bash
  2. # Slackware build script for ex-vi
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210830 bkw: build 4, -j1 no longer needed on -current.
  6. # 20160726 bkw: build 3
  7. # parallel make (-jN where N > 1) fails on Slack 14.2, add -j1
  8. # 20150331 bkw: build 2
  9. # Increase TUBE* constants in config.h to allow for larger terminals.
  10. # vi has hardcoded terminal size limits of 160 columns and 100 lines.
  11. # These days it's not unusual to have a 1920x1080 framenbuffer with 8x16
  12. # console font, for 240x67 characters. Increase limits here. Doing so uses
  13. # TUBESIZE bytes of memory at startup, and another TUBESIZE bytes every
  14. # time you switch from ex mode to visual mode, so let's not get too crazy
  15. # with the cheez whiz. The real problem is TUBECOLS (the width): if the
  16. # terminal exceeds this, you get 'Terminal too wide' and are stuck in ex
  17. # mode. Exceeding TUBELINES just means vi ignores the extra lines at the
  18. # bottom of the terminal.
  19. # Default to 320x200, which would be enough for a 8x16 console font on a
  20. # WQXGA 2560x1600 display, or a 2/3-width full-height X terminal on 4K
  21. # UHDTV (3840x2160). If I don't make this configurable, someone will
  22. # need it to be. So:
  23. TUBECOLS=${TUBECOLS:-320}
  24. TUBELINES=${TUBELINES:-200}
  25. # We now return you to your regularly scheduled programming:
  26. cd $(dirname $0) ; CWD=$(pwd)
  27. PRGNAM=ex-vi
  28. VERSION=${VERSION:-050325}
  29. BUILD=${BUILD:-4}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. if [ -z "$ARCH" ]; then
  33. case "$( uname -m )" in
  34. i?86) ARCH=i586 ;;
  35. arm*) ARCH=arm ;;
  36. *) ARCH=$( uname -m ) ;;
  37. esac
  38. fi
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. TARNAME=ex
  61. rm -rf $PKG
  62. mkdir -p $TMP $PKG $OUTPUT
  63. cd $TMP
  64. rm -rf $TARNAME-$VERSION
  65. tar xvf $CWD/$TARNAME-$VERSION.tar.bz2
  66. cd $TARNAME-$VERSION
  67. chown -R root:root .
  68. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  69. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  70. # Don't install the binary with the sticky bit set. It doesn't do anything
  71. # on Linux, and might set off alarm bells.
  72. sed -i 's,-m 1755,-m 755,' Makefile
  73. # Apologies for the fugly sed code here. It works, though.
  74. sed -i -e "/^#define/s,\\(TUBESIZE *\\).*$,\\1 $(( TUBECOLS * TUBELINES ))," \
  75. -e "/^#define/s,\\(TUBECOLS *\\).*$,\\1 $TUBECOLS," \
  76. -e "/^#define/s,\\(TUBELINES *\\).*$,\\1 $TUBELINES," \
  77. config.h
  78. # To avoid conflicts with Slackware's elvis and/or vim, we install to /opt and
  79. # include a login script to set PATH and MANPATH.
  80. make all install \
  81. RPMCFLAGS="$SLKCFLAGS" \
  82. MANDIR=/opt/$PRGNAM/man \
  83. PREFIX=/opt/$PRGNAM \
  84. INSTALL=install \
  85. DESTDIR=$PKG
  86. # binary already stripped, yay
  87. find $PKG/opt/$PRGNAM/man -type f -exec gzip -9 {} \;
  88. for i in $( find $PKG/opt/$PRGNAM/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  89. mkdir -p $PKG/etc/profile.d
  90. install -m0755 -oroot -groot $CWD/$PRGNAM.sh.new $PKG/etc/profile.d
  91. install -m0755 -oroot -groot $CWD/$PRGNAM.csh.new $PKG/etc/profile.d
  92. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  93. cp -a Changes LICENSE README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/README_Slackware.txt > $PKG/usr/doc/$PRGNAM-$VERSION/README_Slackware.txt
  95. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  96. mkdir -p $PKG/install
  97. cat $CWD/slack-desc > $PKG/install/slack-desc
  98. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  99. cd $PKG
  100. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE