splint.SlackBuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for splint
  3. # Written by Menno Duursma <druiloor@zonnet.nl>
  4. # Modified by the SlackBuilds.org project
  5. # Maintained by Ozan Türkyılmaz <ozan.turkyilmaz@gmail.com>
  6. # This program is free software. It comes without any warranty.
  7. # Granted WTFPL, Version 2, as published by Sam Hocevar. See
  8. # http://sam.zoy.org/wtfpl/COPYING for more details.
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=splint
  11. VERSION=${VERSION:-20170327_3fb908d}
  12. BUILD=${BUILD:-1}
  13. TAG=${TAG:-_SBo}
  14. PKGTYPE=${PKGTYPE:-tgz}
  15. if [ -z "$ARCH" ]; then
  16. case "$( uname -m )" in
  17. i?86) ARCH=i586 ;;
  18. arm*) ARCH=arm ;;
  19. *) ARCH=$( uname -m ) ;;
  20. esac
  21. fi
  22. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  23. # the name of the created package would be, and then exit. This information
  24. # could be useful to other scripts.
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. set -e
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $PRGNAM-patched-$VERSION
  50. tar xvf $CWD/$PRGNAM-patched-$VERSION.tar.xz
  51. cd $PRGNAM-patched-$VERSION
  52. chown -R root:root .
  53. find -L . \
  54. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  55. -o -perm 511 \) -exec chmod 755 {} \; -o \
  56. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  57. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  58. automake --add-missing || true
  59. autoreconf || true
  60. automake --add-missing
  61. autoreconf
  62. CFLAGS="$SLKCFLAGS" \
  63. CXXFLAGS="$SLKCFLAGS" \
  64. ./configure \
  65. --prefix=/usr \
  66. --libdir=/usr/lib${LIBDIRSUFFIX} \
  67. --sysconfdir=/etc \
  68. --localstatedir=/var \
  69. --mandir=/usr/man \
  70. --build=$ARCH-slackware-linux
  71. # Fix for bison-3 (LDFLAGS doesn't work)
  72. #sed -i \
  73. # -e 's/^LIBS = $/LIBS = -lfl/' \
  74. # src/Makefile
  75. make -j1
  76. make install DESTDIR=$PKG
  77. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  78. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  79. find $PKG/usr/man -type f -exec gzip -9 {} \;
  80. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  81. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/html
  82. cp -a README $PKG/usr/doc/$PRGNAM-$VERSION
  83. cp -a doc/manual.pdf $PKG/usr/doc/$PRGNAM-$VERSION
  84. cp -a doc/html/*.htm{,l} $PKG/usr/doc/$PRGNAM-$VERSION/html
  85. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  86. mkdir -p $PKG/install
  87. cat $CWD/slack-desc > $PKG/install/slack-desc
  88. cd $PKG
  89. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE