mkcue.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. # Slackware build script for mkcue
  3. # Copyright 2016 Andreas Voegele <andreas@andreasvoegele.com>
  4. #
  5. # Permission to use, copy, modify, and distribute this software for any
  6. # purpose with or without fee is hereby granted, provided that the above
  7. # copyright notice and this permission notice appear in all copies.
  8. #
  9. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. cd $(dirname $0) ; CWD=$(pwd)
  17. PRGNAM=mkcue
  18. VERSION=${VERSION:-1.7}
  19. BUILD=${BUILD:-1}
  20. TAG=${TAG:-_SBo}
  21. PKGTYPE=${PKGTYPE:-tgz}
  22. SRCNAM=$PRGNAM-1.orig
  23. if [ -z "$ARCH" ]; then
  24. case "$( uname -m )" in
  25. i?86) ARCH=i586 ;;
  26. arm*) ARCH=arm ;;
  27. *) ARCH=$( uname -m ) ;;
  28. esac
  29. fi
  30. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  31. # the name of the created package would be, and then exit. This information
  32. # could be useful to other scripts.
  33. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  34. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  35. exit 0
  36. fi
  37. TMP=${TMP:-/tmp/SBo}
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp}
  40. if [ "$ARCH" = "i586" ]; then
  41. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "i686" ]; then
  44. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "x86_64" ]; then
  47. SLKCFLAGS="-O2 -fPIC"
  48. LIBDIRSUFFIX="64"
  49. else
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. fi
  53. set -e
  54. rm -rf $PKG
  55. mkdir -p $TMP $PKG $OUTPUT
  56. cd $TMP
  57. rm -rf $SRCNAM
  58. tar xvf $CWD/$( echo $SRCNAM | tr - _ ).tar.gz
  59. cd $SRCNAM
  60. chown -R root:root .
  61. find -L . \
  62. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  63. -o -perm 511 \) -exec chmod 755 {} \; -o \
  64. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  65. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  66. patch -p1 < $CWD/fix_msf_offset.diff
  67. patch -p1 < $CWD/use_ldflags.diff
  68. CFLAGS="$SLKCFLAGS" \
  69. CXXFLAGS="$SLKCFLAGS -std=gnu++98" \
  70. ./configure \
  71. --prefix=/usr \
  72. --libdir=/usr/lib${LIBDIRSUFFIX} \
  73. --sysconfdir=/etc \
  74. --localstatedir=/var \
  75. --mandir=/usr/man \
  76. --build=$ARCH-slackware-linux
  77. make
  78. mkdir -p $PKG/usr/bin
  79. install -m 755 mkcue $PKG/usr/bin/mkcue
  80. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  81. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  82. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  83. cp -a \
  84. AUTHORS COPYING README \
  85. $PKG/usr/doc/$PRGNAM-$VERSION
  86. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  87. mkdir -p $PKG/install
  88. cat $CWD/slack-desc > $PKG/install/slack-desc
  89. cd $PKG
  90. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE