s243a

ffmpeg.SlackBuild (build#1 - puppy phoenix))

Mar 11th, 2021 (edited)
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.95 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Slackware build script for ffmpeg
  4.  
  5. # Copyright 2010-2017 Heinz Wiesinger, Amsterdam, The Netherlands
  6. # Copyright 2017  Patrick J. Volkerding, Sebeka, MN, USA
  7. # All rights reserved.
  8. #
  9. # Redistribution and use of this script, with or without modification, is
  10. # permitted provided that the following conditions are met:
  11. #
  12. # 1. Redistributions of this script must retain the above copyright
  13. #    notice, this list of conditions and the following disclaimer.
  14. #
  15. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  18. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  21. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25.  
  26. # Originally written by core (eroc@linuxmail.org)
  27. # Modified by Robby Workman <rworkman@slackbuilds.org>
  28.  
  29. PRGNAM=ffmpeg
  30. VERSION=${VERSION:-3.2.4}
  31. BUILD=${BUILD:-1}
  32. TAG=${TAG:-_SBo}
  33.  
  34. if [ -z "$ARCH" ]; then
  35.   case "$( uname -m )" in
  36.     i?86) ARCH=i486 ;;
  37.     arm*) ARCH=arm ;;
  38.        *) ARCH=$( uname -m ) ;;
  39.   esac
  40. fi
  41.  
  42. CWD=$(pwd)
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46.  
  47. if [ "$ARCH" = "i486" ]; then
  48.   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  49.   LIBDIRSUFFIX=""
  50. elif [ "$ARCH" = "i686" ]; then
  51.   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  52.   LIBDIRSUFFIX=""
  53. elif [ "$ARCH" = "x86_64" ]; then
  54.   SLKCFLAGS="-O2 -fPIC"
  55.   LIBDIRSUFFIX="64"
  56. else
  57.   SLKCFLAGS="-O2"
  58.   LIBDIRSUFFIX=""
  59. fi
  60.  
  61. # You can enable a lot of optional (not-autodetected) features by
  62. # passing variables to the script (VAR=yes/no ./ffmpeg.SlackBuild).
  63. # Unfortunately ffmpeg's configure doesn't support --enable-feature=yes
  64. # syntax, so we have to do it the complicated way :/
  65. # Additional optional (autodetected) dependencies are:
  66. # - jack
  67. # - libva
  68. # - libvdpau
  69. # - libX11
  70. # - libxcb
  71. # - sdl2
  72. # - xz
  73. # - zlib
  74.  
  75. mp3lame=""    ; [ "${LAME:-no}" != "no" ]         && mp3lame="--enable-libmp3lame"
  76. libx264=""    ; [ "${X264:-no}" != "no" ]         && libx264="--enable-libx264"
  77. libcelt=""    ; [ "${CELT:-no}" != "no" ]         && libcelt="--enable-libcelt"
  78. libdc1394=""  ; [ "${DC1394:-no}" != "no" ]       && libdc1394="--enable-libdc1394"
  79. libfrei0r=""  ; [ "${FREI0R:-no}" != "no" ]       && libfrei0r="--enable-frei0r"
  80. libgsm=""     ; [ "${GSM:-no}" != "no" ]          && libgsm="--enable-libgsm"
  81. librtmp=""    ; [ "${RTMP:-no}" != "no" ]         && librtmp="--enable-librtmp"
  82. dirac_fast="" ; [ "${SCHROEDINGER:-no}" != "no" ] && dirac_fast="--enable-libschroedinger"
  83. libspeex=""   ; [ "${SPEEX:-no}" != "no" ]        && libspeex="--enable-libspeex"
  84. libxvid=""    ; [ "${XVID:-no}" != "no" ]         && libxvid="--enable-libxvid"
  85. libbluray=""  ; [ "${BLURAY:-no}" != "no" ]       && libbluray="--enable-libbluray"
  86. libass=""     ; [ "${ASS:-no}" != "no" ]          && libass="--enable-libass"
  87. libopenal=""  ; [ "${OPENAL:-no}" != "no" ]       && libopenal="--enable-openal"
  88. libiec61883=""; [ "${IEC61883:-no}" != "no" ]     && libiec61883="--enable-libiec61883"
  89. libilbc=""    ; [ "${ILBC:-no}" != "no" ]         && libilbc="--enable-libilbc"
  90. libmodplug="" ; [ "${MODPLUG:-no}" != "no" ]      && libmodplug="--enable-libmodplug"
  91. libopus=""    ; [ "${OPUS:-no}" != "no" ]         && libopus="--enable-libopus"
  92. libtwolame="" ; [ "${TWOLAME:-no}" != "no" ]      && libtwolame="--enable-libtwolame"
  93. ladspa=""     ; [ "${LADSPA:-no}" != "no" ]       && ladspa="--enable-ladspa"
  94. libflite=""   ; [ "${FLITE:-no}" != "no" ]        && libflite="--enable-libflite"
  95. libvidstab="" ; [ "${VIDSTAB:-no}" != "no" ]      && libvidstab="--enable-libvidstab"
  96. libx265=""    ; [ "${X265:-no}" != "no" ]         && libx265="--enable-libx265"
  97. libzvbi=""    ; [ "${ZVBI:-no}" != "no" ]         && libzvbi="--enable-libzvbi"
  98. libopencv=""  ; [ "${OPENCV:-no}" != "no" ]       && libopencv="--enable-libopencv"
  99. libgme=""     ; [ "${GME:-no}" != "no" ]          && libgme="--enable-libgme"
  100. libsnappy=""  ; [ "${SNAPPY:-no}" != "no" ]       && libsnappy="--enable-libsnappy"
  101. libwebp=""    ; [ "${WEBP:-no}" != "no" ]         && libwebp="--enable-libwebp"
  102. libzmq=""     ; [ "${ZMQ:-no}" != "no" ]          && libzmq="--enable-libzmq"
  103. libbs2b=""    ; [ "${BS2B:-no}" != "no" ]         && libbs2b="--enable-libbs2b"
  104. libebur128="" ; [ "${EBUR128:-no}" != "no" ]      && libebur128="--enable-libebur128"
  105. rubberband="" ; [ "${RUBBERBAND:-no}" != "no" ]   && rubberband="--enable-librubberband"
  106. tesseract=""  ; [ "${TESSERACT:-no}" != "no" ]    && tesseract="--enable-libtesseract"
  107. netcdf=""     ; [ "${NETCDF:-no}" != "no" ]       && netcdf="--enable-netcdf"
  108. chromaprint=""  ; [ "${CHROMAPRINT:-no}" != "no" ] && chromaprint="--enable-chromaprint"
  109. opencore_amr="" ; [ "${OPENCORE:-no}" != "no" ]    && \
  110.   opencore_amr="--enable-libopencore-amrnb --enable-libopencore-amrwb"
  111. fdk=""          ; [ "${FDK_AAC:-no}" != "no" ]  && \
  112.   { fdk="--enable-libfdk-aac"; non_free="--enable-nonfree" ; }
  113. ssl=""          ; [ "${OPENSSL:-no}" != "no" ]  && \
  114.   { ssl="--enable-openssl" ; non_free="--enable-nonfree" ; }
  115. decklink=""   ; [ "${DECKLINK:-no}" != "no" ]   && \
  116.   { decklink="--enable-decklink" ; \
  117.     SLKCFLAGS="$SLKCFLAGS -I/usr/include/decklink" ; }
  118.  
  119. #s243a Options
  120. PULSEAUDIO=no
  121. SAMBA=no
  122. WAVPACK=no
  123. X11GRAB=no
  124. LIBSSH=no
  125. THEORA=no
  126. V4L2=no
  127. VPX=no
  128. #end s243a options
  129.  
  130.  
  131. # Default enabled features:
  132. #opencl=""     ; [ "${OPENCL:-yes}" != "no" ]      && opencl="--enable-opencl"
  133. fontconfig="" ; [ "${FONTCONFIG:-yes}" != "no" ]  && fontconfig="--enable-libfontconfig"
  134. freetype=""   ; [ "${FREETYPE:-yes}" != "no" ]    && freetype="--enable-libfreetype"
  135. fribidi=""    ; [ "${FRIBIDI:-yes}" != "no" ]     && fribidi="--enable-libfribidi"
  136. gnutls=""     ; [ "${GNUTLS:-yes}" != "no" ]      && gnutls="--enable-gnutls"
  137. libcaca=""    ; [ "${CACA:-yes}" != "no" ]        && libcaca="--enable-libcaca"
  138. libcdio=""    ; [ "${LIBCDIO:-yes}" != "no" ]     && libcdio="--enable-libcdio"
  139. libssh=""     ; [ "${LIBSSH:-yes}" != "no" ]      && libssh="--enable-libssh"
  140. libtheora=""  ; [ "${THEORA:-yes}" != "no" ]      && libtheora="--enable-libtheora"
  141. libv4l2=""    ; [ "${V4L2:-yes}" != "no" ]        && libv4l2="--enable-libv4l2"
  142. libvorbis=""  ; [ "${VORBIS:-yes}" != "no" ]      && libvorbis="--enable-libvorbis"
  143. libvpx=""     ; [ "${VPX:-yes}" != "no" ]         && libvpx="--enable-libvpx"
  144. opengl=""     ; [ "${OPENGL:-yes}" != "no" ]      && opengl="--enable-opengl"
  145. openjpeg=""   ; [ "${JP2:-yes}" != "no" ]         && openjpeg="--enable-libopenjpeg"
  146. pulse=""      ; [ "${PULSEAUDIO:-yes}" != "no" ]  && pulse="--enable-libpulse"
  147. samba=""      ; [ "${SAMBA:-yes}" != "no" ]       && samba="--enable-libsmbclient"
  148. wavpack=""    ; [ "${WAVPACK:-yes}" != "no" ]     && wavpack="--enable-libwavpack"
  149. x11grab=""    ; [ "${X11GRAB:-yes}" != "no" ]     && x11grab="--enable-x11grab"
  150.  
  151. # Disable patent encumbered features:
  152. aac=""        ; [ "${AAC:-yes}" != "yes" ]           && aac="--disable-encoder=aac"
  153.  
  154. set -e
  155.  
  156. rm -rf $PKG
  157. mkdir -p $TMP $PKG $OUTPUT
  158. cd $TMP
  159. rm -rf $PRGNAM-$VERSION
  160. tar xvf $CWD/$PRGNAM-$VERSION.tar
  161. cd $PRGNAM-$VERSION
  162. chown -R root:root .
  163. find -L . \
  164.  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  165.   -o -perm 511 \) -exec chmod 755 {} \; -o \
  166.  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  167.   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  168.  
  169. # Patch for openjpeg-2.3.0
  170. patch -p1 < $CWD/ffmpeg-3.2.4-openjpeg2.3.patch
  171.  
  172. #patch for libfdk-aac 2.0.0
  173. patch -p0 < $CWD/ffmpeg-3.2.4-libfdk_aac-2.0.0.patch
  174.  
  175. # Fix linking with flite:
  176. sed -i "s| -lflite\"| -lflite -lm -lasound\"|" \
  177.   ./configure
  178.  
  179. CFLAGS="$SLKCFLAGS" \
  180. CXXFLAGS="$SLKCFLAGS" \
  181. ./configure \
  182.   --prefix=/usr \
  183.   --libdir=/usr/lib${LIBDIRSUFFIX} \
  184.   --shlibdir=/usr/lib${LIBDIRSUFFIX} \
  185.   --docdir=/usr/doc/$PRGNAM-$VERSION/html \
  186.   --mandir=/usr/man \
  187.   --disable-debug \
  188.   --enable-shared \
  189.   --disable-static \
  190.   --enable-gpl \
  191.   --enable-version3 \
  192.   --enable-avresample \
  193.   --arch=$ARCH \
  194.   $non_free \
  195.   $aac \
  196.   $chromaprint \
  197.   $decklink \
  198.   $dirac_fast \
  199.   $fdk \
  200.   $fontconfig \
  201.   $freetype \
  202.   $fribidi \
  203.   $gnutls \
  204.   $ladspa \
  205.   $libass \
  206.   $libbluray \
  207.   $libbs2b \
  208.   $libcaca \
  209.   $libcdio \
  210.   $libcelt \
  211.   $libdc1394 \
  212.   $libebur128 \
  213.   $libflite \
  214.   $libfrei0r \
  215.   $libgme \
  216.   $libgsm \
  217.   $libiec61883 \
  218.   $libilbc \
  219.   $libmodplug \
  220.   $libopenal \
  221.   $libopencv \
  222.   $libopus \
  223.   $librtmp \
  224.   $libsnappy \
  225.   $libspeex \
  226.   $libssh \
  227.   $libtheora \
  228.   $libtwolame \
  229.   $libv4l2 \
  230.   $libvidstab \
  231.   $libvorbis \
  232.   $libvpx \
  233.   $libwebp \
  234.   $libx264 \
  235.   $libx265 \
  236.   $libxvid \
  237.   $libzmq \
  238.   $libzvbi \
  239.   $mp3lame \
  240.   $netcdf \
  241.   $opencore_amr \
  242.   $opengl \
  243.   $openjpeg \
  244.   $pulse \
  245.   $rubberband \
  246.   $samba \
  247.   $ssl \
  248.   $tesseract \
  249.   $wavpack \
  250.   $x11grab
  251.  
  252. make
  253. make install DESTDIR=$PKG
  254. make install-man DESTDIR=$PKG
  255.  
  256. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \
  257.   grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  258.  
  259. find $PKG/usr/man -type f -exec gzip -9 {} \;
  260.  
  261. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/txt
  262. cp -a Changelog COPYING* CREDITS INSTALL* LICENSE* MAINTAINERS README* \
  263.   RELEASE VERSION \
  264.   $PKG/usr/doc/$PRGNAM-$VERSION
  265. cp -a doc/*.txt $PKG/usr/doc/$PRGNAM-$VERSION/txt/
  266. find . -name "RELEASE_NOTES" -exec cp -a {} $PKG/usr/doc/$PRGNAM-$VERSION/ \;
  267. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  268.  
  269. mkdir -p $PKG/install
  270. cat $CWD/slack-desc > $PKG/install/slack-desc
  271.  
  272. cd $PKG
  273. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
  274.  
Add Comment
Please, Sign In to add comment