faac.SlackBuild 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/sh
  2. # Slackware build script for faac
  3. # Copyright (c) 2008, Antonio Hernández Blas <hba.nihilismus@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. # 1.- Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
  12. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  15. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  17. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  19. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  20. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. # Thanks to Carpo on LinuxQuestions.org for the tips
  22. # Thanks to Heinz Wiesinger for the information about faac and libmp4v2
  23. # Updated to newer version by Niklas 'Nille' Åkerström and also new maintainer.
  24. PRGNAM=faac
  25. VERSION=${VERSION:-1.28}
  26. BUILD=${BUILD:-2}
  27. TAG=${TAG:-_SBo}
  28. # Automatically determine the architecture we're building on:
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i486 ;;
  32. arm*) ARCH=arm ;;
  33. # Unless $ARCH is already set, use uname -m for all other archs:
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. CWD=$(pwd)
  38. TMP=${TMP:-/tmp/SBo}
  39. PKG=$TMP/package-$PRGNAM
  40. OUTPUT=${OUTPUT:-/tmp}
  41. if [ "$ARCH" = "i486" ]; then
  42. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "i686" ]; then
  45. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  46. LIBDIRSUFFIX=""
  47. elif [ "$ARCH" = "x86_64" ]; then
  48. SLKCFLAGS="-O2 -fPIC"
  49. LIBDIRSUFFIX="64"
  50. else
  51. SLKCFLAGS="-O2"
  52. LIBDIRSUFFIX=""
  53. fi
  54. # Seems that libmp4v2 is a complicated critter. Here's how we think it works:
  55. #
  56. # libmp4v2:installed, --with-mp4v2: faac uses external libmp4v2
  57. # libmp4v2:not installed, --with-mp4v2: faac uses internal libmp4v2
  58. # libmp4v2:installed, --without-mp4v2: faac uses external libmp4v2
  59. # libmp4v2:not installed, --without-mp4v2: faac doesn't use any libmp4v2
  60. #
  61. # Therefore, we'll default to use --without-mp4v2, which should produce the
  62. # desired result in every case *except* where one wants to use the internal
  63. # implementation, and that creates other problems, so we don't support it.
  64. #
  65. # From what used to be in our README:
  66. # faac comes with its own version of libmp4v2, but if you use it, you have to
  67. # uninstall faac everytime you want to update it, as faac would otherwise
  68. # detect the already installed libmp4v2 and build against it. Then, when you
  69. # upgrade to the new package, it doesn't have the included libmp4v2, because
  70. # it was part of the old package, so faac is linking to a nonexistent library
  71. # after the upgrade.
  72. set -e
  73. rm -rf $PKG
  74. mkdir -p $TMP $PKG $OUTPUT
  75. cd $TMP
  76. rm -rf $PRGNAM-$VERSION
  77. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  78. cd $PRGNAM-$VERSION
  79. chown -R root:root .
  80. find . \
  81. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  82. -exec chmod 755 {} \; -o \
  83. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  84. -exec chmod 644 {} \;
  85. # http://lists.slackbuilds.org/pipermail/slackbuilds-users/2010-May/005680.html
  86. # Fix compilation problem faac-1.28 and external libmp4v2 1.9.1
  87. # see http://sourceforge.net/tracker/?func=detail&aid=2894310&group_id=704&atid=100704
  88. # and http://ftp.eenet.ee/gentoo-portage/media-libs/faac/files/faac-1.28-external-libmp4v2.patch
  89. patch -p1 < $CWD/faac-1.28-external-libmp4v2.patch
  90. # having just patched configure.in, we need to bludgeon automake
  91. libtoolize --force --copy
  92. aclocal
  93. autoconf
  94. automake --add-missing
  95. CFLAGS="$SLKCFLAGS" \
  96. CXXFLAGS="$SLKCFLAGS" \
  97. ./configure \
  98. --prefix=/usr \
  99. --libdir=/usr/lib${LIBDIRSUFFIX} \
  100. --mandir=/usr/man \
  101. --enable-shared=yes \
  102. --enable-static=no \
  103. --without-mp4v2 \
  104. --build=$ARCH-slackware-linux
  105. make
  106. make install-strip DESTDIR=$PKG
  107. find $PKG/usr/man -type f -exec gzip -9 {} \;
  108. for i in $(find $PKG/usr/man -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
  109. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  110. cp -a AUTHORS ChangeLog COPYING INSTALL NEWS README TODO docs/* \
  111. $PKG/usr/doc/$PRGNAM-$VERSION
  112. rm -f $PKG/usr/doc/$PRGNAM-$VERSION/faac.1
  113. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  114. find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;
  115. mkdir -p $PKG/install
  116. cat $CWD/slack-desc > $PKG/install/slack-desc
  117. cd $PKG
  118. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
  119. if [ "$1" = "--cleanup" ]; then
  120. rm -rf $PKG $TMP/$PRGNAM-$VERSION
  121. fi