]>
Commit | Line | Data |
---|---|---|
4b7483a2 | 1 | libgit2 - the Git linkable library |
c5b97d5a | 2 | ====================== |
4b7483a2 | 3 | |
37029314 PD |
4 | [![Build Status](https://secure.travis-ci.org/libgit2/libgit2.png?branch=development)](http://travis-ci.org/libgit2/libgit2) |
5 | ||
4b7483a2 SC |
6 | libgit2 is a portable, pure C implementation of the Git core methods provided as a |
7 | re-entrant linkable library with a solid API, allowing you to write native | |
8 | speed custom Git applications in any language with bindings. | |
9 | ||
b760fbf5 VM |
10 | libgit2 is licensed under a **very permissive license** (GPLv2 with a special Linking Exception). |
11 | This basically means that you can link it (unmodified) with any kind of software without having to | |
12 | release its source code. | |
13 | ||
e0d9e12e | 14 | * Website: <http://libgit2.github.com> |
3e3d332b MW |
15 | * StackOverflow Tag: [libgit2](http://stackoverflow.com/questions/tagged/libgit2) |
16 | * Issues: <https://github.com/libgit2/libgit2/issues> | |
e49020e0 | 17 | * API documentation: <http://libgit2.github.com/libgit2> |
743048f1 | 18 | * IRC: #libgit2 on irc.freenode.net. |
3e3d332b MW |
19 | * Mailing list: The libgit2 mailing list was |
20 | traditionally hosted in Librelist but has been deprecated. We encourage you to | |
41a93cc6 | 21 | [use StackOverflow](http://stackoverflow.com/questions/tagged/libgit2) instead for any questions regarding |
bef59b1b | 22 | the library, or [open an issue](https://github.com/libgit2/libgit2/issues) |
41a93cc6 | 23 | on GitHub for bug reports. The mailing list archives are still available at |
3e3d332b MW |
24 | <http://librelist.com/browser/libgit2/>. |
25 | ||
4b7483a2 SC |
26 | |
27 | What It Can Do | |
28 | ================================== | |
29 | ||
3e3d332b MW |
30 | libgit2 is already very usable and is being used in production for many applications including the GitHub.com site, in Plastic SCM |
31 | and also powering Microsoft's Visual Studio tools for Git. The library provides: | |
c5b97d5a | 32 | |
b760fbf5 | 33 | * SHA conversions, formatting and shortening |
5689a8d5 | 34 | * abstracted ODB backend system |
7548b8af | 35 | * commit, tag, tree and blob parsing, editing, and write-back |
4b7483a2 | 36 | * tree traversal |
b760fbf5 VM |
37 | * revision walking |
38 | * index file (staging area) manipulation | |
b760fbf5 | 39 | * reference management (including packed references) |
7548b8af VM |
40 | * config file management |
41 | * high level repository management | |
42 | * thread safety and reentrancy | |
43 | * descriptive and detailed error messages | |
44 | * ...and more (over 175 different API calls) | |
b760fbf5 | 45 | |
7548b8af VM |
46 | Building libgit2 - Using CMake |
47 | ============================== | |
ec821ca6 | 48 | |
bbcc7ffc | 49 | libgit2 builds cleanly on most platforms without any external dependencies. |
a07d8994 | 50 | Under Unix-like systems, like Linux, \*BSD and Mac OS X, libgit2 expects `pthreads` to be available; |
bbcc7ffc VM |
51 | they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API |
52 | for threading. | |
53 | ||
7548b8af | 54 | The libgit2 library is built using CMake 2.6+ (<http://www.cmake.org>) on all platforms. |
4b7483a2 | 55 | |
e0d9e12e | 56 | On most systems you can build the library using the following commands |
4b7483a2 | 57 | |
e0d9e12e VM |
58 | $ mkdir build && cd build |
59 | $ cmake .. | |
60 | $ cmake --build . | |
c5b97d5a | 61 | |
e0d9e12e VM |
62 | Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace. |
63 | ||
64 | To install the library you can specify the install prefix by setting: | |
4b7483a2 | 65 | |
e0d9e12e VM |
66 | $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix |
67 | $ cmake --build . --target install | |
4b7483a2 | 68 | |
e0d9e12e | 69 | For more advanced use or questions about CMake please read <http://www.cmake.org/Wiki/CMake_FAQ>. |
c5b97d5a | 70 | |
7548b8af VM |
71 | The following CMake variables are declared: |
72 | ||
9795a40f | 73 | - `BIN_INSTALL_DIR`: Where to install binaries to. |
77ace82d | 74 | - `LIB_INSTALL_DIR`: Where to install libraries to. |
9795a40f | 75 | - `INCLUDE_INSTALL_DIR`: Where to install headers to. |
f0890fcc | 76 | - `BUILD_SHARED_LIBS`: Build libgit2 as a Shared Library (defaults to ON) |
221ee54b | 77 | - `BUILD_CLAR`: Build [Clar](https://github.com/vmg/clar)-based test suite (defaults to ON) |
7548b8af | 78 | - `THREADSAFE`: Build libgit2 with threading support (defaults to OFF) |
66bf4dbc CMN |
79 | - `STDCALL`: Build libgit2 as `stdcall`. Turn off for `cdecl` (Windows; defaults to ON) |
80 | ||
81 | Compiler and linker options | |
82 | --------------------------- | |
83 | ||
84 | CMake lets you specify a few variables to control the behavior of the | |
85 | compiler and linker. These flags are rarely used but can be useful for | |
86 | 64-bit to 32-bit cross-compilation. | |
87 | ||
88 | - `CMAKE_C_FLAGS`: Set your own compiler flags | |
89 | - `CMAKE_FIND_ROOT_PATH`: Override the search path for libraries | |
90 | - `ZLIB_LIBRARY`, `OPENSSL_SSL_LIBRARY` AND `OPENSSL_CRYPTO_LIBRARY`: | |
91 | Tell CMake where to find those specific libraries | |
92 | ||
93 | MacOS X | |
94 | ------- | |
95 | ||
96 | If you want to build a universal binary for Mac OS X, CMake sets it | |
97 | all up for you if you use `-DCMAKE_OSX_ARCHITECTURES="i386;x86_64"` | |
98 | when configuring. | |
99 | ||
100 | Windows | |
101 | ------- | |
102 | ||
103 | You need to run the CMake commands from the Visual Studio command | |
104 | prompt, not the regular or Windows SDK one. Select the right generator | |
105 | for your version with the `-G "Visual Studio X" option. | |
106 | ||
107 | See [the wiki] | |
108 | (https://github.com/libgit2/libgit2/wiki/Building-libgit2-on-Windows) | |
109 | for more detailed instructions. | |
c5b97d5a | 110 | |
e0d9e12e VM |
111 | Language Bindings |
112 | ================================== | |
4b7483a2 | 113 | |
e0d9e12e | 114 | Here are the bindings to libgit2 that are currently available: |
4b7483a2 | 115 | |
b8d08292 AL |
116 | * C++ |
117 | * libqgit2, Qt bindings <https://projects.kde.org/projects/playground/libs/libqgit2/> | |
0e8144fe EH |
118 | * Chicken Scheme |
119 | * chicken-git <https://wiki.call-cc.org/egg/git> | |
26127ea7 AM |
120 | * D |
121 | * dlibgit <https://github.com/AndrejMitrovic/dlibgit> | |
b8d08292 AL |
122 | * Delphi |
123 | * GitForDelphi <https://github.com/libgit2/GitForDelphi> | |
124 | * Erlang | |
a402179a | 125 | * Geef <https://github.com/carlosmn/geef> |
b8d08292 | 126 | * Go |
f2cda906 | 127 | * git2go <https://github.com/libgit2/git2go> |
b8d08292 | 128 | * GObject |
a7a2fccd | 129 | * libgit2-glib <https://live.gnome.org/Libgit2-glib> |
b8d08292 | 130 | * Haskell |
7d5b0f8b | 131 | * hgit2 <https://github.com/fpco/gitlib> |
b8d08292 AL |
132 | * Lua |
133 | * luagit2 <https://github.com/libgit2/luagit2> | |
134 | * .NET | |
b8d08292 | 135 | * libgit2sharp <https://github.com/libgit2/libgit2sharp> |
3e3d332b | 136 | * libgit2net, low level bindings superceeded by libgit2sharp <https://github.com/txdv/libgit2net> |
b8d08292 AL |
137 | * Node.js |
138 | * node-gitteh <https://github.com/libgit2/node-gitteh> | |
139 | * nodegit <https://github.com/tbranyen/nodegit> | |
140 | * Objective-C | |
141 | * objective-git <https://github.com/libgit2/objective-git> | |
142 | * OCaml | |
143 | * libgit2-ocaml <https://github.com/burdges/libgit2-ocaml> | |
144 | * Parrot Virtual Machine | |
145 | * parrot-libgit2 <https://github.com/letolabs/parrot-libgit2> | |
146 | * Perl | |
1cfaaa9e | 147 | * Git-Raw <https://github.com/ghedo/p5-Git-Raw> |
b8d08292 AL |
148 | * PHP |
149 | * php-git <https://github.com/libgit2/php-git> | |
150 | * Python | |
151 | * pygit2 <https://github.com/libgit2/pygit2> | |
152 | * Ruby | |
153 | * Rugged <https://github.com/libgit2/rugged> | |
154 | * Vala | |
155 | * libgit2.vapi <https://github.com/apmasell/vapis/blob/master/libgit2.vapi> | |
4b7483a2 SC |
156 | |
157 | If you start another language binding to libgit2, please let us know so | |
158 | we can add it to the list. | |
159 | ||
b8d08292 | 160 | How Can I Contribute? |
c5b97d5a SC |
161 | ================================== |
162 | ||
743048f1 | 163 | Check the [contribution guidelines](CONTRIBUTING.md). |
c5b97d5a SC |
164 | |
165 | ||
932d1baf | 166 | License |
4b7483a2 | 167 | ================================== |
e0d9e12e | 168 | libgit2 is under GPL2 **with linking exemption**. This means you |
4b7483a2 SC |
169 | can link to the library with any program, commercial, open source or |
170 | other. However, you cannot modify libgit2 and distribute it without | |
171 | supplying the source. | |
172 | ||
173 | See the COPYING file for the full license text. |