mpd.SlackBuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/bash
  2. # Slackware build script for mpd
  3. # Copyright 2013-2017 Dhaby Xiloj <slack.dhabyx@gmail.com>
  4. # Based on SlackBuild of Andrew Brouwers <abrouwers@gmail.com>
  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. # 20220305 bkw: Modified by SlackBuilds.org:
  24. # - add fmt to REQUIRES. without this, it was dowloading the fmt source.
  25. # 20220218 bkw: Modified by SlackBuilds.org:
  26. # - build was failing if libmikmod or libupnp were installed, so I
  27. # updated to the latest version (0.23.5).
  28. # - the version update didn't fix it, so libmikmod and libupnp are
  29. # disabled now (via meson -D options).
  30. # Note to whoever's updating this script in the future: try removing
  31. # the -Dmikmod=disabled and/or -Dupnp=disabled options. Upstream may
  32. # fix the issue at some point.
  33. # 20200411 bkw: not taking this over, but I'm upgrading it to the latest
  34. # release as part of the migration to fluidsynth-2.x.
  35. cd $(dirname $0) ; CWD=$(pwd)
  36. PRGNAM=mpd
  37. VERSION=${VERSION:-0.23.5}
  38. BUILD=${BUILD:-1}
  39. TAG=${TAG:-_SBo}
  40. PKGTYPE=${PKGTYPE:-tgz}
  41. if [ -z "$ARCH" ]; then
  42. case "$( uname -m )" in
  43. i?86) ARCH=i586 ;;
  44. arm*) ARCH=arm ;;
  45. *) ARCH=$( uname -m ) ;;
  46. esac
  47. fi
  48. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  49. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  50. exit 0
  51. fi
  52. TMP=${TMP:-/tmp/SBo}
  53. PKG=$TMP/package-$PRGNAM
  54. OUTPUT=${OUTPUT:-/tmp}
  55. if [ "$ARCH" = "i586" ]; then
  56. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  57. LIBDIRSUFFIX=""
  58. elif [ "$ARCH" = "i686" ]; then
  59. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  60. LIBDIRSUFFIX=""
  61. elif [ "$ARCH" = "x86_64" ]; then
  62. SLKCFLAGS="-O2 -fPIC"
  63. LIBDIRSUFFIX="64"
  64. else
  65. SLKCFLAGS="-O2"
  66. LIBDIRSUFFIX=""
  67. fi
  68. set -e
  69. # undocumented, but allow disabling pulseaudio
  70. if [ "${PULSE:-yes}" = "yes" ]; then
  71. PULSE="enabled"
  72. else
  73. PULSE="disabled"
  74. fi
  75. rm -rf $PKG
  76. mkdir -p $TMP $PKG $OUTPUT
  77. cd $TMP
  78. rm -rf $PRGNAM-$VERSION
  79. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  80. cd $PRGNAM-$VERSION
  81. chown -R root:root .
  82. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  83. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  84. cd build
  85. CFLAGS="$SLKCFLAGS" \
  86. CXXFLAGS="$SLKCFLAGS" \
  87. LDFLAGS="-L/usr/lib${LIBDIRSUFFIX} -lnsl" \
  88. meson .. \
  89. -Dsystemd=disabled \
  90. -Dpulse=$PULSE \
  91. -Dupnp=disabled \
  92. -Dmikmod=disabled \
  93. --buildtype=release \
  94. --infodir=/usr/info \
  95. --libdir=/usr/lib${LIBDIRSUFFIX} \
  96. --localstatedir=/var \
  97. --mandir=/usr/man \
  98. --prefix=/usr \
  99. --sysconfdir=/etc
  100. "${NINJA:=ninja}"
  101. DESTDIR=$PKG $NINJA install
  102. cd ..
  103. strip $PKG/usr/bin/$PRGNAM
  104. # 20200411 bkw: meson doesn't support --docdir
  105. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  106. mv $PKG/usr/share/doc/* $PKG/usr/doc/$PRGNAM-$VERSION
  107. rm -rf $PKG/usr/share/doc
  108. # Use sample config, without overwriting
  109. install -D -m 644 doc/mpdconf.example $PKG/etc/mpd.conf.new
  110. [ -d $PKG/usr/man ] && gzip -9 $PKG/usr/man/man*/*
  111. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  112. mkdir -p $PKG/install
  113. cat $CWD/slack-desc > $PKG/install/slack-desc
  114. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  115. cd $PKG
  116. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE