1 \chapter{Compiling XCSoar
}\label{cha:compiling
}
3 The
\texttt{make
} command is used to launch the XCSoar build process.
4 You can learn more about the build system internals in chapter
7 Most of this chapter describes how to build XCSoar on Linux, with
8 examples for Debian/Ubuntu. A cross-compiler is used to build
9 binaries for other operating systems (for example Android and
12 \section{Getting the Source Code
}
14 The XCSoar source code is managed with
15 \href{http://git-scm.com/
}{git
}. It can be downloaded with the
19 git clone git://git.xcsoar.org/xcsoar/master/xcsoar.git
22 To update your repository, type:
28 For more information, please read to the git documentation.
30 \section{Requirements
}
32 The following is needed for all targets:
36 \item GNU compiler collection (
\texttt{gcc
}), version
4.6.2 or later
37 or clang/LLVM
3.1 (with "make CLANG=y")
39 \item \href{http://librsvg.sourceforge.net/)
}{rsvg
}
40 \item \href{http://www.imagemagick.org/
}{ImageMagick
6.4}
41 \item \href{http://xmlsoft.org/XSLT/xsltproc2.html
}{xsltproc
}
42 \item Perl and XML::Parser
45 The following command installs these on Debian:
48 apt-get install make \
49 librsvg2-bin xsltproc \
53 \section{Target-specific Build Instructions
}
55 \subsection{Compiling for Linux/UNIX
}
57 The following additional packages are needed to build for Linux and
58 similar operating systems:
61 \item \href{http://www.boost.org/
}{Boost
}
62 \item \href{http://www.zlib.net/
}{zlib
}
63 \item \href{http://curl.haxx.se/
}{CURL
}
64 \item \href{http://www.libsdl.org/
}{SDL
}
65 \item \href{http://www.libsdl.org/projects/SDL
\_ttf/
}{SDL
\_ttf}
66 \item \href{http://www.libpng.org/
}{libpng
}
67 \item \href{http://libjpeg.sourceforge.net/
}{libjpeg
}
69 \item to run XCSoar, you need one of the following fonts (Debian
70 package): DejaVu (
\texttt{ttf-dejavu
}), Droid (
\texttt{ttf-droid
}),
71 Freefont (
\texttt{ttf-freefont
})
74 The following command installs these on Debian:
77 apt-get install make g++ \
78 libboost-dev zlib1g-dev \
79 libsdl1.2-dev libsdl-ttf2.0-dev \
80 libpng-dev libjpeg-dev \
81 libcurl4-openssl-dev \
83 librsvg2-bin xsltproc \
94 You may specify one of the following targets with
\texttt{TARGET=x
}:
96 \begin{tabular
}{lp
{8cm
}}
98 \texttt{UNIX
} & regular build (the default setting) \\
100 \texttt{UNIX32
} & generate
32 bit binary \\
102 \texttt{UNIX64
} & generate
64 bit binary \\
104 \texttt{OPT
} & alias for UNIX with optimisation and no debugging \\
108 \subsection{Compiling for Android
}
110 For Android, you need:
113 \item \href{http://developer.android.com/sdk/
}{Android SDK level
16}
114 \item \href{http://developer.android.com/sdk/ndk/
}{Android NDK r8e
}
115 \item \href{http://www.vorbis.com/
}{Ogg Vorbis
}
116 \item \href{http://ant.apache.org/
}{Apache Ant
}
119 The
\texttt{Makefile
} assumes that the Android SDK is installed in
120 \verb|~/opt/android-sdk-linux_x86| and the NDK is installed in
121 \verb|~/opt/android-ndk-r8e|. You can use the options
122 \verb|ANDROID_SDK| and
\verb|ANDROID_NDK| to override these paths.
130 Use one of the following targets:
132 \begin{tabular
}{lp
{8cm
}}
134 \texttt{ANDROID
} & for ARMv6 CPUs \\
136 \texttt{ANDROID7
} & for ARMv7 CPUs \\
138 \texttt{ANDROID7NEON
} & with
139 \href{http://www.arm.com/products/processors/technologies/neon.php
}{NEON
}
142 \texttt{ANDROID86
} & for x86 CPUs \\
144 \texttt{ANDROIDMIPS
} & for MIPS CPUs \\
146 \texttt{ANDROIDFAT
} & "fat" package for all supported CPUs \\
150 \subsubsection{Enabling IOIO Support
}
152 IOIO support must be enabled explicitly, because it depends on
153 IOIOLib. First get the IOIOLib source code:
156 git clone git://github.com/ytai/ioio.git
159 Now add the parameter
\verb|IOIOLIB_DIR| pointing to this repository:
162 make TARGET=ANDROID clean
163 make TARGET=ANDROID \
164 IOIOLIB_DIR=/usr/src/git/ioio/software/IOIOLib
167 The first command may be necessary if the output directory already
168 contains binaries without IOIO support.
170 \subsection{Compiling for Windows
}
172 To cross-compile to (desktop) Windows, you need the mingw-w64 version
175 http://mingw-w64.sourceforge.net/
177 To compile, run one of the following:
183 Use one of the following targets:
185 \begin{tabular
}{lp
{8cm
}}
187 \texttt{PC
} &
32 bit Windows (i686) \\
189 \texttt{WIN64
} & Windows x64 (amd64 / x86-
64) \\
191 \texttt{WINE
} & WineLib (experimental) \\
193 \texttt{CYGWIN
} & Windows build with Cygwin (experimental) \\
197 \subsection{Compiling for Windows CE
}
199 For PocketPC / Windows CE / Windows Mobile, you need mingw32ce:
202 \item \href{http://max.kellermann.name/projects/cegcc/
}{mingw32ce
}
211 Use one of the following targets:
213 \begin{tabular
}{lp
{8cm
}}
215 \texttt{PPC2000
} & PocketPC
2000 / Windows CE
3.0 \\
217 \texttt{PPC2003
} & PocketPC
2003 / Windows CE
4.0 \\
219 \texttt{PPC2003X
} & for XScale CPUs \\
221 \texttt{WM5
} & Windows Mobile / Windows CE
5.0 \\
223 \texttt{WM5X
} & for XScale CPUs \\
225 \texttt{ALTAIR
} & for Triadis Altair \\
229 \subsection{Compiling for Mac OS X
}
231 For Mac OS X, you need:
234 \item GCC
4.6.2 or newer (http://hpc.sourceforge.net/, or homebrew, or Macports)
235 \item \href{http://www.boost.org/
}{Boost
}
236 \item \href{http://www.zlib.net/
}{zlib
}
237 \item \href{http://curl.haxx.se/
}{CURL
}
238 \item \href{http://www.libsdl.org/
}{SDL
}
239 \item \href{http://www.libsdl.org/projects/SDL
\_ttf/
}{SDL
\_ttf}
240 \item \href{http://www.libpng.org/
}{libpng
}
241 \item \href{http://libjpeg.sourceforge.net/
}{libjpeg
}
242 \item \href{http://icns.sourceforge.net/
}{libicns
}
245 \subsection{Compiling for the Raspberry Pi
}
253 This target is only used for cross-compiling on a (desktop) computer.
254 If you compile on the Raspberry Pi, the default target will
257 \subsection{Compiling for Kobo E-book Readers
}
267 \subsection{Parallel Build
}
269 Most contemporary computers have multiple CPU cores. To take
270 advantage of these, use the
\texttt{make -j
} option:
276 This command launches
12 compiler processes at the same time.
278 Rule of thumb: choose a number that is slightly larger than the number
279 of CPU cores in your computer.
12 is a good choice for a computer
282 \subsection{Optimised Build
}
284 By default, debugging is enabled and compiler optimisations are
285 disabled. The resulting binaries are very slow. During development,
286 that is helpful, because it catches more bugs.
288 To produce optimised binaries, use the option
\texttt{DEBUG
}:
294 Be sure to clean the output directory before you change the
295 \texttt{DEBUG
} setting, because debug and non-debug output files are
298 The convenience target
\texttt{OPT
} is a shortcut for:
301 TARGET=UNIX DEBUG=n TARGET_OUTPUT_DIR=output/OPT
304 It allows building both debug and non-debug incrementally, because two
305 different output directories are used.