]> git.proxmox.com Git - libgit2.git/blob - README.md
Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into nulltoken-repo...
[libgit2.git] / README.md
1 libgit2 - the Git linkable library
2 ======================
3
4 libgit2 is a portable, pure C implementation of the Git core methods provided as a
5 re-entrant linkable library with a solid API, allowing you to write native
6 speed custom Git applications in any language with bindings.
7
8 * Website: <http://libgit2.github.com>
9 * API documentation: <http://libgit2.github.com/libgit2/modules.html>
10 * Usage guide: <http://libgit2.github.com/api.html>
11
12 What It Can Do
13 ==================================
14
15 libgit2 is already very usable.
16
17 * raw <-> hex SHA conversions
18 * raw object reading (loose and packed)
19 * raw object writing (loose)
20 * revlist walker
21 * commit, tag and tree object parsing and write-back
22 * tree traversal
23 * basic index file (staging area) operations
24
25 Building libgit2 - External dependencies
26 ========================================
27
28 The following libraries are required to manually build the libgit2 library:
29
30 * zlib 1.2+ <http://www.zlib.net/>
31
32 When building in Windows using MSVC, make sure you compile ZLib using the MSVC solution that ships in its source distribution.
33 Alternatively, you may download precompiled binaries from: <http://www.winimage.com/zLibDll/>
34
35 * LibSSL **(optional)** <http://www.openssl.org/>
36
37 libgit2 can be built using the SHA1 implementation of LibSSL-Crypto, instead of the built-in custom implementations. Performance wise, they are quite similar.
38
39 * pthreads-w32 **(required on MinGW)** <http://sourceware.org/pthreads-win32/>
40
41 Building libgit2 - Using waf
42 ======================
43
44 Waf is a minimalist build system which only requires a Python 2.5+ interpreter to run. This is the default build system for libgit2.
45
46 To build libgit2 using waf, first configure the build system by running:
47
48 $ ./waf configure
49
50 Then build the library, either in its shared (libgit2.so) or static form (libgit2.a):
51
52 $ ./waf build-static
53 $ ./waf build-shared
54
55 You can then run the full test suite with:
56
57 $ ./waf test
58
59 And finally you can install the library with (you may need to sudo):
60
61 $ sudo ./waf install
62
63 The waf build system for libgit2 accepts the following flags:
64
65 --debug
66 build the library with debug symbols.
67 Defaults to off.
68
69 --sha1=[builtin|ppc|openssl]
70 use the builtin SHA1 functions, the optimized PPC versions
71 or the SHA1 functions from LibCrypto (OpenSSL).
72 Defaults to 'builtin'.
73
74 --msvc=[7.1|8.0|9.0|10.0]
75 Force a specific version of the MSVC compiler, if more than
76 one version is installed.
77
78 --arch=[ia64|x64|x86|x86_amd64|x86_ia64]
79 Force a specific architecture for compilers that support it.
80
81 You can run `./waf --help` to see a full list of install options and
82 targets.
83
84
85 Building libgit2 - Using CMake
86 ==============================
87
88 The libgit2 library can also be built using CMake 2.6+ (<http://www.cmake.org>) on all platforms.
89
90 On most systems you can build the library using the following commands
91
92 $ mkdir build && cd build
93 $ cmake ..
94 $ cmake --build .
95
96 Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace.
97
98 To install the library you can specify the install prefix by setting:
99
100 $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix
101 $ cmake --build . --target install
102
103 For more advanced use or questions about CMake please read <http://www.cmake.org/Wiki/CMake_FAQ>.
104
105
106 Language Bindings
107 ==================================
108
109 Here are the bindings to libgit2 that are currently available:
110
111 * Rugged (Ruby bindings) <https://github.com/libgit2/rugged>
112 * pygit2 (Python bindings) <https://github.com/libgit2/pygit2>
113 * libgit2sharp (.NET bindings) <https://github.com/nulltoken/libgit2sharp>
114 * Geef (Erlang bindings) <https://github.com/schacon/geef>
115
116 If you start another language binding to libgit2, please let us know so
117 we can add it to the list.
118
119 How Can I Contribute
120 ==================================
121
122 Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch
123 in your fork named for the topic, send a pull request.
124
125 You can also file bugs or feature requests under the libgit2 project on
126 GitHub, or join us on the mailing list by sending an email to:
127
128 libgit2@librelist.com
129
130
131 License
132 ==================================
133 libgit2 is under GPL2 **with linking exemption**. This means you
134 can link to the library with any program, commercial, open source or
135 other. However, you cannot modify libgit2 and distribute it without
136 supplying the source.
137
138 See the COPYING file for the full license text.