#!/bin/bash sourcedir="$HOME/.local/src/" mkdir "$sourcedir" export CFLAGS='-march=native -O3 -pipe -fstack-protector -Wall' export CXXFLAGS='-march=native -O3 -pipe -fstack-protector -Wall' ## Installs the build tools and VDPAU drivers for mesa function installDependencies() { sudo apt-fast install -y cmake yasm autoconf build-essential mesa-vdpau-drivers \ libvdpau-va-gl1 # Remove Conflicts sudo apt-get autoremove libass{5,-dev} libx265{-43,-dev} -y # These packages are removed for some reason when removing libass from Ubuntu. sudo apt-fast install -y freepats gstreamer1.0-plugins-bad-faad \ gstreamer1.0-plugins-bad-videoparsers libcdaudio1 libdca0 \ libdirac-encoder0 libdirectfb-1.2-9 libfluidsynth1 libgme0 \ libgstreamer-plugins-bad0.10-0 libgstreamer-plugins-bad1.0-0 libkate1 libmimic0 \ libmms0 libmpg123-0 libofa0 libopencv-calib3d2.4 libopencv-contrib2.4 \ libopencv-features2d2.4 libopencv-flann2.4 libopencv-legacy2.4 \ libopencv-ml2.4 libopencv-objdetect2.4 libopencv-video2.4 libslv2-9 \ libsoundtouch0 libspandsp2 libsrtp0 libwildmidi-config libwildmidi1 libzbar0 \ libzvbi-common libzvbi0 # Development Libraries sudo apt-fast install -y lib{pulse,asound2,jack}-dev \ # Audio lib{x264,vpx,theora,opus,vorbis,fdk-aac,x11}-dev \ # Video lib{freetype6,fribidi,fontconfig1,harfbuzz,enca}-dev \ # Subtitles lib{dvdread,dvdnav,bluray,cdio,cdio-cdda,cdio-paranoia}-dev \ # Media lib{va,vdpau}-dev # Hardware Accel ## Bomi Development Libraries sudo apt-fast install qt5-default qttools5-dev-tools qtquick1-5-dev \ lib{qt5svg5,qt5x11extras5,systemd,smbclient,glib2.0}-dev \ lib{xv,bz2,xcb-icccm4,xcb-screensaver0,xcb-randr0,xcb-xtest0}-dev \ qtdeclarative5-dev -y # Bomi Dependencies sudo apt-fast install qtdeclarative5-controls-plugin -y } ## Compiles the source code, packages it into a deb and cleans up compiled files ## from the source tree. function packageDeb() { make -j9 sudo checkinstall --pkgname "$1" --pkgversion "$2" --provides "$3" -y make distclean; make clean } ## Functions for downloading the latest git of each respective project. function downloadX265() { git clone https://github.com/videolan/x265 } function downloadFfmpeg() { git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg } function downloadLibass() { git clone https://github.com/libass/libass/ } function downloadBomi() { git clone https://github.com/xylosper/bomi } ## Builds the latest version of the libass subtitle library, which is needed by bomi. function buildLibass() { cd "${sourcedir}/libass" ./autogen.sh; ./configure prefix=/usr packageDeb "libass-git" "$(git rev-list --count HEAD)" "libass5, libass-dev" } ## Bulds the latest version of x265 compiled with 10-bit encode support. ## If another package relies upon the stock libx265-43 package, that package might break. ## If there is breakage, I'll work for a solution in the immediate future. function buildX265() { cd "${sourcedir}x265/build/linux" sudo apt-fast autoremove libx265{-43,-dev} -y # Conflicts with ffmpeg [[ $(arch) == x86_64 ]] && LDFLAGS+=',-z,noexecstack' cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr ../../source -DHIGH_BIT_DEPTH=1 packageDeb "x265-10bit" "1.6" "x265" } ## Builds the latest version of ffmpeg with libass-git and x265-10bit-git support. function buildFfmpeg() { cd ${sourcedir}ffmpeg ./configure --prefix=/usr \ --enable-gpl \ --enable-nonfree \ --enable-libass \ --enable-libfreetype \ --enable-libopus \ --enable-libvorbis \ --enable-libfdk-aac \ --enable-libx265 \ --enable-libx264 \ --enable-libvpx \ --enable-libtheora \ --enable-libbluray \ --enable-libcdio \ --enable-libfreetype \ --enable-libfribidi \ --enable-libsmbclient \ --enable-version3 \ --enable-x11grab \ --extra-cflags="-march=native -O3" \ --extra-cxxflags="-march=native -O3" packageDeb "ffmpeg-git" "$(git rev-list --count HEAD)" "ffmpeg" } ## Builds the latest git of Bomi using the version of ffmpeg that we compiled earlier, ## and with all features enabled. Please report missing features. function buildBomi() { cd "${sourcedir}bomi" ./download-libchardet ./build-libchardet ./configure --prefix=/usr/local packageDeb "bomi-git" "$(git rev-list --count HEAD)" "bomi" } function main() { cd "$sourcedir" installDependencies downloadX265; downloadFfmpeg; downloadLibass buildLibass; buildX265; buildFfmpeg downloadBomi; buildBomi ## Optional } main