Last active
September 14, 2020 10:04
-
-
Save d3cod3/2a6e9f1f21045d763571cc4172cf2d6c to your computer and use it in GitHub Desktop.
Fedora automatic Mosaic install script (https://github.com/d3cod3/Mosaic)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################### | |
# ---------------------------------------------------------- | |
# Mosaic | OF Visual Patching Developer Platform | |
# | |
# Copyright (c) 2019 Emanuele Mazza aka n3m3da | |
# | |
# Mosaic is distributed under the MIT License. This gives everyone the | |
# freedoms to use Mosaic in any context: commercial or non-commercial, | |
# public or private, open or closed source. | |
# | |
# See https://github.com/d3cod3/Mosaic for documentation | |
# ---------------------------------------------------------- | |
# | |
# | |
# Mosaic auto compile/install script for fedora boxes | |
# Thanks somas95 <https://github.com/somas95> for the help. | |
# | |
############################################################################### | |
# exit when any command fails | |
set -e | |
# keep track of the last executed command | |
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG | |
# echo an error message before exiting | |
trap 'echo "\"${last_command}\" command failed with exit code $?."' EXIT | |
# 0 - Check if running with sudo | |
if [ $EUID != 0 ]; then | |
echo "this script must be run using sudo" | |
echo "" | |
echo "usage:" | |
echo "sudo "$0 | |
exit $exit_code | |
exit 1 | |
fi | |
# 0/2 - init some vars | |
dnf update | |
dnf install nano make git curl ffmpeg wget python2-libs python2-devel python3-libs python3-devel | |
#HAVEFFMPEG="$( which ffmpeg )" | |
#if [ -z "$HAVEFFMPEG" ]; then | |
# apt install ffmpeg | |
#fi | |
MOSAICDESKTOPFILE=Mosaic.desktop | |
MOSAICVERSION="$( curl https://raw.githubusercontent.com/d3cod3/Mosaic/master/bin/data/release.txt )" | |
LOCALUSERNAME="$( who | awk '{print $1}' )" | |
USERHOME=/home/$LOCALUSERNAME | |
INSTALLFOLDER=/opt | |
OFFOLDERNAME=openFrameworks | |
OFRELURL=https://openframeworks.cc/versions/v0.11.0/of_v0.11.0_linux64gcc6_release.tar.gz | |
OFRELFILENAME=of_v0.11.0_linux64gcc6_release.tar.gz | |
OFRELORIGINALNAME=of_v0.11.0_linux64gcc6_release | |
NPROC="$( nproc )" | |
if [ $NPROC -gt "1" ]; then | |
NUMPU="$( expr $NPROC / 2 )" | |
else | |
NUMPU="1" | |
fi | |
# 1 - Install openFrameworks | |
cd $INSTALLFOLDER | |
if [ ! -d $OFFOLDERNAME ]; then | |
# download OF | |
wget $OFRELURL | |
tar -xvzf $OFRELFILENAME | |
mv $OFRELORIGINALNAME/ $OFFOLDERNAME/ | |
rm -f $OFRELFILENAME | |
# install OF dependencies | |
cd $INSTALLFOLDER/$OFFOLDERNAME/scripts/linux/fedora | |
./install_dependencies.sh -y | |
./install_codecs.sh | |
# small compile fixes, still needed? | |
cd $INSTALLFOLDER/$OFFOLDERNAME/libs/openFrameworks/utils | |
sed -e '/GL\/glext.h/ s/^#*/\/\//' -i ofConstants.h | |
# compile OF | |
cd $INSTALLFOLDER/$OFFOLDERNAME/scripts/linux | |
./compileOF.sh -j$NUMPU | |
fi | |
if [ ! -e /usr/lib64/pkgconfig/python.pc ]; then | |
ln -s /usr/lib64/pkgconfig/python-2.7.pc /usr/lib64/pkgconfig/python.pc | |
fi | |
# 2 - Install ofxaddons dependencies | |
cd $INSTALLFOLDER/$OFFOLDERNAME/addons | |
if [ -d ofxAudioAnalyzer ]; then | |
cd ofxAudioAnalyzer && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxAudioAnalyzer | |
fi | |
if [ -d ofxAudioFile ]; then | |
cd ofxAudioFile && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/npisanti/ofxAudioFile | |
fi | |
if [ -d ofxBTrack ]; then | |
cd ofxBTrack && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxBTrack | |
fi | |
if [ -d ofxChromaKeyShader ]; then | |
cd ofxChromaKeyShader && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxChromaKeyShader | |
fi | |
if [ -d ofxCv ]; then | |
cd ofxCv && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/kylemcdonald/ofxCv | |
fi | |
if [ -d ofxEasing ]; then | |
cd ofxEasing && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/arturoc/ofxEasing | |
fi | |
if [ -d ofxFFmpegRecorder ]; then | |
cd ofxFFmpegRecorder && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxFFmpegRecorder | |
fi | |
if [ -d ofxFontStash ]; then | |
cd ofxFontStash && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxFontStash | |
fi | |
if [ -d ofxGLEditor ]; then | |
cd ofxGLEditor && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxGLEditor | |
fi | |
if [ -d ofxJSON ]; then | |
cd ofxJSON && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/jeffcrouse/ofxJSON | |
fi | |
if [ -d ofxImGui ]; then | |
cd ofxImGui && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxImGui | |
fi | |
if [ -d ofxInfiniteCanvas ]; then | |
cd ofxInfiniteCanvas && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxInfiniteCanvas | |
fi | |
if [ -d ofxLua ]; then | |
cd ofxLua && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=of-0.10.0 https://github.com/d3cod3/ofxLua | |
fi | |
if [ -d ofxMidi ]; then | |
cd ofxMidi && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxMidi | |
fi | |
if [ -d ofxMtlMapping2D ]; then | |
cd ofxMtlMapping2D && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxMtlMapping2D | |
fi | |
if [ -d ofxNDI ]; then | |
cd ofxNDI && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxNDI | |
fi | |
if [ -d ofxPd ]; then | |
cd ofxPd && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/danomatika/ofxPd | |
fi | |
if [ -d ofxPdExternals ]; then | |
cd ofxPdExternals && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxPdExternals | |
fi | |
if [ -d ofxPDSP ]; then | |
cd ofxPDSP && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/npisanti/ofxPDSP | |
fi | |
if [ -d ofxPython ]; then | |
cd ofxPython && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=OF0.9.8 https://github.com/d3cod3/ofxPython | |
fi | |
if [ -d ofxTimeline ]; then | |
cd ofxTimeline && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxTimeline | |
fi | |
if [ -d ofxVisualProgramming ]; then | |
cd ofxVisualProgramming && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxVisualProgramming | |
fi | |
if [ -d ofxWarp ]; then | |
cd ofxWarp && git checkout -- . && git pull && cd .. | |
else | |
git clone --branch=master https://github.com/d3cod3/ofxWarp | |
fi | |
# 3 - Compile fftw3.3.2 library from source and install | |
if [ ! -e $INSTALLFOLDER/$OFFOLDERNAME/addons/ofxAudioAnalyzer/libs/fftw3f/lib/linux64/libfftw3f.a ]; then | |
cd $INSTALLFOLDER | |
git clone --branch=master https://github.com/d3cod3/fftw3.3.2-source | |
cd fftw3.3.2-source | |
./configure --prefix=`pwd` --enable-float --enable-sse2 --with-incoming-stack-boundary=2 --with-our-malloc16 --disable-shared --enable-static | |
make -j$NUMPU | |
cd .libs | |
mkdir $INSTALLFOLDER/$OFFOLDERNAME/addons/ofxAudioAnalyzer/libs/fftw3f/lib/linux64 | |
cp libfftw3f.a $INSTALLFOLDER/$OFFOLDERNAME/addons/ofxAudioAnalyzer/libs/fftw3f/lib/linux64/ | |
cd $INSTALLFOLDER | |
rm -rf fftw3.3.2-source/ | |
fi | |
# 4 - Fix Poco issues | |
echo "fixing poco libs" | |
cd $INSTALLFOLDER | |
if [ "$(ls -A $OFFOLDERNAME/addons/ofxPoco/libs/poco/lib/linux64/)" ]; then | |
rm $OFFOLDERNAME/addons/ofxPoco/libs/poco/lib/linux64/* | |
fi | |
rm -rf $OFFOLDERNAME/addons/ofxPoco/libs/poco/include/Poco | |
cp -R /usr/include/Poco/ $OFFOLDERNAME/addons/ofxPoco/libs/poco/include/ | |
# 4.1 - Copy libndi | |
if [ ! -e /usr/lib/libndi.so.3.7.1 ]; then | |
echo "copying libndi to /usr/lib" | |
cd $INSTALLFOLDER | |
cp $OFFOLDERNAME/addons/ofxNDI/libs/libndi/lib/x86_64-linux-gnu/libndi.so.3.7.1 /usr/lib | |
ln -s /usr/lib/libndi.so.3.7.1 /usr/lib/libndi.so.3 | |
fi | |
# 5 - Compile/Install Mosaic | |
cd $INSTALLFOLDER | |
cd $OFFOLDERNAME/apps | |
if [ -d d3cod3 ]; then | |
cd d3cod3 | |
rm -rf Mosaic | |
git clone --recursive --branch=master https://github.com/d3cod3/Mosaic | |
cd Mosaic | |
make -j$NUMPU Release | |
else | |
mkdir d3cod3 | |
cd d3cod3 | |
git clone --recursive --branch=master https://github.com/d3cod3/Mosaic | |
cd Mosaic | |
make -j$NUMPU Release | |
fi | |
# 6 - Create a Mosaic.desktop file for desktop launchers | |
if [ ! -e /usr/share/applications/$MOSAICDESKTOPFILE ]; then | |
cd $INSTALLFOLDER/$OFFOLDERNAME/apps/d3cod3/Mosaic/bin | |
echo "[Desktop Entry]" > $MOSAICDESKTOPFILE | |
echo "Encoding=UTF-8" >> $MOSAICDESKTOPFILE | |
echo "Version="$MOSAICVERSION >> $MOSAICDESKTOPFILE | |
echo "Name=Mosaic" >> $MOSAICDESKTOPFILE | |
echo "Type=Application" >> $MOSAICDESKTOPFILE | |
echo "Terminal=false" >> $MOSAICDESKTOPFILE | |
echo "Exec=$INSTALLFOLDER/$OFFOLDERNAME/apps/d3cod3/Mosaic/bin/Mosaic" >> $MOSAICDESKTOPFILE | |
echo "Icon=$INSTALLFOLDER/$OFFOLDERNAME/apps/d3cod3/Mosaic/bin/data/images/logo_128.png" >> $MOSAICDESKTOPFILE | |
echo "Categories=AudioVideo;Audio;Development" >> $MOSAICDESKTOPFILE | |
echo "Comment=Live Visual Patching Creative-Coding Platform" >> $MOSAICDESKTOPFILE | |
cp $MOSAICDESKTOPFILE /usr/share/applications | |
fi | |
# 7 - Change the ownership of the entire openFrameworks folder to local user | |
cd $INSTALLFOLDER | |
chown $LOCALUSERNAME:$LOCALUSERNAME -R $OFFOLDERNAME/ | |
# 8 - Create Mosaic Example folder in ~/Documents | |
mkdir -p $USERHOME/Documents/Mosaic | |
cp -R $INSTALLFOLDER/$OFFOLDERNAME/apps/d3cod3/Mosaic/bin/examples $USERHOME/Documents/Mosaic | |
# 9 - Mosaic installed message | |
echo "Mosaic $MOSAICVERSION installed and ready to use." | |
echo "You will find it in your applications menu." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment