]>
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 | |
bbcc7ffc VM |
37 | libgit2 builds cleanly on most platforms without any external dependencies. |
38 | Under Unix-like systems, like Linux, *BSD and Mac OS X, libgit2 expects `pthreads` to be available; | |
39 | they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API | |
40 | for threading. | |
41 | ||
42 | Additionally, he following libraries may be used as replacement for built-in functionality: | |
b97b386d | 43 | |
e0d9e12e | 44 | * LibSSL **(optional)** <http://www.openssl.org/> |
b97b386d | 45 | |
e0d9e12e | 46 | 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 | 47 | |
e0d9e12e VM |
48 | Building libgit2 - Using waf |
49 | ====================== | |
e5fd5b94 | 50 | |
e0d9e12e | 51 | 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 | 52 | |
e0d9e12e | 53 | To build libgit2 using waf, first configure the build system by running: |
b97b386d | 54 | |
e0d9e12e | 55 | $ ./waf configure |
b97b386d | 56 | |
e0d9e12e | 57 | Then build the library, either in its shared (libgit2.so) or static form (libgit2.a): |
b97b386d | 58 | |
c5b97d5a SC |
59 | $ ./waf build-static |
60 | $ ./waf build-shared | |
b97b386d | 61 | |
e0d9e12e | 62 | You can then run the full test suite with: |
b97b386d | 63 | |
c5b97d5a | 64 | $ ./waf test |
b97b386d | 65 | |
e0d9e12e | 66 | And finally you can install the library with (you may need to sudo): |
b97b386d | 67 | |
e0d9e12e | 68 | $ sudo ./waf install |
b97b386d VM |
69 | |
70 | The waf build system for libgit2 accepts the following flags: | |
71 | ||
72 | --debug | |
73 | build the library with debug symbols. | |
74 | Defaults to off. | |
75 | ||
76 | --sha1=[builtin|ppc|openssl] | |
77 | use the builtin SHA1 functions, the optimized PPC versions | |
78 | or the SHA1 functions from LibCrypto (OpenSSL). | |
79 | Defaults to 'builtin'. | |
4b7483a2 | 80 | |
e5fd5b94 VM |
81 | --msvc=[7.1|8.0|9.0|10.0] |
82 | Force a specific version of the MSVC compiler, if more than | |
83 | one version is installed. | |
84 | ||
85 | --arch=[ia64|x64|x86|x86_amd64|x86_ia64] | |
86 | Force a specific architecture for compilers that support it. | |
87 | ||
af774b01 OR |
88 | --without-sqlite |
89 | Disable sqlite support. | |
90 | ||
b97b386d VM |
91 | You can run `./waf --help` to see a full list of install options and |
92 | targets. | |
4b7483a2 | 93 | |
4b7483a2 | 94 | |
e0d9e12e VM |
95 | Building libgit2 - Using CMake |
96 | ============================== | |
4b7483a2 | 97 | |
e0d9e12e | 98 | The libgit2 library can also be built using CMake 2.6+ (<http://www.cmake.org>) on all platforms. |
4b7483a2 | 99 | |
e0d9e12e | 100 | On most systems you can build the library using the following commands |
4b7483a2 | 101 | |
e0d9e12e VM |
102 | $ mkdir build && cd build |
103 | $ cmake .. | |
104 | $ cmake --build . | |
c5b97d5a | 105 | |
e0d9e12e VM |
106 | Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace. |
107 | ||
108 | To install the library you can specify the install prefix by setting: | |
4b7483a2 | 109 | |
e0d9e12e VM |
110 | $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix |
111 | $ cmake --build . --target install | |
4b7483a2 | 112 | |
e0d9e12e | 113 | For more advanced use or questions about CMake please read <http://www.cmake.org/Wiki/CMake_FAQ>. |
c5b97d5a | 114 | |
c5b97d5a | 115 | |
e0d9e12e VM |
116 | Language Bindings |
117 | ================================== | |
4b7483a2 | 118 | |
e0d9e12e | 119 | Here are the bindings to libgit2 that are currently available: |
4b7483a2 | 120 | |
e0d9e12e | 121 | * Rugged (Ruby bindings) <https://github.com/libgit2/rugged> |
74bcb63f | 122 | * objective-git (Objective-C bindings) <https://github.com/libgit2/objective-git> |
b760fbf5 VM |
123 | * pygit2 (Python bindings) <https://github.com/libgit2/pygit2> |
124 | * libgit2sharp (.NET bindings) <https://github.com/libgit2/libgit2sharp> | |
125 | * php-git (PHP bindings) <https://github.com/libgit2/php-git> | |
126 | * luagit2 (Lua bindings) <https://github.com/libgit2/luagit2> | |
127 | * GitForDelphi (Delphi bindings) <https://github.com/libgit2/GitForDelphi> | |
128 | * node-gitteh (Node.js bindings) <https://github.com/libgit2/node-gitteh> | |
11a203e1 | 129 | * nodegit (Node.js bindings) <https://github.com/tbranyen/nodegit> |
b760fbf5 | 130 | * libqgit2 (C++ QT bindings) <https://projects.kde.org/projects/playground/libs/libqgit2/> |
e0d9e12e | 131 | * Geef (Erlang bindings) <https://github.com/schacon/geef> |
4b7483a2 SC |
132 | |
133 | If you start another language binding to libgit2, please let us know so | |
134 | we can add it to the list. | |
135 | ||
c5b97d5a SC |
136 | How Can I Contribute |
137 | ================================== | |
138 | ||
139 | Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch | |
140 | in your fork named for the topic, send a pull request. | |
141 | ||
142 | You can also file bugs or feature requests under the libgit2 project on | |
143 | GitHub, or join us on the mailing list by sending an email to: | |
144 | ||
145 | libgit2@librelist.com | |
146 | ||
147 | ||
4b7483a2 SC |
148 | License |
149 | ================================== | |
e0d9e12e | 150 | libgit2 is under GPL2 **with linking exemption**. This means you |
4b7483a2 SC |
151 | can link to the library with any program, commercial, open source or |
152 | other. However, you cannot modify libgit2 and distribute it without | |
153 | supplying the source. | |
154 | ||
155 | See the COPYING file for the full license text. |