calc.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Slackware build script for calc
  3. # Copyright 2017 Dhaby Xiloj <slack.dhabyx@gmail.com>
  4. # Copyright 2008-2010 Grigorios Bouzakis <grbzks@xsmail.com>
  5. # Copyright 2014 Glenn Becker <burningc@sdf.org>
  6. # All rights reserved.
  7. #
  8. # Permission to use, copy, modify, and distribute this software for any purpose
  9. # with or without fee is hereby granted, provided that the above copyright
  10. # notice and this permission notice appear in all copies.
  11. #
  12. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  13. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  14. # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  15. # AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY
  16. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  17. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  18. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  20. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Modified by Robby Workman <rworkman@slackbuilds.org>
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=calc
  25. VERSION=${VERSION:-2.14.0.14}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. DOCS="BUGS CHANGES COPYING COPYING-LGPL HOWTO.INSTALL LIBRARY"
  60. set -e
  61. rm -rf $PKG
  62. mkdir -p $TMP $PKG $OUTPUT
  63. cd $TMP
  64. rm -rf $PRGNAM-$VERSION
  65. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  66. cd $PRGNAM-$VERSION
  67. chown -R root:root .
  68. find -L . \
  69. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  70. -exec chmod 755 {} \; -o \
  71. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  72. -exec chmod 644 {} \;
  73. make -j1 \
  74. EXTRA_CFLAGS="$SLKCFLAGS" \
  75. SCRIPTDIR=/usr/libexec/calc \
  76. LIBDIR=/usr/lib${LIBDIRSUFFIX} \
  77. USE_READLINE="-DUSE_READLINE" \
  78. READLINE_LIB="-lreadline" \
  79. READLINE_EXTRAS="-lhistory -lncurses" \
  80. MANDIR=/usr/man/man1
  81. make install \
  82. EXTRA_CFLAGS="$SLKCFLAGS" \
  83. SCRIPTDIR=/usr/libexec/calc \
  84. LIBDIR=/usr/lib${LIBDIRSUFFIX} \
  85. MANDIR=/usr/man/man1 \
  86. T=$PKG
  87. # We like root to have write permissions on our files, kthxbye
  88. find $PKG/usr -type f -exec chmod u+w {} \;
  89. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  90. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  91. find $PKG/usr/man -type f -exec gzip -9 {} \;
  92. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  93. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  94. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  95. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  96. mkdir -p $PKG/install
  97. cat $CWD/slack-desc > $PKG/install/slack-desc
  98. cd $PKG
  99. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE