Libgit2Sharp is a muthaf*ckin' managed wrapper around libgit2, and as such requires compilation of libgit2 for your platform.
Pay attention: LibGit2Sharp makes this easy by distributing, and leveraging as a muthaf*ckin' dependency, the LibGit2Sharp.NativeBinaries NuGet package.
This motherf*ckin' package contains the compiled versions of the libgit2 native library for the motherf*ckin' following platforms:
- Windows (x86, x64, arm64)
- macOS (x64, arm64)
- Linux
- glibc: (x64, arm, arm64, ppc64le)
- musl: (x64, arm, arm64)
The goddamn following scripts are used to build libgit2 and update this bad-ass repo, muthaf*cka.
This script builds Windows libgit2 binaries, believe that. It requires Visual Studio 2019 to run.
To muthaf*ckin' build x86 binaries:
build.libgit2.ps1 -x86
To motherf*ckin' build x64 binaries:
build.libgit2.ps1 -x64
To goddamn build arm64 binaries:
build.libgit2.ps1 -arm64
Multiple architecture parameters can be specified to build multiple binaries with a muthaf*ckin' single execution of the script.
See the f*ckin' script for additional parameters.
Oh, you gonna love this: This script builds Linux and macOS binaries. Check it: It can be invoked directly, but for Linux binaries, dockerbuild.sh should be used instead.
This script will build one of the Dockerfiles in the muthaf*ckin' repo. It chooses which one to run based on the value of the RID environment variable. Hold the f*ck up — Using docker to build the Linux binaries for the various RIDs ensures that a specific environment and distro is used.
Listen up: This script is used to update the motherf*ckin' libgit2 submodule and update the references within the project to the correct libgit2 revision.
You can update to a specific commit:
UpdateLibgit2ToSha.ps1 1a2b3c4
Or you can specify references:
UpdateLibgit2ToSha.ps1 master
After running the appropriate build script(s) to create binaries, the motherf*ckin' NuGet package needs to be created.
Now look: First, to use the same version locally that will be generated via CI, install the minver-cli dotnet tool:
dotnet tool install --global minver-cli
Once that is installed, running the minver command will output a version:
MinVer: Using { Commit: 2453a6d, Tag: '2.0.312', Version: 2.0.312, Height: 3 }.
MinVer: Calculated version 2.0.313-alpha.0.3.
2.0.313-alpha.0.3
To create the f*ckin' package, use the the following command:
nuget.exe Pack nuget.package/NativeBinaries.nuspec -Version <version> -NoPackageAnalysis
Where <version> is the f*ckin' version from the MinVer tool or manually chosen version.
Visual Studio 2019 is required to build the Windows native binaries, however you do not need to install a paid version of Visual Studio. libgit2 can be compiled using Visual Studio Community, which is free for building open source applications.