Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mydir="$HOME/LFS"
- mycores="-j4"
- set -euf -o pipefail #sipb.mit.ede safe scripting tutorial
- #pyside , spyder
- # https://github.com/baoboa/pyqt5
- function installThese
- {
- echo "http://www.portaudio.com/usinggit.html"
- git clone git@git.assembla.com:portaudio.git
- tar -nc http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
- # https://github.com/jleb/pyaudio #bindings for port audio.
- }
- function aptDependiesUbuntu
- {
- sudo apt install -y libfreetype6-dev libgtk2.0-dev libgtk-3-dev libv4l-dev gfortran libeigen3-dev
- # libhdf5-dev
- # libv4l-dev is the v4l video 4 linux project.
- #http://www.linuxfromscratch.org/blfs/view/svn/general/freetype2.html
- #wget -nc https://downloads.sourceforge.net/freetype/freetype-2.8.1.tar.bz2 # source installno works.
- }
- function qt5build {
- echo "linuxfromscratch build instructions"
- cd "$mydir"
- export QT5PREFIX=/opt/qt5
- wget -nc https://download.qt.io/archive/qt/5.9/5.9.1/single/qt-everywhere-opensource-src-5.9.1.tar.xz
- if ! [ -d "$mydir/qt-everywhere-opensource-src-5.9.1" ];then
- tar -xJfv qt-everywhere-opensource-src-5.9.1.tar.xz
- fi
- cd qt-everywhere-opensource-src-5.9.1
- export QT5PREFIX=/opt/qt5
- mkdir /opt/qt-5.9.1
- ln -sfnv qt-5.9.1 /opt/qt5
- #echo "INCLUDEPATH += /usr/include/openssl-1.0" >> qtbase/src/network/network.pro
- #export OPENSSL_LIBS='-L/usr/lib/openssl-1.0 -lssl -lcrypto'
- #comment
- #cd "$mydir/qt-everywhere-opensource-src-5.9.1"
- #./configure -prefix $QT5PREFIX \
- # -sysconfdir /etc/xdg \
- # -confirm-license \
- # -opensource \
- # -dbus-linked \
- # -openssl-linked \
- # -system-harfbuzz \
- # -system-sqlite \
- # -nomake examples \
- # -no-rpath \
- # -skip qtwebengine
- ## stripped out ssl stuff , no need for this.
- ./configure -prefix $QT5PREFIX \
- -sysconfdir /etc/xdg \
- -confirm-license \
- -opensource \
- -dbus-linked \
- -no-openssl \
- -system-harfbuzz \
- -system-sqlite \
- -nomake examples \
- -no-rpath \
- -skip qtwebengine
- make "$mycores" && sudo make install
- # sudo find $QT5PREFIX/ -name \*.prl \
- # -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
- # exit 1
- for file in moc uic rcc qmake lconvert lrelease lupdate; do
- ln -sfrvn $QT5BINDIR/$file /usr/bin/$file-qt5
- done
- cat >> /etc/ld.so.conf << EOF
- # Begin Qt addition
- /opt/qt5/lib
- # End Qt addition
- EOF
- sudo ldconfig
- cat > /etc/profile.d/qt5.sh << "EOF"
- # Begin /etc/profile.d/qt5.sh
- echo "FIX THIS qt5" #with
- #http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html pathappend funtion
- # stored in some startup folder. Not native to linux, lfs custom function.
- exit 1
- QT5DIR=/opt/qt5
- pathappend $QT5DIR/bin PATH
- pathappend $QT5DIR/lib/pkgconfig PKG_CONFIG_PATH
- export QT5DIR
- # End /etc/profile.d/qt5.sh
- EOF
- }
- function build_nasm
- {
- cd "$mydir"
- wget -nc http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2
- if ! [ -d "$mydir/nasm-2.13.01" ]; then
- tar xjvf nasm-2.13.01.tar.bz2
- fi
- cd nasm-2.13.01
- ./configure
- make "$mycores"
- sudo make install
- }
- function build_yasm
- {
- cd "$mydir"
- wget -nc http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
- if ! [ -d "$mydir/yasm-1.3.0" ]; then
- echo "yasm no exist"
- tar xzvf yasm-1.3.0.tar.gz
- fi
- cd yasm-1.3.0
- ./configure
- make "$mycores"
- sudo make install
- }
- function build_lame
- {
- cd "$mydir"
- wget -nc http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
- if ! [ -d "$mydir/lame-3.99" ]; then
- echo "lame direct not exist"
- tar xzvf lame-3.99.tar.gz
- fi
- cd lame-3.99
- ./configure --enable-nasm --disable-shared
- make "$mycores"
- sudo make install
- }
- #trap build_lame EXIT
- #################### FFMPEG ################
- # sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
- # libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
- # libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
- function build_ffmpeg
- {
- # --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] https://github.com/mstorsjo/fdk-aac
- # faad2 and faac are compiled for libfdk-aac?
- # --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
- # --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
- # --enable-libx264 enable H.264 encoding via x264 [no]
- # --enable-libx265 enable HEVC encoding via x265 [no]
- cd "$mydir"
- if ! [ -d "$mydir/ffmpeg" ]; then
- git clone git://source.ffmpeg.org/ffmpeg.git
- cd ffmpeg
- else
- cd ffmpeg
- git pull
- fi
- # https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=53936
- # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- # ./configure --enable-shared --enable-gpl --prefix=/usr/local --enable-nonfree \
- # --enable-libmp3lame --enable-libfaac --enable-libx264 \
- # --enable-version3 --disable-mmx
- ./configure --enable-shared --enable-gpl --enable-nonfree --enable-libfdk-aac \
- --enable-libmp3lame --enable-libx264 --enable-libass \
- --enable-version3
- make "$mycores" && sudo make install
- }
- #trap build_ffmpeg EXIT
- ################################################
- ##################
- ### LIBTIFF ######
- ##################
- function mylibtiff11
- {
- echo "tiff build"
- cd "$mydir" #home/lfs
- if [ -d "$mydir/libtiff" ]; then
- pushd libtiff && pwd
- echo "pulling git libtiff"
- git pull # get latest code updat
- else
- cd "$mydir"
- git clone https://github.com/vadz/libtiff.git
- pushd libtiff
- fi
- ./autogen.sh
- ./configure --prefix=/usr/local --disable-static
- make && sudo make install
- pwd
- }
- #trap mylibtiff11 EXIT
- #################
- ##### libpng ###
- #################
- function mylibpng11
- {
- echo "png build"
- cd "$mydir" #home/lfs
- if [ -d "$mydir/libpng" ]; then
- pushd libpng
- echo "pulling git png"
- git pull # get latest code updat
- else
- git clone https://github.com/glennrp/libpng.git
- pushd libpng
- fi
- #./autogen.sh
- ./configure --prefix=/usr/local --disable-static
- make && sudo make install
- }
- #trap mylibpng11 EXIT #http://redsymbol.net/articles/bash-exit-traps/
- ############################
- ############ libjpeg ######
- ############################
- function mylibjpeg11
- {
- echo "jpeg build"
- cd "$mydir"
- # http://www.linuxfromscratch.org/blfs/view/cvs/general/libjpeg.html
- wget -nc https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-1.5.2.tar.gz
- if ! [ -d "$mydir/libjpeg-turbo-1.5.2" ]; then
- tar zxvf libjpeg-turbo-1.5.2.tar.gz
- fi
- pushd libjpeg-turbo-1.5.2
- #sudo rm -rf /usr/lib/libjpeg.so*
- # opencv need jpeg8
- ./configure --prefix=/usr \
- --mandir=/usr/share/man \
- --with-jpeg8 \
- --disable-static \
- --docdir=/usr/share/doc/libjpeg-turbo-1.5.2
- make
- sudo make install
- }
- #trap mylibjpeg11 EXIT
- ###########################################
- ############## JASPER #####################
- function myjasper1
- {
- echo "jasper build"
- cd "$mydir" #home/lfs
- if [ -d "$mydir/jasper" ]; then
- cd "$mydir/jasper"
- echo "pulling git jasper"
- git pull # get latest code updat
- else
- git clone https://github.com/mdadams/jasper.git
- fi
- SOURCE_DIR="$mydir/jasper"
- BUILD_DIR="$mydir/jasper/build1"
- INSTALL_DIR="/usr/local"
- rm -rf "$BUILD_DIR"
- mkdir -p "$BUILD_DIR"
- pushd "$BUILD_DIR"
- cmake -G "Unix Makefiles" -H"$SOURCE_DIR" -B"$BUILD_DIR" \
- -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"
- make clean install
- make test
- sudo make install
- popd
- rm -rf "$BUILD_DIR"
- }
- #trap myjasper1 EXIT
- ##########################################
- ######################## FFMPEG DEPENDENCIES #########################
- function build_h264
- {
- echo "build h264"
- # h.264 video encoder
- cd "$mydir"
- if ! [ -d "$mydir/x264" ]; then
- git clone git://git.videolan.org/x264
- cd x264
- else
- cd x264
- git pull
- fi
- ./configure --enable-shared
- make
- sudo make install
- }
- #trap build_h264 EXIT
- function build_faac
- {
- echo "build faac"
- # https://github.com/knik0/faad2 mirror of sourceforge , https://github.com/knik0/faac
- # aac encoder
- cd "$mydir"
- # curl -#LO http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
- if ! [ -d "$mydir/faac" ]; then
- git clone https://github.com/knik0/faac.git
- cd faac
- else
- cd faac
- git pull
- fi
- ./configure
- make
- make install
- }
- #trap build_faac EXIT
- function build_faad
- {
- echo "build faad"
- # https://github.com/knik0/faad2
- cd "$mydir"
- if ! [ -d "$mydir/faad2" ]; then
- git clone https://github.com/knik0/faad2.git
- cd faad2
- else
- cd faad2
- git pull
- fi
- ./bootstrap
- ./configure
- make "$mycores"
- sudo make install
- }
- function build_fribidi
- {
- echo "build fribidi"
- cd "$mydir"
- if ! [ -d "$mydir/fribidi" ]; then
- git clone https://github.com/behdad/fribidi.git
- cd fribidi
- else
- cd fribidi
- git pull
- fi
- ./bootstrap
- ./configure
- make && sudo make install
- }
- #trap build_fribidi EXIT
- function build_libass
- {
- cd "$mydir"
- if ! [ -d "$mydir/libass" ]; then
- git clone https://github.com/libass/libass.git
- cd libass
- else
- cd libass
- git pull
- fi
- ./configure
- make && sudo make install
- }
- #trap build_libass EXIT
- function build_fdkaac
- {
- cd "$mydir"
- if ! [ -d "$mydir/fdk-aac" ]; then
- git clone https://github.com/mstorsjo/fdk-aac.git
- cd fdk-aac
- else
- cd fdk-aac
- git pull
- fi
- ./autogen.sh
- ./configure
- make "$mycores" && sudo make install
- }
- #trap build_libass EXIT
- function build_libva
- {
- #https://01.org/linuxmedia
- cd "$mydir"
- if ! [ -d "$mydir/libva" ]; then
- git clone https://github.com/01org/libva.git
- cd libva
- else
- cd libva
- git pull
- fi
- ./autogen.sh
- :q ./configure
- make "$mycores" && sudo make install
- }
- function build_LIBAV
- {
- # https://github.com/libav/libav , https://www.libav.org/
- # ubuntu packages libavcodec-dev libavformat-dev
- # libswscale-dev part of ffmpeg install.
- cd "$mydir"
- if ! [ -d "$mydir/libav" ]; then
- git clone https://github.com/libav/libav.git
- cd libav
- else
- cd libav
- git pull
- fi
- ./configure
- make "$mycores" && sudo make install
- }
- function build_libsdl2
- {
- # https://github.com/soulik/libsdl2 , http://www.libsdl.org/
- cd "$mydir"
- wget -nc http://www.libsdl.org/release/SDL2-2.0.6.tar.gz
- if ! [ -d "$mydir/SDL2-2.0.6" ]; then
- tar zxvf SDL2-2.0.6.tar.gz
- fi
- cd SDL2-2.0.6
- ./autogen.sh
- ./configure
- make "$mycores"
- sudo make install
- }
- function xvid
- {
- # libxvidcore-dev libxvidcore4
- # http://www.linuxfromscratch.org/blfs/view/svn/multimedia/xvid.html
- # https://github.com/soulik/libsdl2 , http://www.libsdl.org/
- cd "$mydir"
- wget -nc http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
- if ! [ -d "$mydir/xvidcore" ]; then
- tar zxvf xvidcore-1.3.4.tar.gz
- fi
- cd xvidcore; cd build; cd generic
- ./bootstrap.sh
- ./configure && make "$mycores" && sudo make install
- }
- function dymmyfunction
- {
- echo "bug workaround"
- }
- function build_texinfo6
- {
- cd "$mydir"
- wget -nc ftp://ftp.gnu.org/gnu/texinfo/texinfo-6.5.tar.gz
- if -! [ -d "$mydir/texinfo-6.5" ]; then
- tar zxvf texinfo-6.5.tar.gz
- fi
- cd texinfo-6.5
- ./configure
- make "$mycores" && sudo make install
- }
- add2path() {
- #opt/qt5
- if ! echo "$PATH" | PATH=$(getconf PATH) grep -Eq '(^|:)'"${1:?missing argument}"'(:|\$)' ; then # Use the POSIX grep implementation
- if [ -d "$1" ]; then # Don't add a non existing directory to the PATH
- if [ "$2" = front ]; then # Use a standard shell test
- PATH="$1:$PATH"
- else
- PATH="$PATH:$1"
- fi
- echo PATH
- #export PATH
- fi
- fi
- }
- addthepath() {
- #echo "into addpath"
- if ! echo $PATH | egrep "(^|:)$1(:|\$)" > /dev/null ; then
- #if ! echo $PATH | egrep "(^|:)$1(:|\$)" ; then
- if [[ $2 = "front" ]]; then
- #echo "yy"
- PATH="$1:$PATH"
- else
- #echo "lll"
- PATH="$PATH:$1"
- # echo $thepath
- fi
- echo PATH
- export PATH
- else
- echo "direct already in path"
- fi
- }
- testme() {
- # echo $PATH | egrep "(^|:)$1(:|\$)"
- echo $PATH | egrep "$1"
- }
- buildlibevent() {
- # http://libevent.org/
- cd $mydir
- if ! [ -d "$mydir/libevent" ]; then
- git clone https://github.com/libevent/libevent.git
- pushd libevent
- else
- pushd libevent
- git pull
- fi
- ./autogen.sh && ./configure && make "$mycores" && make install
- }
- buildtmux() {
- # buildlibevent is a dependency.
- cd $mydir
- if ! [ -d "$mydir/tmux" ]; then
- git clone https://github.com/tmux/tmux.git
- pushd tmux
- else
- pushd tmux
- git pull
- fi
- ./autogen.sh && ./configure && make "$mycores" && make install
- }
- # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- echo "Run script as sudo bash opencv3.sh "
- mkdir -p "$mydir" >/dev/null 2>&1
- #aptDependiesUbuntu #freetype , cannot get installed from source.
- #buildlibevent; buildtmux
- #add2path opt/qt5 back
- #addthepath /opt/qt5/bin back
- #testme bin
- ### uncomment all below for ffmpeg install.
- #build_texinfo6
- #build_yasm
- #build_nasm
- #build_lame
- #build_fribidi
- #build_libass # --enable-libass option manually set in ffmpeg, subtitle rendering
- #build_fdkaac #fraunhover aac , android --enable-libfdk-aac , set manually in ffmpeg
- #build_faad
- #build_libva
- #build_libsdl2 #--enable option to select??
- #myjasper1
- #mylibjpeg11
- #build_faac
- #build_h264 #asm enabled , else mpeg4 conversion slow
- #mylibpng11
- #mylibtiff11
- #xvid # source install for package libxvidcore-dev
- #build_LIBAV
- #build_ffmpeg #19 packages so far.
- #qt5build
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement