Building static Qt 5

This is a detail guilde how to build the static version of the Qt framework. Static build of Qt allows you to build solid applications which will work without lots of additional *.DLL/*.SO or *.DYLIB files because everything will be hardcoded into your application.

Download
At first, you must to download entire source code tarball from official Qt site:

Download Qt 5.5.0 tar.gz Note: if this link is outdated, you can find newer version of Qt sources here:

Qt open-source Download page

Unpacking
Unpack everything from the tarball into any folder (on Linux or on Mac OS X):

Removing of glitchy Jasper library
This library provides JPEG2000 image format support, but in the PGE it is useless (main image formats in the PGE are PNG, GIF and BMP), and also causes a random crashes of Qt applications built with your Qt build.

To resolve next issues, recommended to remove building of JPE support: because disabling of JPE building is not provided by ./configure script given with Qt sources, we must remove building of JPE weself:
 * make a kill_jasper.sh file in parent folder of Qt sources folder
 * on OS X: install via homebrew the coreutils and gnu-sed
 * open a text editor ( On OS X: Don't use TextEditor.app, because it makes invalid code!, use text editor from XCode or use nano) and paste next content into it:
 * open command line and execute this script by "bash ./kill_jasper.sh" command

Same for OSX with gnu-sed:

Configure
Open console then change current directory to new folder which you has been unpacked. then Copy-paste this into console ans press ENTER:

Linux Mint / Debian

Mac OS X

then wait while configuring will be finished (you will need to wait ~30...60 min)

Build
(you will wait ~1.2...2 hours)

Installation
(you will wait ~10..30 min)

Usage
Built Qt will be located at ~/Qt/5.5_static or ~/Qt/5.5_static_osx on Mac OS X. To configure your Qt application to be built with static Qt version, you need to call ~/Qt/5.5_static/bin/qmake while you in your project folder, and other steps are same as you build with regular Qt version.