Last active
September 26, 2020 09:01
-
-
Save d3cod3/d1a544e0cf21b8733b567a3d87905d23 to your computer and use it in GitHub Desktop.
Linux Mint automatic install for Mosaic (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 linux mint boxes | |
# | |
############################################################################### | |
# 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 [ $(id -u) != 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 | |
apt update | |
apt install git curl ffmpeg wget libpython2.7-dev libpython3.8-dev libsnappy-dev libswresample-dev libavcodec-dev libavformat-dev libdispatch-dev | |
#HAVEFFMPEG="$( which ffmpeg )" | |
#if [ -z "$HAVEFFMPEG" ]; then | |
# apt install ffmpeg | |
#fi | |
USERHOME="$( echo ~ )" | |
MOSAICDESKTOPFILE=Mosaic.desktop | |
MOSAICVERSION="$( curl https://raw.githubusercontent.com/d3cod3/Mosaic/master/bin/data/release.txt )" | |
LOCALUSERNAME="$( who | awk '{print $1}' )" | |
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 )" | |
NUMPU="1" | |
if [ $NPROC -gt "1" ]; then | |
NUMPU="$( expr $NPROC / 2 )" | |
else | |
NUMPU="1" | |
fi | |
# Ubuntu derivatives supported: ElementaryOS | |
# Loads: NAME, VERSION, ID, ID_LIKE, PRETTY_NAME, | |
# VERSION_ID, HOME_URL, SUPPORT_URL, BUG_REPORT_URL, VERSION_CODENAME, UBUNTU_CODENAME | |
source /etc/os-release | |
if [ "$ID" = "elementary" ]; then | |
# Gets ubuntu base version | |
RELEASE=$(lsb_release -r -u) | |
elif [ "$ID" = "linuxmint" ]; then | |
# Gets ubuntu base version | |
RELEASE=$(cat /etc/upstream-release/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2) | |
else | |
RELEASE=$(lsb_release -r) | |
fi | |
MAJOR_VERSION=$(echo $RELEASE | cut -f2 -d: | cut -f1 -d. | sed "s/\t//g" | cut -c2-3) | |
MINOR_VERSION=$(echo $RELEASE | cut -f2 -d: | cut -f2 -d.) | |
echo "Running on linux mint ${MAJOR_VERSION}.${MINOR_VERSION}" | |
# 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/ubuntu | |
./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/lib/x86_64-linux-gnu/pkgconfig/python.pc ]; then | |
ln -s /usr/lib/x86_64-linux-gnu/pkgconfig/python-2.7.pc /usr/lib/x86_64-linux-gnu/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 | |
cd $INSTALLFOLDER | |
echo "fixing poco libs" | |
if [ "$(ls -A $OFFOLDERNAME/addons/ofxPoco/libs/)" ]; then | |
rm -rf $OFFOLDERNAME/addons/ofxPoco/libs/ | |
fi | |
cp -R $OFFOLDERNAME/scripts/apothecary/poco/include/Poco /usr/include/ | |
cp $OFFOLDERNAME/scripts/apothecary/poco/lib/linux64/* /usr/lib | |
# 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 |
fr4b3lo
commented
Dec 12, 2019
via email
Its Fernando
I dont know what happen....
fr4b3lo@fr4b3lo-LapBook-Air:~$ cd Downloads/
fr4b3lo@fr4b3lo-LapBook-Air:~/Downloads$ ls
install_mosaic_linuxmint.sh
fr4b3lo@fr4b3lo-LapBook-Air:~/Downloads$ chmod +x install_mosaic_linuxmint.sh
fr4b3lo@fr4b3lo-LapBook-Air:~/Downloads$ sudo ./install_mosaic_linuxmint.sh
Hit:1 http://archive.canonical.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:5 http://packages.linuxmint.com tina InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:7 http://packages.linuxmint.com tina Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version (7.58.0-2ubuntu3.8).
git is already the newest version (1:2.17.1-1ubuntu0.5).
libpython2.7-dev is already the newest version (2.7.15-4ubuntu4~18.04.2).
wget is already the newest version (1.19.4-1ubuntu2.2).
ffmpeg is already the newest version (7:3.4.6-0ubuntu0.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5 100 5 0 0 1 0 0:00:05 0:00:03 0:00:02 1
Running on linux mint 8.04
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
Already up to date.
fixing poco libs
ls: cannot access 'openFrameworks/addons/ofxPoco/libs/': No such file or directory
cp: cannot stat 'openFrameworks/scripts/apothecary/poco/include/Poco': No such file or directory
"cp -R $OFFOLDERNAME/scripts/apothecary/poco/include/Poco /usr/include/" command failed with exit code 1.
fr4b3lo@fr4b3lo-LapBook-Air:~/Downloads$
Sent from Mailspring (https://link.getmailspring.com/link/7CE7950D-0DC1-41DE-A574-8579E946F98C@getmailspring.com/0?redirect=https%3A%2F%2Fgetmailspring.com%2F&recipient=cmVwbHkrQU5TTVU1WlZBWTJENVpTREdER0hEQjUzNzZZMjNFVkJNN0hBTE5ZUEpZQHJlcGx5LmdpdGh1Yi5jb20%3D), the best free email app for work
…On Dec 12 2019, at 6:55 pm, Emanuele Mazza ***@***.***> wrote:
Hi fr4b3lo, i've just installed Mosaic on several ubuntu machines without problems, these are the steps:
1 - use ubuntu 18.04, i've not tested the 19.10
2 - run the install script: ./install_mosaic_ubuntu.sh
3 - when asked:
installing OF dependencies with -hwe-18.04 packages, confirm Y/N ? Answer NO
About linux mint, openFrameworks do not mantain a specific script for mint, so every time some appears, there will be some delay between the discovery of the bug and fixing it in the mosaic install script.
The option about skip the OF libs is not available because the script in not intented to re-install openframeworks more than one time. If you do not touch the created folder with OF, and re launch the script, it will automatically skip al the OF specific steps, including the 1.9 GB download.
Anyway, is you still having problems with poco libs, it must be related with one of the point 2 and point 3 described above.
Let me know if worked!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub ***@***.***/1?redirect=https%3A%2F%2Fgist.github.com%2Fd1a544e0cf21b8733b567a3d87905d23%3Femail_source%3Dnotifications%26email_token%3DANSMU5Y6NFWD7Z3HA77KPY3QYJ3K5A5CNFSM4HK7G6Q2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF5ZY2%23gistcomment-3109773&recipient=cmVwbHkrQU5TTVU1WlZBWTJENVpTREdER0hEQjUzNzZZMjNFVkJNN0hBTE5ZUEpZQHJlcGx5LmdpdGh1Yi5jb20%3D), or unsubscribe ***@***.***/2?redirect=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANSMU56AHDT53KNJSI3UZXDQYJ3K5ANCNFSM4HK7G6QQ&recipient=cmVwbHkrQU5TTVU1WlZBWTJENVpTREdER0hEQjUzNzZZMjNFVkJNN0hBTE5ZUEpZQHJlcGx5LmdpdGh1Yi5jb20%3D).
Hello, for the record, I've just installed Mint 20 (Ubuntu 18 based), after some small dirty fixes on specific ofxAddons, Mosaic runs fine.
Compiles on qtCreator 4.6.1 either using clang-10 or gcc-8.
ofxPython/addons.make
(linux64 section) :ADDON_PKG_CONFIG_LIBRARIES = python
replace withADDON_PKG_CONFIG_LIBRARIES = python-2.7
ofxAudioAnalyser/addons.make
(linux64 section) Add :ADDON_LDFLAGS = -lfftw3f -L/usr/lib
Thanks Daan, good to know about the fixes!
Strange the need for the first one, as the script include a fix for that ( line 109 ):
if [ ! -e /usr/lib/x86_64-linux-gnu/pkgconfig/python.pc ]; then
ln -s /usr/lib/x86_64-linux-gnu/pkgconfig/python-2.7.pc /usr/lib/x86_64-linux-gnu/pkgconfig/python.pc
fi
but maybe the path is not right for Mint...
You are right, I reversed my ofxPython change and it still compiles, I made that change before running your script. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment