gprename.SlackBuild 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. # Copyright 2010 Binh Nguyen <binhnguyen@fastmail.fm>
  3. # All rights reserved.
  4. #
  5. # Redistribution and use of this script, with or without modification, is
  6. # permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script 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 EXPRESS OR IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. PRGNAM=gprename
  22. VERSION=${VERSION:-2.6.5}
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_SBo}
  25. ARCH=noarch
  26. CWD=$(pwd)
  27. TMP=${TMP:-/tmp/SBo}
  28. PKG=$TMP/package-$PRGNAM
  29. OUTPUT=${OUTPUT:-/tmp}
  30. set -eu
  31. rm -rf $PKG
  32. mkdir -p $TMP $PKG $OUTPUT
  33. cd $TMP
  34. rm -rf $PRGNAM
  35. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  36. cd $PRGNAM
  37. chown -R root:root .
  38. find . \
  39. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  40. -exec chmod 755 {} \; -o \
  41. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  42. -exec chmod 644 {} \;
  43. make install DESTDIR=$PKG/usr PREFIX=/usr
  44. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  45. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  46. mv $PKG/usr/share/man $PKG/usr
  47. find $PKG/usr/man -type f -exec gzip -9 {} \;
  48. for i in $(find $PKG/usr/man -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
  49. # Fix icon link in $PGRNAM.desktop file
  50. sed -i 's#local/##' $PKG/usr/share/applications/$PRGNAM.desktop
  51. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  52. cp -a COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  53. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  54. mkdir -p $PKG/install
  55. cat $CWD/slack-desc > $PKG/install/slack-desc
  56. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  57. cd $PKG
  58. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}