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 84ad0f
- LibPNG
Campbell Barton 84ad0f
- SuperLU
Campbell Barton 84ad0f
- Lzo2
Campbell Barton 84ad0f
- FreeType
Campbell Barton fc1e00
- LibMyPaint (1.3 or newer)
shun-iwasawa 31accf
- Jpeg-Turbo (1.4 or newer)
shun-iwasawa 31accf
- OpenCV 3.2 or newer
Campbell Barton 3cb5de
Campbell Barton 84ad0f
### Installing Dependencies on Debian / Ubuntu
Campbell Barton 3cb5de
Campbell Barton 3cb5de
```
shun-iwasawa 31accf
$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 libqt5multimedia5-plugins libqt5serialport5-dev libsuperlu-dev 
shun-iwasawa 31accf
liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng-dev libjpeg-dev libglew-dev freeglut3-dev libfreetype6-dev libjson-c-dev qtwayland5 libmypaint-dev libopencv-dev libturbojpeg-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`)
shun-iwasawa 31accf
* We may also need `libegl1-mesa-dev libgles2-mesa-dev libglib2.0-dev liblzma-dev`
shun-iwasawa 31accf
* For Qt, MyPaint and OpenCV, you can alternatively build and install from source.
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
```
Toondad 9c4638
$ 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 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 libtool intltool make qt5-qtmultimedia
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
```
Tact Yoshida 55b178
$ 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 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
```
Toondad 9c4638
$ zypper in boost-devel cmake freeglut-devel freetype2-devel gcc-c++ glew-devel libQt5OpenGL-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 libqt5-qtmultimedia
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
### 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
Benson Muite eb81d1
The build takes a lot of time, be patient. CMake may not pick up all the required dependencies. On Fedora 30, it can be helpful to use 
Benson Muite eb81d1
```
Benson Muite eb81d1
$cmake ../sources/ -DSUPERLU_INCLUDE_DIR=/usr/include/SuperLU
Benson Muite eb81d1
```
Benson Muite eb81d1
instead of just
Benson Muite eb81d1
```
Benson Muite eb81d1
$cmake ../sources/
Benson Muite eb81d1
```
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
```
Ken Taguma a0f8f7
$ LD_LIBRARY_PATH=./lib/opentoonz:$LD_LIBRARY_PATH
Ken Taguma a0f8f7
$ ./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