Skip to content

Commit

Permalink
build-vapoursynth and build-plugins adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Georg Pelz committed Aug 15, 2020
1 parent bd2b985 commit d925641
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 222 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Adding Vapoursynth and plugins to Hybrid
4. When it's finished add:
```
export LD_LIBRARY_PATH=/usr/local/lib
export PYTHONPATH=/usr/local/lib/python3.6/site-packages
export PYTHONPATH=~/opt/vapoursynth/lib/python3.6/site-packages
```
to your `~/.profile`- and `~/.bashrc` -file, close the terminal and open a new terminal.
( Note: depending on your Python version you need to adjust _pyhton3.6_ accordingly)
( Note: depending on your Python version you need to adjust _pyhton3.6_ accordingly and if you changed the default paths inside the config.txt youe need to adjust them here too)
5. Calling `vspipe --version` should output something like:
```
VapourSynth Video Processing Library
Expand All @@ -21,6 +21,6 @@ to your `~/.profile`- and `~/.bashrc` -file, close the terminal and open a new t
(`vspipe --version` should now work without having to enter the export calls)
7. make the build-plugins.sh executable `chmod +x build-plugins.sh` and run it (this will take quite a while).
Now Hybrid will be able to use Vapoursynth, but the Vapoursynth Preview will not work.
Now Hybrid will be able to use Vapoursynth.
75 changes: 35 additions & 40 deletions build-plugins.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
#!/bin/bash
# should be a shell that provides $SECONDS
#!/bin/sh
# Caution: this script is for ubuntu 16.04 or newer
set -e
s_begin=$( date "+%s")

JOBS=4
#stamp="dependencies_for_plugins_installed.stamp"
. ./config.txt
export CFLAGS="-pipe -O3 -fno-strict-aliasing -Wno-deprecated-declarations"
export CXXFLAGS="$CFLAGS"

vsprefix="$HOME/opt/vapoursynth"

export PATH="$vsprefix/bin:$PATH"
export LD_LIBRARY_PATH="$vsprefix/lib"
export PKG_CONFIG_PATH="$vsprefix/lib/pkgconfig"

if [ ! -e "$vsprefix/lib/pkgconfig/vapoursynth.pc" -a ! -e "$vsprefix/lib/pkgconfig/libavcodec.pc" ]; then
echo "error: missing a local installation of FFmpeg libraries and Vapoursynth in \`$vsprefix'"
if [ ! -e "$my_pkg_config_path/vapoursynth.pc" -a\
! -e "$my_pkg_config_path/libavcodec.pc" ]; then
echo "error: missing a local installation of FFmpeg libraries and Vapoursynth in \`$VSPREFIX'"
echo "Have you forgotten to run \`build-vapoursynth.sh' before ?"
exit 1
fi

#if [ ! -e $stamp -x "/usr/bin/apt" ]; then
set -x

sudo apt update
sudo apt upgrade
sudo apt install --no-install-recommends \
Expand All @@ -41,71 +37,70 @@ fi
libboost-system-dev \
libbluray-dev \
libpng-dev

# only on Ubuntu 16.04 ...
#sudo apt install --no-install-recommends libcompute-dev || true

# touch $stamp

set +x
# sudo apt install --no-install-recommends libcompute-dev || true
#touch $stamp
#fi


rm -rf build
mkdir -p build/logs
cd build
build_pwd=$PWD

# newer nasm
if [ ! -x "$vsprefix/bin/nasm" ]; then
set -x
if [ ! -x "$VSPREFIX/bin/nasm" ]; then
ver="2.14.02"
wget -c https://www.nasm.us/pub/nasm/releasebuilds/$ver/nasm-${ver}.tar.xz
tar xf nasm-${ver}.tar.xz
cd nasm-$ver
./configure --prefix="$vsprefix"
./configure --prefix="$VSPREFIX"
make -j$JOBS
make install
cd ..
cd $build_pwd
rm -rf nasm-$ver nasm-${ver}.tar.xz
set +x
fi

# newer cmake
if [ ! -x "$vsprefix/bin/cmake" ]; then
set -x
if [ ! -x "$VSPREFIX/bin/cmake" ]; then
ver="3.14.6"
dir="cmake-${ver}-Linux-x86_64"
wget -c https://github.com/Kitware/CMake/releases/download/v$ver/${dir}.tar.gz
tar xf ${dir}.tar.gz
cp -rf $dir/bin $dir/share "$vsprefix"
cp -rf $dir/bin $dir/share "$VSPREFIX"
rm -rf $dir ${dir}.tar.gz
set +x
fi

export PYTHONUSERBASE="$vsprefix"
pip3 install -q --upgrade --user setuptools wheel # must be installed first
pip3 install -q --upgrade --user meson ninja

pip3 install -q -I --upgrade --user setuptools wheel # must be installed first
pip3 install -q -I --upgrade --user meson ninja
echo $PWD
plugins=$(ls -1 ../build-plugins/plugin-*.sh | sed 's|^\.\./build-plugins/plugin-||g; s|\.sh$||g')
#plugins=( "fft3dfilter" )
#plugins=( "mvtoolssf" )
count=$(echo $plugins | wc -w)
n=0

echo ""
echo "Build plugins:"

# To avoid errors of inattention... but the correct VSPREFIX is in uppercase!
export vsprefix="$VSPREFIX"

for p in $plugins ; do
rm -rf build # remove old stuff
cat ../build-plugins/header.sh ../build-plugins/plugin-${p}.sh > build.sh # copy current build script
n=$(($n + 1)) # increace counter
printf " %s (%d/%d) ... " $p $n $count # show progress
sh ./build.sh >logs/${p}.log 2>&1 && echo "done" || echo "failed" # execute build script and send output to log file
bash ./build.sh >logs/${p}.log 2>&1 && echo "done" || echo "failed" # execute build script and send output to log file
rm -rf build build.sh # remove build folder and build script
done

echo ""
unset vsprefix

pip3 uninstall -y -q setuptools wheel meson ninja

s=$SECONDS
printf "\nfinished after %d min %d sec\n" $(($s / 60)) $(($s % 60))
cd $build_pwd/..
rm -rf build

s_end=$( date "+%s")
s=$(($s_end - $s_begin))
printf "\nFinished after %d min %d sec\n" $(($s / 60)) $(($s % 60))


29 changes: 12 additions & 17 deletions build-plugins/header.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/sh
#!/bin/bash
# Caution: this script is for ubuntu 16.04 or newer
# This script does nothing; it's the header of all others build-plugins scripts.
# on the form plugin-*.sh
set -e

JOBS=4
. ../config.txt

export CFLAGS="-pipe -O3 -Wno-attributes -fPIC -fvisibility=hidden -fno-strict-aliasing $(pkg-config --cflags vapoursynth) -I/usr/include/compute"
export CXXFLAGS="$CFLAGS -Wno-reorder"
export LDFLAGS="-L$VSPREFIX/lib"

install_nnedi3_weights ()
{
p="$vsprefix/lib/vapoursynth"
p="$VSPREFIX/lib/vapoursynth"
f="$p/nnedi3_weights.bin"
sum="27f382430435bb7613deb1c52f3c79c300c9869812cfe29079432a9c82251d42"
if [ ! -f $f ] || [ "$(sha256sum -b $f | head -c64)" != "$sum" ]; then
Expand All @@ -26,14 +33,14 @@ strip_copy ()
chmod a-x $1
strip $1
nm -D --extern-only $1 | grep -q 'T VapourSynthPluginInit'
cp -f $1 $vsprefix/lib/vapoursynth
cp -f $1 $VSPREFIX/lib/vapoursynth
}

finish ()
{
strip_copy $1
cd ..
rm -rf build
rm -rf _build
}

build ()
Expand Down Expand Up @@ -94,15 +101,3 @@ mkghc ()
build $2
}

set -x

vsprefix="$HOME/opt/vapoursynth"

export PATH="$vsprefix/bin:$PATH"
export LD_LIBRARY_PATH="$vsprefix/lib"
export PYTHONUSERBASE="$vsprefix"
export PKG_CONFIG_PATH="$vsprefix/lib/pkgconfig"
export CFLAGS="-pipe -O3 -Wno-attributes -fPIC -fvisibility=hidden -fno-strict-aliasing $(pkg-config --cflags vapoursynth) -I/usr/include/compute"
export CXXFLAGS="$CFLAGS -Wno-reorder"
export LDFLAGS="-L$vsprefix/lib"

Loading

0 comments on commit d925641

Please sign in to comment.