xcalib.SlackBuild 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Slackware build script for xcalib
  3. # Copyright 2014-22 Klaatu <klaatu@member.fsf.org>
  4. # GNU All-Permissive License
  5. # Copying and distribution of this file, with or without modification,
  6. # are permitted in any medium without royalty provided the copyright
  7. # notice and this notice are preserved. This file is offered as-is,
  8. # without any warranty.
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=xcalib
  11. VERSION=${VERSION:-0.10}
  12. BUILD=${BUILD:-1}
  13. GPU=${GPU:-xcalib}
  14. TAG=${TAG:-_SBo}
  15. PKGTYPE=${PKGTYPE:-tgz}
  16. if [ -z "$ARCH" ]; then
  17. case "$( uname -m )" in
  18. i?86) ARCH=i486 ;;
  19. arm*) ARCH=arm ;;
  20. *) ARCH=$( uname -m ) ;;
  21. esac
  22. fi
  23. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  24. # the name of the created package would be, and then exit. This information
  25. # could be useful to other scripts.
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i486" ]; then
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. LIBDIRSUFFIX="64"
  39. else
  40. LIBDIRSUFFIX=""
  41. fi
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG/usr/local/bin $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  48. cd $PRGNAM-$VERSION
  49. chown -R root:root .
  50. find -L . \
  51. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  52. -o -perm 511 \) -exec chmod 755 {} \; -o \
  53. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  54. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  55. sed -i "s|usr/local/bin|usr/bin|" Makefile
  56. mkdir -p $PKG/usr/bin
  57. rm -rf $PKG/usr/local
  58. if [ "${GPU}" != "xcalib" ]; then
  59. make $GPU_xcalib
  60. else
  61. make $GPU
  62. fi
  63. # patch out a bizarre permission line
  64. # in makefile that renders this application
  65. # non executable
  66. sed -i '/chmod/d' ./Makefile
  67. make install DESTDIR=$PKG
  68. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  69. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  70. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  71. cp -a README.md README.profilers ChangeLog COPYING \
  72. $PKG/usr/doc/$PRGNAM-$VERSION
  73. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  74. mkdir -p $PKG/usr/share/color/icc
  75. cp -a gamma*icc AdobeGammaTest.icm bluish.icc $PKG/usr/share/color/icc/
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cd $PKG
  79. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE