VariCAD.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/bash
  2. # Slackware build script for VariCAD
  3. # a 3D/2D CAD system for mechanical engineering
  4. # Copyright 2010-2013 Niels Horn, Rio de Janeiro, Brazil
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # Written with inspiration from the OpenOffice.org SlackBuild, so thanks to Robby Workman :)
  24. # Revision date: 2013/03/29
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=VariCAD
  27. VERSION=${VERSION:-2013_2.01}
  28. BUILD=${BUILD:-1}
  29. TAG=${TAG:-_SBo}
  30. PKGTYPE=${PKGTYPE:-tgz}
  31. # Set language
  32. SRCLANG=${VCLANG:-en}
  33. # Set version of 'source' and package
  34. SRCVERSION=$(echo $VERSION | sed "s/_/-$SRCLANG-/")
  35. PKGVERSION="${VERSION}_$SRCLANG"
  36. case "$( uname -m )" in
  37. i?86) ARCH=i486 ;;
  38. arm*) ARCH=arm ;;
  39. *) ARCH=$( uname -m ) ;;
  40. esac
  41. if [ "$ARCH" = "i486" ]; then
  42. SRCARCH="i586"
  43. PKGARCH="i586"
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SRCARCH="$ARCH"
  46. PKGARCH="$ARCH"
  47. else
  48. printf "$ARCH is not supported...\n"
  49. exit 1
  50. fi
  51. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  52. # the name of the created package would be, and then exit. This information
  53. # could be useful to other scripts.
  54. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  55. echo "$PRGNAM-$PKGVERSION-$PKGARCH-$BUILD$TAG.$PKGTYPE"
  56. exit 0
  57. fi
  58. TMP=${TMP:-/tmp/SBo}
  59. PKG=$TMP/package-$PRGNAM
  60. OUTPUT=${OUTPUT:-/tmp}
  61. set -e
  62. rm -rf $PKG
  63. mkdir -p $TMP $PKG $OUTPUT
  64. # 'unpack' the RPM into the $PKG directory
  65. cd $PKG
  66. rpm2cpio < $CWD/${PRGNAM}_${SRCVERSION}-1.${SRCARCH}.rpm | cpio -imdv
  67. # Put documentation in the right directory
  68. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  69. mv $PKG/usr/share/doc/packages/${PRGNAM}_$(echo $VERSION | cut -f1 -d_)-$SRCLANG/* \
  70. $PKG/usr/doc/$PRGNAM-$VERSION
  71. rm -r $PKG/usr/share
  72. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  73. # Put .desktop & icon in right places
  74. mkdir -p $PKG/usr/share/{applications,pixmaps}
  75. cp $PKG/opt/$PRGNAM/desktop/varicad.xpm $PKG/usr/share/pixmaps/
  76. cp $PKG/opt/$PRGNAM/desktop/varicad.desktop $PKG/usr/share/applications/
  77. mkdir -p $PKG/install
  78. cat $CWD/slack-desc > $PKG/install/slack-desc
  79. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  80. # Set the lib directory as a+w so that we do not need to enter the license as root:
  81. chmod a+w $PKG/opt/$PRGNAM/lib
  82. cd $PKG
  83. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$PKGVERSION-$PKGARCH-$BUILD$TAG.$PKGTYPE