qtoctave.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/sh
  2. # Slackware build script for QtOctave
  3. # Written by Mauro Giachero (mauro dot giachero at gmail dot com)
  4. # Modified by Robby Workman <rworkman@slackbuilds.org>
  5. PRGNAM=qtoctave
  6. VERSION=${VERSION:-0.8.1}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. if [ -z "$ARCH" ]; then
  10. case "$( uname -m )" in
  11. i?86) ARCH=i486 ;;
  12. arm*) ARCH=arm ;;
  13. *) ARCH=$( uname -m ) ;;
  14. esac
  15. fi
  16. CWD=$(pwd)
  17. TMP=${TMP:-/tmp/SBo}
  18. PKG=$TMP/package-$PRGNAM
  19. OUTPUT=${OUTPUT:-/tmp}
  20. if [ "$ARCH" = "i486" ]; then
  21. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  22. LIBDIRSUFFIX=""
  23. elif [ "$ARCH" = "i686" ]; then
  24. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  25. LIBDIRSUFFIX=""
  26. elif [ "$ARCH" = "x86_64" ]; then
  27. SLKCFLAGS="-O2 -fPIC"
  28. LIBDIRSUFFIX="64"
  29. else
  30. SLKCFLAGS="-O2"
  31. LIBDIRSUFFIX=""
  32. fi
  33. set -e
  34. rm -rf $PKG
  35. mkdir -p $TMP $PKG $OUTPUT
  36. cd $TMP
  37. rm -rf $PRGNAM-$VERSION
  38. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  39. cd $PRGNAM-$VERSION/$PRGNAM
  40. chown -R root:root .
  41. find -L . \
  42. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  43. -exec chmod 755 {} \; -o \
  44. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  45. -exec chmod 644 {} \;
  46. # Fix building with gcc4.4
  47. patch -p2 < $CWD/qtoctave-0.8.1-gcc4.4.patch
  48. cmake \
  49. -DCMAKE_C_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
  50. -DCMAKE_CXX_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
  51. -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  52. -DLIB_SUFFIX:STRING=${LIBDIRSUFFIX} .
  53. make
  54. # The install target doesn't have a DESTDIR or INSTALL_ROOT or equivalent,
  55. # and setting the CMAKE_INSTALL_PREFIX to $PKG/usr results in a lot of
  56. # '/tmp/SBo/package-qtoctave' strings embedded in the qtoctave binary.
  57. # This *could* have security implications (for example, if that binary first
  58. # looks in the temp directory for things). It's low risk, and would require
  59. # someone on the system to have knowledge of how the package was built, so
  60. # I'm being a bit "chicken little" here, but correct is always better, so I'm
  61. # going to do this the hard way... --rworkman
  62. #
  63. # Be sure to check the src/cmake_install.cmake file in version updates to
  64. # make sure we don't miss something
  65. mkdir -p $PKG/usr/share/qtoctave $PKG/usr/bin \
  66. $PKG/usr/share/applications $PKG/usr/share/icons/hicolor/64x64/apps
  67. cp -a src/config_files/config.rc src/images src/lang src/menus \
  68. src/config_files/octave.xml src/octave_doc src/qtoctave_doc \
  69. src/scripts $PKG/usr/share/qtoctave
  70. # QtOctave better fits in "Science & Math" (with Octave) than
  71. # under "Edutainment" subcategories
  72. # cp -a src/config_files/qtoctave.desktop $PKG/usr/share/applications/
  73. cat src/config_files/qtoctave.desktop |sed "s/Education/Development/g" \
  74. >$PKG/usr/share/applications/qtoctave.desktop
  75. ln -s /usr/share/qtoctave/images/qtoctave.png $PKG/usr/share/icons/hicolor/64x64/apps/
  76. cp -a src/qtoctave $PKG/usr/bin
  77. find $PKG/usr/share -type f -exec chmod 0644 {} \;
  78. find $PKG/usr/share -type d -exec chmod 0755 {} \;
  79. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  80. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  81. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  82. cp -a leeme.txt news.txt LICENSE_GPL.txt readme.txt \
  83. $PKG/usr/doc/$PRGNAM-$VERSION
  84. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  85. ( cd $PKG/usr/doc/$PRGNAM-$VERSION
  86. ln -s /usr/share/$PRGNAM/qtoctave-doc .
  87. ln -s /usr/share/$PRGNAM/octave-doc .
  88. )
  89. mkdir -p $PKG/install
  90. cat $CWD/slack-desc > $PKG/install/slack-desc
  91. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  92. cd $PKG
  93. /sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}