View Single Post
Old 11th June 2018, 19:16   #3  |  Link
l33tmeatwad
Registered User
 
l33tmeatwad's Avatar
 
Join Date: Jun 2007
Posts: 414
Setting Up Tools

Note: It is recommended that you either use macOS 10.15 or use the '-mmacosx-version-min=10.15' in "export CPPFLAGS=' for better distribution compatibility. VapourSynth and other tools will not work on 10.14 or older.

Download Command Line Tools for Xcode 12.4 and install it.

The installer is built using the software Packages.

IMPORTANT: Some files may not download correctly with curl and will need to be downloaded manually through your web browser.

Create a working directory:
Code:
cd $HOME
mkdir .installs
cd .installs

Setup Autoconf
Code:
cd $HOME/.installs
curl https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz -o autoconf-2.71.tar.gz
tar -xzf autoconf-71.tar.gz
cd autoconf-2.71
./configure
make
sudo make install

Setup Automake
Code:
cd $HOME/.installs
curl https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.gz -o automake-1.16.5.tar.gz
tar -xzf automake-1.16.5.tar.gz
cd automake-1.16.5
./configure
make
sudo make install

Setup Libtool
Code:
cd $HOME/.installs
curl https://ftp.wayne.edu/gnu/libtool/libtool-2.4.7.tar.gz -o libtool-2.4.7.tar.gz
tar -xzf libtool-2.4.7.tar.gz
cd libtool-2.4.7
./configure
make
sudo make install

Setup pkg-config
Code:
cd $HOME/.installs
curl https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz -o pkg-config-0.29.2.tar.gz
tar -xzf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --with-internal-glib
make
sudo make install

Setup CMake
Code:
cd $HOME/.installs
git clone https://gitlab.kitware.com/cmake/cmake.git
cd cmake
git checkout v3.27.9
./configure
make
sudo make install

Setup ragel
Code:
cd $HOME/.installs
curl -L http://www.colm.net/files/ragel/ragel-6.10.tar.gz -o ragel-6.10.tar.gz
tar -xzf ragel-6.10.tar.gz
cd ragel-6.10
./configure
make
sudo make install

Setup NASM
Code:
cd $HOME/.installs
git clone https://github.com/netwide-assembler/nasm
cd nasm
git checkout nasm-2.16.01
./autogen.sh
./configure
make
sudo make install

Setup YASM
Code:
cd $HOME/.installs
curl http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz -o yasm-1.3.0.tar.gz
tar -xzf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
sudo make install
Setting Up VapourSynth.framework

Setup OpenSSL
Code:
cd $HOME/.installs
git clone git://git.openssl.org/openssl.git
cd openssl
git checkout openssl-3.2.0
./config --prefix=/Library/Frameworks/VapourSynth.framework -no-shared
make
sudo make install

Setup XZ Utils
Code:
cd $HOME/.installs
curl -L https://tukaani.org/xz/xz-5.4.5.tar.gz -o xz-5.4.5.tar.gz
tar -xzf xz-5.4.5.tar.gz
cd xz-5.4.5
./configure --prefix=/Library/Frameworks/VapourSynth.framework -disable-shared
make
sudo make install

Setup zlib
Code:
cd $HOME/.installs
git clone https://github.com/madler/zlib
cd zlib
git checkout v1.3
./configure --prefix=/Library/Frameworks/VapourSynth.framework --static
make
sudo make install

Setting up Python
Code:
cd $HOME/.installs
curl https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tgz -o Python-3.11.6.tgz
tar xvfj Python-3.11.6.tgz
cd Python-3.11.6
export LDFLAGS='-L/Library/Frameworks/VapourSynth.framework/lib'
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
export PKG_CONFIG_PATH=/Library/Frameworks/VapourSynth.framework/lib/pkgconfig
./configure --prefix=/Library/Frameworks/VapourSynth.framework  --enable-shared
make
sudo make install

Make Python Links
Code:
sudo ln -s /Library/Frameworks/VapourSynth.framework/bin/pip3.11 /usr/local/bin/vspip3
sudo ln -s /Library/Frameworks/VapourSynth.framework/bin/python3.11 /usr/local/bin/vspython

Setup Cython
Code:
sudo vspip3 install cython
sudo ln -s /Library/Frameworks/VapourSynth.framework/bin/cython /usr/local/bin/cython

Setup NumPy
Code:
sudo vspip3 install numpy

Setup LibJPEG Turbo
Code:
cd $HOME/.installs
git clone https://github.com/libjpeg-turbo/libjpeg-turbo
cd libjpeg-turbo
git checkout 2.1.3
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/Library/Frameworks/VapourSynth.framework/ -DENABLE_STATIC=ON -DENABLE_SHARED=OFF .
make
sudo make install

Setup libpng
Code:
cd $HOME/.installs
curl -L https://download.sourceforge.net/libpng/libpng-1.6.40.tar.gz -o libpng-1.6.40.tar.gz
tar xvzf libpng-1.6.40.tar.gz
cd libpng-1.6.40
./configure --prefix=/Library/Frameworks/VapourSynth.framework --enable-shared=no
make
sudo make install

Setup libtiff
Code:
cd $HOME/.installs
git clone https://gitlab.com/libtiff/libtiff
cd libtiff
git checkout v4.6.0
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/Library/Frameworks/VapourSynth.framework/ -DBUILD_SHARED_LIBS=OFF -Dzstd=OFF -Dlzma=OFF .
make
sudo make install

Setup ImageMagick
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
git clone https://github.com/ImageMagick/ImageMagick
cd ImageMagick
git checkout 7.1.1-21
./configure --prefix=/Library/Frameworks/VapourSynth.framework --without-xml --disable-shared --enable-delegate-build
make
sudo make install

Setup FreeType
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
curl -L http://download.savannah.gnu.org/releases/freetype/freetype-2.13.2.tar.gz -o freetype-2.13.2.tar.gz
tar xvzf freetype-2.13.2.tar.gz
cd freetype-2.13.2
./configure --prefix=/Library/Frameworks/VapourSynth.framework  --disable-shared
make
sudo make install

Setup Harfbuzz
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
git clone https://github.com/harfbuzz/harfbuzz
cd harfbuzz
git checkout 8.3.0
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework --disable-shared
make
sudo make install

Setup FriBidi
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
git clone https://github.com/fribidi/fribidi
cd fribidi
git checkout v1.0.13
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework --disable-shared
make
sudo make install

Setup LIBASS
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include/freetype2 -I/Library/Frameworks/VapourSynth.framework/include/harfbuzz'
git clone https://github.com/libass/libass
cd libass
git checkout 0.17.1
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework --disable-shared
make
sudo make install

Setup Leptonica
Code:
cd $HOME/.installs
git clone https://github.com/danbloomberg/leptonica
cd leptonica
git checkout 1.83.0
export LDFLAGS='-L/Library/Frameworks/VapourSynth.framework/lib' CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework --disable-shared
make
sudo make install

Setup Tesseract
Code:
cd $HOME/.installs
unset CPPFLAGS
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include/leptonica'
export PKG_CONFIG_PATH=/Library/Frameworks/VapourSynth.framework/lib/pkgconfig
git clone https://github.com/tesseract-ocr/tesseract
cd tesseract
git checkout 5.3.3
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework
make
sudo make install

Setup L-SMASH
Code:
cd $HOME/.installs
git clone https://github.com/l-smash/l-smash
cd l-smash
git checkout v2.14.5
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework -disable-shared
make
sudo make install

Setup FFmpeg
Code:
cd $HOME/.installs
git clone https://github.com/ffmpeg/ffmpeg
cd ffmpeg
git checkout n6.1
./configure --prefix=/Library/Frameworks/VapourSynth.framework --enable-gpl --enable-version3 --enable-shared --disable-static --disable-encoders --disable-programs \
 --disable-filters --disable-doc --disable-avdevice --disable-avfilter --disable-network --disable-postproc
make
sudo make install

Setup ZIMG
Code:
cd $HOME/.installs
git clone https://github.com/sekrit-twc/zimg
cd zimg
git checkout release-3.0.3
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework
make
sudo make install

Setup VapourSynth
Code:
cd $HOME/.installs
export PYTHON=/Library/Frameworks/VapourSynth.framework/bin/python3
git clone https://github.com/vapoursynth/vapoursynth
cd vapoursynth
git checkout R58
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.framework
make
sudo make install
sudo mkdir /Library/Frameworks/VapourSynth.framework/lib/vapoursynth
Make VapourSynth Links
Code:
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/libvapoursynth.dylib /usr/local/lib/libvapoursynth.dylib
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/libvapoursynth-script.dylib /usr/local/lib/libvapoursynth-script.dylib
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/libvapoursynth-script.0.dylib /Library/Frameworks/VapourSynth.framework/lib/libvapoursynth-script.0.dylib
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/vapoursynth /usr/local/lib/vapoursynth
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/pkgconfig/vapoursynth.pc /usr/local/lib/pkgconfig/vapoursynth.pc
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/pkgconfig/vapoursynth-script.pc /usr/local/lib/pkgconfig/vapoursynth-script.pc
sudo ln -s /Library/Frameworks/VapourSynth.framework/bin/vspipe /usr/local/bin/vspipe
sudo ln -s /Library/Frameworks/VapourSynth.framework/include/vapoursynth /usr/local/include/vapoursynth
Make Desktop Shortcuts (Optional)
Code:
sudo mkdir $HOME/Desktop/VapourSynth
sudo ln -s /Library/Frameworks/VapourSynth.framework/bin "$HOME/Desktop/VapourSynth/Add Executables"
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib "$HOME/Desktop/VapourSynth/Add Libraries"
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/vapoursynth "$HOME/Desktop/VapourSynth/Add Plugins"
sudo ln -s /Library/Frameworks/VapourSynth.framework/lib/python3.10/site-packages "$HOME/Desktop/VapourSynth/Add Scripts"

Details for Plugins

Most plugins will be compiled similarly to the dependencies above, here's an example using FFMS2:
Code:
git clone https://github.com/FFMS/ffms2
cd ffms2
git checkout 2.23
export LDFLAGS='-L/Library/Frameworks/VapourSynth.framework/lib'
export CPPFLAGS='-I/Library/Frameworks/VapourSynth.framework/include'
export PKG_CONFIG_PATH=/Library/Frameworks/VapourSynth.framework/lib/pkgconfig
./autogen.sh
./configure --prefix=/Library/Frameworks/VapourSynth.Framework
make
sudo make install
Plugins will usually have autogen.sh or just a configure file, however a few others will use cmake or waf. With the current setup the autoloading path for VapourSynth is /Library/Frameworks/VapourSynth.framework/lib/vapoursynth, but most plugins will actually install to the /Library/Frameworks/VapourSynth.framework/lib instead. Often this path path will be hard coded into the plugin ID, so it will need to be altered so the plugin can be moved to the correct path for autoloading. Browse to the path the plugin was installed to and use the following command to check the plugin (ex. ffms2):
Code:
otool -L libffms2.4.dylib
You will then see something similar to this:
Code:
/Library/Frameworks/VapourSynth.framework/libffms2.4.dylib (compatibility version 5.0.0, current version 5.0.0)
/Library/Frameworks/VapourSynth.framework/lib/libavformat.58.dylib (compatibility version 58.0.0, current version 58.12.100)
/Library/Frameworks/VapourSynth.framework/lib/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.18.100)
/Library/Frameworks/VapourSynth.framework/lib/libswscale.5.dylib (compatibility version 5.0.0, current version 5.1.100)
/Library/Frameworks/VapourSynth.framework/lib/libavutil.56.dylib (compatibility version 56.0.0, current version 56.14.100)
/Library/Frameworks/VapourSynth.framework/lib/libavresample.4.dylib (compatibility version 4.0.0, current version 4.0.0)
/Library/Frameworks/VapourSynth.framework/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
If the plugin has the full path on the first line containing it's own filename, use the following command to change it:
Code:
sudo install_name_tool -id "libffms2.4.dylib" libffms2.4.dylib
NOTE: You can also use this opportunity to change the name of the plugin itself by changing the id to what you want it to be.


Additionally, the location of dependencies can be changed to be relative to the location of the actual plugin. For example, ffms2 looks for it's dependency zlib in /Library/Frameworks/VapourSynth.framework/lib, that location can be change to look for it one directory above where libffms2.4.dylib is located (assuming you place libffms2.4.dylib in the VapourSynth autoloading folder) by using a variable called @loader_path. Here is an example of how that would work:
Code:
sudo install_name_tool -change /Library/Frameworks/VapourSynth.framework/lib/libz.1.dylib @loader_path/../libz.1.dylib libffms2.4.dylib
Using otool to check files and install_name_tool to change the id and dependency paths to be relative instead of absolute will allow the modified plugins to work no matter what path vapoursynth is installed to as long as the plugin is located in the autoload directory. This same method can be used on the dependencies as well to allow for distribution of those with the plugins.

Last edited by l33tmeatwad; 1st December 2023 at 18:09. Reason: Updated info.
l33tmeatwad is offline   Reply With Quote