specimen.SlackBuild 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. #
  3. # Slackbuild script for specimen
  4. # Adapted from Matt Hayes's Slackbuild for phat
  5. #
  6. # Copyright (c) 2009, Matt Hayes <dominian@slackadelic.com>
  7. # Copyright (c) 2009, Christopher Forrest <nyrednek@gmx.com>
  8. #
  9. # Permission to use, copy, modify, and/or distribute this software for any
  10. # purpose with or without fee is hereby granted, provided that the above
  11. # copyright notice and this permission notice appear in all copies.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  14. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  16. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  18. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  19. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20. cd $(dirname $0) ; CWD=$(pwd)
  21. PRGNAM=specimen
  22. VERSION=${VERSION:-0.5.1}
  23. BUILD=${BUILD:-3}
  24. TAG=${TAG:-_SBo}
  25. PKGTYPE=${PKGTYPE:-tgz}
  26. if [ -z "$ARCH" ]; then
  27. case "$( uname -m )" in
  28. i?86) ARCH=i586 ;;
  29. arm*) ARCH=arm ;;
  30. *) ARCH=$( uname -m ) ;;
  31. esac
  32. fi
  33. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  34. # the name of the created package would be, and then exit. This information
  35. # could be useful to other scripts.
  36. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  37. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  38. exit 0
  39. fi
  40. TMP=${TMP:-/tmp/SBo}
  41. PKG=$TMP/package-$PRGNAM
  42. OUTPUT=${OUTPUT:-/tmp}
  43. if [ "$ARCH" = "i586" ]; then
  44. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-O2 -fPIC"
  51. LIBDIRSUFFIX="64"
  52. fi
  53. set -e
  54. rm -rf $PKG
  55. mkdir -p $TMP $PKG $OUTPUT
  56. cd $TMP
  57. rm -rf $PRGNAM-$VERSION
  58. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  59. cd $PRGNAM-$VERSION
  60. chown -R root:root .
  61. patch -Np1 < $CWD/$PRGNAM.patch
  62. find -L . \
  63. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  64. -exec chmod 755 {} \; -o \
  65. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  66. -exec chmod 644 {} \;
  67. CFLAGS="$SLKCFLAGS" \
  68. CXXFLAGS="$SLKCFLAGS" \
  69. LDFLAGS="-L/lib${LIBDIRSUFFIX} -L/usr/lib${LIBDIRSUFFIX} -lm" \
  70. ./configure \
  71. --prefix=/usr \
  72. --libdir=/usr/lib${LIBDIRSUFFIX}
  73. make
  74. make install-strip DESTDIR=$PKG
  75. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  76. cp -a AUTHORS ChangeLog INSTALL NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
  77. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  78. mkdir $PKG/usr/share/applications
  79. cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications/
  80. mkdir -p $PKG/install
  81. cat $CWD/slack-desc > $PKG/install/slack-desc
  82. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  83. cd $PKG
  84. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE