rplay.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #!/bin/bash
  2. # Slackware build script for rplay
  3. # Written by Andrew Rowland <darowland@ieee.org>
  4. # 20220410 bkw: Modified by SlackBuilds.org, BUILD=2:
  5. # - do not install headers executable in /usr/include.
  6. # - remove useless INSTALL.generic from doc dir, rename
  7. # useful INSTALL to something more descriptive.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=rplay
  10. VERSION=${VERSION:-3.3.2}
  11. BUILD=${BUILD:-2}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. # Set the user for the rplay daemon.
  15. RPLAYUSER=${RPLAYUSER:-rplayd}
  16. RPLAYGROUP=${RPLAYGROUP:-rplayd}
  17. RPLAYUID=${RPLAYUID:-258}
  18. RPLAYGID=${RPLAYGID:-258}
  19. # Bail out if user or group isn't valid on your system
  20. # For slackbuilds.org, assigned rplayd uid/gid are 258/258
  21. # See http://slackbuilds.org/uid_gid.txt
  22. if [ "$(grep ^$RPLAYUSER: /etc/passwd)" = "" -o "$(grep ^$RPLAYGROUP: /etc/group)" = "" ] ; then
  23. echo " You must have a \"$RPLAYGROUP\" group and user to run this script."
  24. echo " # groupadd -g $RPLAYGID $RPLAYGROUP"
  25. echo " # useradd -u $RPLAYUID -g $RPLAYGROUP -d /dev/null -s /bin/false $RPLAYUSER"
  26. exit 1
  27. fi
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i486 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  36. # the name of the created package would be, and then exit. This information
  37. # could be useful to other scripts.
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i486" ]; then
  46. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. fi
  58. set -e
  59. rm -rf $PKG
  60. mkdir -p $TMP $PKG $OUTPUT
  61. cd $TMP
  62. rm -rf $PRGNAM-$VERSION
  63. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  64. cd $PRGNAM-$VERSION
  65. chown -R root:root .
  66. find -L . \
  67. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  68. -exec chmod 755 {} \; -o \
  69. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  70. -exec chmod 644 {} \;
  71. patch -Np1 -i $CWD/$PRGNAM-$VERSION-destdir-1.patch
  72. # Teach this to accept --libdir
  73. sed -i "s/^\(libdir=\).*/\1@libdir@/" Makefile.config.in
  74. sed -i "s/^\(libdir = \).*/\1@libdir@/" rx/Makefile.in
  75. CFLAGS="$SLKCFLAGS -D_GNU_SOURCE" \
  76. CXXFLAGS="$SLKCFLAGS -D_GNU_SOURCE" \
  77. ./configure \
  78. --prefix=/usr \
  79. --libdir=/usr/lib${LIBDIRSUFFIX} \
  80. --sysconfdir=/etc/rplay \
  81. --localstatedir=/var \
  82. --mandir=/usr/man \
  83. --enable-rplayd-user=$RPLAYER \
  84. --enable-rplayd-group=$RPLAYER
  85. make
  86. make install DESTDIR=$PKG
  87. # Remove the static library. There is no configure option to suppress the
  88. # static library and this is easier than hacking the script.
  89. rm -f $PKG/usr/lib$LIBDIRSUFFIX/librplay.a
  90. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  91. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  92. rm -f $PKG/usr/info/dir
  93. gzip -9 $PKG/usr/info/*.info* $PKG/usr/man/man*/*
  94. # 20220410 bkw: C headers shouldn't be executable.
  95. chmod 0644 $PKG/usr/include/*.h
  96. # 20220410 bkw: normally, INSTALL is useless to package users.
  97. # This one actually has useful config info and a FAQ, so it should
  98. # be installed... but give it a different name.
  99. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  100. cp -a INSTALL $PKG/usr/doc/$PRGNAM-$VERSION/install-config-faq.txt
  101. cp -a \
  102. COPYING NEWS PORTING README README.linux TODO \
  103. $PKG/usr/doc/$PRGNAM-$VERSION
  104. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  105. mkdir -p $PKG/install
  106. cat $CWD/slack-desc > $PKG/install/slack-desc
  107. cd $PKG
  108. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE