connie.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #!/bin/bash
  2. # Slackware build script for connie
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211130 bkw: BUILD=2, new-style icons.
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=connie
  8. VERSION=${VERSION:-0.4.3rc9}
  9. BUILD=${BUILD:-2}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i586 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  20. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  21. exit 0
  22. fi
  23. TMP=${TMP:-/tmp/SBo}
  24. PKG=$TMP/package-$PRGNAM
  25. OUTPUT=${OUTPUT:-/tmp}
  26. # No support for CFLAGS, use upstream's
  27. if [ "$ARCH" = "i586" ]; then
  28. LIBDIRSUFFIX=""
  29. elif [ "$ARCH" = "i686" ]; then
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. LIBDIRSUFFIX="64"
  33. else
  34. LIBDIRSUFFIX=""
  35. fi
  36. set -e
  37. rm -rf $PKG
  38. mkdir -p $TMP $PKG $OUTPUT
  39. cd $TMP
  40. rm -rf $PRGNAM-$VERSION
  41. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  42. cd $PRGNAM-$VERSION
  43. chown -R root:root .
  44. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  45. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  46. # SSE isn't autodetected
  47. SSE=${SSE:-yes}
  48. # QT is left disabled by default because it's experimental. It works,
  49. # but is basically useless.
  50. # 20211130 bkw: Slackware -current dropped qt4, and SBo hasn't picked it
  51. # up yet, and this won't with with 5. So even more useless than before.
  52. QT=${QT:-no}
  53. if [ "$SSE" = "yes" ]; then
  54. TARGET=${PRGNAM}_sse
  55. else
  56. TARGET=${PRGNAM}_i386
  57. fi
  58. # clean up the Makefile, enable jack session support.
  59. # There are a couple of scary-looking compile warnings, but the program
  60. # seems to run fine, so I won't try to fix them.
  61. sed -i \
  62. -e 's,pentium3,native -fPIC ,' \
  63. -e '/-ljack/s,$, -lm -lpthread,' \
  64. -e '/^# *JACK_SESSION/s,^# *,,' \
  65. Makefile qt4/${PRGNAM}_qt4.pro
  66. make $TARGET
  67. # 'make install' is tailored to debian, just do it manually.
  68. # We won't use upstream's wrapper script, as it causes unexpected
  69. # behaviour (spawns a new xterm, even if run from an xterm). Instead,
  70. # the .desktop file runs in a terminal.
  71. mkdir -p $PKG/usr/bin $PKG/usr/man/man1
  72. install -s -m0755 $TARGET $PKG/usr/bin/$PRGNAM
  73. for px in 16 32 48 64; do
  74. size=${px}x${px}
  75. dir=$PKG/usr/share/icons/hicolor/$size/apps
  76. mkdir -p $dir
  77. convert -resize $size $PRGNAM.png $dir/$PRGNAM.png
  78. done
  79. # original icon is 116x116, do not embiggen.
  80. mkdir -p $PKG/usr/share/icons/hicolor/128x128/apps
  81. convert -background none -extent 128x128 -gravity center \
  82. $PRGNAM.png \
  83. $PKG/usr/share/icons/hicolor/128x128/apps/$PRGNAM.png
  84. mkdir -p $PKG/usr/share/pixmaps
  85. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  86. # .desktop written for this SlackBuild
  87. mkdir -p $PKG/usr/share/applications
  88. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  89. # We only install one binary (either i386 or sse), so fix up the man page
  90. # so it doesn't mention connie_i386 and connie_sse.
  91. sed -i '/^Two bin/,+4d' $PRGNAM.1
  92. # Build experimental QT4 UI if enabled.
  93. if [ "$QT" = "yes" ]; then
  94. cd qt4
  95. [ "$SSE" = "no" ] && sed -i 's,-march.*,-Wall -O3 -fomit-frame-pointer -pipe,' *.pro
  96. qmake
  97. make
  98. install -s -m0755 ${PRGNAM}_qt4 $PKG/usr/bin/${PRGNAM}_qt4
  99. cat $CWD/${PRGNAM}_qt4.desktop > $PKG/usr/share/applications/${PRGNAM}_qt4.desktop
  100. cd -
  101. sed -i \
  102. -e '/^\.SH DESC/i.br\n.B connie_qt4 [options]' \
  103. -e '/^\.sp/cconnie_qt4 has a GUI, takes the same options as connie, but supports no keyboard commands.' \
  104. $PRGNAM.1
  105. ln -sf $PRGNAM.1.gz $PKG/usr/man/man1/${PRGNAM}_qt4.1.gz
  106. fi
  107. gzip -9c $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  108. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  109. cp -a README TODO LICENSE debian/changelog \
  110. $PKG/usr/doc/$PRGNAM-$VERSION
  111. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  112. mkdir -p $PKG/install
  113. sed -e "s,%SSE%,$SSE," -e "s,%QT%,$QT," $CWD/slack-desc \
  114. > $PKG/install/slack-desc
  115. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  116. # Only add capability stuff if not disabled:
  117. if [ "${SETCAP:-yes}" = "yes" ]; then
  118. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  119. # Only allow execution by audio group
  120. chown root:audio $PKG/usr/bin/*
  121. chmod 0750 $PKG/usr/bin/*
  122. fi
  123. cd $PKG
  124. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE