Skip to content

Commit cb67c9c

Browse files
committed
README: provide some information to future hackers
1 parent 9d88851 commit cb67c9c

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Native Binaries NuGet Package for LibGit2Sharp
2+
==============================================
3+
4+
[Libgit2Sharp](https://github.com/libgit2/libgit2sharp) is a managed
5+
wrapper around [libgit2](https://github.com/libgit2/libgit2), and as
6+
such requires compilation of libgit2 for your platform. LibGit2Sharp
7+
makes this easy by distributing NuGet packages that include precompiled
8+
versions of these native binaries.
9+
10+
If you need to build your own native binaries for some reason, you can
11+
do so easily with the scripts in this repository:
12+
13+
1. Clone the LibGit2Sharp repository. Do so recursively to ensure that
14+
the `libgit2` submodule is initialized automatically:
15+
16+
`git clone --recursive https://github.com/libgit2/libgit2sharp.nativebinaries`
17+
18+
(If you have already cloned this repository, you can simply run
19+
`git submodule init` followed by `git submodule update`.)
20+
21+
2. Update the included libgit2 sources and configuration files to the
22+
version of libgit2 you want to build. For example, to build
23+
commit `1a2b3c4`:
24+
25+
`UpdateLibgit2ToSha.ps1 1a2b3c4`
26+
27+
Or you can specify references. To build the remote's `master` branch:
28+
29+
`UpdateLibgit2ToSha.ps1 master`
30+
31+
3. Build the libgit2 binaries. For Windows, this requires a Visual Studio
32+
installation, and will compile both x86 and amd64 variants. (See
33+
"Notes on Visual Studio", below). Run the build PowerShell script,
34+
specifying the version number of Visual Studio as the first argument.
35+
For example, to build with Visual Studio 2013 (aka "Visual Studio 12.0"):
36+
37+
`build.libgit2.ps1 12`
38+
39+
For Linux, this will build only the architecture that you're running
40+
(x86 or amd64). For Mac OS X, this will build a fat library that
41+
includes both x86 and amd64. Run the shell script:
42+
43+
`build.libgit2.sh`
44+
45+
4. Create the NuGet package from the built binaries. You will need to
46+
specify the version number of the resultant NuGet package that you
47+
want to generate. Note that you may wish to provide a suffix to
48+
disambiguate your custom package from the official, published NuGet
49+
packages. For example, if you are building a product called
50+
`fooproduct` then that may be a helpful suffix.
51+
52+
To build a NuGet package at version `1.2.3-foo`:
53+
54+
`buildpackage.ps1 1.2.3-foo`
55+
56+
And the result will be a NuGet package in the current directory:
57+
58+
`LibGit2Sharp.NativeBinaries.1.2.3-foo.nupkg`
59+
60+
Specifying custom DLL names
61+
---------------------------
62+
If you want to redistribute a LibGit2Sharp that uses a custom libgit2,
63+
you may want to change the name of the libgit2 shared library file to
64+
disambiguate it from other installations. This may be useful if you
65+
are running as a plugin inside a larger process and wish to avoid
66+
conflicting with other plugins who may wish to use LibGit2Sharp and
67+
want to ensure that *your* version of libgit2 is loaded into memory
68+
and available to you.
69+
70+
For example, if your plugin names if `fooplugin`, you may wish to
71+
distribute a DLL named `git2-fooplugin.dll`. You can specify the
72+
custom DLL name as the second argument to the update and build scripts:
73+
74+
UpdateLibgit2ToSha.ps1 1a2b3c4 git2-fooplugin
75+
build.libgit2.sh 14 git2-fooplugin
76+
77+
Then build the NuGet package as described above, making sure to provide
78+
a helpful suffix to ensure that your NuGet package will not be confused
79+
with the official packages.
80+
81+
Notes on Visual Studio
82+
----------------------
83+
Visual Studio is required to build the native binaries, however you
84+
do not need to install a *paid* version of Visual Studio. libgit2
85+
can be compiled using [Visual Studio Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs),
86+
which is free for building open source applications.
87+
88+
You need to specify the actual version number (not the marketing name)
89+
of Visual Studio. (For example, "Visual Studio 2013" is the name of the
90+
product, but its actual version number is "12.0".) A handy guide:
91+
92+
| Marketing Name | Version Number
93+
|--------------------|---------------
94+
| Visual Studio 2010 | 10.0
95+
| Visual Studio 2012 | 11.0
96+
| Visual Studio 2013 | 12.0
97+
| Visual Studio 2015 | 14.0
98+

0 commit comments

Comments
 (0)