wmcalc.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # 20221226 bkw: add missing update-desktop-database to doinst.sh, BUILD=2.
  28. # 20180911 bkw: update for v0.7.
  29. # 20160816 bkw:
  30. # - take over maintenance
  31. # - BUILD=2
  32. # - install binary stripped
  33. # - actually use SLKCFLAGS
  34. # - don't install extra copy of wmcalc.conf in doc dir
  35. # - use .new for the config file, add doinst.sh
  36. # - i486 => i586
  37. # - use tarball hosted on naptime, to avoid md5sum mismatches
  38. # 20161010 bkw:
  39. # - version bump, BUILD=1
  40. # - previous version installed man page in wrong place
  41. cd $(dirname $0) ; CWD=$(pwd)
  42. PRGNAM=wmcalc
  43. VERSION=${VERSION:-0.7}
  44. BUILD=${BUILD:-2}
  45. TAG=${TAG:-_SBo}
  46. PKGTYPE=${PKGTYPE:-tgz}
  47. if [ -z "$ARCH" ]; then
  48. case "$( uname -m )" in
  49. i?86) ARCH=i586 ;;
  50. arm*) ARCH=arm ;;
  51. *) ARCH=$( uname -m ) ;;
  52. esac
  53. fi
  54. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  55. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  56. exit 0
  57. fi
  58. TMP=${TMP:-/tmp/SBo}
  59. PKG=$TMP/package-$PRGNAM
  60. OUTPUT=${OUTPUT:-/tmp}
  61. if [ "$ARCH" = "i586" ]; then
  62. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  63. LIBDIRSUFFIX=""
  64. elif [ "$ARCH" = "i686" ]; then
  65. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  66. LIBDIRSUFFIX=""
  67. elif [ "$ARCH" = "x86_64" ]; then
  68. SLKCFLAGS="-O2 -fPIC"
  69. LIBDIRSUFFIX="64"
  70. else
  71. SLKCFLAGS="-O2"
  72. LIBDIRSUFFIX=""
  73. fi
  74. set -e
  75. rm -rf $PKG
  76. mkdir -p $TMP $PKG $OUTPUT
  77. cd $TMP
  78. rm -rf $PRGNAM-$VERSION
  79. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  80. cd $PRGNAM-$VERSION
  81. chown -R root:root .
  82. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  83. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  84. CFLAGS="$SLKCFLAGS" \
  85. CXXFLAGS="$SLKCFLAGS" \
  86. ./configure \
  87. --prefix=/usr \
  88. --libdir=/usr/lib${LIBDIRSUFFIX} \
  89. --sysconfdir=/etc \
  90. --localstatedir=/var \
  91. --mandir=/usr/man \
  92. --docdir=/usr/doc/$PRGNAM-$VERSION \
  93. --build=$ARCH-slackware-linux
  94. make install-strip DESTDIR=$PKG PREFIX=/usr MANDIR=/usr/man/man1
  95. gzip -9 $PKG/usr/man/man1/$PRGNAM.1
  96. mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
  97. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  98. cp -a COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  99. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  100. mkdir -p $PKG/install
  101. cat $CWD/slack-desc > $PKG/install/slack-desc
  102. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  103. cd $PKG
  104. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE