ngspice.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/bash
  2. # Slackware build script for ngspice and libngspice
  3. # Written by B. Jogai <jogaib {at} comcast [dot] net>
  4. # Now maintained by R. S. Ananda Murthy (rsamurti@gmail.com)
  5. # Set initial variables:
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=ngspice
  8. VERSION=${VERSION:-36}
  9. BUILD=${BUILD:-1}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i586 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  20. # the name of the created package would be, and then exit. This information
  21. # could be useful to other scripts.
  22. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  23. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  24. exit 0
  25. fi
  26. TMP=${TMP:-/tmp/SBo}
  27. PKG=$TMP/package-$PRGNAM
  28. OUTPUT=${OUTPUT:-/tmp}
  29. if [ "$ARCH" = "i586" ]; then
  30. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "i686" ]; then
  33. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "x86_64" ]; then
  36. SLKCFLAGS="-O2 -fPIC"
  37. LIBDIRSUFFIX="64"
  38. else
  39. SLKCFLAGS="-O2"
  40. LIBDIRSUFFIX=""
  41. fi
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  48. cd $PRGNAM-$VERSION
  49. chown -R root:root .
  50. find -L . \
  51. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  52. -exec chmod 755 {} \; -o \
  53. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  54. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  55. # Fix the lib path to the code modules
  56. if [ "$ARCH" = "x86_64" ]; then
  57. sed -i "s%/lib/%/lib${LIBDIRSUFFIX}/%g" src/spinit.in
  58. fi
  59. mkdir release
  60. cd release
  61. ../configure \
  62. --prefix=/usr \
  63. --mandir=/usr/man \
  64. --infodir=/usr/info \
  65. --enable-xspice \
  66. --enable-cider \
  67. --enable-openmp \
  68. --with-x \
  69. --disable-debug \
  70. --with-ngshared
  71. make
  72. CFLAGS="$SLKCFLAGS" \
  73. ../configure --prefix=/usr \
  74. --bindir=/usr/bin \
  75. --libdir=/usr/lib${LIBDIRSUFFIX} \
  76. --mandir=/usr/man \
  77. --infodir=/usr/info \
  78. --disable-debug \
  79. --enable-xspice \
  80. --enable-cider \
  81. --enable-shared \
  82. --disable-static \
  83. --enable-ndev \
  84. --enable-openmp \
  85. --with-x \
  86. --build=$ARCH-slackware-linux
  87. make
  88. make DESTDIR=$PKG install
  89. # This has installed the configure output file as /usr/include/config.h.
  90. cd ..
  91. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  92. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  93. find $PKG/usr/man -type f -exec gzip -9 {} \;
  94. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  95. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples
  96. cp -a \
  97. ANALYSES AUTHORS BUGS COPYING ChangeLog DEVICES FAQ \
  98. INSTALL NEWS README* examples/ \
  99. $PKG/usr/doc/$PRGNAM-$VERSION/
  100. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. cat $CWD/$PRGNAM-$VERSION-manual.pdf \
  102. > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM-$VERSION-manual.pdf
  103. # The shared library enabled by "--with-ngshared"
  104. install -Dm755 ./release/src/.libs/libngspice.so.0.0.2 \
  105. "$PKG/usr/lib${LIBDIRSUFFIX}/libngspice.so.0.0.2"
  106. ln -s "libngspice.so.0.0.2" "$PKG/usr/lib${LIBDIRSUFFIX}/libngspice.so.0"
  107. ln -s "libngspice.so.0.0.2" "$PKG/usr/lib${LIBDIRSUFFIX}/libngspice.so"
  108. # The include file needed to use the shared library enabled by "--with-ngshared"
  109. install -Dm644 ./src/include/ngspice/sharedspice.h $PKG/usr/include/ngspice/sharedspice.h
  110. # Move the configure output file.
  111. mv $TMP/$PRGNAM-$VERSION/release/src/include/ngspice/config.h $PKG/usr/include/ngspice/
  112. install -Dm644 $CWD/$PRGNAM.png $PKG/usr/share/icons/hicolor/48x48/apps/$PRGNAM.png
  113. mkdir -p $PKG/usr/share/applications
  114. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  115. mkdir -p $PKG/install
  116. cat $CWD/slack-desc > $PKG/install/slack-desc
  117. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  118. cd $PKG
  119. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE