| 1 | How to build Box Backup on Win32 using Cygwin and MinGW |
|---|
| 2 | By 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 | |
|---|
| 9 | Start by installing Cygwin on your Windows machine from [http://www.cygwin.org/cygwin/]. |
|---|
| 10 | |
|---|
| 11 | Make 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 | |
|---|
| 24 | If you already have Cygwin installed, please re-run the installer and |
|---|
| 25 | ensure that those packages are installed. |
|---|
| 26 | |
|---|
| 27 | You 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 | |
|---|
| 35 | Choose a directory where you will unpack and compile OpenSSL, Zlib and |
|---|
| 36 | Box Backup. We will call this the ''base directory''. An example might be: |
|---|
| 37 | |
|---|
| 38 | C:\Cygwin\Home\YourUsername |
|---|
| 39 | |
|---|
| 40 | Make sure you know the full path to this directory. |
|---|
| 41 | |
|---|
| 42 | If your user name has spaces in it, which is quite common on Windows, |
|---|
| 43 | please rename your home directory to one without any spaces, and change |
|---|
| 44 | your user's home directory in /etc/passwd to match. |
|---|
| 45 | |
|---|
| 46 | == OpenSSL == |
|---|
| 47 | |
|---|
| 48 | Download OpenSSL from [http://www.openssl.org/source/openssl-1.0.0e.tar.gz] |
|---|
| 49 | |
|---|
| 50 | Open a Cygwin shell, go to the base directory, and unpack OpenSSL: |
|---|
| 51 | |
|---|
| 52 | tar xzvf openssl-1.0.0e.tar.gz |
|---|
| 53 | |
|---|
| 54 | Configure 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 | |
|---|
| 63 | This step is only required to support regular expressions in including/excluding files from backups. However, this is a very useful feature. |
|---|
| 64 | |
|---|
| 65 | Download PCRE from |
|---|
| 66 | [http://prdownloads.sourceforge.net/pcre/pcre-8.12.tar.bz2?download]. |
|---|
| 67 | |
|---|
| 68 | Open a Cygwin shell, go to the base directory, and unpack, build and |
|---|
| 69 | install 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 | |
|---|
| 79 | Note: we must disable shared libraries on Windows because otherwise |
|---|
| 80 | libpcreposix.a is built to depend on libpcre.dll, even if you define |
|---|
| 81 | PCRE_STATIC, and since /usr/i686-pc-mingw32/bin (the location of the DLL) |
|---|
| 82 | is not normally on the PATH, the DLL can't be found, which stops you |
|---|
| 83 | from running any executables. |
|---|
| 84 | |
|---|
| 85 | == Readline (Optional) == |
|---|
| 86 | |
|---|
| 87 | Readline enables editing and completion of commands in bbackupquery. |
|---|
| 88 | It is optional, but it makes bbackupquery easier to use. However, please |
|---|
| 89 | do not enable readline if you intend to distribute the resulting Box |
|---|
| 90 | Backup binaries, as this would be a violation of the GPL license of |
|---|
| 91 | readline. |
|---|
| 92 | |
|---|
| 93 | If 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, |
|---|
| 95 | unpack 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 | |
|---|
| 102 | Download Readline version 6.2 from |
|---|
| 103 | [ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz], and unpack |
|---|
| 104 | and 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 | |
|---|
| 119 | Go 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 | |
|---|
| 123 | Note: If you have problems during the configure or make stage, please try to |
|---|
| 124 | eliminate one potential source of problems by running the following command |
|---|
| 125 | to convert all line endings to Unix format: |
|---|
| 126 | |
|---|
| 127 | find -type f -not \( -wholename .*svn*. \) -exec dos2unix {} \; |
|---|
| 128 | |
|---|
| 129 | == Compile Box Backup == |
|---|
| 130 | |
|---|
| 131 | Enter 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 | |
|---|
| 139 | Create the destination directory, ''C:\Program Files\Box Backup\bbackupd''. |
|---|
| 140 | |
|---|
| 141 | Write a configuration file, keys and certificate on a Unix machine, and |
|---|
| 142 | copy them into the ''Box Backup'' directory, together with the following |
|---|
| 143 | files 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 | |
|---|
| 152 | Ensure that the user running Box Backup can read from the ''Box Backup'' |
|---|
| 153 | directory, and write to the ''bbackupd'' directory inside it. |
|---|
| 154 | |
|---|
| 155 | Run Box Backup by double-clicking on it, and check that it connects to |
|---|
| 156 | the server. If the window opens and closes immediately, it's probably |
|---|
| 157 | due to a problem with the configuration file. Check the Windows Event |
|---|
| 158 | Viewer for details. |
|---|
| 159 | |
|---|
| 160 | See also the service installation and upgrade instructions at |
|---|
| 161 | [https://www.boxbackup.org/trac/wiki/CompilationOnWindows]. |
|---|