| 1 | = Pidgin for Windows Build Instructions = |
| 2 | |
| 3 | == Set up your build environment == |
| 4 | |
| 5 | === The easy way === |
| 6 | |
| 7 | 1. Install the [http://cygwin.com Cygwin] Bash shell. Make sure to select Unix file mode during setup. |
| 8 | Also make sure you install bash, bzip2, coreutils, gawk, grep, gzip, '''make''', '''monotone''', '''patch''', sed, tar, '''unzip''', '''wget''', 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 monotone commit messages, you need to install the Cygwin version of vim -- native Win32 vim will be unable to read Cygwin-style paths). [[BR]] |
| 9 | You may prefer to use the native Windows monotone binary available [http://www.monotone.ca here]. |
| 10 | |
| 11 | 2. Download the [http://gaim-extprefs.sourceforge.net/bef.shtml Build Environment Fetcher] script. Follow the instructions on the website to fetch and install most of the needed build dependencies. The script can fetch Pidgin's source code distribution; you will be prompted to choose which version you'd like to use.[[BR]] |
| 12 | Note that this script is occasionally out of date, especially immediately following releases, in which case you will need to perform some of the manual steps in addition. The ChangeLog may clue you into which dependencies have changed. |
| 13 | |
| 14 | 3. Skip the [#Themanualway The manual way], [#InstallPidginsbuilddependencies Install Pidgin's build dependencies], and [#GetthePidginsourcecode Get the Pidgin source code] sections and go straight to [#BuildPidgin Build Pidgin]. |
| 15 | |
| 16 | === The manual way === |
| 17 | |
| 18 | 1. Install the [http://cygwin.com Cygwin] Bash shell. |
| 19 | Also make sure you install bash, bzip2, coreutils, gawk, grep, gzip, '''make''', '''monotone''', '''patch''', sed, tar, '''unzip''', '''wget''', and '''zip''' (several of these are selected by default, those in bold are not).[[BR]] |
| 20 | You may prefer to use the native Windows monotone binary available [http://www.monotone.ca here]. |
| 21 | |
| 22 | 2. Install the MinGW "current" packages from the [http://www.mingw.org MinGW site].[[BR]] |
| 23 | The easiest way to install these is to use the [http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780 Automated MinGW Installer].[[BR]] |
| 24 | Specifically, you will need `gcc-core 3.4.2`, `binutils 2.15.91`, `mingw-runtime 3.9` and `win32api 3.9` (or newer).[[BR]] |
| 25 | You will need to set MinGW's bin directory before Cygwin's in your PATH.[[BR]] |
| 26 | For Example (You can add the following to your `~/.bashrc` file (create the file if it doesn't exist yet)): |
| 27 | {{{ |
| 28 | export PATH=/cygdrive/c/MinGW/bin:$PATH |
| 29 | }}} |
| 30 | You do not want to use any of Cygwin's build tools, with one exception; you need to use Cygwin's make utility. If typing `which make` produces MinGW's make utility, then just rename the `make.exe` in the MinGW bin directory to something else so that cygwin's make utility will be used instead. This shouldn't be a problem with recent versions of MinGW. |
| 31 | |
| 32 | 3. The following instructions were written under the assumption that [#GetthePidginsourcecode the Pidgin source] will be extracted or checked out into `$PIDGIN_DEV_ROOT/pidgin-<version>` and that you install all of Pidgin's build dependencies under `$PIDGIN_DEV_ROOT/win32-dev` (the point being that the pidgin source root and `win32-dev` directories should be on the same level). |
| 33 | Some users may find the [#CustomizingtheBuildEnvironment instructions for customizing their build environment] useful. |
| 34 | |
| 35 | You don't have to actually define an environment variable called `PIDGIN_DEV_ROOT`, it is simply used here as a placeholder. |
| 36 | |
| 37 | ** Note: You should avoid using a `$PIDGIN_DEV_ROOT` path that contains spaces as that can cause unnecessary complications. |
| 38 | |
| 39 | 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:/development/pidgin_dev` in this example): |
| 40 | {{{ |
| 41 | C:\development\pidgin_dev |
| 42 | (The following is the source tree root, containing config.h.mingw and libpurple.) |
| 43 | C:\development\pidgin_dev\pidgin-<version> |
| 44 | C:\development\pidgin_dev\win32-dev |
| 45 | (If the following file is present, your structure is probably correct.) |
| 46 | C:\development\pidgin_dev\win32-dev\gtk_2_0\include\libintl.h |
| 47 | }}} |
| 48 | |
| 49 | == Install Pidgin's build dependencies == |
| 50 | |
| 51 | === GTK+ === |
| 52 | |
| 53 | Pidgin depends on GTK+ 2.6.10 (newer runtime versions can be used, but building against newer headers will prevent Win98/ME compatibility). |
| 54 | For your convenience, we have included all of GTK's dependencies in one tarball. |
| 55 | Extract [http://prdownloads.sourceforge.net/pidgin/gtk-dev-2.6.10-rev-a.tar.gz?download gtk-dev-2.6.10-rev-a.tar.gz] within `$PIDGIN_DEV_ROOT/win32-dev`.[[BR]] |
| 56 | If you wish to run Pidgin from the `win32-install-dir` directory once it is built, you will need to make sure that you have installed the GTK+ runtime, and make sure that its bin dir is in your PATH.[[BR]] |
| 57 | Visit the [http://www.gtk.org GTK+ website] for official binary and source releases. |
| 58 | |
| 59 | === Libxml2 === |
| 60 | Download and extract [/static/win32/libxml2-2.6.30.tar.gz libxml2-2.6.30.tar.gz] to `win32-dev`. (older version: [/static/win32/libxml2-2.6.24.tar.gz 2.6.24]) |
| 61 | |
| 62 | === Perl 5.10 === |
| 63 | Install Perl 5.10 for Windows (I use [http://www.activestate.com/Products/ActivePerl/ ActivePerl]), to `C:\Perl`. |
| 64 | If you install Perl anywhere else, you will need to override the `PERL` and `EXTUTILS` variables in your `pidgin/local.mak` file. |
| 65 | You will also need to install [/static/win32/perl_5-10-0.tar.gz perl_5-10-0.tar.gz] under `$PIDGIN_DEV_ROOT/win32-dev` (Containing headers and import lib for mingw gcc). (Pidgin 2.4.3 and prior require an older version: [/static/win32/perl582.tar.gz perl582.tar.gz]) |
| 66 | |
| 67 | === Tcl 8.4.5 === |
| 68 | Download and extract [/static/win32/tcl-8.4.5.tar.gz tcl-8.4.5.tar.gz] to `win32-dev` |
| 69 | |
| 70 | === !GtkSpell / Aspell === |
| 71 | * Download the following development packages for !GtkSpell and Aspell, and extract them under `win32-dev`: |
| 72 | * [ftp://ftp.gnu.org/gnu/aspell/w32/aspell-dev-0-50-3-3.zip aspell-dev-0-50-3-3.zip] |
| 73 | * [/static/win32/gtkspell-2.0.11-daa1.tar.gz gtkspell-2.0.11-daa1.tar.gz] (older versions: [/static/win32/gtkspell-2.0.11.tar.gz 2.0.11], [/static/win32/gtkspell-2.0.6.tar.gz 2.0.6]) |
| 74 | |
| 75 | === Mozilla NSS === |
| 76 | * Download and unzip the following under `$PIDGIN_DEV_ROOT/win32-dev`: |
| 77 | * [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_11_4_RTM/msvc6.0/WIN954.0_OPT.OBJ/nss-3.11.4.zip Network Security Services (NSS)] |
| 78 | * [ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.6.4/msvc6.0/WIN954.0_OPT.OBJ/nspr-4.6.4.zip Netscape Portable Runtime (NSPR)] |
| 79 | |
| 80 | === SILC Toolkit === |
| 81 | Download and extract [/static/win32/silc-toolkit-1.1.8.tar.gz silc-toolkit-1.1.8.tar.gz] to `win32-dev`. (older versions: [/static/win32/silc-toolkit-1.0.2.tar.gz 1.0.2], [/static/win32/silc-toolkit-1.1.2.tar.gz 1.1.2], [/static/win32/silc-toolkit-1.1.5.tar.gz 1.1.5], [/static/win32/silc-toolkit-1.1.7.tar.gz 1.1.7]) |
| 82 | |
| 83 | === Meanwhile === |
| 84 | Download and extract [/static/win32/meanwhile-1.0.2_daa2-win32.zip meanwhile-1.0.2_daa2-win32.zip] to `win32-dev`. (older versions: [http://prdownloads.sourceforge.net/meanwhile/meanwhile-1.0.2-win32.zip?download 1.0.2], [/static/win32/meanwhile-1.0.2_daa1-win32.zip 1.0.2_daa1]) |
| 85 | |
| 86 | === Bonjour SDK === |
| 87 | |
| 88 | Download the `Bonjour SDK for Windows` from [http://developer.apple.com/networking/bonjour/download/ the Apple developer website] and install it to `win32-dev/Bonjour_SDK`. |
| 89 | |
| 90 | === Cyrus SASL === |
| 91 | |
| 92 | Download and extract [/static/win32/cyrus-sasl-2.1.22-daa1.zip cyrus-sasl-2.1.22-daa1.zip] to `win32-dev`. (older version: [/static/win32/cyrus-sasl-2.1.22.zip cyrus-sasl-2.1.22.zip]) |
| 93 | [[BR]](this also contains the MIT GSSAPI module) |
| 94 | |
| 95 | |
| 96 | == Get the Pidgin source code == |
| 97 | The source for Pidgin 2.6.3 is available [http://prdownloads.sourceforge.net/pidgin/pidgin-2.6.3.tar.bz2 here] (use the latest release if this isn't updated yet).[[BR]][[BR]] |
| 98 | The development source is available via monotone. See [wiki:UsingPidginMonotone] for more information. |
| 99 | |
| 100 | == Build Pidgin == |
| 101 | Run the following: |
| 102 | {{{ |
| 103 | $ cd $PIDGIN_DEV_ROOT/pidgin-<version> |
| 104 | $ make -f Makefile.mingw install |
| 105 | }}} |
| 106 | Now just wait and let your compiler do its thing. When finished, Pidgin will be in `$PIDGIN_DEV_ROOT/pidgin-<version>/win32-install-dir`. |
| 107 | |
| 108 | == Build the Pidgin Installer == |
| 109 | |
| 110 | * If you want to build the Pidgin installer, do the following (skip to the `make` command below if you chose to use the Build Environment Fetcher): |
| 111 | * Download and install [http://nsis.sourceforge.net/Download NSIS]. Include NSIS to your PATH. |
| 112 | For information on the NSIS installer, visit the [http://nsis.sourceforge.net NSIS website].[[BR]] |
| 113 | NSIS version 2.46 or greater is required to cross-compile. If compiling NSIS from source, the [http://www.scons.org/ scons] package is a dependency. This can usually be installed through your linux distribution's package archive. An example of how to install the NSIS package is given below (Assuming use of the NSIS 2.46 version): |
| 114 | |
| 115 | |
| 116 | |
| 117 | .tar.bz2 file contains latest source[[BR]] |
| 118 | .zip file contains libraries |
| 119 | {{{ |
| 120 | $ mkdir nsis;cd nsis |
| 121 | $ wget http://prdownloads.sourceforge.net/nsis/nsis-2.46-src.tar.bz2?download |
| 122 | $ wget http://prdownloads.sourceforge.net/nsis/nsis-2.46.zip?download |
| 123 | $ tar -jxvf nsis-2.46-src.tar.bz2 |
| 124 | $ cd nsis-2.46 |
| 125 | $ scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no |
| 126 | $ sudo scons install-compiler |
| 127 | $ cd .. |
| 128 | $ sudo unzip nsis-2.46 -d /usr/local/share |
| 129 | $ sudo mv /usr/local/share/nsis-2.46/ /usr/local/share/nsis |
| 130 | }}} |
| 131 | If following the above instructions, the local.mak file ([#CrossCompiling listed below]) should be modified[[BR]] |
| 132 | MAKENSIS := /usr/local/bin/makensis |
| 133 | |
| 134 | * Download [http://prdownloads.sourceforge.net/pidgin/gtk-2.14.7-rev-a-installer.tar.gz?download gtk-2.14.7-rev-a-installer.tar.gz] |
| 135 | and extract it to `$PIDGIN_DEV_ROOT/`. From within the new `gtk_installer directory`, run `. build.sh` (this builds the GTK+ runtime installer, which the Pidgin installer will include). **Please see [#CrossCompiling note below] if building on Ubuntu/Debian about modification of the build.sh file. |
| 136 | * Download [/static/win32/pidgin-inst-deps.tar.gz pidgin-inst-deps.tar.gz] and extract under `$PIDGIN_DEV_ROOT/win32-dev`. |
| 137 | * Now you can actually build the installer.[[BR]] |
| 138 | There are 3 different installers: "Normal" (with GTK+), "No GTK+" and "Debug". |
| 139 | The Makefile targets for these are `installer`, `installer_nogtk`, and `installer_debug` respectively. To build all 3, use the `installers` target. |
| 140 | {{{ |
| 141 | $ cd $PIDGIN_DEV_ROOT/pidgin-<version> |
| 142 | $ make -f Makefile.mingw installers |
| 143 | }}} |
| 144 | When it finishes, your installer(s) should be in `$PIDGIN_DEV_ROOT/pidgin-<version>/`. |
| 145 | |
| 146 | == Customizing the Build Environment == |
| 147 | Most people will find that the standard build evironment directory is completely adequate. |
| 148 | It is, however, possible to override the locations of the various dependencies and target directories. |
| 149 | This is often useful to test against a development version of a library dependency or to override compiler flags. |
| 150 | |
| 151 | This done is by overridding the various Makefile variables in a `local.mak` file in the `$PIDGIN_DEV_ROOT/pidgin-<version>` directory. |
| 152 | This file does not exist by default. |
| 153 | |
| 154 | Most of the variables that can be overridden with this method are defined in the [/viewmtn/revision/file/8c0ef1cb63204eeb0e5cda5501300c62d11bf89e/libpurple/win32/global.mak libpurple/win32/global.mak] file. |
| 155 | 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: |
| 156 | {{{ |
| 157 | #Override the install location |
| 158 | PIDGIN_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin |
| 159 | PURPLE_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin |
| 160 | }}} |
| 161 | |
| 162 | One nice use of the `local.mak` file is for cross compiling, there is an additional example in the [#CrossCompiling section below]. |
| 163 | |
| 164 | == Debugging == |
| 165 | There is a quite good '''Just In Time''' debugger for MinGW: [http://jrfonseca.planetaclix.pt/projects/gnu-win32/software/drmingw/index.html drmingw]. |
| 166 | You can download it [/static/win32/drmingw.exe here].[[BR]] |
| 167 | There is also a version of `gdb` available from MinGW, if you prefer. |
| 168 | |
| 169 | == Cross Compiling == |
| 170 | It is quite easy to cross compile Pidgin for Windows on a Linux machine. Note that cross-compiling does '''''not''''' work properly on Debian Sid on amd64 (also called x86_64 or x64) systems--the most common failure is that the linker will die with a segmentation fault at various points. You may have differing success or failure on other 64-bit Linux distributions. |
| 171 | |
| 172 | To begin, you'll need to install MinGW. On Debian/Ubuntu, this involves installing packages `mingw32`, `mingw32-binutils`, and `mingw32-runtime`. On other distributions, the packages may be named differently. |
| 173 | |
| 174 | Set up a build environment as described [#Themanualway above], skipping steps 1 and 2. |
| 175 | |
| 176 | Create a `local.mak` file in the source directory root to override the Makefile variables - mine looks like this: |
| 177 | {{{ |
| 178 | SHELL := /bin/bash |
| 179 | CC := /usr/bin/i586-mingw32msvc-cc |
| 180 | GMSGFMT := msgfmt |
| 181 | MAKENSIS := /usr/bin/makensis |
| 182 | MAKENSISOPT := - |
| 183 | PERL := /usr/bin/perl |
| 184 | EXTUTILS := /usr/share/perl/5.8/ExtUtils |
| 185 | WINDRES := /usr/bin/i586-mingw32msvc-windres |
| 186 | STRIP := /usr/bin/i586-mingw32msvc-strip |
| 187 | |
| 188 | INCLUDE_PATHS := -I$(PIDGIN_TREE_TOP)/../win32-dev/w32api/include |
| 189 | LIB_PATHS := -L$(PIDGIN_TREE_TOP)/../win32-dev/w32api/lib |
| 190 | }}} |
| 191 | |
| 192 | If your distribution doesn't include a recent enough win32api, you can download it from the [http://www.mingw.org/ MinGW site], extract it into your `win32-dev` directory, and override the `INCLUDE_PATHS` and `LIB_PATHS` variables in your `local.mak` as I have done. |
| 193 | |
| 194 | If you want to build the installers, you'll need to install [#BuildthePidginInstaller NSIS]. On Debian and Ubuntu, the package name is `nsis`; this will likely be different elsewhere. In order to build the GTK+ installer as mentioned above, the `build.sh` script referenced above needs to be changed. The line starting with `makensis.exe` needs to be changed to read: |
| 195 | {{{ |
| 196 | makensis -V3 -DGTK_VERSION=$gtk_version -DGTK_REVISION=$gtk_revision gtk-installer.nsi |
| 197 | }}} |
| 198 | |
| 199 | Once this is all set up, you should be able to follow the [#BuildPidgin building instructions above]. |