jamulus.SlackBuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #!/bin/bash
  2. # Slackware build script for jamulus
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211207 bkw:
  6. # - update for v3.8.1.
  7. # - add 'headless' option to SERVERONLY=yes config.
  8. # - new-style icons.
  9. # - man page.
  10. # - dynamic slack-desc.
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=jamulus
  13. VERSION=${VERSION:-3.8.1}
  14. BUILD=${BUILD:-1}
  15. TAG=${TAG:-_SBo}
  16. PKGTYPE=${PKGTYPE:-tgz}
  17. if [ -z "$ARCH" ]; then
  18. case "$( uname -m )" in
  19. i?86) ARCH=i586 ;;
  20. arm*) ARCH=arm ;;
  21. *) ARCH=$( uname -m ) ;;
  22. esac
  23. fi
  24. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. if [ "$ARCH" = "i586" ]; then
  32. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "i686" ]; then
  35. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. else
  41. SLKCFLAGS="-O2"
  42. LIBDIRSUFFIX=""
  43. fi
  44. set -e
  45. # Check this before doing anything else.
  46. if [ "${SERVERONLY:-no}" = "yes" ]; then
  47. EXTRACONF="CONFIG+=nosound CONFIG+=headless"
  48. elif ! pkg-config --exists jack; then
  49. cat <<EOF
  50. ***********************************************************************
  51. $0: jack not found.
  52. If you want $PRGNAM to be able to make sound, you must install
  53. jack before running this script.
  54. If you want to build a dedicated server, you don't have to install
  55. jack. Instead, export SERVERONLY=yes in the environment. See SERVER.txt
  56. for details.
  57. ***********************************************************************
  58. EOF
  59. sleep 5
  60. exit 1
  61. fi
  62. TARVER=r"${VERSION//./_}"
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$TARVER
  67. tar xvf $CWD/$PRGNAM-$TARVER.tar.gz
  68. cd $PRGNAM-$TARVER
  69. chown -R root:root .
  70. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  71. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  72. qmake-qt5 \
  73. "CONFIG+=noupcasename" \
  74. $EXTRACONF \
  75. QMAKE_CFLAGS="$SLKCFLAGS" QMAKE_CXXFLAGS="$SLKCFLAGS" \
  76. PREFIX=/usr \
  77. Jamulus.pro
  78. make clean
  79. make
  80. make install INSTALL_ROOT=$PKG
  81. # binary already stripped.
  82. # Man page borrowed from Debian and modified slightly (since they
  83. # don't use 'noupcasename', their binary is called Jamulus).
  84. # Had to make the man page a "1x" instead of "1": It uses BSD macros
  85. # (see groff_mdoc(7)). If I made it a "1" man page, it would say
  86. # "BSD General Commands Manual" unconditionally (no way to force it
  87. # to say "SlackBuilds.org" or even "General Commands Manual").
  88. mkdir -p $PKG/usr/man/man1
  89. gzip -9c < $CWD/$PRGNAM.1x > $PKG/usr/man/man1/$PRGNAM.1x.gz
  90. if [ "${SERVERONLY:-no}" != "yes" ]; then
  91. # 'make install' puts the SVG icons in the wrong place. also the only
  92. # png icon provided is 512x512, ludicrously large.
  93. HICOLOR=$PKG/usr/share/icons/hicolor/
  94. mkdir -p $HICOLOR/scalable/apps
  95. mv $HICOLOR/512x512/apps/*.svg $HICOLOR/scalable/apps
  96. CVT="convert -background none"
  97. for px in 16 32 48 64 128; do
  98. size=${px}x${px}
  99. dir=$HICOLOR/$size/apps
  100. mkdir -p $dir
  101. $CVT -resize $size distributions/$PRGNAM.svg $dir/$PRGNAM.png
  102. $CVT -resize $size distributions/$PRGNAM-server.svg $dir/$PRGNAM-server.png
  103. done
  104. mkdir -p $PKG/usr/share/pixmaps
  105. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  106. fi
  107. # NEWS is a 0-byte placeholder in 3.4.3.
  108. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  109. cp -a \
  110. COPYING ChangeLog CONTRIBUTING.md README.md \
  111. SECURITY.md RELEASE-PROCESS.md TRANSLATING.md \
  112. $PKG/usr/doc/$PRGNAM-$VERSION
  113. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  114. # Include our own (hopefully) helpful hints for servers.
  115. cat $CWD/SERVER.txt > $PKG/usr/doc/$PRGNAM-$VERSION/SERVER.txt
  116. if objdump -p $PKG/usr/bin/$PRGNAM | grep -q 'NEEDED.*libjack'; then
  117. DESC="full client and server"
  118. else
  119. DESC="headless server only"
  120. fi
  121. mkdir -p $PKG/install
  122. sed "s,@DESC@,$DESC," $CWD/slack-desc > $PKG/install/slack-desc
  123. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  124. # Only add capability stuff if not disabled:
  125. if [ "${SERVERONLY:-no}" != "yes" ]; then
  126. if [ "${SETCAP:-yes}" = "yes" ]; then
  127. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  128. # Only allow execution by audio group
  129. chown root:audio $PKG/usr/bin/$PRGNAM
  130. chmod 0750 $PKG/usr/bin/$PRGNAM
  131. fi
  132. fi
  133. cd $PKG
  134. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE