mythtv.SlackBuild 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #!/bin/sh
  2. # Slackware build script for mythtv
  3. # http://www.mythtv.org/
  4. # Written by David Somero <dsomero@hotmail.com>
  5. # Derived from Slackware's Slackbuilds.
  6. #
  7. # Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
  8. # Copyright 2010-2013 David Somero (dsomero@hotmail.com) Athens, TN, USA
  9. # All rights reserved.
  10. #
  11. # Redistribution and use of this script, with or without modification, is
  12. # permitted provided that the following conditions are met:
  13. #
  14. # 1. Redistributions of this script must retain the above copyright
  15. # notice, this list of conditions and the following disclaimer.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  18. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  20. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  23. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  25. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  26. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. PRGNAM=mythtv
  28. VERSION=${VERSION:-0.27.6}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. if [ -z "$ARCH" ]; then
  32. case "$( uname -m )" in
  33. i?86) ARCH=i586 ;;
  34. arm*) ARCH=arm ;;
  35. *) ARCH=$( uname -m ) ;;
  36. esac
  37. fi
  38. CWD=$(pwd)
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. if [ "$ARCH" = "i586" ]; then
  43. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "i686" ]; then
  46. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "x86_64" ]; then
  49. SLKCFLAGS="-O2 -fPIC"
  50. LIBDIRSUFFIX="64"
  51. else
  52. SLKCFLAGS="-O2"
  53. LIBDIRSUFFIX=""
  54. fi
  55. set -e
  56. rm -rf $PKG
  57. mkdir -p $TMP $PKG $OUTPUT
  58. cd $TMP
  59. rm -rf $PRGNAM-$VERSION
  60. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/v$VERSION.tar.gz
  61. cd $PRGNAM-$VERSION
  62. chown -R root:root .
  63. find -L . \
  64. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  65. -o -perm 511 \) -exec chmod 755 {} \; -o \
  66. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  67. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  68. cd mythtv
  69. # Pass libdir to zeromq.
  70. sed -i \
  71. -e"s|--without-documentation|--without-documentation --libdir=/usr/lib$LIBDIRSUFFIX|" \
  72. configure
  73. # Thanks to ARCH Linux
  74. patch -d external/FFmpeg -p1 < $CWD/libvpxenc.patch
  75. CFLAGS="$SLKCFLAGS" \
  76. CXXFLAGS="$SLKCFLAGS" \
  77. ./configure \
  78. --prefix=/usr \
  79. --libdir-name=lib${LIBDIRSUFFIX} \
  80. --mandir=/usr/man \
  81. --compile-type=release \
  82. --dvb-path=/usr/include \
  83. --with-bindings="perl,python,php" \
  84. --perl-config-opts="INSTALLDIRS=vendor" \
  85. --disable-ccache \
  86. --disable-distcc \
  87. --disable-hdhomerun \
  88. --enable-dvb \
  89. --enable-xrandr \
  90. --enable-xv \
  91. --enable-x11 \
  92. --enable-nonfree \
  93. --enable-opengl-video \
  94. --enable-libmp3lame \
  95. --enable-libfaac \
  96. --enable-libx264 \
  97. --enable-libvpx \
  98. --enable-libxvid \
  99. --enable-symbol-visibility \
  100. --enable-pic
  101. make
  102. make install INSTALL_ROOT="$PKG"
  103. # Don't package empty and wrong man directories.
  104. rm -rf $PKG/usr/share/man
  105. mkdir -p $PKG/var/lib/mythtv
  106. mkdir -p $PKG/var/cache/mythtv
  107. mkdir -p $PKG/etc/{logrotate.d,mythtv}
  108. # Other config/init files
  109. install -D -m 0755 $CWD/files/rc.mythbackend.new $PKG/etc/rc.d/rc.mythbackend.new
  110. touch $PKG/etc/mythtv/config.xml.new
  111. cat $CWD/files/mysql.txt > $PKG/etc/mythtv/mysql.txt.new
  112. cat $CWD/files/mythtv.logrotate.d > $PKG/etc/logrotate.d/mythbackend.new
  113. # Create desktop entry for mythfrontend and myth-setup.
  114. mkdir -p $PKG/usr/share/{pixmaps,applications}
  115. for file in mythtv-setup mythfrontend; do
  116. cat $CWD/files/$file.png > $PKG/usr/share/pixmaps/$file.png
  117. cat $CWD/files/$file.desktop > $PKG/usr/share/applications/$file.desktop
  118. done
  119. # Copy some other needed stuff to /usr/share/mythtv
  120. # Nuke Windows and Mac OS X build scripts
  121. rm -rf contrib/Win32 contrib/OSX
  122. cp -a database contrib $PKG/usr/share/$PRGNAM
  123. find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f
  124. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  125. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  126. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  127. cp -a AUTHORS COPYING FAQ keys.txt README UPGRADING docs/* \
  128. $PKG/usr/doc/$PRGNAM-$VERSION
  129. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  130. cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
  131. ( cd $PKG/usr/doc ; ln -s $PRGNAM-$VERSION $PRGNAM )
  132. mkdir -p $PKG/install
  133. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  134. cat $CWD/slack-desc > $PKG/install/slack-desc
  135. cd $PKG
  136. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}