karma.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/bash
  2. # Slackware build script for karma
  3. # Copyright 2017 Nitish Ragoomundun, Mauritius
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # 20220318 bkw: Modified by SlackBuilds.org: fix build when ARCH is
  23. # set to i586 in the environment.
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=karma
  26. VERSION=${VERSION:-1.7.25}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_SBo}
  29. PKGTYPE=${PKGTYPE:-tgz}
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i686 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  38. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  39. exit 0
  40. fi
  41. TMP=${TMP:-/tmp/SBo}
  42. PKG=$TMP/package-$PRGNAM
  43. OUTPUT=${OUTPUT:-/tmp}
  44. set -e
  45. case "$ARCH" in
  46. x86_64) ARCHDEP="amd64_Linux_libc6.3" ;;
  47. i?86) ARCHDEP="i386_Linux_libc6" ;;
  48. *) printf "\n\n$ARCH is not supported... \n"; exit 1 ;;
  49. esac
  50. rm -rf $PKG
  51. mkdir -p $TMP $PKG $OUTPUT
  52. cd $TMP
  53. rm -rf $PRGNAM-$VERSION
  54. tar -jxvf $CWD/$PRGNAM-$VERSION-common.tar.bz2
  55. tar -jxvf $CWD/$PRGNAM-$VERSION-$ARCHDEP.tar.bz2
  56. # Remove some broken links and reorder directories
  57. cd $PRGNAM-$VERSION
  58. rm i386_Darwin x86_64_Darwin
  59. mv $ARCHDEP/{bin,lib} .
  60. rm -R $ARCHDEP
  61. chown -R root:root .
  62. find -L . \
  63. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  64. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  65. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  66. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  67. # Copy everything to package directory
  68. mkdir -p $PKG/opt/$PRGNAM
  69. cp -pR * $PKG/opt/$PRGNAM
  70. find $PKG/opt/$PRGNAM/man -type f -exec gzip -9 {} \;
  71. for i in $( find $PKG/opt/$PRGNAM/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  72. # Put scripts in /etc/profile.d to set up environment variables
  73. mkdir -p $PKG/etc/profile.d/
  74. # sh script
  75. cat << EOF > $PKG/etc/profile.d/karma.sh.new
  76. #!/bin/sh
  77. PATH=$PATH:/opt/$PRGNAM/bin
  78. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/$PRGNAM/lib
  79. KARMABASE=/opt/$PRGNAM
  80. EOF
  81. # csh script
  82. cat << EOF > $PKG/etc/profile.d/karma.csh.new
  83. #!/bin/csh
  84. setenv PATH $PATH:/opt/$PRGNAM/bin
  85. setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/opt/$PRGNAM/lib
  86. setenv KARMABASE /opt/$PRGNAM
  87. EOF
  88. chmod 0755 $PKG/etc/profile.d/*
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. ln -s /opt/$PRGNAM/doc/{COPYING,README} $PKG/usr/doc/$PRGNAM-$VERSION
  91. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  92. mkdir -p $PKG/install
  93. cat $CWD/slack-desc > $PKG/install/slack-desc
  94. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  95. cd $PKG
  96. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE