wmcalc.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/bash
  2. # Slackware build script for wmcalc
  3. #
  4. # Copyright 2015 Gethyn ThomasQuail <email removed>
  5. # All rights reserved.
  6. #
  7. # Based on:
  8. # SBo's cmake-template
  9. #
  10. # Redistribution and use of this script, with or without modification, is
  11. # permitted provided that the following conditions are met:
  12. #
  13. # 1. Redistributions of this script must retain the above copyright
  14. # notice, this list of conditions and the following disclaimer.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  17. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  19. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  22. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  23. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  24. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  25. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. # Now maintained by B. Watson <urchlay@slackware.uk>
  27. # 20180911 bkw: update for v0.7.
  28. # 20160816 bkw:
  29. # - take over maintenance
  30. # - BUILD=2
  31. # - install binary stripped
  32. # - actually use SLKCFLAGS
  33. # - don't install extra copy of wmcalc.conf in doc dir
  34. # - use .new for the config file, add doinst.sh
  35. # - i486 => i586
  36. # - use tarball hosted on naptime, to avoid md5sum mismatches
  37. # 20161010 bkw:
  38. # - version bump, BUILD=1
  39. # - previous version installed man page in wrong place
  40. cd $(dirname $0) ; CWD=$(pwd)
  41. PRGNAM=wmcalc
  42. VERSION=${VERSION:-0.7}
  43. BUILD=${BUILD:-1}
  44. TAG=${TAG:-_SBo}
  45. PKGTYPE=${PKGTYPE:-tgz}
  46. if [ -z "$ARCH" ]; then
  47. case "$( uname -m )" in
  48. i?86) ARCH=i586 ;;
  49. arm*) ARCH=arm ;;
  50. *) ARCH=$( uname -m ) ;;
  51. esac
  52. fi
  53. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  54. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  55. exit 0
  56. fi
  57. TMP=${TMP:-/tmp/SBo}
  58. PKG=$TMP/package-$PRGNAM
  59. OUTPUT=${OUTPUT:-/tmp}
  60. if [ "$ARCH" = "i586" ]; then
  61. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  62. LIBDIRSUFFIX=""
  63. elif [ "$ARCH" = "i686" ]; then
  64. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  65. LIBDIRSUFFIX=""
  66. elif [ "$ARCH" = "x86_64" ]; then
  67. SLKCFLAGS="-O2 -fPIC"
  68. LIBDIRSUFFIX="64"
  69. else
  70. SLKCFLAGS="-O2"
  71. LIBDIRSUFFIX=""
  72. fi
  73. set -e
  74. rm -rf $PKG
  75. mkdir -p $TMP $PKG $OUTPUT
  76. cd $TMP
  77. rm -rf $PRGNAM-$VERSION
  78. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  79. cd $PRGNAM-$VERSION
  80. chown -R root:root .
  81. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  82. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  83. CFLAGS="$SLKCFLAGS" \
  84. CXXFLAGS="$SLKCFLAGS" \
  85. ./configure \
  86. --prefix=/usr \
  87. --libdir=/usr/lib${LIBDIRSUFFIX} \
  88. --sysconfdir=/etc \
  89. --localstatedir=/var \
  90. --mandir=/usr/man \
  91. --docdir=/usr/doc/$PRGNAM-$VERSION \
  92. --build=$ARCH-slackware-linux
  93. make install-strip DESTDIR=$PKG PREFIX=/usr MANDIR=/usr/man/man1
  94. gzip -9 $PKG/usr/man/man1/$PRGNAM.1
  95. mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
  96. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  97. cp -a COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  98. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE