librsync  2.3.0
install.md
1 # Installing librsync {#page_install}
2 
3 ## Requirements
4 
5 To build librsync you will need:
6 
7 * A C compiler and appropriate headers and libraries
8 
9 * [CMake]
10 
11 * Some build tool supported by CMake: [Make] is most common,
12  [Ninja] is nicer.
13 
14 * [popt] command line parsing library
15 
16 * [Doxygen] - optional, to build docs
17 
18 [popt]: http://rpm5.org/files/popt/
19 [CMake]: http://cmake.org/
20 [Doxygen]: https://www.stack.nl/~dimitri/doxygen
21 [Ninja]: http://build-ninja.org
22 [Make]: https://www.gnu.org/software/make/
23 
24 ## Building
25 
26 Generate the Makefile by running
27 
28  $ cmake .
29 
30 After building you can install `rdiff` and `librsync` for system-wide use.
31 
32  $ make
33 
34 To build and run the tests:
35 
36  $ make check
37 
38 To install:
39 
40  $ sudo make install
41 
42 To build the documentation:
43 
44  $ make doc
45 
46 librsync should be widely portable. Patches to fix portability bugs are
47 welcome.
48 
49 If you are using GNU libc, you might like to use
50 
51  MALLOC_CHECK_=2 ./rdiff
52 
53 to detect some allocation bugs.
54 
55 librsync has annotations for the SPLINT static checking tool.
56 
57 
58 ## Build options
59 
60 The build is customizable by using CMake options in the configure step:
61 
62  $ cmake -D <option-name>=<value> .
63 
64 If you are interested in building only the `librsync` target, you can skip
65 the `rdiff` build. In this way you don't need its dependencies (e.g. `popt`).
66 To do that, set the `BUILD_RDIFF` option to `OFF`:
67 
68  $ cmake -D BUILD_RDIFF=OFF .
69 
70 Be aware that many tests depend on `rdiff` executable, so when it is disabled,
71 also those tests are.
72 
73 Compression support is under development (see
74 [#8](https://github.com/librsync/librsync/issues/8)). It is so disabled by
75 default. You can turn it on by using `ENABLE_COMPRESSION` option:
76 
77  $ cmake -D ENABLE_COMPRESSION=ON .
78 
79 To build code for debug trace messages:
80 
81  $ cmake -D ENABLE_TRACE=ON .
82 
83 ## Ninja builds
84 
85 CMake generates input files for an underlying build tool that will actually do
86 the build. Typically this is Make, but others are supported. In particular
87 [Ninja] is a nice alternative. To use it:
88 
89  $ cmake -G Ninja .
90  $ ninja check
91 
92 
93 ## Cygwin
94 
95 With Cygwin you can build using gcc as under a normal unix system. It
96 is also possible to compile under Cygwin using MSVC++. You must have
97 environment variables needed by MSVC set using the Vcvars32.bat
98 script.