fbida.SlackBuild 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #!/bin/bash
  2. # Slackware build script for fbida
  3. # (C) 2007 Michael Wagner <email removed>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Modified by Luis Henrique <email removed>
  23. # Modified and currently maintained by B. Watson <yalhcru@gmail.com>
  24. # 20170921 bkw:
  25. # - update for v2.14
  26. # - remove old maintainers' email addresses
  27. # - fix French man page stuff for new version, but allow old version
  28. # to still build via VERSION=2.13 in env.
  29. # - add man page for fbipdf.
  30. # 20170703 bkw:
  31. # - update for v2.13
  32. # - use new homepage
  33. # - verbose make
  34. # 20161015 bkw:
  35. # - update for v2.12
  36. # - add optional motif support, since Slack 14.2 has real Motif. Also
  37. # add .desktop and icon, if motif was included.
  38. # - actually apply SLKCFLAGS
  39. # - 2.12 has a new fbpdf command, which I've renamed to
  40. # fbipdf to avoid conflicting with the fbpdf package
  41. # - include French man pages, which aren't installed by default
  42. # 20150508 bkw: update for v2.10
  43. # 20140915 bkw: take over maintenance, minor script cleanup
  44. cd $(dirname $0) ; CWD=$(pwd)
  45. PRGNAM=fbida
  46. VERSION=${VERSION:-2.14}
  47. BUILD=${BUILD:-1}
  48. TAG=${TAG:-_SBo}
  49. PKGTYPE=${PKGTYPE:-tgz}
  50. if [ -z "$ARCH" ]; then
  51. case "$( uname -m )" in
  52. i?86) ARCH=i586 ;;
  53. arm*) ARCH=arm ;;
  54. *) ARCH=$( uname -m ) ;;
  55. esac
  56. fi
  57. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  58. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  59. exit 0
  60. fi
  61. TMP=${TMP:-/tmp/SBo}
  62. PKG=$TMP/package-$PRGNAM
  63. OUTPUT=${OUTPUT:-/tmp}
  64. DOCS="COPYING Changes README TODO"
  65. if [ "$ARCH" = "i586" ]; then
  66. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  67. LIBDIRSUFFIX=""
  68. elif [ "$ARCH" = "i686" ]; then
  69. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  70. LIBDIRSUFFIX=""
  71. elif [ "$ARCH" = "x86_64" ]; then
  72. SLKCFLAGS="-O2 -fPIC"
  73. LIBDIRSUFFIX="64"
  74. else
  75. SLKCFLAGS="-O2"
  76. LIBDIRSUFFIX=""
  77. fi
  78. set -e
  79. rm -rf $PKG
  80. mkdir -p $TMP $PKG $OUTPUT
  81. cd $TMP
  82. rm -rf $PRGNAM-$VERSION
  83. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  84. cd $PRGNAM-$VERSION
  85. chown -R root:root .
  86. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  87. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  88. # https://gitlab.com/kraxel/fbida/-/commit/1bb8a8aa.patch
  89. patch -p1 < $CWD/gcc10.patch
  90. MOTIF_OPT="HAVE_MOTIF=${MOTIF:-yes}"
  91. sed -i "/^CFLAGS/s,-g *-O2,$SLKCFLAGS," mk/Variables.mk
  92. make $MOTIF_OPT prefix=/usr verbose=1
  93. strip fbpdf # not stripped for some reason
  94. make install prefix=/usr DESTDIR=$PKG mandir=$PKG/usr/man $MOTIF_OPT
  95. gzip -9 $PKG/usr/man/man1/*
  96. FR_MAN="exiftran fbgs fbi"
  97. # upstream's .desktop file doesn't validate, we ship a corrected one,
  98. # but only include it if motif support was built in. PNG icon was
  99. # converted from mallard_48.xpm in the src.
  100. if [ "${MOTIF:-yes}" = "yes" ]; then
  101. mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
  102. cat $CWD/ida.desktop > $PKG/usr/share/applications/ida.desktop
  103. cat $CWD/ida.png > $PKG/usr/share/pixmaps/ida.png
  104. FR_MAN="$FR_MAN ida"
  105. fi
  106. # /usr/bin/fbpdf conflicts with office/fbpdf, so rename it
  107. mv $PKG/usr/bin/fbpdf $PKG/usr/bin/fbipdf
  108. # French man pages. I don't see a way to get make to install these. Hope
  109. # they're useful, I can't actually read French. They're UTF-8, and display
  110. # poorly with Slackware's old man command... so I convert them to 8859-1
  111. # and hope for the best. They look OK with LANG set to either fr_FR
  112. # or fr_FR.UTF-8. They also look OK with the man command from man-db.
  113. # iconv chokes on the unicode ellipsis character (U+2026), the sed stuff
  114. # converts it back to three periods as Bemer intended!
  115. mkdir -p $PKG/usr/man/fr/man1
  116. for i in $FR_MAN; do
  117. if [ -e $i.man.fr ]; then
  118. M=$i.man.fr # v2.13 and older
  119. else
  120. M=man/fr/$i.1 # v2.14 and up
  121. fi
  122. LANG=C sed 's,\xe2\x80\xa6,...,g' < $M | \
  123. iconv -c -f UTF-8 -t ISO-8859-1 | \
  124. gzip -9c > $PKG/usr/man/fr/man1/$i.1.gz
  125. done
  126. # fbpdf (fbipdf) doesn't have a man page, so I wrote one. English only,
  127. # sorry, I no hablo Franco.
  128. gzip -9c < $CWD/fbipdf.1 > $PKG/usr/man/man1/fbipdf.1.gz
  129. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  130. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  131. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  132. chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*
  133. mkdir -p $PKG/install
  134. cat $CWD/slack-desc > $PKG/install/slack-desc
  135. [ "${MOTIF:-yes}" = "yes" ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh
  136. cd $PKG
  137. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE