2 ### Instructions for building Tor Browser Bundle components
4 ### Copyright 2007 Steven J. Murdoch <http://www.cl.cam.ac.uk/users/sjm217/>
5 ### Copyright 2008 The Tor Project <https://www.torproject.org/>
6 ### See LICENSE for licensing information
14 - Introduction to Building the Tor Browser Bundle
18 - Install MinGW (MinGW - Minimalist GNU for Windows)
30 - Unpacking PidginPortable
31 - Building Firefox or Unpacking Firefox Portable
32 - Adding extensions to Firefox Portable (3.6.x series)
33 - Customizing and Building the Tor Browser Bundle
35 An Introduction to Building Tor Browser Bundle
36 ==============================================
38 To build Tor Browser Bundle, you need to have built:
39 Vidalia (in /c/build/vidalia-<version> by default)
40 Tor (in /c/build/tor-<version> by default)
41 Polipo (in /c/build/polipo-<version> by default)
42 and have uncompressed Firefox Portable or produce a custom build Firefox
43 FirefoxPortable (in /c/build/FirefoxPortable by default)
45 Instructions for building Vidalia, Polipo and Tor are included below.
47 As a prerequisite for all builds, we'll need a build directory:
52 Vidalia needs to have the BrowserExecutable, ProxyExecutable,
53 RunProxyAtStart and ProxyExecutableArguments options. Currently this
54 is only available in the Vidalia trunk revision 2328 and later.
56 Furthermore, you'll need to install many different software packages for the
57 checkout and build process. Sadly, many of these packages are unsigned and
58 there is very little in the way of a chain of trust.
63 To checkout the Tor Browser Bundle, you need Subversion.
64 You can download and install the stock Subversion package:
66 http://subversion.tigris.org/getting.html
68 Specifically you should use the pre-built packages. You can choose any from
71 http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
73 Or if you'd like a direct link, you can use this as it is tested and working
76 http://subversion.tigris.org/files/documents/15/41686/svn-1.4.6-setup.exe
78 Alternatively, TortoiseSVN offers a graphical interface and integrates
79 with Windows Explorer:
81 http://tortoisesvn.tigris.org/
86 Download 7zip and install it. Possible choices for downloads are listed here:
88 http://www.7-zip.org/download.html
90 Currently, 7-zip doesn't have package signatures, we requested this for current
93 http://sourceforge.net/forum/message.php?msg_id=4982530
95 The suggested version is "7-Zip 4.57":
97 http://downloads.sourceforge.net/sevenzip/7z457.exe
102 Either Python or wget is required to download Firefox extensions. Python is the
103 suggested method. To use Python, you'll need to download Python and install
104 it. The suggested method is a pre-built Windows build.
105 Download and install the following msi installer:
107 http://python.org/ftp/python/2.5.2/python-2.5.2.msi
109 Download and verify the signature:
111 http://www.python.org/download/releases/2.5.2/python-2.5.2.msi.asc
113 When prompted for a directory, install it into: C:\Python25\
116 (MinGW - Minimalist GNU for Windows)
117 ====================================
119 You need to install MinGW and then MSYS.
120 It's useful to read about these two projects:
122 http://www.mingw.org/
124 For MinGW, download and run MinGW-5.1.6.
125 You can find the proper release on Sourceforge:
127 http://sourceforge.net/projects/mingw/files/
129 To download MinGW-5.1.6.exe, visit the following URL:
131 http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download
133 Run MinGW-5.1.6.exe and begin the install. When prompted, select 'Full' as the
134 type of install. If you know better, select individual packages. It is
135 expected that you will install MinGW into: C:\MinGW
140 For tar and other useful commands, you will also need MSYS. The current version
141 of this is hellish to find. In short, visit the MSYS Base System download
144 http://sourceforge.net/projects/mingw/files/
146 The MSYS-1.0.11.exe download url is:
148 http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/msys-1.0.11/MSYS-1.0.11.exe/download
150 Download and install MSYS-1.0.11.exe. When prompted, read the license agreement
151 and other documentation. When asked for an install path, choose: C:\msys\1.0
153 You will be prompted to do a post install process that will "normalize" your
154 MinGW environment with MSYS. Agree to the prompt. You will hopefully see a
157 "Oh joy, you do not have C:MinGW/bin/make.exe. Keep it that way."
159 Read the MSYS README. Understanding how to use MSYS is important.
161 Now you'll need to fix your /etc/fstab because it is broken by default. Make it
164 Administrator@I-CF61A82488F14 /
168 Once you have replaced the three old binaries you will be ready to actually do
171 All of the rest of the build commands will take place inside of the MSYS Shell.
172 Launch that now. It's found in:
174 Start Menu -> All Programs -> MinGW -> MSYS -> msys
176 Installing GNU wget is optional. If you installed Python, you do not need to
177 install wget. It is not required as basic wget functionality is implemented in
178 Python. Instructions for downloading, compiling and installing wget for MSYS
181 http://www.mingw.org/MinGWiki/index.php/mingwPORT
186 We'll need CMake to build Vidalia.
188 You can read about different versions on the CMake homepage:
192 Download version 2.8.0:
194 http://www.cmake.org/files/v2.8/cmake-2.8.0-win32-x86.exe
196 Run the installer with Windows Explorer and install into:
198 'C:\Program Files\CMake 2.8'
203 Download Qt 4.3 or later, we'll use 4.6.2:
205 http://qt.nokia.com/downloads/windows-cpp
207 Download and run the installer with Windows Explorer:
209 http://get.qt.nokia.com/qt/source/qt-win-opensource-4.6.2-mingw.exe
211 When prompted, install Qt into 'C:\Qt\4.6.2'
212 You will be prompted for the install path for your MinGW directory, enter 'C:\MinGW'
213 You may have an error about win32api.h being not found. This is not true. You
214 have win32api.h and Qt is wrong. This is a result of the Qt installer not
215 understanding how to count version numbers. This is probably fixed in newer
216 versions of Qt. YMMV.
221 In short, you'll now need to install the msysDTK:
223 http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
225 Run msysDTK-1.0.1.exe and install it into C:\msys\1.0
227 This will give you Perl, which is necessary for the OpenSSL build
232 To produce self extracting split bundles, we use WinRAR.
234 Download a trial copy from the WinRAR website:
235 http://www.rarlab.com/rar/wrar380.exe
237 Install it into C:\Program Files\WinRAR
239 Installing autoconf update
240 ==========================
242 Now you'll download download the mingw autoconf-2.59 update:
244 http://prdownloads.sf.net/mingw/msys-autoconf-2.59.tar.bz2?download
246 Extract the .tar.gz like so in your MSYS console:
248 tar -C / -xvjf /c/Documents\ and\ Settings/Administrator/Desktop/msys-autoconf-2.59.tar.bz2
253 In order to enable the forbiddenFile functionality, the GNU Regex
254 library is required. Download the -bin and -dev tarballs from:
256 http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=73286&release_id=140957
258 Extract them both into you MinGW directory, e.g.
260 tar -C /c/MinGW/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/mingw-libgnurx-2.5.1-bin.tar.gz
261 tar -C /c/MinGW/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/mingw-libgnurx-2.5.1-dev.tar.gz
263 Download Polipo sources:
265 http://www.pps.jussieu.fr/~jch/software/files/polipo/polipo-1.0.4.1.tar.gz
266 http://www.pps.jussieu.fr/~jch/software/files/polipo/polipo-1.0.4.1.tar.gz.asc
268 Verify the PGP signature of the above files by following the developer directions:
270 http://www.pps.jussieu.fr/~jch/software/pgp-validating.html
272 Unpack the Polipo source code into /c/build/polipo-1.0.4.1/ :
275 tar -C . -vxzf /c/Documents\ and\ Settings/Administrator/Desktop/polipo-1.0.4.1.tar.gz
277 Download a Tor contributed Polipo specific Makefile:
279 https://svn.torproject.org/svn/tor/trunk/contrib/polipo/Makefile.mingw
281 Replace the stock Polipo Makefile with the one above:
283 mv Makefile Makefile-dist-unused
284 mv /c/Documents\ and\ Settings/Administrator/Desktop/Makefile.mingw Makefile
290 You should have a working binary. If you don't have gcc, it means your path is
291 broken. Ensure you applied the aforementioned /etc/fstab suggestion.
296 Now we'll download zlib and install it.
298 Download the zlib source:
299 http://www.zlib.net/zlib-1.2.3.tar.gz
301 Currently, zlib doesn't have package signatures. We emailed the zlib team and are awaiting a reply.
305 $ tar -C /c/build/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/zlib-1.2.3.tar.gz
308 Build it (we'll need this because we want zlib.a):
318 http://www.openssl.org/source/openssl-0.9.8l.tar.gz
323 tar -C /c/build/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/openssl-0.9.8l.tar.gz
325 You should see errors not unlike:
327 tar: openssl-0.9.8l/include/openssl/bn.h: Cannot create symlink to `../../crypto/bn/bn.h': No such file or directory
328 tar: openssl-0.9.8l/include/openssl/blowfish.h: Cannot create symlink to `../../crypto/bf/blowfish.h': No such file or directory
329 tar: openssl-0.9.8l/include/openssl/bio.h: Cannot create symlink to `../../crypto/bio/bio.h': No such file or directory
330 tar: openssl-0.9.8l/include/openssl/asn1t.h: Cannot create symlink to `../../crypto/asn1/asn1t.h': No such file or directory
331 tar: openssl-0.9.8l/include/openssl/asn1_mac.h: Cannot create symlink to `../../crypto/asn1/asn1_mac.h': No such file or directory
332 tar: openssl-0.9.8l/include/openssl/asn1.h: Cannot create symlink to `../../crypto/asn1/asn1.h': No such file or directory
333 tar: openssl-0.9.8l/include/openssl/aes.h: Cannot create symlink to `../../crypto/aes/aes.h': No such file or directory
334 tar: openssl-0.9.8l/apps/md4.c: Cannot create symlink to `../crypto/md4/md4.c': No such file or directory
335 tar: Error exit delayed from previous errors
337 Uncompressing OpenSSL shows a number of errors concerning symlinks. These do
338 not appear to have caused a problem.
340 Now configure the source package:
343 ./config -no-idea -no-rc5 -no-mdc2
345 Edit '/c/build/openssl-0.9.8l/Makefile' and remove the "test:" and "tests:" sections that follow:
350 @(cd test && echo "testing..." && \
351 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DE
352 BUG_MEMORY=on tests );
353 util/opensslwrap.sh version -a
355 Now remove things we don't need that interfere with the build process:
359 Now copy files we do need:
362 find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
364 find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
366 cp *.h include/openssl/
367 cp fips/fips.h include/openssl/
369 And finally, build it - this can take a long time and depends on the speed of your computer:
377 Next, you'll want to download, unpack, build and install libevent (Version: libevent-1.4.13).
378 You can get libevent here:
380 http://www.monkey.org/~provos/libevent/
381 http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
382 http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz.sig
384 Verify the signature.
388 tar -C /c/build/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/libevent-1.4.13-stable.tar.gz
389 cd libevent-1.4.13-stable/
391 Configure, build and install:
393 ./configure --enable-static --disable-shared
400 Download, unpack, build and install Tor:
401 https://www.torproject.org/download.html
402 https://www.torproject.org/dist/tor-0.2.1.26.tar.gz
403 https://www.torproject.org/dist/tor-0.2.1.26.gz.asc
405 tar -C /c/build -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/tor-0.2.1.26.tar.gz
413 To use QSslSocket for GeoIP lookups, install OpenSSL before building
418 https://www.torproject.org/vidalia/dist/vidalia-0.2.9.tar.gz
419 https://www.torproject.org/vidalia/dist/vidalia-0.2.9.tar.gz.asc
421 Verify the signature.
425 tar -C /c/build/ -xvzf /c/Documents\ and\ Settings/Administrator/Desktop/vidalia-0.2.9.tar.gz
426 mv vidalia-0.2.9/ vidalia
428 Set a proper environment:
430 cat << 'EOF' >> /etc/profile
431 export QTDIR="C:\Qt\4.6.2"
432 export PATH=$PATH:/c/Qt/4.6.2/bin
433 export PATH=$PATH:/c/Program\ Files/CMake\ 2.8/bin/
434 export QMAKESPEC=win32-g++
437 export PATH=$PATH:/c/Program\ Files/CMake\ 2.8/bin/:/c/MinGW/bin/:/c/Qt/4.6.2/bin/
439 Create the proper MSYS Makefiles and don't forget the '.' at the end!
442 cmake -G "MSYS Makefiles" .
444 You may see some errors:
446 -- Check size of int - done
448 CMake Warning (dev) at src/vidalia/CMakeLists.txt:229 (add_executable):
449 Policy CMP0003 should be set before this line. Add code such as
451 if(COMMAND cmake_policy)
452 cmake_policy(SET CMP0003 NEW)
453 endif(COMMAND cmake_policy)
455 as early as possible but after the most recent call to
456 cmake_minimum_required or cmake_policy(VERSION). This warning appears
457 because target "vidalia" links to some libraries for which the linker must
460 imm32, winmm, ws2_32, ole32, oleaut32, uuid, winspool, ole32, oleaut32
463 and other libraries with known full path:
465 C:/Qt/4.5.2/lib/libQtGui4.a
468 CMake is adding directories in the second list to the linker search path in
469 case they are needed to find libraries from the first list (for backwards
470 compatibility with CMake 2.4). Set policy CMP0003 to OLD or NEW to enable
471 or disable this behavior explicitly. Run "cmake --help-policy CMP0003" for
473 This warning is for project developers. Use -Wno-dev to suppress it.
476 -- Build files have been written to: C:/build/vidalia
478 This is OK. You can ignore these errors.
480 Now you'll build Vidalia by running MSYS make:
485 Alternatively building under MinGW32
486 ====================================
488 If you decide to not build with MSYS as mentioned above, you can use MinGW32 to build Vidalia.
490 Qt and CMake must be in the %PATH%. An easy way to do this is to
491 copy qtvars.bat and add the path to CMake. Then, copy the shortcut
492 from the Start menu, and edit the path to point to the altered
496 > cmake -G "MinGW Makefiles" .
499 Patches for possible future inclusion
500 =====================================
502 A patch to close the Browser when Vidalia exits is in:
503 ../src/current-patches/vidalia-killbrowser.patch
505 This is not yet useful, since killing FirefoxPortable does not cause
506 Firefox to exit. This patch has not yet been applied to Vidalia.
508 Currently this is not being used by the Torbrowser.
513 Full instructions are in the Vidalia INSTALL file.
515 Unpacking PidginPortable
516 ========================
518 Download PidginPortable from:
519 http://portableapps.com/apps/internet/pidgin_portable
521 Also download the portable Pidgin-OTR plugin from the same page.
523 Install both to C:\build\PidginPortable-<version>
525 When installing Pidgin Portable, choose to install the extra language
531 Currently the Tor Browser Bundle uses FirefoxPortable binaries.
533 Download FirefoxPortable:
535 http://prdownloads.sourceforge.net/portableapps/FirefoxPortable_3.5.10_English.paf.exe
537 Run the installer and select it into: 'C:\build\FirefoxPortable-<version>'
539 If you use FirefoxPortable, you can skip past the following build steps and go directly to the customization section.
541 Eventually it should use a custom build of Firefox. The following is a set of notes on building Firefox.
543 Adding extensions to Firefox Portable
544 =====================================
546 To ship extensions with Firefox (Portable or otherwise) on Windows, do the following:
547 - Create a directory in FirefoxPortable/App/Firefox/distribution/bundles.
548 - Download the extensions you want into this directory. Currently the Tor
549 Browser Bundle is using Torbutton, HTTPS Everywhere, Better Privacy, and NoScript
550 - Make directories named after the extension ID of the extension. For
551 Torbutton, this is {e0204bd5-9d31-402b-a99d-a6aa8ffebdca}. The others can be
552 found inside their respective .xpis, in install.rdf.
553 - Copy the .xpi into the directory with its extension ID and unzip it with 7zip.
555 Tested compilers for building Firefox
556 =====================================
558 MinGW32 cross compile under Linux:
559 Failed to work (unsupported by Mozilla)
560 MSVC 8 (Visual Studio .NET 2005):
561 Failed to work (unsupported by Mozilla for Firefox 2, but should work
563 With some patches it may be possible to build Firefox 2:
564 http://georgedexter.wordpress.com/2007/03/03/building-firefox-2002-on-windows/
565 MSVC 7.1 (Visual Studio .NET 2003):
566 Works, provided msvcp71.dll and msvcr71.dll are copied
568 For more information see:
569 http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites
570 http://developer.mozilla.org/en/docs/Build_and_Install
572 Instructions building Firefox with MSVC 7.1
573 ===========================================
575 - Install MSVC 7.1 (Visual Studio .NET 2003) and upgrade using Microsoft Update
577 - Download Platform SDK from
578 http://www.microsoft.com/downloads/details.aspx?familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb
580 - Install MozillaBuild from
581 http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.1.exe
583 - Run e:\mozilla-build\start-msvc8.bat
585 $ cd "e:\mozilla\build"
586 $ tar -xjvf ../firefox-2.0.0.9-source.tar.bz2
588 [ dot_mozconfg is in config/ ]
589 $ cp ../dot_mozconfig .mozconfig
590 $ make -f client.mk build
592 - Copy msvcp71.dll and msvcr71.dll from "Microsot Visual Studio .NET 2003\Visual
593 Studio .NET Professional 2003 - English" to obj-i686-pc-mingw32\dist\bin
595 - Add "msvcp71.dll" and "msvcr71.dll" to browser/installer/windows/packages-static
597 $ make -C obj-i686-pc-mingw32/browser/installer
602 The locations of Qt, MinGW32, the Vidalia/Tor build directory, 7zip,
603 FirefoxPortable can be altered in Makefile. The WGET variable should
604 be either set to the location of a wget binary, or a command line for
605 executing pyget.py under the installed Python interpreter.
607 Building the Tor Browser Bundle
608 ===============================
610 Now you'll want to ensure you have the Tor Browser Bundle code checked out into C:\build\
612 C:\build>svn co https://svn.torproject.org/svn/torbrowser/
614 Firefox must not be running while you are building the bundle.
615 If you're using different versions than the Makefile, you'll want to patch the
616 Makefile as mentioned in the Customization section above.
618 An example to change the Qt Lib version:
620 From: QT=/c/Qt/4.6.2/bin
621 To: QT=/c/Qt/4.6.2/bin
623 And then change the Tor version:
625 From: TOR=/c/build/tor-0.2.1.26
626 To: TOR=/c/build/tor-0.2.1.26
628 Now you can run "make bundle_LANGUAGE", e.g. "make bundle_en-US".
630 Alternatively, to build a compressed executable version, run "make
631 compressed-bundle_LANGUAGE", e.g. "make compressed-bundle_de".
633 Currently supported language codes are:
648 New languages can be added by finding out the appropriate Mozilla
649 language pack code from:
651 http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.5.10/win32/xpi
653 If the Mozilla code differs from the Vidalia one, update
654 patch-vidalia-language.sh accordingly.