fbdump.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/bash
  2. # Slackware build script for fbdump
  3. # Previously maintained by:
  4. # Ryan P.C. McQuen | Everett, WA | <email removed>
  5. # Original author:
  6. # Copyright 2010 Binh Nguyen <email removed>
  7. # All rights reserved.
  8. #
  9. # Redistribution and use of this script, with or without modification, is
  10. # permitted provided that the following conditions are met:
  11. #
  12. # 1. Redistributions of this script must retain the above copyright
  13. # notice, this list of conditions and the following disclaimer.
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  18. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  21. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. # Now maintained by B. Watson (urchlay@slackware.uk)
  26. # 20170324 bkw:
  27. # - take over maintenance.
  28. # - fix major bug: output was being truncated, producing invalid ppm files!
  29. # - add man page.
  30. # - i486=>i586.
  31. # - minor script updates.
  32. # - update README.
  33. # - BUILD=2.
  34. # TODO: see if there's a way to make fbdump faster. It's taking 8 sec
  35. # to dump a 1920x1080x32bit framebuffer, and that's a pretty common
  36. # framebuffer format these days. Compiling with lots of optimizations
  37. # doesn't seem to help (even switching from gcc to clang).
  38. cd $(dirname $0) ; CWD=$(pwd)
  39. PRGNAM=fbdump
  40. VERSION=${VERSION:-0.4.2}
  41. BUILD=${BUILD:-2}
  42. TAG=${TAG:-_SBo}
  43. PKGTYPE=${PKGTYPE:-tgz}
  44. if [ -z "$ARCH" ]; then
  45. case "$( uname -m )" in
  46. i?86) ARCH=i586 ;;
  47. arm*) ARCH=arm ;;
  48. *) ARCH=$( uname -m ) ;;
  49. esac
  50. fi
  51. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  52. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  53. exit 0
  54. fi
  55. TMP=${TMP:-/tmp/SBo}
  56. PKG=$TMP/package-$PRGNAM
  57. OUTPUT=${OUTPUT:-/tmp}
  58. if [ "$ARCH" = "i586" ]; then
  59. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  60. LIBDIRSUFFIX=""
  61. elif [ "$ARCH" = "i686" ]; then
  62. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  63. LIBDIRSUFFIX=""
  64. elif [ "$ARCH" = "x86_64" ]; then
  65. SLKCFLAGS="-O3 -fPIC -funroll-loops -fvectorize"
  66. LIBDIRSUFFIX="64"
  67. else
  68. SLKCFLAGS="-O2"
  69. LIBDIRSUFFIX=""
  70. fi
  71. set -eu
  72. rm -rf $PKG
  73. mkdir -p $TMP $PKG $OUTPUT
  74. cd $TMP
  75. rm -rf $PRGNAM-$VERSION
  76. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  77. cd $PRGNAM-$VERSION
  78. chown -R root:root .
  79. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  80. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  81. # 20170324 bkw: maybe returning from main() used to cause stdout to
  82. # be flushed, back when fbdump was new... but these days we need to
  83. # explicitly flush the buffer, or the output file is truncated.
  84. patch -p1 < $CWD/fflush_stdout.diff
  85. CC=clang \
  86. CFLAGS="$SLKCFLAGS" \
  87. ./configure \
  88. --prefix=/usr \
  89. --libdir=/usr/lib${LIBDIRSUFFIX} \
  90. --sysconfdir=/etc \
  91. --localstatedir=/var \
  92. --mandir=/usr/man \
  93. --infodir=/usr/info \
  94. --docdir=/usr/doc/$PRGNAM-$VERSION \
  95. --localedir=/usr/share/locale \
  96. --build=$ARCH-slackware-linux
  97. make
  98. make install-strip DESTDIR=$PKG
  99. # man page written for this build, based on --help output and
  100. # text from the homepage.
  101. mkdir -p $PKG/usr/man/man1
  102. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  103. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  104. cp -a AUTHORS C* NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  105. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  106. mkdir -p $PKG/install
  107. cat $CWD/slack-desc > $PKG/install/slack-desc
  108. cd $PKG
  109. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE