cd-discid.SlackBuild 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. # Slackware build script for cd-discid
  3. # Copyright 2007 Jim Capozzoli <saltmiser@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Modified by the SlackBuilds.org project
  23. PRGNAM=cd-discid
  24. VERSION=0.9
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. # Automatically determine the architecture we're building on:
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i486 ;;
  31. arm*) ARCH=arm ;;
  32. # Unless $ARCH is already set, use uname -m for all other archs:
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. CWD=$(pwd)
  37. TMP=${TMP:-/tmp/SBo}
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp}
  40. if [ "$ARCH" = "i486" ]; then
  41. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "i686" ]; then
  44. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "x86_64" ]; then
  47. SLKCFLAGS="-O2 -fPIC"
  48. LIBDIRSUFFIX="64"
  49. else
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. fi
  53. set -e
  54. mkdir -p $TMP $PKG $OUTPUT
  55. rm -rf $PKG $TMP/$PRGNAM-$VERSION
  56. cd $TMP
  57. tar xvf $CWD/${PRGNAM}_${VERSION}.orig.tar.gz
  58. cd $PRGNAM-$VERSION
  59. chown -R root:root .
  60. chmod -R u+w,go+r-w,a-s .
  61. # Apply a patch to Makefile to fix mandir and prevent setting ownership during
  62. # the install. The mandir could easily be done by passing the 'mandir'
  63. # variable to 'make install' but the ownership setting can't be omitted any
  64. # other way. This isn't a huge issue, but I'm probably not the only one who
  65. # likes to test scripts as a normal user before running them as root, and the
  66. # ownership setting has to be removed for that to work. --rworkman
  67. patch -p1 < $CWD/Makefile.diff
  68. make CFLAGS+="$SLKCFLAGS"
  69. make install DESTDIR=$PKG
  70. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  71. cp -a COPYING README changelog $PKG/usr/doc/$PRGNAM-$VERSION
  72. find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. strip --strip-unneeded $PKG/usr/bin/cd-discid
  75. gzip -9 $PKG/usr/man/man1/*.?
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cd $PKG
  79. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}