phat.SlackBuild 2.8 KB

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