]>
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 | ||
e0d9e12e VM |
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> | |
4b7483a2 SC |
11 | |
12 | What It Can Do | |
13 | ================================== | |
14 | ||
15 | libgit2 is already very usable. | |
c5b97d5a | 16 | |
4b7483a2 SC |
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 | ||
e0d9e12e VM |
25 | Building libgit2 - External dependencies |
26 | ======================================== | |
ec821ca6 | 27 | |
e0d9e12e | 28 | The following libraries are required to manually build the libgit2 library: |
ec821ca6 PD |
29 | |
30 | * zlib 1.2+ <http://www.zlib.net/> | |
31 | ||
e0d9e12e | 32 | When building in Windows using MSVC, make sure you compile ZLib using the MSVC solution that ships in its source distribution. |
e5fd5b94 | 33 | Alternatively, you may download precompiled binaries from: <http://www.winimage.com/zLibDll/> |
b97b386d | 34 | |
e0d9e12e | 35 | * LibSSL **(optional)** <http://www.openssl.org/> |
b97b386d | 36 | |
e0d9e12e | 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. |
e5fd5b94 | 38 | |
e0d9e12e | 39 | * pthreads-w32 **(required on MinGW)** <http://sourceware.org/pthreads-win32/> |
b97b386d | 40 | |
e0d9e12e VM |
41 | Building libgit2 - Using waf |
42 | ====================== | |
e5fd5b94 | 43 | |
e0d9e12e | 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. |
b97b386d | 45 | |
e0d9e12e | 46 | To build libgit2 using waf, first configure the build system by running: |
b97b386d | 47 | |
e0d9e12e | 48 | $ ./waf configure |
b97b386d | 49 | |
e0d9e12e | 50 | Then build the library, either in its shared (libgit2.so) or static form (libgit2.a): |
b97b386d | 51 | |
c5b97d5a SC |
52 | $ ./waf build-static |
53 | $ ./waf build-shared | |
b97b386d | 54 | |
e0d9e12e | 55 | You can then run the full test suite with: |
b97b386d | 56 | |
c5b97d5a | 57 | $ ./waf test |
b97b386d | 58 | |
e0d9e12e | 59 | And finally you can install the library with (you may need to sudo): |
b97b386d | 60 | |
e0d9e12e | 61 | $ sudo ./waf install |
b97b386d VM |
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'. | |
4b7483a2 | 73 | |
e5fd5b94 VM |
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 | ||
af774b01 OR |
81 | --without-sqlite |
82 | Disable sqlite support. | |
83 | ||
b97b386d VM |
84 | You can run `./waf --help` to see a full list of install options and |
85 | targets. | |
4b7483a2 | 86 | |
4b7483a2 | 87 | |
e0d9e12e VM |
88 | Building libgit2 - Using CMake |
89 | ============================== | |
4b7483a2 | 90 | |
e0d9e12e | 91 | The libgit2 library can also be built using CMake 2.6+ (<http://www.cmake.org>) on all platforms. |
4b7483a2 | 92 | |
e0d9e12e | 93 | On most systems you can build the library using the following commands |
4b7483a2 | 94 | |
e0d9e12e VM |
95 | $ mkdir build && cd build |
96 | $ cmake .. | |
97 | $ cmake --build . | |
c5b97d5a | 98 | |
e0d9e12e VM |
99 | Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace. |
100 | ||
101 | To install the library you can specify the install prefix by setting: | |
4b7483a2 | 102 | |
e0d9e12e VM |
103 | $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix |
104 | $ cmake --build . --target install | |
4b7483a2 | 105 | |
e0d9e12e | 106 | For more advanced use or questions about CMake please read <http://www.cmake.org/Wiki/CMake_FAQ>. |
c5b97d5a | 107 | |
c5b97d5a | 108 | |
e0d9e12e VM |
109 | Language Bindings |
110 | ================================== | |
4b7483a2 | 111 | |
e0d9e12e | 112 | Here are the bindings to libgit2 that are currently available: |
4b7483a2 | 113 | |
e0d9e12e VM |
114 | * Rugged (Ruby bindings) <https://github.com/libgit2/rugged> |
115 | * pygit2 (Python bindings) <https://github.com/libgit2/pygit2> | |
116 | * libgit2sharp (.NET bindings) <https://github.com/nulltoken/libgit2sharp> | |
e04c7095 SC |
117 | * php-git (PHP bindings) <https://github.com/chobie/php-git> |
118 | * luagit2 (Lua bindings) <https://github.com/Neopallium/luagit2> | |
6f9024a7 | 119 | * GitForDelphi (Delphi bindings) <https://github.com/jasonpenny/GitForDelphi> |
74bcb63f | 120 | * objective-git (Objective-C bindings) <https://github.com/libgit2/objective-git> |
e0d9e12e | 121 | * Geef (Erlang bindings) <https://github.com/schacon/geef> |
4b7483a2 SC |
122 | |
123 | If you start another language binding to libgit2, please let us know so | |
124 | we can add it to the list. | |
125 | ||
c5b97d5a SC |
126 | How Can I Contribute |
127 | ================================== | |
128 | ||
129 | Fork libgit2/libgit2 on GitHub, add your improvement, push it to a branch | |
130 | in your fork named for the topic, send a pull request. | |
131 | ||
132 | You can also file bugs or feature requests under the libgit2 project on | |
133 | GitHub, or join us on the mailing list by sending an email to: | |
134 | ||
135 | libgit2@librelist.com | |
136 | ||
137 | ||
4b7483a2 SC |
138 | License |
139 | ================================== | |
e0d9e12e | 140 | libgit2 is under GPL2 **with linking exemption**. This means you |
4b7483a2 SC |
141 | can link to the library with any program, commercial, open source or |
142 | other. However, you cannot modify libgit2 and distribute it without | |
143 | supplying the source. | |
144 | ||
145 | See the COPYING file for the full license text. |