xref: /freebsd/sys/contrib/libsodium/packaging/dotnet-core/README.md (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1*0ac341f1SConrad MeyerThis directory contains scripts and files to package libsodium for .NET Core.
2*0ac341f1SConrad Meyer
3*0ac341f1SConrad Meyer*Note:* The NuGet package is intended for the implementation of language
4*0ac341f1SConrad Meyerbindings such as [NSec](https://github.com/ektrah/nsec). It does not provide a
5*0ac341f1SConrad Meyer.NET API itself.
6*0ac341f1SConrad Meyer
7*0ac341f1SConrad MeyerIn .NET Core, it is customary to provide pre-compiled binaries for all platforms
8*0ac341f1SConrad Meyeras NuGet packages. The purpose of the `prepare.py` script in this directory is
9*0ac341f1SConrad Meyerto generate a `Makefile` that downloads and builds libsodium binaries for a
10*0ac341f1SConrad Meyernumber of platforms and assembles them in a NuGet package that can be uploaded
11*0ac341f1SConrad Meyerto [nuget.org](https://nuget.org/).
12*0ac341f1SConrad Meyer
13*0ac341f1SConrad Meyer* For Windows, binaries are obtained from
14*0ac341f1SConrad Meyer  [download.libsodium.org](https://download.libsodium.org/libsodium/releases/).
15*0ac341f1SConrad Meyer* For macOS, binaries are extracted from the
16*0ac341f1SConrad Meyer  [Homebrew libsodium bottle](https://bintray.com/homebrew/bottles/libsodium).
17*0ac341f1SConrad Meyer* For Linux, libsodium is compiled in Docker containers.
18*0ac341f1SConrad Meyer
19*0ac341f1SConrad MeyerSee `prepare.py` for the complete list of supported platforms.
20*0ac341f1SConrad Meyer
21*0ac341f1SConrad MeyerThe metadata for the NuGet package is located in `libsodium.props`.
22*0ac341f1SConrad Meyer
23*0ac341f1SConrad Meyer
24*0ac341f1SConrad Meyer**Versioning**
25*0ac341f1SConrad Meyer
26*0ac341f1SConrad MeyerVersion numbers for the packages for .NET Core consist of three components:
27*0ac341f1SConrad Meyer
28*0ac341f1SConrad Meyer* *libsodium version*
29*0ac341f1SConrad Meyer  The libsodium version is in the format `X.Y.Z`.
30*0ac341f1SConrad Meyer* *package revision*
31*0ac341f1SConrad Meyer  It may be necessary to release more than one package for a libsodium version,
32*0ac341f1SConrad Meyer  e.g., when adding support for a new platform or if a release contains a broken
33*0ac341f1SConrad Meyer  binary. In this case, a package revision number is added as a fourth part to
34*0ac341f1SConrad Meyer  the libsodium version, starting at `1`. For example, `1.0.16` is the initial
35*0ac341f1SConrad Meyer  release of the package for libsodium 1.0.16 and `1.0.16.5` is the fifth
36*0ac341f1SConrad Meyer  revision (sixth release) of that package.
37*0ac341f1SConrad Meyer* *pre-release label*
38*0ac341f1SConrad Meyer  If a package is a pre-release, a label is appended to the version number in
39*0ac341f1SConrad Meyer  `-preview-##` format where `##` is the number of the pre-release, starting at
40*0ac341f1SConrad Meyer  `01`. For example, `1.0.16-preview-01` is the first pre-release of the package
41*0ac341f1SConrad Meyer  for libsodium 1.0.16 and `1.0.16.5-preview-02` the second pre-release of the
42*0ac341f1SConrad Meyer  fifth revision of the package for libsodium 1.0.16.
43*0ac341f1SConrad Meyer
44*0ac341f1SConrad Meyer
45*0ac341f1SConrad Meyer**Making a release**
46*0ac341f1SConrad Meyer
47*0ac341f1SConrad Meyer1. Update any existing Docker images.
48*0ac341f1SConrad Meyer2. Run `python3 prepare.py <version>` to generate the `Makefile`, where
49*0ac341f1SConrad Meyer   `<version>` is the package version number in the format described above.
50*0ac341f1SConrad Meyer3. Take a look at the generated `Makefile`. It uses `sudo` a few times.
51*0ac341f1SConrad Meyer4. Run `make` to download and build the binaries and create the NuGet package.
52*0ac341f1SConrad Meyer   You may need to install `docker`, `make`, `curl`, `tar` and `unzip` first.
53*0ac341f1SConrad Meyer5. Grab a cup of coffee. Downloading the Docker images and compiling the Linux
54*0ac341f1SConrad Meyer   binaries takes a while. When done, the NuGet package is output as a `.nupkg`
55*0ac341f1SConrad Meyer   file in the `build` directory.
56*0ac341f1SConrad Meyer6. Run `make test` to perform a quick test of the NuGet package. Verify that
57*0ac341f1SConrad Meyer   everything else in the `.nupkg` file is in place.
58*0ac341f1SConrad Meyer7. Publish the release by uploading the `.nupkg` file to
59*0ac341f1SConrad Meyer   [nuget.org](https://nuget.org/).
60