Setting up a Windows Build Environment

From Bluefish Wiki
Jump to: navigation, search

Windows Build Status

Binary and plugins are running and should be fully functional. If you encounter unexpected behaviour or bugs, please report your problem to our BTS.

Current Known Issues

  • Socket code doesn't work so files can't be opened externally in a currently running copy of bluefish.
  • Launching of external programs doesn't work.
  • Editing of UTF files with a BOM headers is not currently supported.

Recent Build Environment Changes

If you are maintaining a build environment for Bluefish please check this subsection occasionally for important changes!

2011-02-07
The MingW project has created a new installer, which makes things much easier but also changes the way to create the build environment.
2009-12-10
If you build your own installers we now use a unicode version of NSIS, Unicode NSIS, to support UTF-8 encoded translations.
2009-09-23
The GNOME packages have been updated to reflect those versions which are included with Pidgin's GTK+ installer. This is currently being used as our target runtime environment for the Installer version of Bluefish. If you're first setting up your build environment you can skip this section as the information provided below is always up to date. If you already have a build environment setup you will need to update a few packages to the versions provided below. These include atk (1.26.0->1.24.0), glib (2.20.4->2.18.4), gtk+ (2.16.5->2.14.7), and pango (1.24.5->1.22.4).
If you don't intend to run your builds of Bluefish outside of your MSYS environment this change is not required. However if you do wish to do so and wish to remain with GTK+ 2.16 you can use the GTK-Win installer. This version is not officially supported by the windows development team as of yet because while it's fine for Bluefish it does break some features in Pidgin so keep this in mind if you use both programs.


Setting up your Build Environment

The first step is of course to install and setup the MingW and MSYS environments. Start with the automated MinGW installer. When you are asked for the installation location you have to choose a path without spaces like C:\MinGW (but not necessarily this one). From the optional components choose at least the C++ compiler and the MSYS base system.

If you know what you are doing, you might alternatively download and unpack (unzip/untar/...) the packages manually or via the mingw-get tool.


Updating the Build Environment

In a second step all further necessary software needs to be updated and/or installed. You can download and extract them manually or via the mingw-get tool. To unzip things we need at least the unzip too:

mingw-get update
mingw-get install msys-unzip msys-wget

All MinGW and MSYS packages can be retrieved and installed using this way as long as some internet connection is available.

We further need some software by third parties (GNOME packages and it's dependencies). Extract them to the location, where MSYS has been installed. This place is usually C:\MinGW\msys\1.0\. Keep in mind, that this place is equal to the root directory / and to /usr/ (as both are the same) in MSYS. And also /local and /usr/local are equal too. We install all third party software into /usr/local!:

GNOME Packages install into MSYS local directory "/local" (C:\MinGW\local\ or C:\Programs\msys\1.0\local\)
gtk+-bundle_2.14.7-20090119_win32.zip
expat_2.0.1-1_win32.zip
expat-dev_2.0.1-1_win32.zip
intltool_0.40.4-1_win32.zip
intltool-dev_0.40.4-1_win32.zip
libgnurx-2.5.zip
libgnurx-dev-2.5.zip
libxml2_2.7.7-1_win32.zip
libxml2-dev_2.7.7-1_win32.zip
GConf_2.22.0-3_win32.zip
GConf-dev_2.22.0-3_win32.zip
ORBit2_2.14.16-1_win32.zip
ORBit2-dev_2.14.16-1_win32.zip
External Packages install into MSYS local directory "/local" (C:\MinGW\local\ or C:\Programs\msys\1.0\local\)
svn-win32-1.6.15.zip

The Perl Issue

The last thing you need is Perl. The MSYS version is 5.6.1 which is not new enough to pass the configure script for a lot of programs including Bluefish. I use the MSYS 5.6.1 version for autoconf/automake/autogen.sh and an external version such as ActiveState's for anything that needs a newer version. Install the ActivePerl Perl version. Then edit /etc/fstab in your MSYS enviroment (usually ) and add the following line:

c:/programs/perl /opt/perl

so Perl is mounted to the MSYS environment.

Configuring your Build Environment

You might set a few environment variables as follows.

PATH="/bin:/local/bin:/opt/perl/bin"
C_INCLUDE_PATH="/include:/local/include"
LIBRARY_PATH="/lib:/local/lib"
Alternatively pass our config.site script for MSYS to configure to adjust PATH/CFLAGS/LDFLAGS easily.

Further we need to adjust the macro search path for aclocal:

echo /local/share/aclocal > /mingw/share/aclocal/dirlist

Because of a linker bug in the gconftool-2 binary add this symbolic link:

ln -s /local/bin/libxml2-2.dll /local/bin/libxml2.dll


Building External Packages

To build bluefish we need some libraries not available from the MinGW/MSYS project.

Installing Pre-Compiled Packages

Shawn Novak provides pre-compiled tarballs, which you just need to extract to /local:

Custom Packages install into MSYS local directory "/local" (C:\MinGW\local\ or C:\Programs\msys\1.0\local\)
aspell-0.60.6-bin-MinGW-20090901.tbz2
enchant-1.5.0-bin-MinGW-20090901.tbz2

A full set of dictionaries for Aspell 0.60.6 can be found here: http://www.muleslow.net/files/aspell/lang/

Building and Installing from the Source

If you wish to build your own version of these custom packages, these are the configure parameters used for the ones provided. [1]

Aspell 0.60.6

In the aspell source add

#include "asc_ctype.hpp"

to the includes at common/file_util.cpp.

./configure --prefix=/local --disable-rpath --enable-win32-relocatable
Enchant 1.6.0
./configure --prefix=/local --enable-aspell --disable-ispell --disable-myspell
gucharmap 2.32

Unfortunately gucharmap does not build out-of-the-box. The following instructions were taken from the mailing list. First apply the following patch by Daniel Leidert gucharmap26.diff and then configure with the following commands.

patch -p0 <gucharmap26.diff
intltoolize -f
libtoolize -f
aclocal -I m4/ --force
autoheader -f
automake -f
autoconf -f
./configure --disable-gconf --disable-schemas-install --disable-scrollkeeper

Building Bluefish

Check out the latest code from trunk:

svn checkout https://bluefish.svn.sourceforge.net/svnroot/bluefish/trunk/bluefish

Run autogen.sh (uses perl 5.6.1). Then run configure (make sure, Perl from /opt/perl/bin is used; e.g. adjust PATH) and make:

./autogen.sh
./configure CONFIG_SITE=config.site/config.msys
make
make install


Debugging Bluefish

For console debugging output, configure bluefish by passing '--enable-debugging-output' to ./configure. Further CFLAGS should contain '-g' (default, also explicitly set by config.msys).

For debugging crashes install the GNU Debugger (GDB).


Create the Installer

To compile the installer you'll need to have Unicode NSIS with the UnTGZ plugin installed. You should also have makensis.exe in your path (such as in /opt/nsis).

To build the installer configure and build Bluefish with the following commands.

./configure CONFIG_SITE=win32/config.nsis
cd win32
make -f Makefile.mingw installer


Notes and references

References:
  1. Note by Daniel Leidert: I further pass a short msys.site script with the following content to configure:
    #!/bin/sh
    PATH="/opt/perl/bin:$PATH"
    prefix=/local
    exec_prefix='${prefix}'
    enable_shared=yes
    enable_static=no
    enable_maintainer_mode=yes
    LDFLAGS="-L/local/lib -L/lib"
    CFLAGS="-g -Wall -O2 -I/local/include -I/include -mwindows"
    CPPFLAGS="-g -Wall -O2 -I/local/include -I/include"

    The configure script is then called as follows together with the switches as shown above:

    ./configure CONFIG_SITE=msys.site ...configure options see above...

See also

Existing win32 builds