ScanTailor Advanced: https://github.com/4lex4/scantailor-advanced
This is an instruction for building ScanTailor Advanced and its dependencies for Windows and Linux.
- Boost 1.60.x or higher
- libpng 1.x.x
- zlib 1.x.x
- jpeg 9x
- libtiff 4.x.x
- Qt 5.6.x or higher (Note: Qt 5.6.x are the latest versions that support Windows XP)
Usage: cmake -D <option>=<value> ...
Useful options:
CMAKE_INSTALL_PREFIX=<path>
- install ScanTailor Advanced into thepath
after building.PORTABLE_VERSION=[ON|OFF]
- whether to build portable version. If enabled, ScanTailor tries to store its settings and files inside the application folder if possible, else ScanTailor stores those in the system specific paths. If disabled, the settings and files are always stored in the system specific paths.
Supported toolchains for Windows are MinGW and MSVC.
-
Download the sources of ScanTailor Advanced.
-
Clone this project. (Push the 'Clone or download' button above)
-
Unpack ScanTailor Advanced sources into a folder.
-
Create the empty folder named
libs
near the ScanTailor sources folder (but not inside). -
Download and unpack the sources of all the dependencies listed into the libs folder.
-
Unpack the folder of this project there.
You must have gotten a catalog structure similar to this:..\ | |-- libs | |-- boost_1_xx_x | |-- jpeg-9 | |-- libpng-1.x.xx | |-- scantailor-libs-build-master | |-- jpeg-9x | |-- qt-everywhere-opensource-src-5.x.x | |-- tiff-4.x.x | |-- zlib-1.x.x | |-- scantailor-advanced-1.x.x |
-
Install CMake.
- Install mingw64 into the path
C:\mingw64
/C:\mingw32
- Install msys2 into the path
C:\msys64
/C:\msys32
- Add mingw into the
PATH
environment variable:- go to: My Computer -> Right click -> Properties -> Advanced system settings;
- click Environment variables;
- Find
Path
variable in the system variables tab and paste;C:\mingw64\bin
/;C:\mingw32\bin
at the end of its value.
-
Run script
configure_msys.bat
with administrative permissions. -
Run script
configure_libs_x32.bat
/configure_libs_x64.bat
-
Open the command prompt (
cmd
) and enter, having...
replaced with your folder containing the libs folder:cd /d "...\libs\scantailor-libs-build-master" mkdir build && cd build cmake -G "MinGW Makefiles" --build ..
mingw32-make -j %NUMBER_OF_PROCESSORS%
-
Open the command prompt (
cmd
) and enter, having...\scantailor-advanced-1.x.x
replaced with your path to scantailor-advanced sources:cd /d "...\scantailor-advanced-1.x.x" mkdir build && cd build cmake -G "MinGW Makefiles" --build ..
mingw32-make -j %NUMBER_OF_PROCESSORS%
- Visual Studio (version 2015 or higher [with the Win XP compability package] required)
- Jom
- Place
jom.exe
into the%ProgramFiles(x86)%\Jom\
folder. - Add Jom into the
PATH
environment variable:- go to: My Computer -> Right click -> Properties -> Advanced system settings;
- click Environment variables;
- Find
Path
variable in the system variables tab and paste;%ProgramFiles(x86)%\Jom\
at the end of its value.
-
Open the Native Tools Command Prompt for VS and enter, having
...
replaced with your folder containing the libs:cd /d "...\libs\scantailor-libs-build-master" mkdir build && cd build cmake -G "NMake Makefiles JOM" -D CMAKE_BUILD_TYPE=Release --build ..
jom -j %NUMBER_OF_PROCESSORS%
-
Build scantailor. Open the Native Tools Command Prompt for VS and enter, having
...\scantailor-advanced-1.x.x
replaced with your path to scantailor-advanced sources:cd /d "...\scantailor-advanced-1.x.x" mkdir build && cd build cmake -G "NMake Makefiles JOM" -D CMAKE_BUILD_TYPE=Release --build ..
jom -j %NUMBER_OF_PROCESSORS%
-
Configure some environment variables. Open the Native Tools Command Prompt for VS and enter:
set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE% set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH% set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
-
Enter, having
...
replaced with your folder containing the libs:cd /d "...\libs\scantailor-libs-build-master" mkdir build && cd build cmake -G "NMake Makefiles JOM" -D CMAKE_BUILD_TYPE=Release -D WIN_XP=ON --build ..
jom -j %NUMBER_OF_PROCESSORS%
-
Configure some environment variables as stated above, if it has not been done yet.
-
Enter, having
...\scantailor-advanced-1.x.x
replaced with your path to scantailor-advanced sources:cd /d "...\scantailor-advanced-1.x.x" mkdir build && cd build cmake -G "NMake Makefiles JOM" -D CMAKE_BUILD_TYPE=Release -D WIN_XP=ON --build ..
jom -j %NUMBER_OF_PROCESSORS%
Linux users have two options here: download them from their repositories or build them from sources.
-
Just download CMake and dependencies developing packages from the repository and then build scantailor. Developing packages are usually have
-devel
or-dev
suffix.Examples:
Ubuntu
sudo apt-get install gcc-7 g++-7 cmake libjpeg-dev libpng-dev libtiff5 libtiff5-dev libboost-test1.63-dev libboost-test1.63.0 qtbase5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev libpthread-stubs0-dev
OpenSUSE
sudo zypper install gcc7 gcc7-c++ cmake libjpeg8-devel libpng16-devel libtiff5 libtiff-devel libboost_test1_66_0 libboost_test1_66_0-devel libqt5-qtbase-devel libqt5-qttools-devel pthread-stubs-devel
-
Install CMake, gcc, g++ and developing packages of Xrender, fontconfig, pthread-stubs, X11, OpenGL (Mesa) from your repository. Developing packages are usually have
-devel
or-dev
suffix.
(Example of the package names on OpenSUSE:libXrender-devel
,fontconfig-devel
,pthread-stubs-devel
,libX11-devel
,Mesa-devel
).
See Qt Linux requirements article for more information. -
Download and unpack dependencies sources.
-
Configure some make environment variables:
export LDFLAGS="-L/usr/local/lib -L/usr/local/lib64 -Wl,--rpath=/usr/local/lib -Wl,--rpath=/usr/local/lib64" export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 export CFLAGS="-fPIC" export CXXFLAGS="-fPIC"
-
Build libjpeg, zlib, then libpng and then libtiff with
./configure make -j `nproc` sudo make install
-
Build Qt:
./configure -platform linux-g++ -release -shared \ -system-zlib -system-libpng -system-libjpeg -system-freetype \ -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity \ -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtlocation \ -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols \ -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors \ -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel \ -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtxmlpatterns \ -nomake examples -nomake tests -opensource -confirm-license -no-ltcg make -j `nproc` sudo make install
After building and installing copy findqt.sh and findqt.csh into
/etc/profile.d/
folder then entersudo . ~/.profile && . /etc/profile
in console to apply the changes made instantly or add Qt into PATH yourself. -
Build boost:
./bootstrap.sh ./b2 -q --with-test toolset=gcc link=shared threading=multi -j `nproc` stage sudo ./b2 -q --with-test toolset=gcc link=shared threading=multi install
-
Enter, having
.../scantailor-advanced-1.x.x
replaced with your path to scantailor-advanced sources:cd ".../scantailor-advanced-1.x.x" mkdir build && cd build cmake -G "Unix Makefiles" --build .. make -j `nproc`
-
Optionally, install ScanTailor Advanced with:
sudo make install
Note: you can use
sudo make uninstall
from the build dir to uninstall ScanTailor Advanced later.
-
Build ScanTailor Advanced following the instructions above.
-
Use
cpack -G <generator> [options]
to create a package for your platform. Entercpack --help
to see the options and generators available.Examples:
- To create a Linux DEB package use:
cpack -G "DEB"
- To create a Linux RPM package use:
cpack -G "RPM"
Note:rpm-build
package has to be installed. - To create an installer for Windows use:
cpack -G "NSIS"
Note: NSIS has to be installed.
- To create a Linux DEB package use: