This is an old revision of the document!
Table of Contents
Build Geany on Windows (using Waf)
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).
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.
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.
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
Download the following archives and extract them to c:\libs.
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)
If you want to compile geany-plugins as well, you need the following dependencies. Download the archives and extract them into c:\libs.
Lua for Windows
Setting up Lua on Windows in our custom build environment requires a few additional steps.
- Download lua-5.1.4_Win32_dll12_lib.zip from http://sourceforge.net/projects/luabinaries/files/5.1.4/Windows%20Libraries/
- Extract to c:\libs
- Move liblua5.1.* to c:\libs\lib
- Create c:\libs\lib\pkgconfig\lua.pc with the following content:
- 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 glob, os, shutil VERSION = '1.25nightly' DEST = r'\libs' # header files shutil.rmtree(r'%s\include\geany' % DEST, ignore_errors=True) shutil.copytree(r'geany-%s\include\geany' % VERSION, r'%s\include\geany' % DEST) # geany-0.dll dlls = glob.glob(r'geany-%s\bin\geany*.dll' % VERSION) for filename in dlls: # copy it to lib\ instead bin\ so the lookup works # rename the file to geany.dll, as the linker uses '-lgeany' # this loop will overwrite previously copied files if there is more # one geany*.dll in the source directory, this should not happen shutil.copy(filename, r'%s\lib\geany.dll' % 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.
Create a stripped down GTK runtime environment
To create a stripped down GTK runtime environment used to embed into the Windows installer, we first download the latest GTK (currently GTK2) bundle from www.gtk.org.
For this example the bundle gtk+-bundle_2.24.10-20120208_win32.zip was used. Extract the bundle into a new folder.
Then execute the following commands to remove any not necessary files:
rm -rf bin\envsubst.exe rm -rf bin\fc-cache.exe rm -rf bin\fc-cat.exe rm -rf bin\fc-list.exe rm -rf bin\freetype-config rm -rf bin\gdbus.exe rm -rf bin\gdk-pixbuf-csource.exe rm -rf bin\gdk-pixbuf-query-loaders.exe rm -rf bin\gettext.exe rm -rf bin\gettext.sh rm -rf bin\gio-querymodules.exe rm -rf bin\glib-compile-schemas.exe rm -rf bin\glib-genmarshal.exe rm -rf bin\glib-gettextize rm -rf bin\glib-mkenums rm -rf bin\gobject-query.exe rm -rf bin\gtk-builder-convert rm -rf bin\gtk-demo.exe rm -rf bin\gtk-query-immodules-2.0.exe rm -rf bin\gtk-update-icon-cache.exe rm -rf bin\gtk-update-icon-cache.exe.manifest rm -rf bin\libasprintf-0.dll rm -rf bin\libcairo-script-interpreter-2.dll rm -rf bin\libgcc_s_dw2-1.dll rm -rf bin\ngettext.exe rm -rf bin\pango-querymodules.exe rm -rf bin\pango-view.exe rm -rf bin\pkg-config.exe rm -rf bin\xmlwf.exe rm -rf etc\bash_completion.d rm -rf gtk+-bundle_2.*README.txt rm -rf include rm -rf lib\*.a rm -rf lib\*.def rm -rf lib\*.dll rm -rf lib\*.lib rm -rf lib\gdk-pixbuf-2.0 rm -rf lib\glib-2.0 rm -rf lib\pkgconfig rm -rf man rm -rf manifest rm -rf share\aclocal rm -rf share\doc rm -rf share\glib-2.0 rm -rf share\gtk-2.0 rm -rf share\gtk-doc rm -rf share\man rm -rf src
Then create a subdirectory “gtk” in your Geany git clone and copy the remaining bundle contents into the “gtk” directory so that it contains the bin-etc-lib-share directory structure:
Et voila: you got a stripped down GTK runtime environment ready to use for Geany on Windows.
Release Geany and Geany-Plugins
Release Geany
Download release.py.txt (and remove the .txt extension)
- 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
Download release.plugins.py.txt (and remove the .txt extension)
- 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 plugins contrib
- document release process in detail
- document PyGTK installation