guitarix.SlackBuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #!/bin/bash
  2. # Slackware build script for guitarix
  3. # Originally written by Michales Michaloudes (email removed)
  4. # Modified by B. Watson <yalhcru@gmail.com>. Modified version released
  5. # under the WTFPL, for details see http://www.wtfpl.net/txt/copying/
  6. # Note to self: git URL for guitarix is:
  7. # git://git.code.sf.net/p/guitarix/git/
  8. # 20211205 bkw: BUILD=2
  9. # - new-style icons.
  10. # - correct install permissions in /usr/share/gx_head
  11. # - who the heck is kb6?
  12. # 20200408 kb6: Updated for 0.42.1. Add -fpermissive compiler flag.
  13. # 20201105 bkw: Add no-upgrade note to README.
  14. # 20200307 bkw: Updated for 3.39.0.
  15. # 20191211 bkw: Updated for 0.38.1.
  16. # 20180828 bkw: Updated for 0.37.3.
  17. cd $(dirname $0) ; CWD=$(pwd)
  18. PRGNAM=guitarix
  19. VERSION=${VERSION:-0.42.1}
  20. BUILD=${BUILD:-2}
  21. TAG=${TAG:-_SBo}
  22. PKGTYPE=${PKGTYPE:-tgz}
  23. if [ -z "$ARCH" ]; then
  24. case "$( uname -m )" in
  25. i?86) ARCH=i586 ;;
  26. arm*) ARCH=arm ;;
  27. *) ARCH=$( uname -m ) ;;
  28. esac
  29. fi
  30. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  31. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  32. exit 0
  33. fi
  34. TMP=${TMP:-/tmp/SBo}
  35. PKG=$TMP/package-$PRGNAM
  36. OUTPUT=${OUTPUT:-/tmp}
  37. # 20220322 bkw: 32-bit builds need -mfxsr now.
  38. if [ "$ARCH" = "i586" ]; then
  39. SLKCFLAGS="-O2 -march=i586 -mtune=i686 -msse -mfxsr"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "i686" ]; then
  42. SLKCFLAGS="-O2 -march=i686 -mtune=i686 -msse -mfxsr"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SLKCFLAGS="-O2 -fPIC"
  46. LIBDIRSUFFIX="64"
  47. else
  48. SLKCFLAGS="-O2"
  49. LIBDIRSUFFIX=""
  50. fi
  51. # Tarballs are now named "guitarix2-$VERSION", but the dir inside the
  52. # tarball is still "guitarix-$VERSION".
  53. TARNAME=${PRGNAM}2
  54. set -e
  55. rm -rf $PKG
  56. mkdir -p $TMP $PKG $OUTPUT
  57. cd $TMP
  58. rm -rf $PRGNAM-$VERSION
  59. tar xvf $CWD/$TARNAME-$VERSION.tar.xz
  60. cd $PRGNAM-$VERSION
  61. chown -R root:root .
  62. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  63. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  64. # 20211205 bkw: why? *WHY?!*
  65. sed -i '/chmod/s,0o664,0o644,g' wscript
  66. # guitarix wants to install the roboto font in the wrong place for
  67. # slackware.
  68. sed -i '/fonts/s,\<truetype\>,TTF,' wscript tools/undiag
  69. # this is no longer documented in README, but still here for debugging.
  70. if [ "${LV2:-yes}" = "no" ]; then
  71. LV2OPT=--no-lv2
  72. fi
  73. # grrr, -DNDEBUG doesn't get added to the flags automatically...
  74. LIBDIR="/usr/lib${LIBDIRSUFFIX}"
  75. ./waf configure \
  76. --prefix=/usr \
  77. --cxxflags-release="$SLKCFLAGS -DNDEBUG -fpermissive" \
  78. --ladspadir="$LIBDIR/ladspa/" \
  79. --lv2dir="$LIBDIR/lv2/" \
  80. --libdir="$LIBDIR" \
  81. --no-avahi \
  82. --no-ldconfig \
  83. --no-desktop-update \
  84. --no-faust \
  85. --includeresampler \
  86. --includeconvolver \
  87. --ladspa \
  88. --new-ladspa \
  89. --mod-lv2 \
  90. $EXTRAOPT \
  91. $LV2OPT
  92. ./waf build # -v # verbose, shows actual commands
  93. ./waf install --destdir=$PKG
  94. # Dunno how to make waf strip stuff...
  95. strip $PKG/usr/bin/* $PKG/usr/lib*/{,ladspa/*,lv2/*/*}*.so \
  96. # --install-roboto-font does the wrong thing, we'll install it manually.
  97. mkdir -p $PKG/usr/share/fonts/TTF
  98. install -m0644 fonts/* $PKG/usr/share/fonts/TTF
  99. # Shared libraries are supposed to be +x.
  100. chmod 755 $PKG/$LIBDIR/libgx*.so.?.?
  101. # Man page written for this SlackBuild, see guitarix.rst.
  102. mkdir -p $PKG/usr/man/man1
  103. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  104. # for the 128x128 icon, center upstream's 100x100 icon in a 128x128 png.
  105. dir=$PKG/usr/share/icons/hicolor/128x128/apps
  106. mkdir -p $dir
  107. convert -background none -extent 128x128 -gravity center \
  108. pixmaps/gx_head.png \
  109. $dir/$PRGNAM.png
  110. # for the rest, resize as usual.
  111. for px in 16 32 48 64; do
  112. size=${px}x${px}
  113. dir=$PKG/usr/share/icons/hicolor/$size/apps
  114. mkdir -p $dir
  115. convert -resize $size \
  116. pixmaps/gx_head.png \
  117. $dir/$PRGNAM.png
  118. done
  119. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  120. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  121. cp -a COPYING changelog README* $PKG/usr/doc/$PRGNAM-$VERSION
  122. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  123. mkdir -p $PKG/install
  124. cat $CWD/slack-desc > $PKG/install/slack-desc
  125. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  126. # Only add capability stuff if not disabled:
  127. if [ "${SETCAP:-yes}" = "yes" ]; then
  128. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  129. # Only allow execution by audio group
  130. chown root:audio $PKG/usr/bin/$PRGNAM
  131. chmod 0750 $PKG/usr/bin/$PRGNAM
  132. fi
  133. cd $PKG
  134. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE