xzgv.SlackBuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. # Slackware build script for xzgv
  3. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  4. # Original author: Markus Reichelt.
  5. # Now maintained by B. Watson <urchlay@slackware.uk>.
  6. # 20230308 bkw: BUILD=2, add doinunst.sh to clean up GNU info index.
  7. # 20230102 bkw: v0.9.2_2
  8. # - take over maintenance.
  9. # - relicense as WTFPL.
  10. # - include Debian's improved .desktop file and PNG icons.
  11. # - include GNU info doc in package.
  12. # - fix documentation permissions.
  13. # - get rid of useless INSTALL from docs.
  14. # - use Debian patch to fix man page nroff formatting.
  15. cd $(dirname $0) ; CWD=$(pwd)
  16. PRGNAM=xzgv
  17. VERSION=${VERSION:-0.9.2_2}
  18. BUILD=${BUILD:-2}
  19. TAG=${TAG:-_SBo}
  20. PKGTYPE=${PKGTYPE:-tgz}
  21. if [ -z "$ARCH" ]; then
  22. case "$( uname -m )" in
  23. i?86) ARCH=i586 ;;
  24. arm*) ARCH=arm ;;
  25. *) ARCH=$( uname -m ) ;;
  26. esac
  27. fi
  28. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  29. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  30. exit 0
  31. fi
  32. TMP=${TMP:-/tmp/SBo}
  33. PKG=$TMP/package-$PRGNAM
  34. OUTPUT=${OUTPUT:-/tmp}
  35. if [ "$ARCH" = "i586" ]; then
  36. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "i686" ]; then
  39. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  40. LIBDIRSUFFIX=""
  41. elif [ "$ARCH" = "x86_64" ]; then
  42. SLKCFLAGS="-O2 -fPIC"
  43. LIBDIRSUFFIX="64"
  44. else
  45. SLKCFLAGS="-O2"
  46. LIBDIRSUFFIX=""
  47. fi
  48. set -e
  49. SRCVER="$( echo $VERSION | cut -d_ -f1 )"
  50. DEBVER="$( echo $VERSION | cut -d_ -f2 )"
  51. rm -rf $PKG
  52. mkdir -p $TMP $PKG $OUTPUT
  53. cd $TMP
  54. rm -rf $PRGNAM-$SRCVER
  55. tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
  56. cd $PRGNAM-$SRCVER
  57. tar xvf $CWD/${PRGNAM}_$SRCVER-$DEBVER.debian.tar.xz
  58. chown -R root:root .
  59. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  60. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  61. # use Debian's .desktop file
  62. cp debian/$PRGNAM.desktop src/
  63. # use 48x48 old-style icon
  64. sed -i 's,icon-64,icon-48,' src/Makefile
  65. # apply Debian's patches (currently, fixes for the man page)
  66. for i in $( cat debian/patches/series ); do
  67. patch -p1 < debian/patches/$i
  68. done
  69. cat > config.mk <<EOF
  70. CC=gcc
  71. AWK=awk
  72. CFLAGS=$SLKCFLAGS
  73. BINDIR=$PKG/usr/bin
  74. INFODIR=$PKG/usr/info
  75. MANDIR=$PKG/usr/man/man1
  76. USE_A4_DEF=-t @afourpaper
  77. LDFLAGS=-lX11 -lm
  78. PIXMAPDIR=$PKG/usr/share/pixmaps
  79. DESKTOPDIR1=$PKG/usr/share/applications
  80. DESKTOPDIR2=$PKG/usr/share/applications
  81. EOF
  82. mkdir -p $PKG/usr/{bin,man/man1,info,share/{pixmaps,applications}}
  83. make
  84. strip src/$PRGNAM
  85. make info
  86. make install
  87. rm -f $PKG/usr/info/dir
  88. chmod 644 $PKG/usr/man/man*/*
  89. gzip $PKG/usr/man/man*/*
  90. # include Debian's PNG icons
  91. for i in debian/$PRGNAM-*.png; do
  92. px="$( basename $i .png | cut -d- -f2 )"
  93. size=${px}x${px}
  94. dir=$PKG/usr/share/icons/hicolor/$size/apps
  95. mkdir -p $dir
  96. install -m0644 -oroot -groot $i $dir/$PRGNAM.png
  97. done
  98. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  99. mkdir -p $PKGDOC
  100. cp -a AUTHORS ChangeLog COPYING NEWS README TODO $PKGDOC
  101. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  102. mkdir -p $PKG/install
  103. cat $CWD/slack-desc > $PKG/install/slack-desc
  104. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  105. cat $CWD/douninst.sh > $PKG/install/douninst.sh
  106. cd $PKG
  107. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE