File indexing completed on 2024-04-14 04:45:51

0001 #!/bin/bash
0002 # SPDX-FileCopyrightText: 2018 V. Pinon <vpinon@kde.org>
0003 # SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 # Tested in Debian sid x86_64
0005 
0006 # Be verbose, halt on errors
0007 set -xe
0008 
0009 # Prepare the install location
0010 # change this to another location if you prefer
0011 export WLD=/app/usr
0012 SRC_DIR=/external
0013 
0014 mkdir -p $WLD/lib $SRC_DIR
0015 # make sure lib and lib64 are the same thing
0016 [[ -L $WLD/lib64 ]] || ln -s $WLD/lib $WLD/lib64
0017 # qjsonparser, used to add metadata to the plugins needs to work in a en_US.UTF-8 environment.
0018 export LC_ALL=en_US.UTF-8 LANG=en_us.UTF-8
0019 export PATH=$WLD/bin:$PATH
0020 export LD_LIBRARY_PATH=$WLD/lib:/usr/lib64/:/usr/lib
0021 export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/:/usr/lib/pkgconfig
0022 export ACLOCAL_PATH=$WLD/share/aclocal
0023 export ACLOCAL="aclocal -I $ACLOCAL_PATH"
0024 
0025 CPU_CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
0026 if [[ $CPU_CORES -gt 1 ]]; then
0027     CPU_CORES=$((CPU_CORES-1))
0028 fi
0029 ARCH=$(arch)
0030 if [[ "$ARCH" != "i686" && "$ARCH" != "x86_64" ]] ; then
0031     echo "Architecture could not be determined" ; exit 1
0032 fi
0033 
0034 # $1: repo URL, $2: branch
0035 function git_pull {
0036     URL=$1 BRANCH=$2
0037     PKG=${URL##*/}; PKG=${PKG%%.git}
0038     cd $SRC_DIR
0039     if [ -d $PKG ]; then
0040         echo "$PKG already cloned"
0041         cd $PKG
0042         git reset --hard
0043         git checkout $BRANCH
0044         git pull --rebase
0045         cd ..
0046     else
0047         git clone $URL
0048     fi
0049 }
0050 
0051 # $1: archive URL
0052 function wget_extract {
0053     URL=$1
0054     ARCHIVE=${URL##*/}
0055     PKGVERS=${ARCHIVE%%.tar.*} 
0056     cd $SRC_DIR
0057     if [ -d $SRC_DIR/$PKGVERS ]; then
0058         echo "$PKGVERS already downloaded"
0059     else
0060         [ -f $ARCHIVE ] || wget --no-check-certificate $URL
0061         if [[ ${ARCHIVE##*.} == zip ]] ; then
0062             unzip $ARCHIVE
0063         else
0064             tar -xf ${URL##*/}
0065         fi
0066     fi
0067 }
0068 
0069 # $1: package name ; $*: cmake args
0070 function cmake_make {
0071     PKG=$1; shift; CMAKE_ARGS=$*
0072     mkdir -p $SRC_DIR/$PKG/build
0073     cd $SRC_DIR/$PKG/build
0074     cmake -DCMAKE_INSTALL_PREFIX:PATH=$WLD -DCMAKE_BUILD_TYPE=Release $CMAKE_ARGS ..
0075     make -j$CPU_CORES
0076     make install
0077 }
0078 
0079 # $1: package name ; $2: configure args
0080 function configure_make {
0081     PKG=$1; shift; CONFIGURE_ARGS=$*
0082     cd $SRC_DIR/$PKG
0083     ./configure --prefix=$WLD $CONFIGURE_ARGS
0084     make -j$CPU_CORES
0085     make install
0086 }
0087 
0088 # Build tools
0089 wget_extract https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
0090 cmake_make yasm-1.3.0
0091 wget_extract http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.xz
0092 configure_make nasm-2.13.02
0093 
0094 # Media libs
0095 wget_extract ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.5.tar.bz2
0096 configure_make alsa-lib-1.1.5
0097 wget_extract https://libsdl.org/release/SDL2-2.0.8.tar.gz
0098 configure_make SDL2-2.0.8 --with-alsa-prefix=$WLD/lib --with-alsa-inc-prefix=$WLD/include
0099 
0100 # Image libs
0101 wget_extract https://sourceforge.net/projects/libjpeg-turbo/files/1.5.3/libjpeg-turbo-1.5.3.tar.gz
0102 configure_make libjpeg-turbo-1.5.3
0103 wget_extract http://www.ece.uvic.ca/~frodo/jasper/software/jasper-2.0.14.tar.gz
0104 cmake_make jasper-2.0.14
0105 wget_extract http://prdownloads.sourceforge.net/libpng/libpng-1.6.34.tar.xz
0106 configure_make libpng-1.6.34
0107 wget_extract https://codeload.github.com/Exiv2/exiv2/tar.gz/master
0108 cmake_make exiv2-master \
0109     -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PRINTUCS2=OFF -DEXIV2_ENABLE_LENSDATA=OFF -DEXIV2_ENABLE_BUILD_SAMPLES=OFF
0110 # Codec libs
0111 wget_extract http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz
0112 configure_make libsndfile-1.0.28
0113 wget_extract http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz
0114 configure_make libsamplerate-0.1.9
0115 git_pull https://anonscm.debian.org/git/pkg-multimedia/libvpx.git
0116 configure_make libvpx --enable-shared
0117 git_pull https://anonscm.debian.org/git/pkg-multimedia/x264.git
0118 configure_make x264 --enable-shared
0119 wget_extract http://ftp.videolan.org/pub/videolan/x265/x265_2.7.tar.gz
0120 pushd $SRC_DIR/x265_2.7/build/linux
0121 cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$WLD" -DENABLE_SHARED=ON ../../source
0122 make -j$CPU_CORES
0123 make install
0124 popd
0125 git_pull https://anonscm.debian.org/git/pkg-multimedia/ffmpeg.git debian/7%3.4.2-1
0126 configure_make ffmpeg --extra-ldflags="-L$WLD/lib" --extra-cflags="-I$WLD/include" \
0127     --enable-shared --enable-gpl --disable-doc --enable-avfilter --enable-avresample \
0128     --enable-libvpx --enable-libx264 --enable-libx265
0129 
0130 # Graphics libs
0131 wget_extract https://www.cairographics.org/releases/cairo-1.14.12.tar.xz
0132 configure_make cairo-1.14.12
0133 wget_extract https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.7.6.tar.bz2
0134 configure_make harfbuzz-1.7.6
0135 #requires libfribidi-dev
0136 wget_extract https://download.gnome.org/sources/pango/1.42/pango-1.42.0.tar.xz
0137 configure_make pango-1.42.0
0138 wget_extract https://download.gnome.org/sources/gdk-pixbuf/2.32/gdk-pixbuf-2.32.3.tar.xz
0139 configure_make gdk-pixbuf-2.32.3
0140 wget_extract https://download.gnome.org/sources/gtk+/2.24/gtk+-2.24.32.tar.xz
0141 configure_make gtk+-2.24.32
0142 wget_extract https://download.qt.io/official_releases/qt/5.13/5.13.1/single/qt-everywhere-src-5.13.1.tar.xz
0143 pushd $SRC_DIR/qt-everywhere-src-5.13.1
0144 ./configure -prefix $WLD -opensource -confirm-license -release -shared \
0145     -nomake examples -nomake tests -no-pch \
0146     -qt-zlib -qt-pcre -qt-harfbuzz -openssl \
0147     -qt-xcb -qt-xkbcommon-x11
0148 make -j$CPU_CORES
0149 make install
0150 popd
0151 
0152 # libxcb-keysyms1-dev
0153 # KDE Frameworks
0154 KF5_VERSION=5.62.0
0155 for FRAMEWORK in \
0156         extra-cmake-modules breeze-icons karchive kconfig kcoreaddons kdbusaddons kguiaddons \
0157         ki18n kitemviews kwidgetsaddons kcompletion kwindowsystem \
0158         kcrash kjobwidgets kauth kcodecs kconfigwidgets kiconthemes \
0159         solid sonnet attica kservice kglobalaccel ktextwidgets \
0160         kxmlgui kbookmarks knotifications kio knewstuff knotifyconfig \
0161         kpackage kdeclarative ; do
0162     #git_pull git://anongit.kde.org/$FRAMEWORK v$KF5_VERSION
0163     wget_extract https://download.kde.org/stable/frameworks/${KF5_VERSION%.*}/$FRAMEWORK-$KF5_VERSION.tar.xz
0164     if [ "$FRAMEWORK" = "breeze-icons" ]; then
0165         cmake_make $FRAMEWORK-$KF5_VERSION -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DBUILD_TESTING:BOOL=OFF -DBINARY_ICONS_RESOURCE=1
0166     else
0167         cmake_make $FRAMEWORK-$KF5_VERSION -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DBUILD_TESTING:BOOL=OFF
0168     fi
0169 done
0170 wget_extract https://download.kde.org/stable/plasma/5.12.4/kdecoration-5.12.4.tar.xz
0171 cmake_make kdecoration-5.12.4 -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DBUILD_TESTING:BOOL=OFF
0172 wget_extract https://download.kde.org/stable/plasma/5.12.4/breeze-5.12.4.tar.xz
0173 cmake_make breeze-5.12.4 -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DBUILD_TESTING:BOOL=OFF
0174 
0175 wget_extract https://codeload.github.com/opencv/opencv/tar.gz/3.4.1
0176 wget_extract https://github.com/opencv/opencv_contrib/archive/3.4.1.tar.gz
0177 cmake_make opencv-3.4.1 -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.1/modules \
0178     -DJASPER_INCLUDE_DIR=$WLD/include \
0179     -DBUILD_opencv_plot=ON \
0180     -DBUILD_opencv_aruco=OFF -DBUILD_opencv_bgsegm=OFF -DBUILD_opencv_bioinspired=OFF \
0181     -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_cnn_3dobj=OFF -DBUILD_opencv_cvv=OFF \
0182     -DBUILD_opencv_dnn=OFF -DBUILD_opencv_dnns_easily_fooled=OFF -DBUILD_opencv_dpm=OFF \
0183     -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_hdf=OFF -DBUILD_opencv_line_descriptor=OFF \
0184     -DBUILD_opencv_matlab=OFF -DBUILD_opencv_optflow=OFF \
0185     -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF -DBUILD_opencv_saliency=OFF \
0186     -DBUILD_opencv_sfm=OFF -DBUILD_opencv_stereo=OFF -DBUILD_opencv_structured_light=OFF \
0187     -DBUILD_opencv_surface_matching=OFF -DBUILD_opencv_xfeatures2d=OFF \
0188     -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=OFF -DBUILD_opencv_calib3d=OFF \
0189     -DBUILD_opencv_cudaarithm=OFF -DBUILD_opencv_cudabgsegm=OFF \
0190     -DBUILD_opencv_cudacodec=OFF -DBUILD_opencv_cudafilters=OFF \
0191     -DBUILD_opencv_cudalegacy=OFF -DBUILD_opencv_cudaobjdetect=OFF \
0192     -DBUILD_opencv_cudaoptflow=OFF -DBUILD_opencv_cudastereo=OFF \
0193     -DBUILD_opencv_cudawarping=OFF -DBUILD_opencv_cudev=OFF \
0194     -DBUILD_opencv_java=OFF -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF \
0195     -DBUILD_opencv_superres=OFF -DBUILD_opencv_ts=OFF -DBUILD_opencv_videoio=OFF \
0196     -DBUILD_opencv_videostab=OFF -DBUILD_opencv_viz=OFF
0197 #git_pull https://github.com/georgmartius/vid.stab
0198 wget_extract https://codeload.github.com/georgmartius/vid.stab/tar.gz/v1.1.0
0199 cmake_make vid.stab-1.1.0
0200 wget_extract https://files.dyne.org/frei0r/releases/frei0r-plugins-1.6.1.tar.gz
0201 cmake_make frei0r-plugins-1.6.1 -DWITHOUT_OPENCV:BOOL=ON
0202 # git_pull https://git.sesse.net/movit
0203 # pushd $SRC_DIR/movit
0204 # ./autogen.sh
0205 # popd
0206 # configure_make movit
0207 
0208 git_pull https://github.com/mltframework/mlt.git
0209 configure_make mlt --enable-gpl --disable-rtaudio
0210 #po->ruby
0211 git_pull git://anongit.kde.org/kdenlive
0212 cmake_make kdenlive -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON -DPACKAGERS_BUILD=1 -DBUILD_TESTING=FALSE
0213 #-DKDE_L10N_AUTO_TRANSLATIONS:BOOL=ON \