wcd.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for wcd
  3. # Originally written by Ryan P.C. McQuen <email removed>
  4. # Now maintained by B. Watson <urchlay@slackware.uk>
  5. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  6. # 20210910 bkw:
  7. # - updated for v6.0.4_beta2. there are no code changes in the beta,
  8. # only the documentation and translations have been updated, so
  9. # it's a safe upgrade that won't break anything.
  10. # - relicense as WTFPL with permission from original author.
  11. # 20191201 bkw: updated for v6.0.3.
  12. # 20180612 bkw: updated for v6.0.2.
  13. # 20171219 bkw: updated for v6.0.1. also, add /etc/profile.d scripts
  14. # so wcd actually *works*.
  15. cd $(dirname $0) ; CWD=$(pwd)
  16. PRGNAM=wcd
  17. VERSION=${VERSION:-6.0.4_beta2}
  18. BUILD=${BUILD:-1}
  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. set -e
  36. TARVER=${VERSION/_/-}
  37. rm -rf $PKG
  38. mkdir -p $TMP $PKG $OUTPUT
  39. cd $TMP
  40. rm -rf $PRGNAM-$TARVER
  41. tar xvf $CWD/$PRGNAM-$TARVER.tar.gz
  42. cd $PRGNAM-$TARVER
  43. chown -R root:root .
  44. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  45. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  46. if [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. cd src
  60. RPM_OPT_FLAGS="$SLKCFLAGS" \
  61. make all
  62. make \
  63. prefix=$PKG/usr \
  64. docdir=$PKG/usr/doc/$PRGNAM-$VERSION \
  65. mandir=$PKG/usr/man \
  66. install
  67. # remove .exe so command is executable
  68. mv $PKG/usr/bin/wcd.exe $PKG/usr/bin/wcd
  69. # Put _all_ man pages under usr/man
  70. mv $PKG/usr/share/man/* $PKG/usr/man
  71. rmdir $PKG/usr/share/man
  72. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  73. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  74. find $PKG/usr/man -type f -exec gzip -9 {} \;
  75. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  76. # profile.d scripts, installed executable (like mc does).
  77. mkdir -p $PKG/etc/profile.d/
  78. install -m0755 -oroot -groot \
  79. $CWD/$PRGNAM.sh $CWD/$PRGNAM.csh $PKG/etc/profile.d/
  80. cp -a ../doc/INSTALL.txt $PKG/usr/doc/$PRGNAM-$VERSION
  81. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  82. mkdir -p $PKG/install
  83. cat $CWD/slack-desc > $PKG/install/slack-desc
  84. cd $PKG
  85. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE