rarcrack.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. #
  3. # Slackware build script for rarcrack.
  4. #
  5. # Copyright 2015-2020 Edinaldo P. Silva, Rio de Janeiro, Brazil.
  6. # Copyright 2020 B. Watson
  7. # All rights reserved.
  8. #
  9. # Redistribution and use of this script, with or without modification, is
  10. # permitted provided that the following conditions are met:
  11. #
  12. # 1. Redistributions of this script must retain the above copyright
  13. # notice, this list of conditions and the following disclaimer.
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  18. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  21. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. # 20200304 bkw:
  26. # - take over maintenance
  27. # - i486 => i586
  28. # - strip binary, BUILD=3
  29. # - install test archives in doc dir
  30. # - patch to fix file type autodetection
  31. # - actually use SLKCFLAGS
  32. # - use 'make install'
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=rarcrack
  35. VERSION=${VERSION:-0.2}
  36. BUILD=${BUILD:-3}
  37. TAG=${TAG:-_SBo}
  38. PKGTYPE=${PKGTYPE:-tgz}
  39. if [ -z "$ARCH" ]; then
  40. case "$( uname -m )" in
  41. i?86) ARCH=i586 ;;
  42. arm*) ARCH=arm ;;
  43. *) ARCH=$( uname -m ) ;;
  44. esac
  45. fi
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. if [ "$ARCH" = "i586" ]; then
  54. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "i686" ]; then
  57. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "x86_64" ]; then
  60. SLKCFLAGS="-O2 -fPIC"
  61. LIBDIRSUFFIX="64"
  62. else
  63. SLKCFLAGS="-O2"
  64. LIBDIRSUFFIX=""
  65. fi
  66. set -e
  67. rm -rf $PKG
  68. mkdir -p $TMP $PKG $OUTPUT
  69. cd $TMP
  70. rm -rf $PRGNAM-$VERSION
  71. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  72. cd $PRGNAM-$VERSION
  73. chown -R root:root .
  74. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  75. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  76. # autodetection relies on file(1), but on the author's system it must
  77. # be an old version, or a non-gnu one.
  78. sed -i -e '/CMD_DETECT/s|"file[^"]*"|"file -b --mime-type %s"|' \
  79. -e 's|"application/octet-stream"|"application/x-7z-compressed"|' \
  80. -e 's|"application/x-zip"|"application/zip"|' \
  81. $PRGNAM.h
  82. sed -i "s|-O2|$SLKCFLAGS|" Makefile
  83. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  84. mkdir -p $PKGDOC $PKG/usr/bin
  85. make
  86. make install PREFIX=$PKG/usr DOCDIR=$PKGDOC
  87. # 20200305 bkw: the test archives are small and may be useful (if nothing
  88. # else, useful to me for testing).
  89. cp -a test.* $PKGDOC
  90. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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