Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Fail on error
- set -e
- # ------------------------------------------------------------------------------
- # Directories
- # ------------------------------------------------------------------------------
- # Root dir
- ROOT_DIR=$(cd $(dirname $0); pwd -P)
- YASM_DIR="$ROOT_DIR/yasm"
- X264_DIR="$ROOT_DIR/x264"
- X265_DIR="$ROOT_DIR/x265"
- FDK_AAC_DIR="$ROOT_DIR/fdk-aac"
- MP3LAME_DIR="$ROOT_DIR/lame-3.99.5"
- OPUS_DIR="$ROOT_DIR/opus"
- OGG_DIR="$ROOT_DIR/libogg-1.3.2"
- VORBIS_DIR="$ROOT_DIR/libvorbis-1.3.4"
- VPX_DIR="$ROOT_DIR/libvpx"
- FFMPEG_DIR="$ROOT_DIR/ffmpeg"
- echo "Build root is '$ROOT_DIR'."
- # ------------------------------------------------------------------------------
- # Yasm
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$YASM_DIR" ]]; then
- echo "Yasm directory found. Pulling latest changes."
- cd $YASM_DIR
- git pull origin
- else
- echo "Yasm directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone --depth 1 git://github.com/yasm/yasm.git
- cd $YASM_DIR
- fi
- # Do the build
- autoreconf -fiv
- ./configure
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libx264
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$X264_DIR" ]]; then
- echo "x264 directory found. Pulling latest changes."
- cd $X264_DIR
- git pull origin
- else
- echo "x264 directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone --depth 1 git://git.videolan.org/x264
- cd $X264_DIR
- fi
- # Do the build
- ./configure --enable-static --enable-shared --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libx265
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$X265_DIR" ]]; then
- echo "x265 directory found. Pulling latest changes."
- cd $X265_DIR
- hg update
- else
- echo "x265 directory not found. Cloning repository."
- cd $ROOT_DIR
- hg clone https://bitbucket.org/multicoreware/x265
- cd $X265_DIR
- fi
- # Do the build
- cd build/linux
- cmake ../../source -DENABLE_SHARED:bool=on
- make
- # Install
- make install
- # ------------------------------------------------------------------------------
- # libfdk_aac
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$FDK_AAC_DIR" ]]; then
- echo "fdk_aac directory found. Pulling latest changes."
- cd $FDK_AAC_DIR
- git pull origin
- else
- echo "fdk_aac directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
- cd $FDK_AAC_DIR
- fi
- # Do the build
- autoreconf -fiv
- ./configure --enable-shared --enable-static --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libmp3lame
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$MP3LAME_DIR" ]]; then
- echo "mp3lame directory found. Skipping download."
- cd $MP3LAME_DIR
- else
- echo "mp3lame directory not found. Downloading."
- cd $ROOT_DIR
- curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
- tar xzvf lame-3.99.5.tar.gz
- cd $MP3LAME_DIR
- fi
- # Do the build
- ./configure --enable-nasm --enable-shared --enable-static --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libopus
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$OPUS_DIR" ]]; then
- echo "opus directory found. Pulling latest changes."
- cd $OPUS_DIR
- git pull origin
- else
- echo "opus directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone http://git.opus-codec.org/opus.git opus
- cd $OPUS_DIR
- fi
- # Do the build
- autoreconf -fiv
- ./configure --enable-static --enable-shared --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libogg
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$OGG_DIR" ]]; then
- echo "ogg directory found. Skipping download."
- cd $OGG_DIR
- else
- echo "ogg directory not found. Downloading."
- cd $ROOT_DIR
- curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
- tar xzvf libogg-1.3.2.tar.gz
- cd $OGG_DIR
- fi
- # Do the build
- ./configure --enable-static --enable-shared --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libvorbis
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$VORBIS_DIR" ]]; then
- echo "vorbis directory found. Skipping download."
- cd $VORBIS_DIR
- else
- echo "vorbis directory not found. Downloading."
- cd $ROOT_DIR
- curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
- tar xzvf libvorbis-1.3.4.tar.gz
- cd $VORBIS_DIR
- fi
- # Do the build
- ./configure --enable-static --enable-shared --enable-pic
- make
- # Install
- make install
- make distclean
- # ------------------------------------------------------------------------------
- # libvpx
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$VPX_DIR" ]]; then
- echo "vpx directory found. Pulling latest changes."
- cd $VPX_DIR
- git pull origin
- else
- echo "vpx directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
- cd $VPX_DIR
- fi
- # Do the build
- ./configure --disable-examples --enable-static --enable-shared --enable-pic
- make
- # Install
- make install
- make clean
- # ------------------------------------------------------------------------------
- # FFmpeg
- # ------------------------------------------------------------------------------
- # Update the code from the repository
- if [[ -d "$FFMPEG_DIR" ]]; then
- echo "FFmpeg directory found. Pulling latest changes."
- cd $FFMPEG_DIR
- git pull origin
- else
- echo "FFmpeg directory not found. Cloning repository."
- cd $ROOT_DIR
- git clone https://git.ffmpeg.org/ffmpeg.git
- cd $FFMPEG_DIR
- fi
- # Do the build
- PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --enable-static --enable-shared --enable-pic --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
- make
- # Install
- make install
- make distclean
- hash -r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement