xli.SlackBuild 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #!/bin/bash
  2. # Slackware build script for xli
  3. # Copyright 2014 Leonard Schmidt <email removed>
  4. # All rights reserved.
  5. #
  6. # Permission to use, copy, modify, and distribute this software for any purpose
  7. # with or without fee is hereby granted, provided that the above copyright
  8. # notice and this permission notice appear in all copies.
  9. #
  10. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  11. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  13. # AUTHORS AND COPYRIGHT HOLDERS AND THEIR CONTRIBUTORS BE LIABLE FOR ANY
  14. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  15. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  18. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  19. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. # Now maintained by B. Watson <urchlay@slackware.uk>
  21. # 20180629 bkw:
  22. # - Take over maintenance.
  23. # - BUILD=2.
  24. # - Stop spamming /etc/X11/app-defaults and /usr/bin (!!)
  25. # - Add -DHAVE_GUNZIP and -DHAVE_BUNZIP2 options, to support viewing
  26. # compressed images.
  27. # - Install xliguide.5 man page.
  28. # - Make system-wide config file actually work as documented in the
  29. # man page. Previous it was getting installed (straight to /etc, not
  30. # as part of the package!) and totally ignored at runtime.
  31. # - Include chkgamma.jpg in doc dir, since ABOUTGAMMA references it.
  32. # TODO: find out why "-border" doesn't seem to work. The -fullscreen
  33. # window border is always white, no matter what color you give to
  34. # -border. I only moderately care about this, TBH.
  35. cd $(dirname $0) ; CWD=$(pwd)
  36. PRGNAM=xli
  37. VERSION=${VERSION:-1.17}
  38. SRCVER=${SRCVER:-2005-02-27}
  39. BUILD=${BUILD:-2}
  40. TAG=${TAG:-_SBo}
  41. PKGTYPE=${PKGTYPE:-tgz}
  42. if [ -z "$ARCH" ]; then
  43. case "$( uname -m )" in
  44. i?86) ARCH=i586 ;;
  45. arm*) ARCH=arm ;;
  46. *) ARCH=$( uname -m ) ;;
  47. esac
  48. fi
  49. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  50. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  51. exit 0
  52. fi
  53. TMP=${TMP:-/tmp/SBo}
  54. PKG=$TMP/package-$PRGNAM
  55. OUTPUT=${OUTPUT:-/tmp}
  56. if [ "$ARCH" = "i586" ]; then
  57. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  58. LIBDIRSUFFIX=""
  59. elif [ "$ARCH" = "i686" ]; then
  60. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  61. LIBDIRSUFFIX=""
  62. elif [ "$ARCH" = "x86_64" ]; then
  63. SLKCFLAGS="-O2 -fPIC"
  64. LIBDIRSUFFIX="64"
  65. else
  66. SLKCFLAGS="-O2"
  67. LIBDIRSUFFIX=""
  68. fi
  69. set -e
  70. rm -rf $PKG
  71. mkdir -p $TMP $PKG $OUTPUT
  72. cd $TMP
  73. rm -rf $PRGNAM-$SRCVER
  74. tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
  75. cd $PRGNAM-$SRCVER
  76. chown -R root:root .
  77. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  78. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  79. # These patches are from NetBSD's pkgsrc:
  80. # <http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/graphics/xli/patches/?only_with_tag=MAIN>
  81. for i in c d e f g h; do
  82. patch -p0 < $CWD/patch-a${i}
  83. done
  84. # 20180629 bkw: Seems we have to explicitly define the system-wide
  85. # config file in CCOPTIONS. Might as well add .gz and .bz2 support,
  86. # while we're at it.
  87. APPDEF=/etc/X11/app-defaults/Xli
  88. xmkmf -a
  89. make \
  90. CDEBUGFLAGS="$SLKCFLAGS" \
  91. CCOPTIONS="-DHAVE_GUNZIP -DHAVE_BUNZIP2 -DSYSPATHFILE=\\\"$APPDEF\\\""
  92. # 20180629 bkw: Do not use 'make install', it doesn't fully support
  93. # DESTDIR and spams stuff to /usr/bin and /etc/X11/app-defaults.
  94. mkdir -p $PKG/usr/bin $PKG/usr/man/man1 $PKG
  95. for i in $PRGNAM ${PRGNAM}to; do
  96. install -s -m0755 -oroot -groot $i $PKG/usr/bin
  97. gzip -9c < $PRGNAM.man > $PKG/usr/man/man1/$i.1x.gz
  98. done
  99. for i in xview xsetbg; do
  100. ln -s $PRGNAM $PKG/usr/bin/$i
  101. ln -s $PRGNAM.1x.gz $PKG/usr/man/man1/$i.1x.gz
  102. done
  103. # This is API doc, for extending xli with new image formats. Not
  104. # necessarily useful, but why not package it?
  105. mkdir -p $PKG/usr/man/man5
  106. gzip -9c < xliguide.man > $PKG/usr/man/man5/xliguide.5.gz
  107. # The defaults file is only 2 lines, easier to create here than
  108. # try to make the Makefile play nice with DESTDIR. Plus, the hard-coded
  109. # defaults need modifying anyway (add formats to extension= and use dirs
  110. # that actually exist for path=).
  111. mkdir -p $PKG/etc/X11/app-defaults
  112. cat <<EOF >$PKG/etc/X11/app-defaults/Xli
  113. path=/usr/share/pixmaps /usr/share/icons
  114. extension=.png .gif .jpg .PNG .GIF .JPG .jpeg .JPEG .xpm .pcx .PCX .bmp .BMP .pbm .pgm .ppm .tga .TGA .rle .csun .msun .sun .face .xbm .bm
  115. EOF
  116. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  117. cp -a ABOUTGAMMA CHANGES README* TODO chkgamma.jpg $PKG/usr/doc/$PRGNAM-$VERSION
  118. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  119. mkdir -p $PKG/install
  120. cat $CWD/slack-desc > $PKG/install/slack-desc
  121. cd $PKG
  122. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE