raw-thumbnailer.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/bash
  2. # Slackware build script for raw-thumbnailer
  3. # Copyright 2007-2011 Michiel van Wessem, Manchester, United Kingdom
  4. # Copyright 2019 B. Watson
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are
  9. # met:
  10. #
  11. # * Redistributions of source code must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  18. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. # Now maintained by B. Watson <urchlay@slackware.uk>.
  26. # For testing: raw-thumbnailer -s size input.raw output.png
  27. # 20191231 bkw:
  28. # - take over maintenance
  29. # - update for v3.0.0
  30. # - i486 => i586
  31. # - don't install INSTALL or empty files in doc dir
  32. # - support both .gz and .bz2 tarballs, so we can still build v0.2.1
  33. # - add doinst.sh with update-mime-database
  34. # - fix slack-desc and README
  35. # Note to self: there's a bunch of sample images in various camera formats
  36. # here: https://www.rawsamples.ch/index.php/en/
  37. cd $(dirname $0) ; CWD=$(pwd)
  38. PRGNAM=raw-thumbnailer
  39. VERSION=${VERSION:-3.0.0}
  40. BUILD=${BUILD:-1}
  41. TAG=${TAG:-_SBo}
  42. PKGTYPE=${PKGTYPE:-tgz}
  43. if [ -z "$ARCH" ]; then
  44. case "$( uname -m )" in
  45. i?86) ARCH=i586 ;;
  46. arm*) ARCH=arm ;;
  47. *) ARCH=$( uname -m ) ;;
  48. esac
  49. fi
  50. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  51. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  52. exit 0
  53. fi
  54. TMP=${TMP:-/tmp/SBo}
  55. PKG=$TMP/package-$PRGNAM
  56. OUTPUT=${OUTPUT:-/tmp}
  57. if [ "$ARCH" = "i586" ]; then
  58. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  59. LIBDIRSUFFIX=""
  60. elif [ "$ARCH" = "i686" ]; then
  61. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  62. LIBDIRSUFFIX=""
  63. elif [ "$ARCH" = "x86_64" ]; then
  64. SLKCFLAGS="-O2 -fPIC"
  65. LIBDIRSUFFIX="64"
  66. else
  67. SLKCFLAGS="-O2"
  68. LIBDIRSUFFIX=""
  69. fi
  70. set -e
  71. rm -rf $PKG
  72. mkdir -p $TMP $PKG $OUTPUT
  73. cd $TMP
  74. rm -rf $PRGNAM-$VERSION
  75. tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
  76. cd $PRGNAM-$VERSION
  77. chown -R root:root .
  78. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  79. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  80. CFLAGS="$SLKCFLAGS" \
  81. CXXFLAGS="$SLKCFLAGS" \
  82. ./configure \
  83. --prefix=/usr \
  84. --libdir=/usr/lib${LIBDIRSUFFIX} \
  85. --sysconfdir=/etc \
  86. --localstatedir=/var \
  87. --mandir=/usr/man \
  88. --docdir=/usr/doc/$PRGNAM-$VERSION \
  89. --build=$ARCH-slackware-linux
  90. make
  91. make install-strip DESTDIR=$PKG
  92. DOCDIR=$PKG/usr/doc/$PRGNAM-$VERSION
  93. mkdir -p $DOCDIR
  94. cp -a AUTHORS COPYING ChangeLog NEWS README $DOCDIR
  95. find $DOCDIR -type f -a -empty -a -exec rm {} \+
  96. cat $CWD/$PRGNAM.SlackBuild > $DOCDIR/$PRGNAM.SlackBuild
  97. mkdir -p $PKG/install
  98. cat $CWD/slack-desc > $PKG/install/slack-desc
  99. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  100. cd $PKG
  101. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE