You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.4 KiB

  1. #!/bin/bash
  2. # Slackware build script for beets
  3. # Copyright 2022-2025 fourtysixandtwo <fourtysixandtwo@sliderr.net>
  4. # Copyright 2014-2019 Dimitris Zlatanidis Orestiada, Greece
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # 20221016 46and2: Added bash/zsh completions.
  24. # 20221103 46and2: Rebuilt for python3-mediafile and python3-confuse.
  25. # 20250412 46and2: Stick with github tagged source for 2.2.0 as there
  26. # are issues with pypi sdist. The extra and docs dirs are not
  27. # included.
  28. # 20250508 46and2: Back to pypi tarball as 2.3.0 has the fixes for the above.
  29. cd $(dirname $0) ; CWD=$(pwd)
  30. PRGNAM=beets
  31. VERSION=${VERSION:-2.4.0}
  32. BUILD=${BUILD:-1}
  33. TAG=${TAG:-_SBo}
  34. PKGTYPE=${PKGTYPE:-tgz}
  35. if [ -z "$ARCH" ]; then
  36. case "$( uname -m )" in
  37. i?86) ARCH=i586 ;;
  38. arm*) ARCH=arm ;;
  39. *) ARCH=$( uname -m ) ;;
  40. esac
  41. fi
  42. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  43. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  44. exit 0
  45. fi
  46. TMP=${TMP:-/tmp/SBo}
  47. PKG=$TMP/package-$PRGNAM
  48. OUTPUT=${OUTPUT:-/tmp}
  49. set -e
  50. rm -rf $PKG
  51. mkdir -p $TMP $PKG $OUTPUT
  52. cd $TMP
  53. rm -rf $PRGNAM-$VERSION
  54. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  55. cd $PRGNAM-$VERSION
  56. chown -R root:root .
  57. find -L . \
  58. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  59. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  60. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  61. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  62. python3 -m build --no-isolation
  63. python3 -m installer -d "$PKG" dist/*.whl
  64. mkdir -p $PKG/usr/share/bash-completion/completions
  65. install -m644 $CWD/beet $PKG/usr/share/bash-completion/completions/
  66. mkdir -p $PKG/usr/share/zsh/site-functions
  67. install -m644 extra/_beet $PKG/usr/share/zsh/site-functions/
  68. install -D -m644 man/beet.1 $PKG/usr/man/man1/beet.1
  69. install -D -m644 man/beetsconfig.5 $PKG/usr/man/man5/beetsconfig.5
  70. find $PKG/usr/man -type f -exec gzip -9 {} \+
  71. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  72. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  73. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  74. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  75. cp -a README.rst LICENSE docs/* $PKG/usr/doc/$PRGNAM-$VERSION
  76. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  77. mkdir -p $PKG/install
  78. cat $CWD/slack-desc > $PKG/install/slack-desc
  79. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  80. cd $PKG
  81. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE