pipewire-native-jack.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. # Copyright 2020 Eric Hameleers, Eindhoven, NL
  3. # Copyright 2020, 2021, 2022 Patrick J. Volkerding, Sebeka, Minnesota, USA
  4. # Copyright 2022 Johannes Schoepfer, Germany
  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. # Thanks to almope and qunying on LQ for the headsup.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=pipewire-native-jack
  26. PRGNAM_SOURCE=pipewire
  27. VERSION=${VERSION:-0.3.44}
  28. BUILD=${BUILD:-1}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. if [ -z "$ARCH" ]; then
  32. case "$(uname -m)" in
  33. i?86) ARCH=i586 ;;
  34. arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
  35. *) ARCH=$(uname -m) ;;
  36. esac
  37. export ARCH
  38. fi
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. if [ "$ARCH" = "i586" ]; then
  44. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-O2 -march=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-O2 -fPIC"
  51. LIBDIRSUFFIX="64"
  52. elif [ "$ARCH" = "armv7hl" ]; then
  53. SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
  54. LIBDIRSUFFIX=""
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. TMP=${TMP:-/tmp}
  61. PKG=$TMP/package-$PRGNAM
  62. OUTPUT=${OUTPUT:-/tmp}
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM_SOURCE-$VERSION
  67. tar xvf $CWD/$PRGNAM_SOURCE-$VERSION.tar.?z?
  68. cd $PRGNAM_SOURCE-$VERSION
  69. chown -R root:root .
  70. find -L . \
  71. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  72. -o -perm 511 \) -exec chmod 755 {} \; -o \
  73. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  74. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  75. mkdir tmp_destdir
  76. mkdir build
  77. cd build
  78. CFLAGS="$SLKCFLAGS" \
  79. CXXFLAGS="$SLKCFLAGS" \
  80. meson .. \
  81. --buildtype=release \
  82. --infodir=/usr/info \
  83. --libdir=/usr/lib${LIBDIRSUFFIX} \
  84. --localstatedir=/var \
  85. --mandir=/usr/man \
  86. --prefix=/usr \
  87. --sysconfdir=/etc \
  88. -Djack=disabled \
  89. -Dpipewire-jack=enabled \
  90. -Djack-devel=true \
  91. -Dlibjack-path=/usr/lib$LIBDIRSUFFIX \
  92. -Dsession-managers=false \
  93. -Dstrip=true
  94. "${NINJA:=ninja}"
  95. DESTDIR=$TMP/$PRGNAM_SOURCE-$VERSION/tmp_destdir $NINJA install
  96. # Only put the jack stuff into the package:
  97. cd $TMP/$PRGNAM_SOURCE-$VERSION/tmp_destdir
  98. cp -a --parents usr/include/jack $PKG/
  99. cp -a --parents usr/lib${LIBDIRSUFFIX}/*jack* $PKG/
  100. cp -a --parents usr/lib${LIBDIRSUFFIX}/pkgconfig/jack.pc $PKG/
  101. cd ..
  102. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  103. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  104. mkdir -p $PKG/usr/doc/${PRGNAM}-$VERSION
  105. cp -a \
  106. CODE_OF_CONDUCT* COPYING* INSTALL* LICENSE* NEWS* README* \
  107. $PKG/usr/doc/${PRGNAM}-$VERSION
  108. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  109. mkdir -p $PKG/install
  110. cat $CWD/slack-desc > $PKG/install/slack-desc
  111. cd $PKG
  112. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE