This is an old revision of the document!


Build Geany on Windows

This howto describes how to set up a working build environment on Windows to be able to compile, build and test Geany and Geany-Plugins.

Furthermore, this howto will cover how to create a full Geany release on Windows including generating the Windows installers.

The described setup is quite custom and might not be state-of-art and as clean as it could. However, it worked for the author(Enrico Tröger) for years :).

Be careful about paths: this howto assumes everything is installed on the C: drive of a Windows system (tested on Windows XP and 7). Furthermore, most additional dependent libraries and helper utilities are installed into c:\libs. It is recommended to keep these locations. If you need to change them, be careful and be sure to adjust all paths mentioned in the following sections before executing them.

Also note that in some of the linked helper scripts, the paths are hardcoded, so you need to adjust them as well.

Prerequisites

Download and install the following tools

Git

Download and install from http://git-scm.com/download/win

Python

Python is required for the Waf build system and various helper scripts. Best to use the x86 (32bit) version of the latest Python 2 installer. Download the installer, execute it and follow the instructions (install to c:\python27).

https://www.python.org/downloads/windows/

Perl

Download and install the Strawberry Perl distribution from http://strawberryperl.com. This distribution also includes the mingw-gcc and related tools which will be used to compile Geany later. Choose the 32bit installer and install Perl into c:\perl.

http://strawberryperl.com/

NSIS

To be able to Windows installers for Geany (most probably only interesting for Geany core devs), you need the Nullsoft Scriptable Install System (NSIS).

Download and install NSIS 2.46.

http://nsis.sourceforge.net/Download

UnxUtils

UnxUtils contain lots of well known and useful tools from a Unix system, compiled for Windows (find, grep, etc.).

Download the ZIP archive and unpack it to C:\libs\utils

http://sourceforge.net/projects/unxutils/files/latest/download

GTK+

And now to the exciting part: GTK+ on Windows.

The easiest way is to download the whole GTK+ bundle (GTK+2.0, http://www.gtk.org/download/win32.php) and extract it to c:\libs.

http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip

Gettext

DocUtils (rst2html)

Download the tarball from http://docutils.sourceforge.net and extract it to some folder. Enter the folder and execute the following commands:

cd docutils-0.12
python setup.py install
cp Tools\rst2html.py c:\python27

Further dependencies (for geany-plugins)

Lua for Windows

Setting up Lua on Windows in our custom build environment requires a few additional steps.

lua.pc
prefix=c:\libs
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
datarootdir=${prefix}/share
datadir=${datarootdir}
localedir=${datarootdir}/locale
 
Name: Lua
Description: A fast and lightweight IDE using GTK2
Requires: gtk+-2.0 >= 2.8.0
Version: 5.1
Libs: -L${libdir} -llua5.1
Cflags: -I${includedir}

Setup

Modify %PATH%

For convenience and a working build system, you need to extend the %PATH% variable, so the newly installed tools will be available without typing the whole path every time.

To do so, open the Control Panel and choose System and Security\System, then click on the left on Advanced system settings. In the newly opened dialog, click on Environment Variables. In the list of System variables search for Path.

Edit it and add the following paths to the end of list (seperated with semicolon):

C:\python27;C:\Program Files (x86)\NSIS;c:\libs\bin;C:\libs\utils\usr\local\wbin;C:\Program Files (x86)\Git\cmd;C:\perl\perl\site\bin;C:\perl\perl\bin;C:\perl\c\bin

It might be some of the paths were already added by some installers. Adding them twice won't hurt but it is always better to check the whole list before saving.

Then save and close all dialogs.

To test the new setting, open a new command line window (Start → Run → “cmd.exe”) and test executing the following commands:

  • python
  • perl
  • wget
  • pkg-config
  • makensis

Clone the Geany repository from Github

Before starting with the rest, you need the Geany source code first (and the code of geany-plugins and the extra themes). In a command line window, execute the following commands:

mkdir \git
cd \git
git clone git://github.com/geany/geany
git clone git://github.com/geany/geany-plugins
git clone git://github.com/geany/geany-themes

Build and test

Build Geany

Now you are ready to compile and build Geany already.

In a command line window, execute the following commands:

cd \git\geany
python waf configure
python waf build
python waf install

If all went fine, you should have a full Geany for Windows build in \git\geany\geany-1.25 (or whatever is the current version of GIT Master).

Copy include headers for later use

To be able to compile plugins against your current version of Geany, you need to copy the header files and the pkg-config file geany.pc to c:\libs so that pkg-config and the compiler will find those files.

To do so easily, you can use the following script to copy the header files and the geany.pc pkg-config file to c:\libs.

copy_headers.py
#!/usr/bin/env python
 
import os, shutil
 
VERSION = '1.25'
DEST = r'\libs'
 
# header files
shutil.rmtree(r'\libs\include\geany', ignore_errors=True)
shutil.copytree(r'geany-%s\include\geany' % VERSION, r'%s\include\geany' % DEST)
# geany.pc
shutil.copy(r'geany-%s\lib\pkgconfig\geany.pc' % VERSION, r'%s\lib\pkgconfig' % DEST)

Build Geany-Plugins

After Geany has been compiled and the headers copied into the target location, you should be able to compile Geany-Plugins as well. In a command line window, execute the following commands:

cd \git\geany
python waf configure
python waf build
python waf install

Carefully read the output of python waf configure and check whether the installed dependencies have been found. At the time of writing, it is expected that the following dependencies will not be found and/or are not really supported yet:

  • GpgMe
  • GtkSpell
  • PyGTK (an update to this tutorial for building GeanyPy using PyGTK on Windows is planned)
  • VTE
  • Vala
  • WebKit

If all went fine, you should have the plugins built in \git\geany-plugins\geany-plugins-1.25 (or whatever is the current version of GIT Master).

Test the Geany build

After you have built Geany and Geany-Plugins from source, you might want to run and test it. This is a bit tricky but possible.

Initial test setup

Execute the following commands only once:

  • create directory: c:\git\geany_test
  • copy everything from c:\git\geany\geany-1.25 to c:\git\geany_test
  • copy bundled GTK runtine environment to c:\git\geany_test
  • copy everything from c:\git\geany-plugins\geany-plugins-1.25 to c:\git\geany_test
  • copy plugins dependencies from c:\git\geany-plugins\contrib to c:\git\geany_test

Usage

Save the following script to \git\geany\

_geany_test.bat
cd c:\git\geany\
 
copy _build_\geany.exe c:\git\geany_test\bin\
xcopy /Y _build_\*.dll c:\git\geany_test\lib\
 
cd c:\git\geany-plugins\
for /F "usebackq" %%i in (`dir /s /b _build_\*.dll`) do copy %%i c:\git\geany_test\lib
# cleanup
rm c:\git\geany_test\lib\libgeanylua.dll
 
cd c:\git\geany_test\bin\
 
geany.exe -v --socket-file ..\_geany_config\mysocket -c ..\_geany_config

Then whenever you want to test a Geany build, run _geany_test.bat from \git\geany.

Release Geany and Geany-Plugins

Release Geany

  • edit release.py and update VERSION constant
  • check for a clean working copy (e.g. no uncommitted changes)
  • clean and build (adjust versions as necessary):
rmdir /S geany-1.24
python waf clean
git pull
python waf configure --no-scm
python waf build
python waf install
python release.py
  • Party!

Release Geany-Plugins

  • edit: release.py and update VERSION constant
  • check for a clean working copy (e.g. no uncommitted changes)
  • clean and build (adjust versions as necessary):
rmdir /S geany-plugins-1.24
python waf clean
git pull
python waf configure --no-scm
python waf build
python waf install
python release.py
  • Party!

TODO

  • document and provide stripped GTK bundle
  • document and provide plugins contrib
  • document release process in detail
  • document PyGTK installation
Print/export