inform.SlackBuild 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #!/bin/bash
  2. # Slackware build script for inform
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210831 bkw:
  6. # - updated for v6.35_r2 (upstream changed their version numbering
  7. # scheme again). script had to change a lot, so can't build old
  8. # versions any more.
  9. # 20201104 bkw: updated for 6.34_6.12.4. In case anyone's wondering
  10. # why I use a self-hosted URL for the source, it's because upstream
  11. # moves the old source immediately when a new release is made. Also
  12. # moved the binary to /usr/games and the man page to section 6.
  13. # 20191216 bkw: updated for 6.34_6.12.2. The secondary version number
  14. # is the inform6 library version. This script can no longer build the
  15. # old 6.32.1 version, but it should be fine for future releases.
  16. # The old 6.32.1 release shipped with a lot more include
  17. # files. Upstream removed a lot of them because they were either buggy
  18. # or license-incompatible. If you're trying to compile something that
  19. # needs any of these old includes, please let me know. If there's enough
  20. # demand, I'll dig up the old includes and re-add them to the package.
  21. cd $(dirname $0) ; CWD=$(pwd)
  22. PRGNAM=inform
  23. VERSION=${VERSION:-6.35_r2}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo}
  26. PKGTYPE=${PKGTYPE:-tgz}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  35. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  36. exit 0
  37. fi
  38. TMP=${TMP:-/tmp/SBo}
  39. PKG=$TMP/package-$PRGNAM
  40. OUTPUT=${OUTPUT:-/tmp}
  41. if [ "$ARCH" = "i586" ]; then
  42. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "i686" ]; then
  45. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  46. LIBDIRSUFFIX=""
  47. elif [ "$ARCH" = "x86_64" ]; then
  48. SLKCFLAGS="-O2 -fPIC"
  49. LIBDIRSUFFIX="64"
  50. else
  51. SLKCFLAGS="-O2"
  52. LIBDIRSUFFIX=""
  53. fi
  54. set -e
  55. MANVER="${MANVER:-4}"
  56. MANUAL=designers_manual_${MANVER}.zip
  57. TARVER="${VERSION//_/-}"
  58. DOCDIR=/usr/doc/$PRGNAM-$VERSION
  59. PKGDOC=$PKG/$DOCDIR
  60. rm -rf $PKG
  61. mkdir -p $TMP $PKG $OUTPUT
  62. cd $TMP
  63. rm -rf $PRGNAM-$TARVER
  64. tar xvf $CWD/$PRGNAM-$TARVER.tar.gz
  65. cd $PRGNAM-$TARVER
  66. chown -R root:root .
  67. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  68. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  69. # 20201104 bkw: Since inform is for game purposes, install the binary
  70. # to /usr/games, and its man page to section 6. Also change the
  71. # "see also" to a man page that actually might exist.
  72. sed -e '1s/"1"/"6"/' -e "s,zcode-interpreter,frotz," $PRGNAM.1 > $PRGNAM.6
  73. # 20201104 bkw: upstream now supports DESTDIR again.
  74. # 20210831 bkw: upstream *broke* DESTDIR again. Sigh.
  75. patch -p1 < $CWD/destdir.diff
  76. # 20210831 bkw: install-strip failed with "text file busy" on -current,
  77. # use -Wl,-s to build the binary stripped in the first place.
  78. make install \
  79. OPTS="$SLKCFLAGS" \
  80. LDFLAGS="-Wl,-s" \
  81. BINDIR=/usr/games \
  82. MANDIR=/usr/man/man6 \
  83. MANPAGE=$PRGNAM.6 \
  84. PREFIX=/usr \
  85. TUTORDIR=$DOCDIR/tutor \
  86. DEMODIR=$DOCDIR/demos \
  87. DESTDIR=$PKG
  88. gzip $PKG/usr/man/man?/*.?
  89. # 20201104 bkw: the binary got moved, be kind and provide a symlink
  90. mkdir -p $PKG/usr/bin
  91. ln -s ../games/$PRGNAM $PKG/usr/bin/$PRGNAM
  92. # Inform started life (and is still used primarily) on OSes
  93. # with case-insensitive filenames, meaning that a lot of inform
  94. # source refers to e.g. VerbLib or even VERBLIB (with or without
  95. # the .h at the end, which could also be capitalized as .H). The
  96. # Makefile can create a few symlinks to support this, but let's
  97. # be more all-inclusive. We got 8 .h files, and end up with 70+
  98. # symlinks. There's no kill like overkill!
  99. ( cd $PKG/usr/share/$PRGNAM/std/lib
  100. for file in *.h; do
  101. name=${file%%.*}
  102. # Name.h NAME.h
  103. for link in ${name^}.h ${name^^}.h; do
  104. ln -s $file $link
  105. done
  106. done
  107. # MixedCase isn't standardized, these are guesses. Some are pretty
  108. # unlikely, but they don't cost much. Better to have and not need,
  109. # than to need and not have.
  110. for link in VerbLib VerbLIB verbLib verbLIB \
  111. InFix InFIX inFix inFIX \
  112. InfGlk InfGLK infGlk infGLK \
  113. LinkLpa LinkLPA linkLpa linkLPA
  114. do
  115. ln -s ${link,,}.h $link.h
  116. done
  117. # Any of the above might appear with .H. Use readlink so all the
  118. # variant names link to the real file (no symlinks to symlinks).
  119. # This might be overcautious: the example code all just says
  120. # e.g. 'Include "Parser"', without the .h.
  121. for file in *.h; do
  122. dest="${file%%.*}.H"
  123. [ -L "$file" ] && file="$( readlink $file )"
  124. ln -s $file $dest
  125. done
  126. )
  127. # Upstream removed the manual for licensing reasons. It belongs in the
  128. # binary package IMO.
  129. mkdir -p $PKGDOC/manual
  130. ( cd $PKGDOC/manual
  131. unzip $CWD/$MANUAL
  132. # manual has no subdirs
  133. chmod 644 *
  134. chown root.root *
  135. )
  136. # Inform Beginners' Guide, required reading.
  137. cat $CWD/IBG.pdf > $PKGDOC/inform_beginners_guide.pdf
  138. ln -s inform_beginners_guide.pdf $PKGDOC/IBG.pdf
  139. # Library documentation should be visibile in /usr/doc.
  140. mkdir -p $PKGDOC/lib
  141. for i in ChangeLog README.txt voices_and_tenses.txt; do
  142. ln -s ../../../share/$PRGNAM/std/lib/$i $PKGDOC/lib
  143. done
  144. # Same for punyinform docs.
  145. mkdir -p $PKGDOC/punyinform
  146. for i in README.md LICENSE documentation; do
  147. ln -s ../../../share/$PRGNAM/punyinform/$i $PKGDOC/punyinform
  148. done
  149. # ARTISTIC and COPYING are redundant: src/licence.txt includes the
  150. # full text of both.
  151. cp -a AUTHORS NEWS README* src/*.txt src/*.html docs/* $PKGDOC
  152. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  153. mkdir -p $PKG/install
  154. cat $CWD/slack-desc > $PKG/install/slack-desc
  155. cd $PKG
  156. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE