]>
Commit | Line | Data |
---|---|---|
4b7483a2 | 1 | libgit2 - the Git linkable library |
c5b97d5a | 2 | ====================== |
4b7483a2 SC |
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 | ||
b760fbf5 VM |
8 | libgit2 is licensed under a **very permissive license** (GPLv2 with a special Linking Exception). |
9 | This basically means that you can link it (unmodified) with any kind of software without having to | |
10 | release its source code. | |
11 | ||
12 | * Mailing list: <libgit2@librelist.org> | |
e0d9e12e VM |
13 | * Website: <http://libgit2.github.com> |
14 | * API documentation: <http://libgit2.github.com/libgit2/modules.html> | |
15 | * Usage guide: <http://libgit2.github.com/api.html> | |
4b7483a2 SC |
16 | |
17 | What It Can Do | |
18 | ================================== | |
19 | ||
20 | libgit2 is already very usable. | |
c5b97d5a | 21 | |
b760fbf5 VM |
22 | * SHA conversions, formatting and shortening |
23 | * object reading (loose and packed) | |
24 | * object writing (loose) | |
25 | * commit, tag, tree and blob parsing and write-back | |
4b7483a2 | 26 | * tree traversal |
b760fbf5 VM |
27 | * revision walking |
28 | * index file (staging area) manipulation | |
29 | * custom ODB backends | |
30 | * reference management (including packed references) | |
31 | * ...and more | |
32 | ||
4b7483a2 | 33 | |
e0d9e12e VM |
34 | Building libgit2 - External dependencies |
35 | ======================================== | |
ec821ca6 | 36 | |
ab6a3d3d VM |
37 | libgit2 builds cleanly on most platforms without any external dependencies. However, the following libraries |
38 | may be used on some platforms. | |
b97b386d | 39 | |
e0d9e12e | 40 | * LibSSL **(optional)** <http://www.openssl.org/> |
b97b386d | 41 | |
e0d9e12e | 42 | libgit2 can be built using the SHA1 implementation of LibSSL-Crypto, instead of the built-in custom implementations. Performance wise, they are quite similar. |
e5fd5b94 | 43 | |
ab6a3d3d | 44 | * pthreads-w32 **(required for MinGW)** <http://sourceware.org/pthreads-win32/> |
b97b386d | 45 | |
e0d9e12e VM |
46 | Building libgit2 - Using waf |
47 | ====================== | |
e5fd5b94 | 48 | |
e0d9e12e | 49 | Waf is a minimalist build system which only requires a Python 2.5+ interpreter to run. This is the default build system for libgit2. |
b97b386d | 50 | |
e0d9e12e | 51 | To build libgit2 using waf, first configure the build system by running: |
b97b386d | 52 | |
e0d9e12e | 53 | $ ./waf configure |
b97b386d | 54 | |
e0d9e12e | 55 | Then build the library, either in its shared (libgit2.so) or static form (libgit2.a): |
b97b386d | 56 | |
c5b97d5a SC |
57 | $ ./waf build-static |
58 | $ ./waf build-shared | |
b97b386d | 59 | |
e0d9e12e | 60 | You can then run the full test suite with: |
b97b386d | 61 | |
c5b97d5a | 62 | $ ./waf test |
b97b386d | 63 | |
e0d9e12e | 64 | And finally you can install the library with (you may need to sudo): |
b97b386d | 65 | |
e0d9e12e | 66 | $ sudo ./waf install |
b97b386d VM |
67 | |
68 | The waf build system for libgit2 accepts the following flags: | |
69 | ||
70 | --debug | |
71 | build the library with debug symbols. | |
72 | Defaults to off. | |
73 | ||
74 | --sha1=[builtin|ppc|openssl] | |
75 | use the builtin SHA1 functions, the optimized PPC versions | |
76 | or the SHA1 functions from LibCrypto (OpenSSL). | |
77 | Defaults to 'builtin'. | |
4b7483a2 | 78 | |
e5fd5b94 VM |
79 | --msvc=[7.1|8.0|9.0|10.0] |
80 | Force a specific version of the MSVC compiler, if more than | |
81 | one version is installed. | |
82 | ||
83 | --arch=[ia64|x64|x86|x86_amd64|x86_ia64] | |
84 | Force a specific architecture for compilers that support it. | |
85 | ||
af774b01 OR |
86 | --without-sqlite |
87 | Disable sqlite support. | |
88 | ||
b97b386d VM |
89 | You can run `./waf --help` to see a full list of install options and |
90 | targets. | |
4b7483a2 | 91 | |
4b7483a2 | 92 | |
e0d9e12e VM |
93 | Building libgit2 - Using CMake |
94 | ============================== | |
4b7483a2 | 95 | |
e0d9e12e | 96 | The libgit2 library can also be built using CMake 2.6+ (<http://www.cmake.org>) on all platforms. |
4b7483a2 | 97 | |
e0d9e12e | 98 | On most systems you can build the library using the following commands |
4b7483a2 | 99 | |
e0d9e12e VM |
100 | $ mkdir build && cd build |
101 | $ cmake .. | |
102 | $ cmake --build . | |
c5b97d5a | 103 | |
e0d9e12e VM |
104 | Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace. |
105 | ||
106 | To install the library you can specify the install prefix by setting: | |
4b7483a2 | 107 | |
e0d9e12e VM |
108 | $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix |
109 | $ cmake --build . --target install | |
4b7483a2 | 110 | |
e0d9e12e | 111 | For more advanced use or questions about CMake please read <http://www.cmake.org/Wiki/CMake_FAQ>. |
c5b97d5a | 112 | |
c5b97d5a | 113 | |
e0d9e12e VM |
114 | Language Bindings |
115 | ================================== | |
4b7483a2 | 116 | |
e0d9e12e | 117 | Here are the bindings to libgit2 that are currently available: |
4b7483a2 | 118 | |
e0d9e12e | 119 | * Rugged (Ruby bindings) <https://github.com/libgit2/rugged> |
74bcb63f | 120 | * objective-git (Objective-C bindings) <https://github.com/libgit2/objective-git> |
b760fbf5 VM |
121 | * pygit2 (Python bindings) <https://github.com/libgit2/pygit2> |
122 | * libgit2sharp (.NET bindings) <https://github.com/libgit2/libgit2sharp> | |
123 | * php-git (PHP bindings) <https://github.com/libgit2/php-git> | |
124 | * luagit2 (Lua bindings) <https://github.com/libgit2/luagit2> | |
125 | * GitForDelphi (Delphi bindings) <https://github.com/libgit2/GitForDelphi> | |
126 | * node-gitteh (Node.js bindings) <https://github.com/libgit2/node-gitteh> | |
11a203e1 | 127 | * nodegit (Node.js bindings) <https://github.com/tbranyen/nodegit> |
b760fbf5 | 128 | * libqgit2 (C++ QT bindings) <https://projects.kde.org/projects/playground/libs/libqgit2/> |
e0d9e12e | 129 | * Geef (Erlang bindings) <https://github.com/schacon/geef> |
4b7483a2 SC |
130 | |
131 | If you start another language binding to libgit2, please let us know so | |
132 | we can add it to the list. | |
133 | ||
c5b97d5a SC |
134 | How Can I Contribute |
135 | ================================== | |
136 | ||
137 | Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch | |
138 | in your fork named for the topic, send a pull request. | |
139 | ||
140 | You can also file bugs or feature requests under the libgit2 project on | |
141 | GitHub, or join us on the mailing list by sending an email to: | |
142 | ||
143 | libgit2@librelist.com | |
144 | ||
145 | ||
4b7483a2 SC |
146 | License |
147 | ================================== | |
e0d9e12e | 148 | libgit2 is under GPL2 **with linking exemption**. This means you |
4b7483a2 SC |
149 | can link to the library with any program, commercial, open source or |
150 | other. However, you cannot modify libgit2 and distribute it without | |
151 | supplying the source. | |
152 | ||
153 | See the COPYING file for the full license text. |