perl-gtk2-imageview.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. #
  3. # Slackware build script for perl-gtk2-imageview.
  4. #
  5. # Copyright 2010 Binh Nguyen
  6. # Copyright 2014-2017 Glenn Becker
  7. # Copyright 2017-2020 Edinaldo P. Silva, Rio de Janeiro, Brazil.
  8. # Copyright 2020 Donald Cooley, South Haven, Indiana, USA
  9. #
  10. # All rights reserved.
  11. #
  12. # Redistribution and use of this script, with or without modification, is
  13. # permitted provided that the following conditions are met:
  14. #
  15. # 1. Redistributions of this script must retain the above copyright
  16. # notice, this list of conditions and the following disclaimer.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  19. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  20. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  21. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  23. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  24. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  26. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  27. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. cd $(dirname $0) ; CWD=$(pwd)
  29. PRGNAM=perl-gtk2-imageview
  30. VERSION=${VERSION:-0.05}
  31. BUILD=${BUILD:-3}
  32. TAG=${TAG:-_SBo}
  33. PKGTYPE=${PKGTYPE:-tgz}
  34. if [ -z "$ARCH" ]; then
  35. case "$( uname -m )" in
  36. i?86) ARCH=i586 ;;
  37. arm*) ARCH=arm ;;
  38. *) ARCH=$( uname -m ) ;;
  39. esac
  40. fi
  41. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  42. # the name of the created package would be, and then exit. This information
  43. # could be useful to other scripts.
  44. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  45. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  46. exit 0
  47. fi
  48. TMP=${TMP:-/tmp/SBo}
  49. PKG=$TMP/package-$PRGNAM
  50. OUTPUT=${OUTPUT:-/tmp}
  51. if [ "$ARCH" = "i586" ]; then
  52. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  53. LIBDIRSUFFIX=""
  54. elif [ "$ARCH" = "i686" ]; then
  55. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  56. LIBDIRSUFFIX=""
  57. elif [ "$ARCH" = "x86_64" ]; then
  58. SLKCFLAGS="-O2 -fPIC"
  59. LIBDIRSUFFIX="64"
  60. else
  61. SLKCFLAGS="-O2"
  62. LIBDIRSUFFIX=""
  63. fi
  64. SRCNAM="Gtk2-ImageView"
  65. set -e
  66. rm -rf $PKG
  67. mkdir -p $TMP $PKG $OUTPUT
  68. cd $TMP
  69. rm -rf $SRCNAM-$VERSION
  70. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  71. cd $SRCNAM-$VERSION
  72. chown -R root:root .
  73. find -L . \
  74. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  75. -o -perm 511 \) -exec chmod 755 {} \; -o \
  76. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  77. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  78. perl Makefile.PL \
  79. OPTIMIZE="$SLKCFLAGS" \
  80. PREFIX=/usr \
  81. INSTALLDIRS=vendor \
  82. INSTALLVENDORMAN3DIR=/usr/man/man3
  83. make
  84. make install DESTDIR=$PKG
  85. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  86. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  87. find $PKG/usr/man -type f -exec gzip -9 {} \;
  88. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  89. find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true
  90. # Remove empty directories
  91. find $PKG -depth -type d -empty -delete || true
  92. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  93. cp -a AUTHORS COPYING.LESSER INSTALL README examples/ $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  95. find $PKG/usr/doc/$PRGNAM-$VERSION -type d -exec chmod 0755 {} \;
  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