envision.SlackBuild 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. # Slackware build script for envision
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=envision
  7. VERSION=${VERSION:-0.9}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  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 [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  19. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  20. exit 0
  21. fi
  22. TMP=${TMP:-/tmp/SBo}
  23. PKG=$TMP/package-$PRGNAM
  24. OUTPUT=${OUTPUT:-/tmp}
  25. if [ "$ARCH" = "i586" ]; then
  26. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  27. LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. LIBDIRSUFFIX="64"
  34. else
  35. SLKCFLAGS="-O2"
  36. LIBDIRSUFFIX=""
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM-$VERSION
  43. # -x excludes the prebuilt binaries and git stuff, makes the source dir
  44. # 90% smaller.
  45. unzip $CWD/$PRGNAM-$VERSION.zip -x '*.dll' '*.exe' '*/.git/*' '*/envision'
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  49. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  50. sed -i "s,-O3,$SLKCFLAGS," src/Makefile.linux
  51. make -C src -f Makefile.linux
  52. mkdir -p $PKG/usr/bin
  53. install -s -m0755 src/$PRGNAM $PKG/usr/bin
  54. # wish there were an icon bigger than 32x32...
  55. mkdir -p $PKG/usr/share/icons/hicolor/32x32/apps $PKG/usr/share/pixmaps
  56. convert src/icon32_32.bmp $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png
  57. ln -s ../icons/hicolor/32x32/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  58. # .desktop file written by SlackBuild author.
  59. mkdir -p $PKG/usr/share/applications
  60. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  61. # man page written by SlackBuild author.
  62. mkdir -p $PKG/usr/man/man1
  63. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  64. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  65. mkdir -p $PKGDOC
  66. cp -a $PRGNAM.txt $PRGNAM.blurb $PKGDOC
  67. cat $CWD/example.xfd > $PKGDOC/example.xfd
  68. cat $CWD/example.txt > $PKGDOC/example.txt
  69. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  70. mkdir -p $PKG/install
  71. cat $CWD/slack-desc > $PKG/install/slack-desc
  72. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  73. cd $PKG
  74. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE