convertall.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. #
  3. # Slackware build script for convertall
  4. #
  5. # Copyright 2012-2021 John Berger <irgunii ampersand gmail . com>, TN, USA
  6. # I couldn't have made this script work without the help of
  7. # Willy Sudiarto Raharjo <willysr@slackware-id.org>, so big thanks to him.
  8. # Also a big thank you to Kevin McCormick for helping with a python 3
  9. # problem I'd missed.
  10. #
  11. #
  12. # All rights reserved.
  13. #
  14. # Redistribution and use of this script, with or without modification, is
  15. # permitted provided that the following conditions are met:
  16. #
  17. # 1. Redistributions of this script must retain the above copyright
  18. # notice, this list of conditions and the following disclaimer.
  19. #
  20. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  21. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  22. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  23. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  26. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  27. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  28. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  29. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. # 20220405 bkw: Modified by SlackBuilds.org, BUILD=2:
  31. # - remove /usr/share/doc and useless INSTALL instructions.
  32. cd $(dirname $0) ; CWD=$(pwd)
  33. PRGNAM=convertall
  34. SRCNAM=ConvertAll
  35. VERSION=${VERSION:-0.8.0}
  36. BUILD=${BUILD:-2}
  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 $SRCNAM
  71. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  72. cd $SRCNAM
  73. chown -R root:root .
  74. find -L . \
  75. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  76. -exec chmod 755 {} \+ -o \
  77. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  78. -exec chmod 644 {} \+
  79. # Change installation directory to /usr and use LIBDIRSUFFIX
  80. sed -i -e "s/usr\/local/usr/" -e "s/'lib'/'lib$LIBDIRSUFFIX'/" install.py
  81. python3 install.py -b $PKG
  82. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  83. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  84. rm -rf doc/INSTALL $PKG/usr/share/doc
  85. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  86. cp -a \
  87. doc/* \
  88. $PKG/usr/doc/$PRGNAM-$VERSION
  89. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  90. mkdir -p $PKG/install
  91. cat $CWD/slack-desc > $PKG/install/slack-desc
  92. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  93. cd $PKG
  94. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE