svkbd.SlackBuild 2.8 KB

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