Campbell Barton 3cb5de
# Setting up the development environment for GNU/Linux and Unix
Campbell Barton 3cb5de
Campbell Barton 3cb5de
## Required software
Campbell Barton 3cb5de
Campbell Barton 3cb5de
You will need to install some dependencies before you can build. Depending on your distribution you will be able to install the packages directly with the command lines below or will have to manually install:
Campbell Barton 6aa05c
- Git
Campbell Barton 6aa05c
- GCC
Campbell Barton 6aa05c
- CMake
Campbell Barton 3cb5de
  - confirmed to work with 3.4.1.
Campbell Barton 6aa05c
- Qt5
Campbell Barton 3cb5de
  - http://download.qt.io/official_releases/qt/5.5/5.5.1/
Campbell Barton 6aa05c
- Boost
Campbell Barton 3cb5de
  - http://www.boost.org/users/history/version_1_55_0.html
Campbell Barton 6aa05c
- SDL2
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Installing required packages on Debian / Ubuntu
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 4b2c78
$ sudo apt-get install build-essential git cmake pkg-config libboost-all-dev qt5-default qtbase5-dev libqt5svg5-dev qtscript5-dev qttools5-dev-tools libqt5opengl5-dev libsuperlu-dev liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng16-dev libjpeg-dev libglew-dev freeglut3-dev libsdl2-dev libfreetype6-dev
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
Notes:
Campbell Barton 3cb5de
* Debian doesn't seem to be a package yet for libpng 1.6, but try libpng16-dev
Campbell Barton 3cb5de
* It's possible we also need libgsl2 (or maybe libopenbias-dev)
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Installing required packages on RedHat / Mageia
Campbell Barton 3cb5de
Campbell Barton 3cb5de
TODO
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ rpm ...
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Installing required packages on Fedora
Campbell Barton 3cb5de
(it may include some useless packages)
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 04a69a
dnf install gcc gcc-c++ automake git cmake boost boost-devel SuperLU SuperLU-devel lz4-devel libusb-devel lzo-devel libjpeg-turbo-devel GLEW libGLEW freeglut-devel freeglut SDL2 SDL2-devel freetype-devel libpng-devel qt5-base qt5-qtbase-devel qt5-qtsvg qt5-qtsvg-devel qt5-qtscript qt5-qtscript-devel qt5-qttools qt5-qttools-devel blas blas-devel
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Installing required packages on ArchLinux
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 04a69a
$ sudo pacman -S base-devel git cmake boost boost-libs qt5-base qt5-svg qt5-script qt5-tools lz4 libusb lzo libjpeg-turbo glew freeglut sdl2 freetype2
Campbell Barton 3cb5de
$ sudo pacman -S blas cblas
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
From AUR, using eg. yaourt:
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ yaourt -S superlu
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
Notes:
Campbell Barton 3cb5de
* ArchLinux had BLAS splitted in blas and cblas
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Installing required packages on openSUSE
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 04a69a
zypper in boost-devel git cmake gcc-c++ freeglut-devel freetype2-devel glew-devel libjpeg-devel liblz4-devel libqt5-linguist-devel libQt5OpenGL5 libqt5-qtbase-devel libqt5-qtscript-devel libqt5-qtsvg-devel lzo-devel libusb-devel openblas-devel SDL2-devel superlu-devel zlib-devel
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
## Build instructions
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### cloning the git tree
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ git clone https://github.com/opentoonz/opentoonz
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3158be
### Copying the stuff directory
Campbell Barton 3cb5de
Campbell Barton 3cb5de
TODO: some parts should really be installed in $prefix/ instead... and some other in various cache or user-local places.
Campbell Barton 3cb5de
cf. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Campbell Barton 3cb5de
Until then we just follow the Win32/OSX layout.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
It is supposedly optional but some files are actually required to run the executable properly.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
The .config/OpenToonz/ directory in your home folder will contain your settings, work and other files. We need to create it from the command-line:
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ mkdir -p $HOME/.config/OpenToonz
Campbell Barton 3cb5de
$ cp -r opentoonz/stuff $HOME/.config/OpenToonz/
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Creating a default ini file for stuff folders
Campbell Barton 3cb5de
Campbell Barton 3cb5de
TODO: fix the code to discover it automatically
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ cat << EOF > $HOME/.config/OpenToonz/SystemVar.ini
Campbell Barton 3cb5de
[General]
Campbell Barton 3cb5de
OPENTOONZROOT="$HOME/.config/OpenToonz/stuff"
Campbell Barton 3cb5de
OpenToonzPROFILES="$HOME/.config/OpenToonz/stuff/profiles"
Campbell Barton 3cb5de
TOONZCACHEROOT="$HOME/.config/OpenToonz/stuff/cache"
Campbell Barton 3cb5de
TOONZCONFIG="$HOME/.config/OpenToonz/stuff/config"
Campbell Barton 3cb5de
TOONZFXPRESETS="$HOME/.config/OpenToonz/stuff/projects/fxs"
Campbell Barton 3cb5de
TOONZLIBRARY="$HOME/.config/OpenToonz/stuff/projects/library"
Campbell Barton 3cb5de
TOONZPROFILES="$HOME/.config/OpenToonz/stuff/profiles"
Campbell Barton 3cb5de
TOONZPROJECTS="$HOME/.config/OpenToonz/stuff/projects"
Campbell Barton 3cb5de
TOONZROOT="$HOME/.config/OpenToonz/stuff"
Campbell Barton 3cb5de
TOONZSTUDIOPALETTE="$HOME/.config/OpenToonz/stuff/projects/studiopalette"
Campbell Barton 3cb5de
EOF
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Note the generated file must not actually contain "$HOME", this shell command repaces it with /home/youraccount in the generated file.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Building the tiff library from thirdparty
Campbell Barton 3cb5de
Campbell Barton 3cb5de
TODO: make sure we can use the system libtiff instead and remove this section.
Campbell Barton 3cb5de
Features from the modified libtiff and needed currently, so this isn't a simple switch.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ cd opentoonz/thirdparty/tiff-4.0.3
Campbell Barton 3cb5de
$ CFLAGS="-fPIC" ./configure && make
Campbell Barton 3cb5de
$ cd -
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Compiling the actual application
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ cd ../../toonz
Campbell Barton 3cb5de
$ mkdir build
Campbell Barton 3cb5de
$ cd build
Campbell Barton 3cb5de
$ cmake ../sources
Campbell Barton 3cb5de
$ make
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
The build takes a lot of time, be patient.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Debugging the build
Campbell Barton 3cb5de
Campbell Barton 3cb5de
If something doesn't compile or link, please run `make` this way to help spot the problem:
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
LANG=C make VERBOSE=1
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
#### Debug build
Campbell Barton 3cb5de
If you need to debug the application, you should be able to use `cmake -DCMAKE_BUILD_TYPE=Debug`.
Campbell Barton 3cb5de
Campbell Barton 3cb5de
Campbell Barton 3cb5de
### Running the application
Campbell Barton 3cb5de
Campbell Barton 3cb5de
You can now run the application:
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
$ cd bin
Campbell Barton 3158be
$ LD_LIBRARY_PATH=./lib/opentoonz:$LD_LIBRARY_PATH ./bin/OpenToonz_1.0
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3158be
### Performing a system installation
Campbell Barton 3158be
Campbell Barton 3158be
The steps above show how to run OpenToonz from the build directory,
Campbell Barton 3158be
however you may wish to install OpenToonz onto your system.
Campbell Barton 3158be
Campbell Barton 3158be
OpenToonz will install to `/opt/opentoonz` by default, to do this run:
Campbell Barton 3158be
Campbell Barton 3158be
```
Campbell Barton 3158be
$ sudo make install
Campbell Barton 3158be
```
Campbell Barton 3158be
Campbell Barton 3158be
Then you can launch OpenToonz by running `/opt/opentoonz/bin/opentoonz`.
Campbell Barton 3158be
Campbell Barton 3158be
You can change the installation path by modifying the `CMAKE_INSTALL_PREFIX` CMake variable.
Campbell Barton 3158be