Campbell Barton bb2094
# Setting up the development environment for GNU/Linux
Campbell Barton 3cb5de
Campbell Barton 3cb5de
## Required software
Campbell Barton 3cb5de
Campbell Barton 84ad0f
Building OpenToonz from source requires the following dependencies:
Campbell Barton 6aa05c
- Git
Campbell Barton 8539fa
- GCC or Clang
Campbell Barton 84ad0f
- CMake (3.4.1 or newer).
shun_iwasawa 31362d
- Qt5 (5.9 or newer)
Campbell Barton 84ad0f
- Boost (1.55 or newer)
Campbell Barton 6aa05c
- SDL2
Campbell Barton 84ad0f
- LibPNG
Campbell Barton 84ad0f
- SuperLU
Campbell Barton 84ad0f
- Lzo2
Campbell Barton 84ad0f
- FreeType
Campbell Barton fc1e00
- LibMyPaint (1.3 or newer)
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Installing Dependencies on Debian / Ubuntu
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
2dc390
$ 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 libjson-c-dev
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
2dc390
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
Campbell Barton 3cb5de
2dc390
```
2dc390
$ sudo apt-get install libmypaint-dev
2dc390
```
Campbell Barton 3cb5de
2dc390
Notes:
2dc390
* It's possible we also need `libgsl2` (or maybe `libopenblas-dev`)
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Installing Dependencies on Fedora
Campbell Barton 3cb5de
(it may include some useless packages)
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
2dc390
$ sudo dnf install gcc gcc-c++ automake git cmake boost boost-devel SuperLU SuperLU-devel lz4-devel lzma libusb-devel lzo-devel libjpeg-turbo-devel libGLEW glew-devel freeglut-devel freeglut SDL2 SDL2-devel freetype-devel libpng-devel qt5-qtbase-devel qt5-qtsvg qt5-qtsvg-devel qt5-qtscript qt5-qtscript-devel qt5-qttools qt5-qttools-devel qt5-qtmultimedia-devel blas blas-devel json-c-devel
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
2dc390
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
2dc390
2dc390
```
2dc390
$ sudo dnf install libmypaint-devel
2dc390
```
Campbell Barton fc1e00
Campbell Barton fc1e00
Campbell Barton 84ad0f
### Installing Dependencies on ArchLinux
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton a107c1
$ sudo pacman -S base-devel git cmake boost boost-libs qt5-base qt5-svg qt5-script qt5-tools qt5-multimedia 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 fc1e00
$ yaourt -S superlu libmypaint
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
Notes:
Campbell Barton 84ad0f
* ArchLinux has `blas` split into `blas` and `cblas`.
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Installing Dependencies on openSUSE
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
2dc390
$ zypper in boost-devel cmake freeglut-devel freetype2-devel gcc-c++ glew-devel libQt5OpenGL-devel libSDL2-devel libjpeg-devel liblz4-devel libpng16-compat-devel libqt5-linguist-devel libqt5-qtbase-devel libqt5-qtmultimedia-devel libqt5-qtscript-devel libqt5-qtsvg-devel libtiff-devel libusb-devel lzo-devel openblas-devel pkgconfig sed superlu-devel zlib-devel json-c-devel
2dc390
```
2dc390
2dc390
For newest versions of OS you may install libmypaint from repository and don't need to build it from source:
2dc390
2dc390
```
2dc390
$ zypper install libmypaint-devel
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
2dc390
## Build libmypaint dependency
2dc390
2dc390
If your linux distributions does not have libmypaint package, then build it from the source:
Campbell Barton fc1e00
2dc390
```
2dc390
$ git clone https://github.com/mypaint/libmypaint.git -b v1.3.0
2dc390
$ cd libmypaint
2dc390
$ ./autogen.sh
2dc390
$ ./configure
2dc390
$ make
2dc390
$ sudo make install
2dc390
$ sudo ldconfig
2dc390
$ cd ..
2dc390
```
Campbell Barton fc1e00
Campbell Barton 3cb5de
## Build instructions
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### 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 84ad0f
### 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 84ad0f
The `~/.config/OpenToonz/` directory contains your settings, work and other files.
Campbell Barton 3cb5de
Campbell Barton 84ad0f
Initialize this path with the folling commands:
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 84ad0f
*Currently this is required to run OpenToonz.*
Campbell Barton 84ad0f
Campbell Barton 84ad0f
### Creating SystemVar.ini
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"
Jeremy Bullock eb8f40
TOONZSTUDIOPALETTE="$HOME/.config/OpenToonz/stuff/studiopalette"
Campbell Barton 3cb5de
EOF
Campbell Barton 3cb5de
```
Campbell Barton 84ad0f
Note the generated file must not actually contain `$HOME`, this expands to an absolute path in the generated file.
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Building LibTIFF
Campbell Barton 3cb5de
Campbell Barton 3cb5de
TODO: make sure we can use the system libtiff instead and remove this section.
caryoscelus 58356f
Features from the modified libtiff are 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 503351
$ ./configure --with-pic --disable-jbig
Campbell Barton cec9b9
$ make -j$(nproc)
Campbell Barton cec9b9
$ cd ../../
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Building OpenToonz
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
Campbell Barton cec9b9
$ cd toonz
Campbell Barton 3cb5de
$ mkdir build
Campbell Barton 3cb5de
$ cd build
Campbell Barton 3cb5de
$ cmake ../sources
Campbell Barton cec9b9
$ make -j$(nproc)
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 3cb5de
The build takes a lot of time, be patient.
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Troubleshooting Build Errors
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 8539fa
$ LANG=C make VERBOSE=1
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 84ad0f
#### 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 84ad0f
### Running OpenToonz
Campbell Barton 3cb5de
Campbell Barton 3cb5de
You can now run the application:
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
shun-iwasawa f39ea0
$ LD_LIBRARY_PATH=./lib/opentoonz:$LD_LIBRARY_PATH ./bin/OpenToonz
Campbell Barton 3cb5de
```
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### 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
Campbell Barton efb7a2
----
Campbell Barton efb7a2
Campbell Barton efb7a2
# Linux Package Definitions
Campbell Barton efb7a2
Campbell Barton efb7a2
It may be helpful to use existing packages as a reference when creating a package for your own distribution.
Campbell Barton efb7a2
Campbell Barton efb7a2
- ArchLinux (AUR):
Campbell Barton efb7a2
  https://aur.archlinux.org/packages/opentoonz-git/
Campbell Barton efb7a2
Campbell Barton efb7a2
- App-Image (Portable):
Campbell Barton efb7a2
  https://github.com/morevnaproject/morevna-builds
Campbell Barton efb7a2