viewnior.SlackBuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/bash
  2. #
  3. # Slackware build script for viewnior.
  4. #
  5. # Written by Šime Ramov <email removed>
  6. # Copyright 2016-2018 Edinaldo P. Silva, Rio de Janeiro, Brazil.
  7. # Copyright 2020 B. Watson
  8. # All rights reserved.
  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. # 20200304 bkw:
  27. # - take over maintenance
  28. # - use proper github URL
  29. # - fix typos (It's => Its), BUILD=2
  30. # - fix permissions (svg icon in package was +x)
  31. # - tighten up script a bit
  32. cd $(dirname $0) ; CWD=$(pwd)
  33. PRGNAM=viewnior
  34. VERSION=${VERSION:-1.7}
  35. BUILD=${BUILD:-2}
  36. TAG=${TAG:-_SBo}
  37. PKGTYPE=${PKGTYPE:-tgz}
  38. SRCNAM=Viewnior-$PRGNAM
  39. if [ -z "$ARCH" ]; then
  40. case "$( uname -m )" in
  41. i?86) ARCH=i586 ;;
  42. arm*) ARCH=arm ;;
  43. *) ARCH=$( uname -m ) ;;
  44. esac
  45. fi
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. if [ "$ARCH" = "i586" ]; then
  54. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. else
  63. SLKCFLAGS="-O2"
  64. LIBDIRSUFFIX=""
  65. fi
  66. set -e
  67. rm -rf $PKG
  68. mkdir -p $TMP $PKG $OUTPUT
  69. cd $TMP
  70. rm -rf $SRCNAM-$VERSION
  71. tar xvf $CWD/$SRCNAM-$VERSION.tar.?z
  72. cd $SRCNAM-$VERSION
  73. chown -R root:root .
  74. # 20200304 bkw: upstream perms suck, do not revert to template:
  75. find -L . -type d -a -exec chmod 755 {} + -o \
  76. -type f -a -exec chmod 644 {} +
  77. sed -i "s,It's,Its," man/$PRGNAM.1
  78. CFLAGS="$SLKCFLAGS" \
  79. CXXFLAGS="$SLKCFLAGS" \
  80. meson \
  81. --prefix=/usr \
  82. --libdir=/usr/lib${LIBDIRSUFFIX} \
  83. --sysconfdir=/etc \
  84. --mandir=/usr/man \
  85. build
  86. NINJA=${NINJA:-ninja}
  87. $NINJA -C build
  88. DESTDIR=$PKG $NINJA -C build install
  89. strip $PKG/usr/bin/$PRGNAM
  90. gzip -9 $PKG/usr/man/man1/$PRGNAM.1
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cp -a AUTHORS COPYING NEWS README.md TODO $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  97. cd $PKG
  98. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE