perl-WWW-Curl.SlackBuild 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Slackware build script for perl-WWW-Curl
  3. # Written by Pragmatic Cypher <slackbuilds@server.ky>
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=perl-WWW-Curl
  6. VERSION=${VERSION:-4.17}
  7. BUILD=${BUILD:-2}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. SRCNAM=$(echo $PRGNAM | cut -f2- -d-)
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i586 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  19. # the name of the created package would be, and then exit. This information
  20. # could be useful to other scripts.
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i586" ]; then
  29. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. set -e
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $SRCNAM-$VERSION
  46. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  47. cd $SRCNAM-$VERSION
  48. chown -R root:root .
  49. find -L . \
  50. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  51. -o -perm 511 \) -exec chmod 755 {} \; -o \
  52. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  53. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  54. zcat $CWD/curl-7.71.0.patch.gz | patch -p1
  55. perl Makefile.PL \
  56. PREFIX=/usr \
  57. INSTALLDIRS=vendor \
  58. INSTALLVENDORMAN1DIR=/usr/man/man1 \
  59. INSTALLVENDORMAN3DIR=/usr/man/man3
  60. make
  61. # 20220301 bkw: 'make test' requires internet access, don't run it
  62. # if it looks like the network is down (e.g. due to 'unshare -n').
  63. ping -w10 -c1 google.com &>/dev/null && make test
  64. make install DESTDIR=$PKG
  65. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  66. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  67. find $PKG/usr/man -type f -exec gzip -9 {} \;
  68. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  69. find $PKG -name "perllocal.pod" -o -name ".packlist" -o -name "*.bs" -empty | xargs rm -f || true
  70. find $PKG -depth -type d -empty -delete || true
  71. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  72. cp -a Changes LICENSE MANIFEST README $PKG/usr/doc/$PRGNAM-$VERSION
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. mkdir -p $PKG/install
  75. cat $CWD/slack-desc > $PKG/install/slack-desc
  76. cd $PKG
  77. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE