source: box/trunk/docs/api-notes/win32_build_on_cygwin_using_mingw.txt @ 3003

Revision 3003, 5.0 KB checked in by chris, 8 months ago (diff)

Update to latest released versions of dependencies.

Don't install man pages for openssl, as they're not very useful and
it takes forever.

Itemise development dependencies and include an editor (vim).

  • Property svn:eol-style set to native
Line 
1How to build Box Backup on Win32 using Cygwin and MinGW
2By Chris Wilson, 2009-03-31
3
4(To read this document online with better formatting, browse to:
5[http://www.boxbackup.org/trac/wiki/CompileWithMinGW])
6
7== MinGW C++ ==
8
9Start by installing Cygwin on your Windows machine from [http://www.cygwin.org/cygwin/].
10
11Make sure to select the following packages during installation:
12
13 * Archive/unzip
14 * Devel/automake
15 * Devel/autoconf
16 * Devel/gcc-mingw
17 * Devel/gcc-mingw-g++
18 * Devel/make
19 * Libs/libxml2
20 * Libs/libxslt (for xsltproc)
21 * Mingw/mingw-zlib-devel
22 * Perl/Perl
23
24If you already have Cygwin installed, please re-run the installer and
25ensure that those packages are installed.
26
27You may also want to install:
28
29 * Devel/gdb (the debugger)
30 * Devel/subversion (the command-line Subversion client)
31 * Editors/vim (the Vim text editor)
32
33== Base Directory ==
34
35Choose a directory where you will unpack and compile OpenSSL, Zlib and
36Box Backup. We will call this the ''base directory''. An example might be:
37
38  C:\Cygwin\Home\YourUsername
39
40Make sure you know the full path to this directory.
41
42If your user name has spaces in it, which is quite common on Windows,
43please rename your home directory to one without any spaces, and change
44your user's home directory in /etc/passwd to match.
45
46== OpenSSL ==
47
48Download OpenSSL from [http://www.openssl.org/source/openssl-1.0.0e.tar.gz]
49
50Open a Cygwin shell, go to the base directory, and unpack OpenSSL:
51
52        tar xzvf openssl-1.0.0e.tar.gz
53
54Configure OpenSSL for MinGW compilation, and build and install it:
55
56        cd openssl-1.0.0e
57        ./Configure --prefix=/usr/i686-pc-mingw32/ mingw
58        make
59        make install_sw
60
61== PCRE ==
62
63This step is only required to support regular expressions in including/excluding files from backups. However, this is a very useful feature.
64
65Download PCRE from
66[http://prdownloads.sourceforge.net/pcre/pcre-8.12.tar.bz2?download].
67
68Open a Cygwin shell, go to the base directory, and unpack, build and
69install PCRE:
70
71        tar xjvf pcre-8.12.tar.bz2
72        cd pcre-8.12
73        export CFLAGS="-mno-cygwin"
74        export CXXFLAGS="-mno-cygwin"
75        ./configure --prefix=/usr/i686-pc-mingw32 --disable-shared
76        make
77        make install
78
79Note: we must disable shared libraries on Windows because otherwise
80libpcreposix.a is built to depend on libpcre.dll, even if you define
81PCRE_STATIC, and since /usr/i686-pc-mingw32/bin (the location of the DLL)
82is not normally on the PATH, the DLL can't be found, which stops you
83from running any executables.
84
85== Readline (Optional) ==
86
87Readline enables editing and completion of commands in bbackupquery.
88It is optional, but it makes bbackupquery easier to use. However, please
89do not enable readline if you intend to distribute the resulting Box
90Backup binaries, as this would be a violation of the GPL license of
91readline.
92
93If you want Readline support, download PDCurses from
94[http://sourceforge.net/projects/pdcurses/files/pdcurses/3.4/PDCurses-3.4.tar.gz/download]. Save it in your base directory, then open a Cygwin shell there,
95unpack it, compile and install it:
96
97        tar xzvf PDCurses-3.4.tar.gz
98        cd PDCurses-3.4/win32
99        make -f gccwin32.mak CC="gcc -mno-cygwin" LINK="gcc -mno-cygwin"
100        cp pdcurses.a /usr/i686-pc-mingw32/lib/libpdcurses.a
101
102Download Readline version 6.2 from
103[ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz], and unpack
104and install it thus:
105
106        tar xzvf readline-6.2.tar.gz
107        cd readline-6.2
108        ./configure --prefix=/usr/i686-pc-mingw32 \
109                CFLAGS="-mno-cygwin" \
110                CPPFLAGS="-mno-cygwin" \
111                LDFLAGS="-mno-cygwin" \
112                LIBS="-lpdcurses" \
113                --with-curses --disable-shared
114        make
115        make install
116
117== Download Box Backup ==
118
119Go back to the base directory, and download the latest Box Backup sources:
120
121        svn co https://www.boxbackup.org/svn/box/trunk/ trunk
122
123Note: If you have problems during the configure or make stage, please try to
124eliminate one potential source of problems by running the following command
125to convert all line endings to Unix format:
126
127        find -type f -not \( -wholename .*svn*. \) -exec dos2unix {} \;
128
129== Compile Box Backup ==
130
131Enter the source directory and configure like this:
132
133        cd trunk
134        ./infrastructure/mingw/configure.sh [--enable-gnu-readline]
135        make
136
137== Installation ==
138
139Create the destination directory, ''C:\Program Files\Box Backup\bbackupd''.
140
141Write a configuration file, keys and certificate on a Unix machine, and
142copy them into the ''Box Backup'' directory, together with the following
143files from the ''base directory'':
144
145 * boxbackup\release\bin\bbackupd\bbackupd.exe
146 * boxbackup\release\bin\bbackupquery\bbackupquery.exe
147 * boxbackup\release\bin\bbackupctl\bbackupctl.exe
148 * openssl\out32dll\libeay32.dll
149 * openssl\out32dll\ssleay32.dll
150 * zlib\zlib1.dll
151
152Ensure that the user running Box Backup can read from the ''Box Backup''
153directory, and write to the ''bbackupd'' directory inside it.
154
155Run Box Backup by double-clicking on it, and check that it connects to
156the server. If the window opens and closes immediately, it's probably
157due to a problem with the configuration file. Check the Windows Event
158Viewer for details.
159
160See also the service installation and upgrade instructions at
161[https://www.boxbackup.org/trac/wiki/CompilationOnWindows].
Note: See TracBrowser for help on using the repository browser.