User:Gaaned92: Difference between revisions

From RawPedia
Jump to navigation Jump to search
No edit summary
(Blanked the page)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
This guide documents how to build RawTherapee for 32-bit or 64-bit versions of Windows using the MSYS2 application.


RawTherapee is built using GTK+ version 3.  GTK+ 3.22.24 or newer is required as this is the first version to support native windows , without which the RawTherapee window could exhibit [https://github.com/Beep6581/RawTherapee/issues/4125 strange behavior] such as maximizing under the taskbar in Windows 10.
The last version of RawTherapee to support GTK2 and compatible with Windows XP is 5.0-r1-gtk2 released on 2017-02-02.
== MSYS2 Installation==
=== Install base MSYS2 system ===
Begin by installing and updating MSYS2 carefully following the instructions from the [https://msys2.github.io/ MSYS2 website].
Update the base MSYS2 system until no further updates are available using:
<pre style="white-space: pre-wrap">
$ pacman -Syu
</pre>
At the end of this installation, you get three shells:
* MSYS shell: used to developp the core system and manage the MSYS2 application( mainly updating MSYS2 packages)
* MINGW64 shell: it provides environment to build  64B applications.
* MINGW32 shell: it provides environment to build  32B applications.
note: in following text, <code><MSYS2></code> is the MSYS2 installation folder.
=== Install tools and libraries ===
The MSYS2 package manager is "''pacman''" (see [https://wiki.archlinux.org/index.php/ https://wiki.archlinux.org/index.php/pacman])
In the MSYS shell:
First, install a few miscellaneous tools:
<pre style="white-space: pre-wrap">
$ pacman -S tar gzip nano make diffutils intltool git
</pre>
Then install the necessary development tools:
<pre style="white-space: pre-wrap">
# win32
$ pacman -S mingw-w64-i686-gcc mingw-w64-i686-gdb mingw-w64-i686-make mingw-w64-i686-pkg-config mingw-w64-i686-cmake
# win64
$ pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-cmake
</pre>
and the required libraries:
<pre style="white-space: pre-wrap">
# win32
$ pacman -S  mingw-w64-i686-gtkmm3 mingw-w64-i686-lcms2 mingw-w64-i686-fftw mingw-w64-i686-lensfun
# win64
$ pacman -S  mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-lcms2 mingw-w64-x86_64-fftw mingw-w64-x86_64-lensfun
</pre>
=== Get applicable versions of packages ===
As MSYS2 provides rolling releases of packages, it can happen that new versions of some packages are incompatible with present rawtherapee.
This is a list of all packages which have to be downgraded to:
<pre style="white-space: pre-wrap">
mingw-w64-x86_64-gtk3-3.22.30-1-any.pkg.tar.xz
mingw-w64-x86_64-lensfun-0.3.2-4-any.pkg.tar.xz
mingw-w64-x86_64-libjpeg-turbo-1.5.3-1-any.pkg.tar.xz
</pre>
If not present in <MSYS2>\var\cache\pacman\pkg, these files can be downloaded from: http://repo.msys2.org/mingw/x86_64/
Then in the MSYS shell:
<pre style="white-space: pre-wrap">
Pacman -U <path-to-files>/mingw-w64-x86_64-...
</pre>
Add following to the file <MSYS2>\etc\pacman.conf to prevent pacman from updating the packages.
<pre style="white-space: pre-wrap">
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg = mingw-w64-x86_64-libjpeg-turbo
IgnorePkg = mingw-w64-x86_64-lensfun
IgnorePkg = mingw-w64-x86_64-gtk3
</pre>
If you want to build 32B applications, do the above, replacing '''x86_64''' by '''i386'''.
=== Updating MSYS2 base system and application packages ===
in MSYS shell:
<pre style="white-space: pre-wrap">
$ pacman -Syuu
</pre>
=== Updating Lensfun data base ===
<pre style="white-space: pre-wrap">
$ lensfun-update-data
</pre>
== Download and build libiptcdata ==
Use either "''MinGW32 Shell''" if you want to build a 32-bit version, or "''MinGW64 Shell''" if you want to build a 64-bit version.
The libiptcdata library is not provided by MSYS2, therefore it should be downloaded and configured using:
<pre style="white-space: pre-wrap">
$ curl -LO http://downloads.sourceforge.net/project/libiptcdata/libiptcdata/1.0.4/libiptcdata-1.0.4.tar.gz
$ tar xzf libiptcdata-1.0.4.tar.gz
$ cd libiptcdata-1.0.4
# win32
$ ./configure --prefix=/mingw32
# win64
$ ./configure --prefix=/mingw64
</pre>
Afterwards the <code>Makefile</code> needs to be opened using a text editor to remove <code>iptc</code> and <code>docs</code> from the lists named <code>SUBDIRS</code> and <code>DIST_SUBDIRS</code>, as building or installing will fail otherwise:
<pre style="white-space: pre-wrap">
$ nano -m Makefile
# search (command ctrl/G)
DIST_SUBDIRS = m4 libiptcdata po iptc docs win python
# and replace with
DIST_SUBDIRS = m4 libiptcdata po win python
# search
SUBDIRS = m4 libiptcdata po iptc docs win $(MAYBE_PYTHONLIB)
# and replace with
SUBDIRS = m4 libiptcdata po win $(MAYBE_PYTHONLIB)
# save
ctrl/O
# quit
ctrl/X
</pre>
Finally build and install the library:
<pre style="white-space: pre-wrap">
$ make
$ make install
$ cd
</pre>
== Clone and build RawTherapee ==
Use either "''MinGW32 Shell''" if you want to build a 32-bit version, or "''MinGW64 Shell''" if you want to build a 64-bit version.
=== Clone RawTherapee's Git repository. ===
The build process will fail if there is a space character anywhere in your <code>build</code> folder path. For example if your Windows username is "Zank Frappa" then your home path will be <code>C:\Users\Zank Frappa\</code> and if you clone RawTherapee inside there then the build will fail during compilation. Simply clone to a folder where neither it nor its parent folders have a space in their name, for example <code>C:\code\repo-rt</code>
<pre style="white-space: pre-wrap">
$ git clone http://github.com/Beep6581/RawTherapee.git /c/code/repo-rt
$ cd /c/code/repo-rt
</pre>
When you clone the repository you will automatically find yourself in the <code>dev</code> branch. To switch to the <code>dev</code> branch manually, do the following:
<pre style="white-space: pre-wrap">
$ git checkout dev
</pre>
=== Create a separate directory for the build ===
<pre style="white-space: pre-wrap">
$ mkdir build
$ cd build
</pre>
Note that if you switch branches then you must delete and recreate the <code>build</code> folder so that compilation starts from scratch in an empty folder, otherwise compilation is likely to fail. However if you are just updating without changing branches then you do not have to start with an empty build folder - you can just go into the existing one, and compilation will be faster because not everything will need to be recompiled.
=== Run CMake and Make ===
<pre style="white-space: pre-wrap">
$ cmake -G "MSYS Makefiles" -DLENSFUNDBDIR=share/lensfun -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" ..
$ make install
</pre>
You can find an explanation of the various CMake options in the [[Linux#CMake|Linux article]], including an explanation of the various "BUILD_TYPE" options.
If you are building for 32-bit Windows  and are using the <code>release</code> or <code>relwithdebinfo</code> "BUILD_TYPE", you will need to add the <code>-mstackrealign</code> compiler flag before the last two dots <code>..</code> of the CMake command above:
<pre style="white-space: pre-wrap">
-DCMAKE_C_FLAGS="-mstackrealign" -DCMAKE_CXX_FLAGS="-mstackrealign"
</pre>
RawTherapee can now be started from the MSYS2 command line:
<pre style="white-space: pre-wrap">
# for debug builds
$ cd debug
# for release builds
$ cd release
# for relwithdebinfo builds
$ cd relwithdebinfo
$ ./rawtherapee.exe
</pre>
== Copy RawTherapee and required DLLs ==
The file manager can be used to copy the contents of <code>c:\code\repo-rt\build\<debug|release|relwithdebinfo></code> together with the necessary DLLs from <code><prefix>\bin</code> into <code>.</code>, where:
*<code><prefix></code> is <code><MSYS2>\<mingw32|mingw64></code>,
*<code><MSYS2></code> is the MSYS2 installation folder,
*and <code>.</code> is the RawTherapee installation folder.
The current list of required DLLs and EXE is:
<pre style="white-space: pre-wrap">
gspawn-<win32|win64>-helper.exe
gspawn-<win32|win64>-helper-console.exe
libatk-1.0-0.dll
libatkmm-1.6-1.dll
libbz2-1.dll
libcairo-2.dll
libcairo-gobject-2.dll
libcairomm-1.0-1.dll
libcroco-0.6-3.dll
libdatrie-1.dll
libepoxy-0.dll
libexpat-1.dll
libffi-6.dll
libfftw3f-3.dll
libfontconfig-1.dll
libfreetype-6.dll
libfribidi-0.dll
libgcc_s_dw2-1.dll (or libgcc_s_seh-1.dll for W32)
libgdk_pixbuf-2.0-0.dll
libgdk-3-0.dll
libgdkmm-3.0-1.dll
libgio-2.0-0.dll
libgiomm-2.4-1.dll
libglib-2.0-0.dll
libglibmm-2.4-1.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgomp-1.dll
libgraphite2.dll
libgtk-3-0.dll
libgtkmm-3.0-1.dll
libharfbuzz-0.dll
libiconv-2.dll
libintl-8.dll
libjpeg-8.dll
liblcms2-2.dll
liblensfun.dll
liblzma-5.dll
libpango-1.0-0.dll
libpangocairo-1.0-0.dll
libpangoft2-1.0-0.dll
libpangomm-1.4-1.dll
libpangowin32-1.0-0.dll
libpcre-1.dll
libpixman-1-0.dll
libpng16-16.dll
librsvg-2-2.dll
libsigc-2.0-0.dll
libstdc++-6.dll
libsystre-0.dll
libthai-0.dll
libtiff-5.dll
libtre-5.dll
libwinpthread-1.dll
libxml2-2.dll
zlib1.dll
</pre>
The following list of Adwaita theme files and directories should be copied from <code><prefix>\share\icons\Adwaita\</code> to <code>.\share\icons\Adwaita\</code>:
<pre style="white-space: pre-wrap">
scalable\actions
scalable\devices
scalable\mimetypes
scalable\places
scalable\status
index.theme
cursors\plus.cur
cursors\sb_h_double_arrow.cur
cursors\sb_left_arrow.cur
cursors\sb_right_arrow.cur
cursors\sb_v_double_arrow.cur
</pre>
The following files also need to be copied:
<pre style="white-space: pre-wrap">
<prefix>\lib\gdk-pixbuf-2.0 -> .\lib\gdk-pixbuf-2.0
<prefix>\share\glib-2.0\schemas\gschemas.compiled -> .\share\glib-2.0\schemas
<prefix>\share\lensfun\version_1\* -> .\share\lensfun
</pre>
Create in .\share\GTK3 a file settings.ini containing :
<pre style="white-space: pre-wrap">
[Settings] gtk-button-images=1
</pre>
== Creating a distributable package ==
If you plan to distribute RawTherapee packages for the Windows platform, as a first step you need to make sure that RawTherapee will be built for the "generic" processor target. To do so, use <code>-DPROC_TARGET_NUMBER="1"</code> in the CMake command.
During compilation, a script named <code>WindowsInnoSetup.iss</code> is created in the RawTherapee installation folder. This script is used by Inno Setup [http://www.jrsoftware.org/isinfo.php], a program which is used to generate installers for Windows programs. It is advised to download the Unicode version [http://www.jrsoftware.org/download.php/is-unicode.exe] to avoid problems with some languages.
To help users [[How_to_write_useful_bug_reports|write useful bug reports]], package maintainers are encouraged to produce builds which include both a "release" and a "debug" executable, and to bundle them together with the GDB debugger executable. In other words, put the <code>rawtherapee.exe</code> (release) file together with the <code>rawtherapee-debug.exe</code> (debug) file and the <code>gdb.exe</code> file together into the same installer or the same archive. An alternative is to produce "relwithdebinfo" builds - these are much faster than "debug" but not as optimized as "release" builds, yet they provide just about as much useful information as "debug" builds. When making "relwithdebinfo" or "debug" builds you must provide the GDB debugger executable. Windows binaries of the debugger <code>gdb.exe</code> can be downloaded from [http://www.equation.com/servlet/equation.cmd?fa=gdb here] in 32- and 64-bit versions.
The <code>gdb.exe</code> binary, available from http://www.gnu.org/software/gdb/, should be copied into the RawTherapee installation folder.
Now that everything is set up, to create the package right-click on the <code>WindowsInnoSetup.iss</code> script and choose ''Compile'' from the context menu. It will automatically generate the installer and place it in the parent folder.
To make your new package compatible with the RawTherapee website's upload panel, create a zip archive in which you will place both the newly created installer and the corresponding ''AboutThisBuild.txt'' file which can be found at the same place. Name the resulting zip archive following this template:
<code>RawTherapee_<version>_WinVista_<32|64>_<buildtype>.zip</code>
If you are building and distributing nightly builds, follow this template:
<code>RawTherapee_<branch>_<version>_WinVista_<32|64>_<buildtype>.zip</code>
* "WinVista"  means it can run on any version of Windows from Vista upwards, including 10.
* The "version" will either look like <code>5.2</code> if you checkout the <code>5.2</code> tag, or <code>5.2-g1a2b3c4d</code> if you checkout the <code>dev</code> branch after 5.2 was tagged.
* If you are shipping more than one build type in an installer, don't include <buildtype> in the name.

Latest revision as of 10:07, 22 December 2018