discount.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/sh
  2. # Slackware build script for discount
  3. # Copyright (c) 2011-2015, Antonio Hernández Blas <hba.nihilismus@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. # 1.- Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
  12. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  15. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  17. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  19. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  20. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. PRGNAM=discount
  22. VERSION=${VERSION:-2.1.8a}
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_SBo}
  25. if [ -z "$ARCH" ]; then
  26. case "$( uname -m )" in
  27. i?86) ARCH=i486 ;;
  28. arm*) ARCH=arm ;;
  29. *) ARCH=$( uname -m ) ;;
  30. esac
  31. fi
  32. CWD=$(pwd)
  33. TMP=${TMP:-/tmp/SBo}
  34. PKG=$TMP/package-$PRGNAM
  35. OUTPUT=${OUTPUT:-/tmp}
  36. if [ "$ARCH" = "i486" ]; then
  37. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "i686" ]; then
  40. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  41. LIBDIRSUFFIX=""
  42. elif [ "$ARCH" = "x86_64" ]; then
  43. SLKCFLAGS="-O2 -fPIC"
  44. LIBDIRSUFFIX="64"
  45. else
  46. SLKCFLAGS="-O2"
  47. LIBDIRSUFFIX=""
  48. fi
  49. set -e
  50. rm -rf $PKG
  51. mkdir -p $TMP $PKG $OUTPUT
  52. cd $TMP
  53. rm -rf $PRGNAM-$VERSION
  54. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  55. cd $PRGNAM-$VERSION
  56. chown -R root:root .
  57. find -L . \
  58. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  59. -o -perm 511 \) -exec chmod 755 {} \; -o \
  60. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  61. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  62. # Disable ldconfig use during 'make install'
  63. sed -i 's/LDCONFIG=.*$/LDCONFIG=true/g' configure.inc
  64. # Fix file permission
  65. sed -i 's/PROG_INSTALL -m 444/PROG_INSTALL -m 644/g' configure.inc
  66. CFLAGS="$SLKCFLAGS" \
  67. CXXFLAGS="$SLKCFLAGS" \
  68. ./configure.sh \
  69. --prefix=/usr \
  70. --libdir=/usr/lib${LIBDIRSUFFIX} \
  71. --confdir=/etc \
  72. --mandir=/usr/man \
  73. --with-dl=Both \
  74. --with-id-anchor \
  75. --with-github-tags \
  76. --with-fenced-code \
  77. --with-urlencoded-anchor \
  78. --enable-all-features \
  79. --shared
  80. make
  81. mkdir -p $PKG/usr/{bin,lib${LIBDIRSUFFIX},include}
  82. make install.everything DESTDIR=$PKG
  83. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  84. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  85. if [ -d $PKG/usr/share/man ]; then
  86. mv $PKG/usr/share/man $PKG/usr
  87. fi
  88. if [ -d $PKG/usr/man ]; then
  89. ( cd $PKG/usr/man
  90. find . -type f -exec gzip -9 {} \;
  91. for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  92. )
  93. fi
  94. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  95. cp -a \
  96. COPYRIGHT CREDITS INSTALL README VERSION \
  97. $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. cd $PKG
  102. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}