HandBrake.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for HandBrake
  3. # This slackbuild maintained by Klaatu at klaatu@hackerpublicradio.org
  4. # Modified by David Somero at SlackBuilds.org.
  5. # Modified by Erik Hanson at SlackBuilds.org
  6. # Patched to fix x264 segfault by John Vogel
  7. cd $(dirname $0) ; CWD=$(pwd)
  8. PRGNAM=HandBrake
  9. VERSION=${VERSION:-1.5.1}
  10. BUILD=${BUILD:-2}
  11. TAG=${TAG:-_SBo}
  12. PKGTYPE=${PKGTYPE:-tgz}
  13. DOCDIR=${DOCDIR:-/usr/doc}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i686 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i486" ]; then
  29. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. SLKCFLAGS="$SLKCFLAGS -fno-aggressive-loop-optimizations"
  42. export CFLAGS="$SLKCFLAGS"
  43. export CXXFLAGS="$SLKCFLAGS"
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf $PRGNAM-$VERSION
  49. tar xvf $CWD/$PRGNAM-$VERSION-source.tar.bz2
  50. cd $PRGNAM-$VERSION
  51. mkdir -p download
  52. cp -r $CWD/*{gz,bz2} download
  53. chown -R root:root .
  54. find -L . \
  55. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  56. -o -perm 511 \) -exec chmod 755 {} \; -o \
  57. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  58. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  59. # 20220324 bkw: this fixes the 32-bit build, at the cost of adding
  60. # x265 as a required dep. It's based on Debian's
  61. # 0001-Remove-embedded-downloaded-copies-of-various-librari.patch
  62. # ...but it only affects x265.
  63. patch -p1 < $CWD/system_x265.diff
  64. # Autodetect onevpl support
  65. if pkg-config --exists vpl ; then qsv="--enable-qsv" ; else qsv="" ; fi
  66. CFLAGS="$SLKCFLAGS" \
  67. CXXFLAGS="$SLKCFLAGS" \
  68. ./configure \
  69. --prefix=/usr \
  70. --disable-gtk-update-checks \
  71. --enable-fdk-aac \
  72. --enable-nvenc \
  73. --enable-vce \
  74. --enable-x265 \
  75. $qsv \
  76. --arch=$ARCH
  77. cd build
  78. make
  79. make install DESTDIR=$PKG
  80. strip $PKG/usr/bin/*
  81. cd $TMP/$PRGNAM-$VERSION
  82. mkdir -p $PKG/$DOCDIR/$PRGNAM-$VERSION
  83. cp -a AUTHORS.markdown COPYING NEWS.markdown THANKS.markdown README.markdown \
  84. $PKG/$DOCDIR/$PRGNAM-$VERSION
  85. cat $CWD/$PRGNAM.SlackBuild > $PKG/$DOCDIR/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  86. mkdir -p $PKG/install
  87. cat $CWD/slack-desc > $PKG/install/slack-desc
  88. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  89. cd $PKG
  90. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE