libebur128.SlackBuild 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. # Slackware build script for libebur128
  3. # Copyright 2019-22 | Klaatu, Lawrence NZ | klaatu@member.fsf.org
  4. # All rights reserved.
  5. #
  6. # GNU All-Permissive License
  7. # Copying and distribution of this file, with or without modification,
  8. # are permitted in any medium without royalty provided the copyright
  9. # notice and this notice are preserved. This file is offered as-is,
  10. # without any warranty.
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=libebur128
  13. VERSION=${VERSION:-1.2.6}
  14. BUILD=${BUILD:-1}
  15. TAG=${TAG:-_SBo}
  16. PKGTYPE=${PKGTYPE:-tgz}
  17. if [ -z "$ARCH" ]; then
  18. case "$( uname -m )" in
  19. i?86) ARCH=i586 ;;
  20. arm*) ARCH=arm ;;
  21. *) ARCH=$( uname -m ) ;;
  22. esac
  23. fi
  24. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  25. # the name of the created package would be, and then exit. This information
  26. # could be useful to other scripts.
  27. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  28. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  29. exit 0
  30. fi
  31. TMP=${TMP:-/tmp/SBo}
  32. PKG=$TMP/package-$PRGNAM
  33. OUTPUT=${OUTPUT:-/tmp}
  34. if [ "$ARCH" = "i586" ]; then
  35. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "i686" ]; then
  38. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  39. LIBDIRSUFFIX=""
  40. elif [ "$ARCH" = "x86_64" ]; then
  41. SLKCFLAGS="-O2 -fPIC"
  42. LIBDIRSUFFIX="64"
  43. else
  44. SLKCFLAGS="-O2"
  45. LIBDIRSUFFIX=""
  46. fi
  47. set -e
  48. rm -rf $PKG
  49. mkdir -p $TMP $PKG $OUTPUT
  50. cd $TMP
  51. rm -rf $PRGNAM-$VERSION
  52. tar xvf $CWD/"${PRGNAM}"-"${VERSION}".tar.gz
  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. mkdir -p build
  61. cd build
  62. cmake \
  63. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  64. -DCMAKE_INSTALL_PREFIX=/usr \
  65. -DBUILD_STATIC_LIBS=OFF \
  66. -DCMAKE_BUILD_TYPE=Release ..
  67. make
  68. make install DESTDIR=$PKG
  69. cd ..
  70. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  71. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cp -a COPYING README.md $PKG/usr/doc/$PRGNAM-$VERSION
  74. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  75. mkdir -p $PKG/install
  76. cat $CWD/slack-desc > $PKG/install/slack-desc
  77. cd $PKG
  78. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE