Compiling Tux Paint using MinGW/MSYS2

This document provides how to compile Tux Paint with MinGW/MSYS2 on Microsoft Windows.


Basic MinGW/MSYS2 tools and required libraries

So many tools and libraries are required to build Tux Paint. The package management system "pacman" helps you install them automatically solving complicated dependencies.


MSYS2

First of all, you have to install latest MSYS2 as follows.

Open the msys2 shell from the "Start Menu" -> "MSYS2 64bit" -> "MSYS2 MSYS" and execute following command.

$ yes "" | pacman -Syu

This will update core system and the window will close automatically if necessary.

Open the msys2 shell again and execute following command to finish remaining updating process.

$ yes "" | pacman -Syu

Install basic development tools required to build Tux Paint and Tux Paint Config as follows.

$ yes "" | pacman -S make automake-wrapper autoconf-wrapper libtool git zip patch gperf dos2unix

Proceed to the next "MinGW 64bit compiler and tools" section or skip to the "MinGW 32bit compiler and tools" section if you need only a 32bit build environment.


MinGW 64bit (x86_64) compiler and tools

Open the msys2 shell from the "Start Menu" -> "MSYS2 64bit" -> "MSYS2 MSYS" and install 64bit compiler and basic development tools required to build Tux Paint and Tux Paint Config as follows.

$ yes "" | pacman -S mingw-w64-x86_64-{gcc,pkgconf,ntldd-git}

"ntldd" is a small tool which examine windows executable files to list dynamic link library (.dll) files they depends on. Tux Paint's packaging process for binary distribution uses it to find required .dll files.

64bit (x86_64) dependency libraries for Tux Paint and Tux Paint Config

You can install tools and libraries required for compiling Tux Paint and Tux Paint Config on MinGW/MSYS2 using "pacman" except for SDL_mixer, SDL_Pango and libunibreak.

$ yes "" | pacman -S mingw-w64-x86_64-SDL_{image,ttf,gfx}
$ yes "" | pacman -S mingw-w64-x86_64-{libvorbis,librsvg,fribidi,libimagequant,fltk}

Close the shell before proceeding to the remaining process.

Install SDL_mixer, SDL_Pango and libunibreak.

SDL_mixer, SDL_Pango and libunibreak should be installed manually.

This time, use the MinGW "64bit" shell. Open the shell from the "Start Menu" -> "MSYS2 64bit" -> "MSYS2 MinGW 64-bit"

SDL_mixer

Download source tar-ball from SDL_mixer's page. Then build and install SDL_mixer as follows.

$ tar zxvf SDL_mixer-1.2.12.tar.gz
$ cd SDL_mixer-1.2.12/
$ ./configure --prefix=/mingw64 && make && make install

SDL_Pango

At first, you have to prepare source tar-ball and a patch required in the same directory.

Build and install SDL_Pango as follows.

$ wget http://johnnypops.co.uk/tuxpaint/SDL_Pango-configure-extra-api.patch
$ tar zxvf SDL_Pango-0.1.2.tar.gz
$ cd SDL_Pango-0.1.2/
$ patch -p0 < ../SDL_Pango-configure-extra-api.patch
$ ./configure --prefix=/mingw64 && make && make install

libunibreak

libunibreak is required for compiling Tux Paint Config - a graphical configuration tool for teachers and parents.

You can fetch the source code from the git repositry and compile it as follows.

$ git clone https://github.com/adah1972/libunibreak libunibreak
$ cd libunibreak
$ ./autogen.sh --prefix=/mingw64 && make && make install

Proceed to the next "MinGW 32bit compiler and tools" section or skip to the "ImageMagick" section if you need only a 64bit build environment.


MinGW 32bit (i686) compiler and tools

Open the msys2 shell from the "Start Menu" -> "MSYS2 64bit" -> "MSYS2 MSYS" and install 32bit compiler and basic development tools required to build Tux Paint and Tux Paint Config as follows.

$ yes "" | pacman -S mingw-w64-i686-{gcc,pkgconf,ntldd-git}

"ntldd" is a small tool which examin windows executable files to list dynamic link library (.dll) files they depends on. Tux Paint's packaging process for binary distribution uses it to find required .dll files.

32bit (i686) dependency libraries for Tux Paint and Tux Paint Config

You can install tools and libraries required for compiling Tux Paint and Tux Paint Config on MinGW/MSYS2 using "pacman" except for SDL_mixer, SDL_Pango and libunibreak.

$ yes "" | pacman -S mingw-w64-i686-SDL_{image,ttf,gfx}
$ yes "" | pacman -S mingw-w64-i686-{libvorbis,librsvg,fribidi,libimagequant,fltk}

Close the shell before proceeding to the remaining process.

Install SDL_mixer, SDL_Pango and libunibreak.

SDL_mixer, SDL_Pango and libunibreak should be installed manually.

This time, use the MinGW "32bit" shell. Open the shell from the "Start Menu" -> "MSYS2 64bit" -> "MSYS2 MinGW 32-bit"

SDL_mixer

Download source tar-ball from SDL_mixer's page. Then build and install SDL_mixer as follows.

$ tar zxvf SDL_mixer-1.2.12.tar.gz
$ cd SDL_mixer-1.2.12/
$ ./configure --prefix=/mingw32 && make && make install

SDL_Pango

At first, you have to prepare source tar-ball and a patch required in the same directory.

Build and install SDL_Pango as follows.

$ wget http://johnnypops.co.uk/tuxpaint/SDL_Pango-configure-extra-api.patch
$ tar zxvf SDL_Pango-0.1.2.tar.gz
$ cd SDL_Pango-0.1.2/
$ patch -p0 < ../SDL_Pango-configure-extra-api.patch
$ ./configure --prefix=/mingw32 && make && make install

libunibreak

libunibreak is required for compiling the graphical configuration tool for teachers and parents "tuxpaint-config".

You can fetch the source code from the git repositry and compile it as follows.

$ git clone https://github.com/adah1972/libunibreak libunibreak
$ cd libunibreak
$ ./autogen.sh --prefix=/mingw32 && make && make install

Proceed to the next ImageMagick section.


ImageMagick

ImageMagick is a compilation of command line tools to create, edit, compose, or convert bitmap images supporting quite a large number of image formats. Tux Paint uses two functions ("convert" and "composite") in it to generate thumbnails for startar images and templates in the build process.

Using official binary release available from "Windows Binary Release" is recommended because its commands installed using "pacman" on MinGW/MSYS2 do not work as expected.

Do not forget to enable "Install legacy utilities (e.g. convert)" while installing it because Tux Paint's build process uses them.

Add the path to the directory in which ImageMagick is installed at the top of the "PATH" environment variable. For example;

$ export PATH=/c/Program\ Files/ImageMagick-7.0.10-Q16-HDRI:$PATH

You can make it permanent by describing above in the bash configuration file "~/.bash_profile".


Tux Paint

You are able to compile 64bit binaries using MSYS2 64bit shell and 32bit binaries using 32bit shell respectively.


Tux Paint Config

"Tux Paint Config" is a useful graphical tool for tweaking Tux Paint's behavior. You have to build this component before compiling Tux Paint if you want to have it included in your package.

You can use any of [a] stable tar-ball release or [b] developing source tree.

[a] Using stable tar-ball release.

Expand the tar-ball and change the directory name so that the final packaging process can find related files.

$ tar zxvf tuxpaint-config-0.0.19.tar.gz
$ mv tuxpaint-config-0.0.19 tuxpaint-config

[b] Using developing source tree

Fetch the developing source tree from git repository.

$ git clone https://git.code.sf.net/p/tuxpaint/tuxpaint-config tuxpaint-config

Now you can build tuxpaint-config as follows.

$ cd tuxpaint-config
$ make win32
$ cd ..

Tux Paint

You can use any of [a] stable tar-ball release or [b] developing source tree.

[a] Using stable tar-ball release.

Expand the tar-ball and enter to the top of the source tree.

$ tar zxvf tuxpaint-0.9.28-sdl1.tar.gz
$ cd tuxpaint-0.9.28-sdl1

[b] Using developing source tree

Fetch the developing source tree from git repository and enter to the top of the source tree.

$ git clone https://git.code.sf.net/p/tuxpaint/tuxpaint tuxpaint
$ cd tuxpaint

Now you can build Tux Paint as follows.

$ make bdist-win32

All the files needed for starting Tux Paint and Tux Paint Config are collected in the directory for binary distribution "bdist" directory under "win32". You can start them by double-clicking .exe files in the "bdist" directory.


Tux Paint installer

Inno Setup is used to build executable installer for Tux Paint. Therefore you have to install it in the first place.

Inno Setup officially supports translations for only about 20 languages. However, one of the great points of Tux Paint is it supports so many languages. Therefore, the set up script "tuxpaint.iss" to build the installer is written to use much more translations including unofficial one which are available on "Inno Setup Translations". You have to download translation files (.isl) required and put them in "Languages" directory under the directory in which Inno Setup is installed.

Then, you can easily build an executable installer just as follows.

(Or, you can use the script "compile.sh" which automatically set "BiuldTarget" according to the shell you are running and builds suitable installer and portable zip archive.)

It takes for a while and you will find "tuxpaint-<version>-windows-sdl1.2-<arch>-installer.exe" in the same directory.