foo-yc20.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # Slackware build script for foo-yc20
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211129 bkw: BUILD=3, new-style icons.
  6. # 20170621 bkw: Rework optimization options. Needed because -current's
  7. # gcc7 requires massive amounts of memory to build this.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=foo-yc20
  10. VERSION=${VERSION:-1.3.0}
  11. BUILD=${BUILD:-3}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i586" ]; then
  29. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. set -e
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $PRGNAM-$VERSION
  46. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  47. cd $PRGNAM-$VERSION
  48. chown -R root:root .
  49. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  50. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  51. sed -i "s,\<lib\>,lib$LIBDIRSUFFIX,g" Makefile
  52. case "${OPTIMIZE:-default}" in
  53. slack)
  54. make PREFIX=/usr CFLAGS="$SLKCFLAGS" ;;
  55. default)
  56. sed -i 's,-O3,-O2,g' Makefile ; make PREFIX=/usr ;;
  57. upstream)
  58. make PREFIX=/usr ;;
  59. *)
  60. echo "Bad OPTIMIZE, must be one of: 'default', 'slack', 'upstream'" 2>&1
  61. exit 1
  62. esac
  63. make install DESTDIR=$PKG PREFIX=/usr
  64. for px in 16 32 48 64 128; do
  65. size=${px}x${px}
  66. dir=$PKG/usr/share/icons/hicolor/$size/apps
  67. mkdir -p $dir
  68. convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
  69. done
  70. mkdir -p $PKG/usr/share/pixmaps
  71. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  72. # make the .desktop file pass desktop-file-validate, and use our icon.
  73. sed -i \
  74. -e '/^Encoding/d' \
  75. -e '/^Categories/s/$/;/' \
  76. -e '/^Icon/s,=.*,='$PRGNAM',' \
  77. $PKG/usr/share/applications/$PRGNAM.desktop
  78. strip $PKG/usr/bin/* $PKG/usr/lib$LIBDIRSUFFIX/lv2/$PRGNAM.lv2/*.so
  79. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  80. cp -a LICENSE README $PKG/usr/doc/$PRGNAM-$VERSION
  81. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  82. mkdir -p $PKG/install
  83. cat $CWD/slack-desc > $PKG/install/slack-desc
  84. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  85. if [ "${SETCAP:-yes}" = "yes" ]; then
  86. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  87. # Only allow execution by audio group
  88. chown root:audio $PKG/usr/bin/$PRGNAM
  89. chmod 0750 $PKG/usr/bin/$PRGNAM
  90. fi
  91. cd $PKG
  92. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE