You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.4 KiB

  1. #!/bin/sh
  2. # Slackware Package Build Script for perl module: Crypt::OpenSSL::Random
  3. # Home Page http://search.cpan.org/dist/Crypt-OpenSSL-Random/
  4. # Copyright (c) 2008-2016, Nishant Limbachia, Hoffman Estates, IL, USA
  5. # (nishant _AT_ mnspace _DOT_ net)
  6. # All rights reserved.
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. # 1. Redistributions of script must retain the above copyright notice,
  10. # this list of conditions and the following disclaimer.
  11. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  12. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  13. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  14. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  15. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  16. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  18. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  19. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  20. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  21. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. # Modified by the SlackBuilds.org project.
  24. SRCNAM="Crypt-OpenSSL-Random"
  25. PRGNAM="perl-Crypt-OpenSSL-Random"
  26. VERSION=${VERSION:-0.11}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_SBo}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. CWD=$(pwd)
  37. TMP=${TMP:-/tmp/SBo}
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp}
  40. set -e
  41. DOCS="Changes LICENSE"
  42. if [ "$ARCH" = "i586" ]; then
  43. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "i686" ]; then
  46. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "x86_64" ]; then
  49. SLKCFLAGS="-O2 -fPIC"
  50. LIBDIRSUFFIX="64"
  51. else
  52. SLKCFLAGS="-O2"
  53. LIBDIRSUFFIX=""
  54. fi
  55. rm -fr $TMP/$SRCNAM-$VERSION $PKG
  56. mkdir -p $TMP $PKG $OUTPUT
  57. cd $TMP
  58. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  59. cd $TMP/$SRCNAM-$VERSION
  60. chown -R root.root .
  61. find -L . \
  62. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  63. -exec chmod 755 {} \; -o \
  64. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  65. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  66. CFLAGS="$SLKCFLAGS" \
  67. perl Makefile.PL PREFIX=/usr INSTALLDIRS=vendor INSTALLVENDORMAN3DIR=/usr/man/man3
  68. make
  69. make install DESTDIR=$PKG
  70. ### putting essential docs
  71. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  72. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. # Remove perlocal.pod and .packlist from $PKG
  75. ( cd $PKG
  76. find . -name "perllocal.pod" -o -name ".packlist" -o -name "*.bs" | xargs rm -f
  77. )
  78. # Remove empty directories
  79. find $PKG -depth -type d -empty -exec rm -rf {} \;
  80. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  81. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  82. ( cd $PKG/usr/man
  83. find . -type f -exec gzip -9 {} \;
  84. for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
  85. )
  86. mkdir -p $PKG/install
  87. cat $CWD/slack-desc > $PKG/install/slack-desc
  88. cd $PKG
  89. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}