octave.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/bin/sh
  2. # Slackware build script for octave
  3. # Copyright 2012-2015 Kyle Guinn <elyk03@gmail.com>, USA
  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. PRGNAM=octave
  23. VERSION=${VERSION:-4.0.0}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo}
  26. if [ -z "$ARCH" ]; then
  27. case "$(uname -m)" in
  28. i?86) ARCH=i486 ;;
  29. arm*) ARCH=arm ;;
  30. *) ARCH=$(uname -m) ;;
  31. esac
  32. fi
  33. CWD=$(pwd)
  34. TMP=${TMP:-/tmp/SBo}
  35. PKG=$TMP/package-$PRGNAM
  36. OUTPUT=${OUTPUT:-/tmp}
  37. DOCS="AUTHORS BUGS CITATION COPYING ChangeLog INSTALL* NEWS README"
  38. if [ "$ARCH" = "i486" ]; then
  39. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "i686" ]; then
  42. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. SLKCFLAGS="-O2 -fPIC"
  46. LIBDIRSUFFIX="64"
  47. else
  48. SLKCFLAGS="-O2"
  49. LIBDIRSUFFIX=""
  50. fi
  51. # TODO: ImageMagick 6.8.6-10 from Slackware 14.1 is not compatible.
  52. # Newer versions might work, so try offering that alternative again later.
  53. # umfpack.h includes amd.h, which may be installed outside of the standard
  54. # search dirs if you use the SBo packages. This ensures UMFPACK is found.
  55. WITH_AMD_INCLUDEDIR=${WITH_AMD_INCLUDEDIR:-/usr/include/amd}
  56. set -e
  57. rm -rf $PKG
  58. mkdir -p $TMP $PKG $OUTPUT
  59. cd $TMP
  60. rm -rf $PRGNAM-$VERSION
  61. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  62. cd $PRGNAM-$VERSION
  63. chown -R root:root .
  64. chmod -R u+w,go-w,a+rX-st .
  65. # Avoid rebuilding the documentation by making stamp-vti newer than its
  66. # dependencies (in particular ./configure, which we may need to patch).
  67. # If you live far enough east or west that the date contained in version.texi
  68. # does not match that file's timestamp when printed accounting for your
  69. # timezone, then the docs get rebuilt with your local date.
  70. #
  71. # The TeX environment in Slackware 14.1 fails to build the DVI and PDF
  72. # targets in Octave 3.8.1. Maybe it works with a recent version of TeXLive?
  73. find . -name stamp-vti -exec touch {} +
  74. CFLAGS="$SLKCFLAGS" \
  75. CXXFLAGS="$SLKCFLAGS" \
  76. FFLAGS="$SLKCFLAGS" \
  77. ./configure \
  78. --prefix=/usr \
  79. --libdir=/usr/lib${LIBDIRSUFFIX} \
  80. --sysconfdir=/etc \
  81. --localstatedir=/var \
  82. --mandir=/usr/man \
  83. --infodir=/usr/info \
  84. --docdir=/usr/doc/$PRGNAM-$VERSION \
  85. --disable-dependency-tracking \
  86. --enable-strict-warning-flags \
  87. --with-amd-includedir=$WITH_AMD_INCLUDEDIR \
  88. --build=$ARCH-slackware-linux
  89. make
  90. make check
  91. make install-strip DESTDIR=$PKG
  92. find $PKG/usr/lib${LIBDIRSUFFIX} -name '*.la' -delete
  93. find $PKG/usr/man -type f -exec gzip -9 {} +
  94. rm -f $PKG/usr/info/dir
  95. gzip -9 $PKG/usr/info/*.info*
  96. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  97. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  98. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  99. mkdir -p $PKG/install
  100. cat $CWD/slack-desc > $PKG/install/slack-desc
  101. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  102. cd $PKG
  103. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}