fabla.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. # Slackware build script for fabla
  3. # Copyright 2015 Klaatu, Wellington NZ
  4. # GNU All-Permissive License
  5. # Copying and distribution of this file, with or without modification,
  6. # are permitted in any medium without royalty provided the copyright
  7. # notice and this notice are preserved. This file is offered as-is,
  8. # without any warranty.
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=fabla
  11. VERSION=${VERSION:-1.3.2}
  12. BUILD=${BUILD:-1}
  13. TAG=${TAG:-_SBo}
  14. PKGTYPE=${PKGTYPE:-tgz}
  15. if [ -z "$ARCH" ]; then
  16. case "$( uname -m )" in
  17. i?86) ARCH=i586 ;;
  18. arm*) ARCH=arm ;;
  19. *) ARCH=$( uname -m ) ;;
  20. esac
  21. fi
  22. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  23. # the name of the created package would be, and then exit. This information
  24. # could be useful to other scripts.
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. if [ "$ARCH" = "i586" ]; then
  33. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "x86_64" ]; then
  39. SLKCFLAGS="-O2 -fPIC"
  40. LIBDIRSUFFIX="64"
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  44. fi
  45. set -e
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $PRGNAM-$VERSION
  50. mkdir $PRGNAM-$VERSION
  51. tar xvf $CWD/release-$VERSION.tar.gz -C $PRGNAM-$VERSION --strip-components 1 \
  52. || tar xvf $CWD/openAV-Fabla-release-$VERSION.tar.gz -C $PRGNAM-$VERSION --strip-components 1
  53. cd $PRGNAM-$VERSION
  54. chown -R root:root .
  55. find -L . \
  56. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  57. -o -perm 511 \) -exec chmod 755 {} \; -o \
  58. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  59. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  60. # Patch for the newer lv2
  61. patch -p1 < $CWD/fabla-1.3.2-lv2-1.18.0.patch
  62. mkdir -p build
  63. cd build
  64. cmake \
  65. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  66. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  67. -DCMAKE_INSTALL_PREFIX=/usr \
  68. -DCMAKE_BUILD_TYPE=Release ..
  69. make
  70. # patch
  71. sed -i 's_fabla.lv2/fabla.ttl_dsp/fabla.ttl_' cmake_install.cmake
  72. sed -i 's_lib/_lib'$LIBDIRSUFFIX'/_' cmake_install.cmake
  73. make install DESTDIR=$PKG
  74. cd ..
  75. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  76. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  77. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  78. cp -a LICENSE README.md run.sh $PKG/usr/doc/$PRGNAM-$VERSION
  79. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  80. mkdir -p $PKG/install
  81. cat $CWD/slack-desc > $PKG/install/slack-desc
  82. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  83. if [ X"$JALV" != "X" ]; then
  84. # desktop file, added to SlackBuild for convenience
  85. mkdir -p $PKG/usr/share/applications/
  86. cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications/
  87. # generate icon for .desktop file
  88. mkdir -p $PKG/usr/share/icons/hicolor/256x256/apps/
  89. ICONPX=256x256
  90. ICONDIR=$PKG/usr/share/icons/hicolor/$ICONPX/apps/
  91. convert gui/header_flat.xcf -background black -flatten $ICONDIR/fabla.png
  92. convert $ICONDIR/fabla.png -crop $ICONPX+0+0 $ICONDIR/title.png
  93. convert -size $ICONPX pattern:checkerboard -auto-level +level-colors black,#ff5100 $ICONDIR/check.png
  94. convert -size $ICONPX gradient: -flip $ICONDIR/grad.png
  95. composite -compose multiply $ICONDIR/grad.png $ICONDIR/check.png $ICONDIR/back.png
  96. composite -gravity north $ICONDIR/title.png $ICONDIR/back.png $ICONDIR/$PRGNAM.png
  97. rm $ICONDIR/{b,c,g,t}*png
  98. fi
  99. cd $PKG
  100. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE