| 1 | = Pidgin for Windows Build Instructions = |
| 2 | |
| 3 | Note: These instructions are for 3.0.0 branch. The current instructions for 2.x.y are found [wiki:BuildingWinPidgin here]. |
| 4 | |
| 5 | == Set up your build environment == |
| 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, '''ca-certificates''', coreutils, gawk, '''gnupg''', grep, gzip, '''libiconv''', '''make''', '''mercurial''', '''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 [hxxp://sourceforge.net/projects/mingw/files/MSYS/ MSYS] instead of Cygwin. |
| 10 | |
| 11 | |
| 12 | 2. Download the `Bonjour SDK for Windows` from [hxxps://developer.apple.com/bonjour/ the Apple developer website] (Apple ID may be necessary) and install it to default location. |
| 13 | |
| 14 | |
| 15 | 3. Download `Perl 5.10` or newer and install it, preferably to `C:\Perl`. You may use [hxxp://www.activestate.com/activeperl/downloads ActivePerl Community Edition]. |
| 16 | |
| 17 | |
| 18 | 4. Extract or check out [#GetthePidginsourcecode the Pidgin source] into `$PIDGIN_DEV_ROOT/pidgin-<version>`. |
| 19 | Some users may find the [#CustomizingtheBuildEnvironment instructions for customizing their build environment] useful. |
| 20 | |
| 21 | You don't have to actually define an environment variable called `PIDGIN_DEV_ROOT`, it is simply used here as a placeholder. |
| 22 | |
| 23 | ** Note: You should avoid using a `$PIDGIN_DEV_ROOT` path that contains spaces as that can cause unnecessary complications. |
| 24 | |
| 25 | 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): |
| 26 | {{{ |
| 27 | c:\devel\pidgin-devel |
| 28 | (The following is the source tree root, containing config.h.mingw.) |
| 29 | c:\devel\pidgin-devel\pidgin-<version> |
| 30 | (If the following file is present, your structure is probably correct.) |
| 31 | c:\devel\pidgin-devel\pidgin-<version>\pidgin\win32\prepare-workspace.sh |
| 32 | }}} |
| 33 | |
| 34 | 5. Go through the rest of setting build environment using automatic setup script by running the following from Cygwin terminal: |
| 35 | {{{ |
| 36 | #!sh |
| 37 | cd $PIDGIN_DEV_ROOT/pidgin-<version>/pidgin/win32 |
| 38 | ./prepare-workspace.sh |
| 39 | }}} |
| 40 | |
| 41 | == Get the Pidgin source code == |
| 42 | {{{ |
| 43 | #!comment |
| 44 | The source for Pidgin 3.x.y is available [hxxp://prdownloads.sourceforge.net/pidgin/pidgin-3.x.y.tar.bz2 here] (use the latest release if this isn't updated yet).[[BR]][[BR]] |
| 45 | }}} |
| 46 | The 3.0.0 branch isn't released yet, so there are no source packages for this at the moment.[[BR]][[BR]] |
| 47 | The development source is available via mercurial. See [wiki:UsingPidginMercurial] for more information. |
| 48 | |
| 49 | == Build Pidgin == |
| 50 | |
| 51 | Run the following: |
| 52 | {{{ |
| 53 | #!sh |
| 54 | cd $PIDGIN_DEV_ROOT/pidgin-<version> |
| 55 | make -f Makefile.mingw install |
| 56 | }}} |
| 57 | Now just wait and let your compiler do its thing. When finished, Pidgin will be in `$PIDGIN_DEV_ROOT/pidgin-<version>/win32-install-dir`. |
| 58 | |
| 59 | == Build the Pidgin Installer == |
| 60 | |
| 61 | TODO |
| 62 | {{{ |
| 63 | #!comment |
| 64 | * 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): |
| 65 | * Download and install [hxxp://nsis.sourceforge.net/Download NSIS]. Include NSIS to Cygwin's `PATH`. |
| 66 | * For information on the NSIS installer, visit the [hxxp://nsis.sourceforge.net NSIS website].[[BR]] |
| 67 | * Download the [hxxp://nsis.sourceforge.net/Nsisunz_plug-in nsisunz plugin], and extract `nsisunz.dll` into the `Plugins` directory of your NSIS installation. |
| 68 | * Copy `$PIDGIN_DEV_ROOT/win32-dev/pidgin-inst-deps-20130214/SHA1Plugin.dll` into the `Plugins` directory of your NSIS installation. |
| 69 | * Now you'll need to decide if you want to sign the executables (not necessary for personal use) |
| 70 | * If you do, 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 [hxxp://www.mono-project.com/Download Mono]. In your `local.mak` file (see [wiki:"BuildingWinPidgin#CustomizingtheBuildEnvironment" below]), define the `MONO_SIGNCODE` variable 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.: |
| 71 | {{{ |
| 72 | MONO_SIGNCODE=/cygdrive/c/Program\ Files\ \(x86\)/Mono-2.10.8/bin/signcode |
| 73 | SIGNCODE_SPC=c:\\Path\\to\\authenticode.spc |
| 74 | SIGNCODE_PVK=c:\\Path\\to\\authenticode.pvk |
| 75 | #Set up gpg to use a separate keyring |
| 76 | GPG_SIGN=gpg --no-default-keyring --secret-keyring /path/to/secring.gpg |
| 77 | }}} |
| 78 | * Otherwise, in your `local.mak` file (see [wiki:"BuildingWinPidgin#CustomizingtheBuildEnvironment" below]),add the following: |
| 79 | {{{ |
| 80 | #Disable Signing |
| 81 | MONO_SIGNCODE=echo ***Bypassing signcode*** |
| 82 | GPG_SIGN=echo ***Bypassing gpg*** |
| 83 | }}} |
| 84 | * Now you can actually build the installer.[[BR]] |
| 85 | 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. |
| 86 | The `Makefile.mingw` targets for these are `installer_offline`, and `installer` respectively. To build both, use the `installers` target. |
| 87 | {{{ |
| 88 | #!sh |
| 89 | cd $PIDGIN_DEV_ROOT/pidgin-<version> |
| 90 | make -f Makefile.mingw installers |
| 91 | }}} |
| 92 | When it finishes, your installer(s) should be in `$PIDGIN_DEV_ROOT/pidgin-<version>/`. |
| 93 | }}} |
| 94 | |
| 95 | == Customizing the Build Environment == |
| 96 | Most people will find that the standard build environment directory is completely adequate. |
| 97 | It is, however, possible to override the locations of the various dependencies and target directories. |
| 98 | This is often useful to test against a development version of a library dependency or to override compiler flags. |
| 99 | |
| 100 | This done is by overriding the various Makefile variables in a `local.mak` file in the `$PIDGIN_DEV_ROOT/pidgin-<version>` directory. |
| 101 | This file does not exist by default. |
| 102 | |
| 103 | Most of the variables that can be overridden with this method are defined in the [hxxp://hg.pidgin.im/pidgin/main/file/default/libpurple/win32/global.mak libpurple/win32/global.mak] file. |
| 104 | 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: |
| 105 | {{{ |
| 106 | #Override the install location |
| 107 | PIDGIN_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin |
| 108 | PURPLE_INSTALL_DIR = /cygdrive/c/Program\ Files/Pidgin |
| 109 | }}} |
| 110 | |
| 111 | One nice use of the `local.mak` file is for cross compiling. |
| 112 | {{{ |
| 113 | #!comment |
| 114 | , there is an additional example in the [#CrossCompiling section below]. |
| 115 | }}} |
| 116 | |
| 117 | == Debugging == |
| 118 | There is a quite good '''Just In Time''' debugger for MinGW: [hxxp://code.google.com/p/jrfonseca/wiki/DrMingw drmingw].[[BR]] |
| 119 | There is also a version of `gdb` available from MinGW, if you prefer. |
| 120 | |
| 121 | |
| 122 | {{{ |
| 123 | #!comment |
| 124 | == Cross Compiling == |
| 125 | It is quite easy to cross compile Pidgin for Windows on a Linux machine. |
| 126 | |
| 127 | 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. |
| 128 | |
| 129 | Set up a build environment as described [#Themanualway above], skipping steps 1 and 3. |
| 130 | |
| 131 | Create a `local.mak` file in the source directory root to override the Makefile variables - mine looks like this: |
| 132 | {{{ |
| 133 | SHELL := /bin/bash |
| 134 | CC := /usr/bin/i586-mingw32msvc-cc |
| 135 | GMSGFMT := msgfmt |
| 136 | MAKENSIS := /usr/bin/makensis |
| 137 | WINDRES := /usr/bin/i586-mingw32msvc-windres |
| 138 | STRIP := /usr/bin/i586-mingw32msvc-strip |
| 139 | INTLTOOL_MERGE := /usr/bin/intltool-merge |
| 140 | |
| 141 | INCLUDE_PATHS := -I$(PIDGIN_TREE_TOP)/../win32-dev/w32api/include |
| 142 | LIB_PATHS := -L$(PIDGIN_TREE_TOP)/../win32-dev/w32api/lib |
| 143 | }}} |
| 144 | |
| 145 | If your distribution doesn't include a recent enough win32api, you can download it from the [hxxp://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. |
| 146 | |
| 147 | NSIS version 2.46 or greater is required to cross-compile. If compiling NSIS from source, the [hxxp://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): |
| 148 | |
| 149 | `.tar.bz2` file contains latest source[[BR]] |
| 150 | `.zip` file contains libraries |
| 151 | {{{ |
| 152 | #!sh |
| 153 | mkdir nsis; cd nsis |
| 154 | wget hxxp://prdownloads.sourceforge.net/nsis/nsis-2.46-src.tar.bz2?download |
| 155 | wget hxxp://prdownloads.sourceforge.net/nsis/nsis-2.46.zip?download |
| 156 | tar -jxvf nsis-2.46-src.tar.bz2 |
| 157 | cd nsis-2.46 |
| 158 | scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no |
| 159 | sudo scons install-compiler |
| 160 | cd .. |
| 161 | sudo unzip nsis-2.46 -d /usr/local/share |
| 162 | sudo mv /usr/local/share/nsis-2.46/ /usr/local/share/nsis |
| 163 | }}} |
| 164 | If following the above instructions, the local.mak file ([#CrossCompiling listed above]) should be modified[[BR]] |
| 165 | {{{ |
| 166 | MAKENSIS := /usr/local/bin/makensis |
| 167 | }}} |
| 168 | |
| 169 | |
| 170 | Once this is all set up, you should be able to follow the [#BuildPidgin building instructions above]. |
| 171 | }}} |