Skip to content

Instantly share code, notes, and snippets.

@mrwm
Last active January 16, 2023 01:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrwm/852a10a39371424b6c8c547c6f263d26 to your computer and use it in GitHub Desktop.
Save mrwm/852a10a39371424b6c8c547c6f263d26 to your computer and use it in GitHub Desktop.
A script to automate the installation of OpenToonz on debian and friends
#!/bin/bash
# Following the steps and help from the steps found here:
# https://github.com/opentoonz/opentoonz/blob/master/doc/how_to_build_linux.md
#
# and here:
#
# https://github.com/opentoonz/opentoonz/issues/866
# Get everything you would need
echo "###########################"
echo "# INSTALLING DEPENDENCIES #"
echo "###########################"
sleep 1
sudo apt-get install build-essential git cmake pkg-config libboost-all-dev qt5-default qtbase5-dev libqt5svg5-dev qtscript5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtmultimedia5-dev libsuperlu-dev liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng-dev libjpeg-dev libglew-dev freeglut3-dev libsdl2-dev libfreetype6-dev
# Optional stuff:
#sudo apt-get install libgsl2 libopenblas-dev
clear
# Get the source
echo "######################"
echo "# Downloading source #"
echo "######################"
sleep 1
git clone https://github.com/opentoonz/opentoonz
clear
# Update source
echo "###################"
echo "# Updating source #"
echo "###################"
cd ./opentoonz
git pull
cd -
clear
# Create the config folder
echo "###################"
echo "# Creating config #"
echo "###################"
sleep 1
mkdir -p ~/.config/OpenToonz
cp -r opentoonz/stuff ~/.config/OpenToonz/
# Create SystemVar.ini
touch ~/.config/OpenToonz/SystemVar.ini
# The absolute path is needed for this
echo "[General]" > ~/.config/OpenToonz/SystemVar.ini
echo "OPENTOONZROOT=\"$HOME/.config/OpenToonz/stuff\"" > ~/.config/OpenToonz/SystemVar.ini
echo "OpenToonzPROFILES=\"$HOME/.config/OpenToonz/stuff/profiles\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZCACHEROOT=\"$HOME/.config/OpenToonz/stuff/cache\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZCONFIG=\"$HOME/.config/OpenToonz/stuff/config\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZFXPRESETS=\"$HOME/.config/OpenToonz/stuff/projects/fxs\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZLIBRARY=\"$HOME/.config/OpenToonz/stuff/projects/library\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZPROFILES=\"$HOME/.config/OpenToonz/stuff/profiles\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZPROJECTS=\"$HOME/.config/OpenToonz/stuff/projects\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZROOT=\"$HOME/.config/OpenToonz/stuff\"" >> ~/.config/OpenToonz/SystemVar.ini
echo "TOONZSTUDIOPALETTE=\"$HOME/.config/OpenToonz/stuff/projects/studiopalette\"" >> ~/.config/OpenToonz/SystemVar.ini
clear
# Check if SystemVar.ini has the absolute path or the variable
home=$(cat ~/.config/OpenToonz/SystemVar.ini | grep "HOME" | head -n1 )
if [ ! -z "$VAR" ]; then
clear
echo "Change the variable \$HOME into the absolute path of your home folder"
exit 1
fi
# Build LibTIFF
echo "####################"
echo "# Building LibTIFF #"
echo "####################"
sleep 1
cd opentoonz/thirdparty/tiff-4.0.3
./configure --with-pic --disable-jbig
make
clear
# Start building
echo "#########################"
echo "# Building CMake config #"
echo "#########################"
sleep 1
cd ../../toonz
mkdir build
cd build
cmake ../sources
# check for liblzo*.a
LIBLZO=$(cat CMakeCache.txt | grep "liblzo" | cut -d'/' -f5 | cut -d'.' -f1 | head -n1)
echo "You Have $LIBLZO installed"
while read a ; do echo ${a//$LIBLZO.a/$LIBLZO.so} ; done < CMakeCache.txt > CMakeCache.txt.t
mv CMakeCache.txt{.t,}
clear
# Start the compile
echo "########################"
echo "# Starting the compile #"
echo "########################"
sleep 1
make
# Ask if the user wants to install
echo "Do you want to install OpenToonz to"
read -p "/opt/opentoonz ? [y/N]" install
if [ "$install" = "Y" ] || [ "$install" = "y" ]; then
sudo make install
echo "##########"
echo "# FINISH #"
echo "##########"
exit 0
fi
echo "##########"
echo "# FINISH #"
echo "##########"
echo "OpenToonz can be launched by running the command below"
echo "LD_LIBRARY_PATH=./lib/opentoonz:\$LD_LIBRARY_PATH opentoonz/toonz/build/bin/OpenToonz_1.1"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment