perl-Class-ReturnValue.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # Copyright (c) 2013 Asaf Ohaion
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions are met:
  7. # * Redistributions of source code must retain the above copyright
  8. # notice, this list of conditions and the following disclaimer.
  9. # * Redistributions in binary form must reproduce the above copyright
  10. # notice, this list of conditions and the following disclaimer in the
  11. # documentation and/or other materials provided with the distribution.
  12. # * Neither the name of the <organization> nor the
  13. # names of its contributors may be used to endorse or promote products
  14. # derived from this software without specific prior written permission.
  15. #
  16. # THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
  17. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
  20. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. cd $(dirname $0) ; CWD=$(pwd)
  27. PRGNAM=perl-Class-ReturnValue
  28. VERSION=${VERSION:-0.55}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. SRCNAM=Class-ReturnValue
  33. if [ -z "$ARCH" ]; then
  34. case "$( uname -m )" in
  35. i?86) ARCH=i586 ;;
  36. arm*) ARCH=arm ;;
  37. *) ARCH=$( uname -m ) ;;
  38. esac
  39. fi
  40. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  41. # the name of the created package would be, and then exit. This information
  42. # could be useful to other scripts.
  43. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  44. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  45. exit 0
  46. fi
  47. TMP=${TMP:-/tmp/SBo}
  48. PKG=$TMP/package-$PRGNAM
  49. OUTPUT=${OUTPUT:-/tmp}
  50. if [ "$ARCH" = "i586" ];then
  51. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  52. LIBDIRSUFFIX=""
  53. elif [ "$ARCH" = "i686" ]; then
  54. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "x86_64" ]; then
  57. SLKCFLAGS="-O2 -fPIC"
  58. LIBDIRSUFFIX="64"
  59. else
  60. SLKCFLAGS="-O2"
  61. LIBDIRSUFFIX=""
  62. fi
  63. set -e
  64. rm -Rf $PKG
  65. mkdir -p $TMP $PKG $OUTPUT
  66. cd $TMP
  67. rm -Rf $PRGNAM-$VERSION
  68. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  69. cd $SRCNAM-$VERSION
  70. chown -R root:root .
  71. find -L . \
  72. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  73. -exec chmod 755 {} \; -o \
  74. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  75. -exec chmod 644 {} \;
  76. perl Makefile.PL \
  77. INSTALL_BASE="" \
  78. PREFIX=/usr \
  79. INSTALLDIRS=vendor \
  80. INSTALLVENDORMAN3DIR=/usr/man/man3
  81. make
  82. make test
  83. make install DESTDIR=$PKG
  84. find $PKG/usr/man -type f -exec gzip -9 {} \;
  85. # Remove perllocal.pod and other special files that don't need to be installed
  86. find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true
  87. # Remove empty directories
  88. find $PKG -depth -type d -empty -delete || true
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  91. mkdir -p $PKG/install
  92. cat $CWD/slack-desc > $PKG/install/slack-desc
  93. cd $PKG
  94. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE