opencomal.SlackBuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/bash
  2. # Slackware build script for opencomal
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=opencomal
  7. VERSION=${VERSION:-0.2.6}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  11. if [ "${BETA:-no}" = "yes" ]; then
  12. VERSION="0.2.7pre1"
  13. TARVER="0.2.7-pre1-work"
  14. else
  15. TARVER="$VERSION"
  16. fi
  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 [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. if [ "$ARCH" = "i586" ]; then
  32. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "i686" ]; then
  35. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. else
  41. SLKCFLAGS="-O2"
  42. LIBDIRSUFFIX=""
  43. fi
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf $PRGNAM-$TARVER
  49. tar xvf $CWD/$PRGNAM-$TARVER.tar.gz
  50. cd $PRGNAM-$TARVER
  51. rm -rf bin/* # do not use prebuilt binaries
  52. chown -R root:root .
  53. find . -type d -exec chmod 755 {} \+
  54. find . -type f -exec chmod 644 {} \+
  55. chmod 755 tools/*
  56. # see patches/README to find out what all these patches are for.
  57. for i in $CWD/patches/*.diff; do
  58. echo "Applying $(basename $i)"
  59. patch -p1 < $i
  60. done
  61. # no point building in debug symbols that we strip out afterwards.
  62. sed -i 's,-ggdb,,' src/Makefile
  63. # not 100% sure -j1 is needed, but this is a small program anyway.
  64. make -j1 -C src PROFILE="$SLKCFLAGS"
  65. # no 'make install' target.
  66. mkdir -p $PKG/usr/bin
  67. install -s -m0755 bin/* $PKG/usr/bin
  68. # don't need to install build docs.
  69. rm -f doc/BUILD
  70. # no man pages. neither binary takes any flags, so I don't see much point
  71. # in creating them.
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cp -a doc/* samples $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