This page is intended to guide you through the process of building the whole GTK+ stack (and a few additional libraries required by HexChat) on Windows using Visual C++ a.k.a. MSVC, version 12 that comes with Visual Studio 2013. It is largely based on Chun-wei Fan’s Compiling the GTK+ stack using Visual C++. Thanks!
You can also skip the building process and right off just download and use the Visual C++ builds of GTK+ so that you don’t have to spend a lot of time on getting it to work like we had. So without further ado:
GTK+ Visual C++ Builds:
This is the redistributable and a bundle of all the GTK+ stuff. This is most likely what you need.
|Microsoft Visual C++ Redistributable Package||2013||32 bit||64 bit|
|GTK+ bundle||2.24.24||32 bit||64 bit|
Building from Source
Building GTK+ and its dependencies on Windows has never been easier. We have a PowerShell script which does most of the work for you, so you just have to wait until it finishes. But first of all, here’s the dependency graph of the GTK+ stack.
To compile all this yourself, you need to install:
- Visual Studio 2013 Express for Windows Desktop
- CMake 3.0.2
- MozillaBuild 1.10.0
- Perl 5.20 x86 or x64 (extract to C:\mozilla-build\perl-5.20\Win32 or C:\mozilla-build\perl-5.20\x64)
- NASM (extract to C:\mozilla-build\nasm)
- msgfmt (extract to C:\mozilla-build)
- Ragel (extract to C:\mozilla-build)
- 7-Zip (install to C:\Program Files\7-Zip; do not use the 7z.exe bundled with MozillaBuild)
When you’re done installing these, you also have to clone the GTK-Win32 repo to C:\mozilla-build\hexchat\github\gtk-win32.
You can use other paths, but then make sure to feed gtk-win32\build.ps1 with the correct parameters (open the script with an editor for examples).
Now you have to allow PowerShell scripts to be run on your system. Open a PowerShell prompt as Administrator and run the following command:
Once done, close this elevated shell, and run PowerShell as a regular user. Go to the gtk-win32 repo root and start building with the script. The example below will perform a default build for x86:
cd C:\mozilla-build\hexchat\github\gtk-win32 .\build.ps1 -Configuration x86
Once ready, your GTK+ stack will be found under C:\mozilla-build\hexchat\gtk. Enjoy!