Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Version 12 (modified by Maiku, 6 years ago) (diff)

Add libdir override to avoid installing libraries into places like lib/x86_64-linux-gnu (meson bug?)

Pidgin for Windows Build Instructions

Note: These instructions are for 3.0.0 branch. The current instructions for 2.x.y are found here.

Get the Pidgin source code

The 3.0.0 branch isn't released yet, so there are no source packages for this at the moment.

The development source is available via mercurial. See UsingPidginMercurial for more information.

Cross Compiling (the easy way)

It is quite easy to cross compile Pidgin for Windows on a Linux machine.

To begin, you'll need to install MinGW. On Debian/Ubuntu, this involves installing packages mingw-w64 and mingw-w64-tools. On other distributions, the packages may be named differently.

Next, you need to set up a MinGW development directory and populate it with all of the Pidgin dependencies. Start by defining that in an environment variable. The exact location can be changed to fit your filesystem:

export WIN_DEV_DIR=${HOME}/win-dev/

Fetch the dependencies using the bootstrap script:

wget -nv -P"$WIN_DEV_DIR" "https://bitbucket.org/%21api/2.0/snippets/CMaiku/pon5L/files/pidgin-bootstrap.sh"
chmod +x "${WIN_DEV_DIR}/pidgin-bootstrap.sh"
${WIN_DEV_DIR}/pidgin-bootstrap.sh

Create a cross compile file for meson. It should be named win32_cross.txt for following this guide. Details can be found here, and an example you can edit to your system is here. It's important to include these lines in the properties section:

[properties]
c_args = ['-I/path/to/win-dev-dir/mingw32/include/']
c_link_args = ['-static-libgcc']

Edit the c_args line to point to the full path of ${WIN_DEV_DIR}/mingw32/include/. The c_link_args line is unnecessary for 64-bit.

Set up pkg-config:

export PKG_CONFIG_SYSROOT_DIR=${WIN_DEV_DIR}
export PKG_CONFIG_PATH="${WIN_DEV_DIR}/mingw32/lib/pkgconfig"

Create your build directory with the --cross-file option. You may choose FHS or classic directory layout (default is classic). For now (while the installer is missing), FHS will be easier to install and run. The rest of this script assumes you're using FHS. Make sure to have the Pidgin source tree as a child of the current directory.

meson pidgin build-win32 --cross-file win32_cross.txt --prefix=/mingw32/ -Dconsoleui=false -Dvv=false -Dintrospection=false -Dwin32-dirs=fhs -Dlibdir=lib

Change into the build directory and build it:

cd build-win32
ninja

And last, install Pidgin and its dependencies. It can be installed anywhere, but it needs dependencies which are, according to this guide, already in ${WIN_DEV_DIR}/mingw32. So for simplicity, this guide installs them there.

DESTDIR=${WIN_DEV_DIR} ninja install

Now you're done. ${WIN_DEV_DIR}/mingw32/ can be copied to a Windows machine and run as is (${WIN_DEV_DIR}/mingw32/bin/pidgin.exe). However, see below regarding TLS certificates.

TLS Certificates

Pidgin 3 uses Gio for its TLS certificates, which by default uses Certificate Authorities from ${WIN_DEV_DIR}/ssl/certs/ca-bundle.crt. Because of the way the dependencies are fetched, currently this file is empty. There are three methods to resolve this:

Populate the file by running p11-kit from the cross compiling host:

p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose server-auth ${WIN_DEV_DIR}/ssl/certs/ca-bundle.crt

OR run it from Windows (run from ${WIN_DEV_DIR}):

bin\p11-kit.exe extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose server-auth ssl\certs\ca-bundle.crt

OR bypass the file and use the alternate Gio TLS Backend by setting the environment variable:

set GIO_USE_TLS=gnutls-pkcs11

Compiling directly on Windows with Cygwin (the hard way)

This method was used for 2.x.y branch and most probably will be dropped, when cross-compilation was fully functional (including the installer).

Set up your build environment

  1. Install the Cygwin Bash shell. Make sure to select Unix file mode during setup. Also make sure you install bash, bzip2, ca-certificates, coreutils, gawk, gnupg, grep, gzip, libiconv, make, mercurial, patch, sed, tar, unzip, wget, xxd and zip (several of these are selected by default, those in bold are not). Be sure to add Cygwin versions of any programs you may use that require Cygwin path names (for example, if you want to use vim to edit commit messages, you need to install the Cygwin version of vim -- native Win32 vim will be unable to read Cygwin-style paths).
    You may prefer to use MSYS instead of Cygwin.
  1. Download and install NSIS and its plugins:
  1. Download Perl 5.20 or newer and install it, preferably to C:\Perl. You may use Strawberry Perl.
  1. Extract or check out the Pidgin source into $PIDGIN_DEV_ROOT/pidgin-<version>. Some users may find the instructions for customizing their build environment useful.

You don't have to actually define an environment variable called PIDGIN_DEV_ROOT, it is simply used here as a placeholder.

Note: You should avoid using a $PIDGIN_DEV_ROOT path that contains spaces as that can cause unnecessary complications.

People are sometimes confused about the directory structure, so here is an example structure after all the dependencies have been installed ($PIDGIN_DEV_ROOT is c:\devel\pidgin-devel in this example):

c:\devel\pidgin-devel
(The following is the source tree root, containing config.h.mingw.)
c:\devel\pidgin-devel\pidgin-<version>
(If the following file is present, your structure is probably correct.)
c:\devel\pidgin-devel\pidgin-<version>\pidgin\win32\prepare-workspace.sh
  1. Go through the rest of setting build environment using automatic setup script by running the following from Cygwin terminal:
    cd $PIDGIN_DEV_ROOT/pidgin-<version>/pidgin/win32
    ./prepare-workspace.sh
    

Build Pidgin

Run the following:

cd $PIDGIN_DEV_ROOT/pidgin-<version>
make -f Makefile.mingw install

Now just wait and let your compiler do its thing. When finished, Pidgin will be in $PIDGIN_DEV_ROOT/pidgin-<version>/win32-install-dir.

Build the Pidgin Installer

If you want to sign the executables (not necessary for personal use), you'll need to get an appropriate code signing certificate, generate a GPG key if you don't already have one, then download and install Mono. In your local.mak file (see below), define the SIGN_EXECUTABLES variable to 1, MONO_SIGNCODE to the fully qualified path to the signcode batch file in the Mono bin directory, and the SIGNCODE_SPC and SIGNCODE_PVK variables to the appropriate files from your certificate. E.g.:

SIGN_EXECUTABLES=1
MONO_SIGNCODE=/cygdrive/c/Program\ Files\ \(x86\)/Mono-2.10.8/bin/signcode
SIGNCODE_SPC=c:\\Path\\to\\authenticode.spc
SIGNCODE_PVK=c:\\Path\\to\\authenticode.pvk
#Set up gpg to use a separate keyring
GPG_SIGN=gpg --no-default-keyring --secret-keyring /path/to/secring.gpg

If you don't need executable signing, you can start here.

There are 2 different installers, an "Offline" installer that includes all dependencies (except spellchecking dictionaries) and the debug symbols and an "Online" installer that includes only Pidgin itself and will download the various dependencies if necessary. The Makefile.mingw targets for these are installer_offline, and installer respectively. To build both, use the installers target.

cd $PIDGIN_DEV_ROOT/pidgin-<version>
make -f Makefile.mingw installers

When it finishes, your installer(s) should be in $PIDGIN_DEV_ROOT/pidgin-<version>/.

Customizing the Build Environment

Most people will find that the standard build environment directory is completely adequate. It is, however, possible to override the locations of the various dependencies and target directories. This is often useful to test against a development version of a library dependency or to override compiler flags.

This done is by overriding the various Makefile variables in a local.mak file in the $PIDGIN_DEV_ROOT/pidgin-<version> directory. This file does not exist by default.

Most of the variables that can be overridden with this method are defined in the libpurple/win32/global.mak file. For example, to install Pidgin over c:\Program Files\Pidgin instead of $PIDGIN_DEV_ROOT/pidgin/win32-install-dir, create a $PIDGIN_DEV_ROOT/pidgin/local.mak containing:

 #Override the install location
 PIDGIN_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin
 PURPLE_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin

One nice use of the local.mak file is for cross compiling.

Debugging

There is a quite good Just In Time debugger for MinGW: drmingw.
There is also a version of gdb available from MinGW, if you prefer.

All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!