svkbd.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. # Slackware build script for svkbd
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210802 bkw: updated for v0.4 and -current.
  6. # 20210219 bkw: updated for v0.2.2.
  7. # 20201102 bkw:
  8. # - updated for v0.2.1.
  9. # - add mobile-intl to default LAYOUTS
  10. # - get rid of my man page, upstream now ships one
  11. # - compile fix: old_fontconfig.diff
  12. # - actually support custom config.h in SlackBuild dir
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=svkbd
  15. VERSION=${VERSION:-0.4}
  16. BUILD=${BUILD:-1}
  17. TAG=${TAG:-_SBo}
  18. PKGTYPE=${PKGTYPE:-tgz}
  19. if [ -z "$ARCH" ]; then
  20. case "$( uname -m )" in
  21. i?86) ARCH=i586 ;;
  22. arm*) ARCH=arm ;;
  23. *) ARCH=$( uname -m ) ;;
  24. esac
  25. fi
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM-$VERSION
  51. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  52. cd $PRGNAM-$VERSION
  53. chown -R root:root .
  54. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  55. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  56. [ -e $CWD/config.h ] && cat $CWD/config.h > config.def.h
  57. LAYOUTS="${LAYOUTS:-en mobile-intl}"
  58. if [ "$LAYOUTS" = "all" ]; then
  59. LAYOUTS="$( ls layout.*.h|cut -d. -f2 | xargs echo )"
  60. FIRST=en
  61. else
  62. FIRST="$( echo $LAYOUTS | cut -d' ' -f1)"
  63. fi
  64. for i in ${LAYOUTS}; do
  65. if [ -e layout.$i.h ]; then
  66. make clean
  67. make install \
  68. CFLAGS="$SLKCFLAGS" \
  69. CPPFLAGS="$SLKCFLAGS" \
  70. LAYOUT="$i" \
  71. PREFIX=/usr \
  72. MANPREFIX=/usr/man \
  73. X11LIB=/usr/lib$LIBDIRSUFFIX \
  74. DESTDIR=$PKG
  75. else
  76. echo "*** $0: No such layout '$i', read the README." 1>&2
  77. exit 1
  78. fi
  79. done
  80. # 20201102 bkw: bit of paranoia here.
  81. if [ "$(/bin/ls $PKG/usr/bin | wc -l)" == 0 ]; then
  82. echo "*** $0: no valid layouts! LAYOUTS is \"$LAYOUTS\"" 1>&2
  83. exit 1
  84. fi
  85. gzip $PKG/usr/man/man1/$PRGNAM.1
  86. for i in ${LAYOUTS}; do
  87. ln -s $PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM-$i.1.gz
  88. done
  89. strip $PKG/usr/bin/*
  90. ln -s $PRGNAM-$FIRST $PKG/usr/bin/$PRGNAM
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cp -a LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. sed -e "s,@LAYOUTS@,$LAYOUTS," -e "s,@FIRST@,$FIRST," \
  96. < $CWD/slack-desc \
  97. > $PKG/install/slack-desc
  98. cd $PKG
  99. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE