{"id":21683403,"url":"https://github.com/stonestepsinc/zlib-nuget","last_synced_at":"2026-01-05T18:05:20.870Z","repository":{"id":62339866,"uuid":"387656581","full_name":"StoneStepsInc/zlib-nuget","owner":"StoneStepsInc","description":"This project builds a zLib Nuget package with static zLib libraries and header files for Win32/x64 platforms and Debug/Release configurations.","archived":false,"fork":false,"pushed_at":"2024-09-22T14:50:40.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-17T06:20:38.470Z","etag":null,"topics":["library","nuget","static-library","zlib"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StoneStepsInc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-07-20T03:06:19.000Z","updated_at":"2024-09-22T13:35:43.000Z","dependencies_parsed_at":"2022-10-31T03:15:41.216Z","dependency_job_id":"db59ddac-e8eb-41f5-b7cd-353a755a472a","html_url":"https://github.com/StoneStepsInc/zlib-nuget","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":"0.014925373134328401","last_synced_commit":"4e7376fdbdb2093d888cf08ab70384942204ae3a"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Fzlib-nuget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Fzlib-nuget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Fzlib-nuget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StoneStepsInc%2Fzlib-nuget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StoneStepsInc","download_url":"https://codeload.github.com/StoneStepsInc/zlib-nuget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226358768,"owners_count":17612405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","nuget","static-library","zlib"],"created_at":"2024-11-25T16:11:48.156Z","updated_at":"2026-01-05T18:05:20.810Z","avatar_url":"https://github.com/StoneStepsInc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## zLib Nuget Package\r\n\r\nThis project builds a zLib Nuget package with static zLib\r\nlibraries and header files  for `Win32`/`x64` platforms.\r\n\r\nVisit zLib website for additional information about the zLib\r\nproject and library documentation:\r\n\r\nhttps://zlib.net/\r\n\r\n## Package Configuration\r\n\r\nThis package contains only static libraries for all platforms\r\nlisted above. There are no dynamic libraries included.\r\n\r\nThe zLib static libraries from this package will appear within\r\nthe installation target project after the package is installed.\r\nThe solution may need to be reloaded to make libraries visible.\r\nBoth, debug and release libraries will be listed in the project,\r\nbut only the one appropriate for the currently selected\r\nconfiguration will be included in the build. These libraries\r\nmay be moved into solution folders after the installation (e.g.\r\n`lib/Debug` and `lib/Release`).\r\n\r\nNote that the zLib library path in this package will be selected\r\nas `Debug` or `Release` based on whether the selected configuration\r\nis designated as a development or as a release configuration via\r\nthe standard Visual Studio property called `UseDebugLibraries`.\r\nAdditional configurations copied from the standard ones will\r\ninherit this property. \r\n\r\nDo not install this package if your projects use debug configurations\r\nwithout `UseDebugLibraries`. Note that CMake-generated Visual Studio\r\nprojects will not emit this property.\r\n\r\nSee `StoneSteps.zLib.VS2022.Static.props` and\r\n`StoneSteps.zLib.VS2022.Static.targets`\r\nfor specific package configuration details and file locations.\r\n\r\nThe static library is built with the `stdcall` calling convention.\r\n\r\nThe non-debug versions of the library are built with `NDEBUG`\r\ndefined, so `assert` calls work as intended for `Debug` and\r\n`Release` configurations.\r\n\r\n## Building a Nuget Package\r\n\r\nThis project can build a Nuget package for zLib either locally\r\nor via a GitHub workflow. In each case, following steps are taken.\r\n\r\n  * zLib source archive is downloaded from zLib's website and\r\n    its SHA-256 signature is verified.\r\n\r\n  * zLib's `Makefile.msc` is patched up to build debug libraries\r\n    using the debug CRT. See the _What's Debug CRT_ section for\r\n    more details.\r\n\r\n  * VS2022 Community Edition is used to build zLib libraries\r\n    locally and Enterprise Edition to build libraries on GitHub.\r\n\r\n  * Build artifacts for all platforms and configurations are\r\n    collected in staging directories under `nuget/build/native/lib`.\r\n\r\n  * `nuget.exe` is used to package staged files with the first\r\n    three version components used as a zLib version and the last\r\n    version component used as a package revision. See _Package\r\n    Version_ section for more details.\r\n\r\n  * The Nuget package built on GitHub is uploaded to [nuget.org][].\r\n    The package built locally is saved in the root project\r\n    directory.\r\n\r\n## Package Version\r\n\r\n### Package Revision\r\n\r\nNuget packages lack package revision and in order to repackage\r\nthe same upstream software version, such as zLib v1.2.11, the\r\n4th component of the Nuget version is used to track the Nuget\r\npackage revision.\r\n\r\nNuget package revision is injected outside of the Nuget package\r\nconfiguration, during the package build process, and is not present\r\nin the package specification file.\r\n\r\nSpecifically, `nuget.exe` is invoked with `-Version=1.2.11.123`\r\nto build a package with the revision `123`.\r\n\r\nIn cases when the upstream version lacks the patch level version\r\ncomponent, `.0` is injected to keep the version consistent with\r\nthe version pattern sequence (e.g. v1.3 is listed in Nuget as\r\nv1.3.0).\r\n\r\n### Version Locations\r\n\r\nzLib version is located in a few places in this repository and\r\nneeds to be changed in all of them for a new version of zLib.\r\n\r\n  * nuget/StoneSteps.zLib.VS2022.Static.nuspec (`version`)\r\n  * devops/make-package.bat (`PKG_VER`, `PKG_REV`, `ZLIB_FNAME`,\r\n    `ZLIB_SHA256`, `PKG_VER_PATCH`)\r\n  * .github/workflows/build-nuget-package.yml (`name`, `PKG_VER`,\r\n    `PKG_REV`, `ZLIB_FNAME`, `ZLIB_SHA256`, `PKG_VER_PATCH`)\r\n\r\n`ZLIB_SHA256` ia a SHA-256 checksum of the zLib package file and\r\nneeds to be changed when a new version of zLib is released.\r\n\r\nVerify that the new zLib archive follows the directory name\r\npattern used in the `ZLIB_DNAME` variable.\r\n\r\nIn the GitHub workflow YAML, `PKG_REV` must be reset to `1` (one)\r\nevery time zLib version is changed. The workflow file must be\r\nrenamed with the new version in the name. This is necessary because\r\nGitHub maintains build numbers per workflow file name.\r\n\r\nFor local builds package revision is supplied on the command line\r\nand should be specified as `1` (one) for a new version of zLib.\r\n\r\nWhen the upstream version lacks the patch component, `PKG_VER_PATCH`\r\nshould be uncommented in all locations listed above to construct\r\na full Nuget version. Otherwise it should be commented out.\r\n\r\n### GitHub Build Number\r\n\r\nBuild number within the GitHub workflow YAML is maintained in an\r\nunconventional way because of the lack of build maturity management\r\nbetween GitHub and Nuget.\r\n\r\nFor example, using build management systems, such as Artifactory,\r\nevery build would generate a Nuget package with the same version\r\nand package revision for the upcoming release and build numbers\r\nwould be tracked within the build management system. A build that\r\nwas successfully tested would be promoted to the production Nuget\r\nrepository without generating a new build.\r\n\r\nWithout a build management system, the GitHub workflow in this\r\nrepository uses the pre-release version as a surrogate build\r\nnumber for builds that do not publish packages to nuget.org,\r\nso these builds can be downloaded and tested before the final\r\nbuild is made and published to nuget.org. This approach is not\r\nrecommended for robust production environments because even\r\nthough the final published package is built from the exact\r\nsame source, the build process may still potentially introduce \r\nsome unknowns into the final package (e.g. build VM was updated).\r\n\r\n## CMake vs. `nmake`\r\n\r\nzLib may be built with CMake, but it is configured such that\r\nusing `--prefix` with `cmake --install` fails to copy build\r\nartifacts into the specified location and instead forces the\r\nprotected `C:\\Program Files\\` directory to be used. In\r\naddition to this, release builds are not configured to\r\ngenerate debug symbols.\r\n\r\nBecause of the issues above, `nmake` is used to build zLib\r\nlibraries, as it is simpler to maintain, compared to patching\r\nCMake files. If you would like to build zLib via CMake,\r\nfollowing commands may be used to build all configurations.\r\n\r\n    cd zlib-1.3\r\n\r\n    cmake -S . -B build\\Win32 -A Win32\r\n    cmake -S . -B build\\x64 -A x64\r\n\r\n    cmake --build build\\Win32 --config Debug\r\n    cmake --build build\\Win32 --config Release\r\n\r\n    cmake --build build\\x64 --config Debug\r\n    cmake --build build\\x64 --config Release\r\n\r\nThe `cmake --install` command will attempt to install build\r\nartifacts into `C:\\Program Files\\`, which is not a good place\r\nfor libraries, even though it is used by CMake as such.\r\n\r\nOne work-around for this is to use `--install-prefix` with\r\nthe initial `cmake -S ...` commands, but then you need to\r\nchange build directories to include configuration names\r\nbecause build files generated this way are not\r\nconfiguration-aware when running `cmake --install`.\r\n\r\nNote that CMake builds static libraries with different\r\nnames, compared to those within this package. If you switch\r\nto using libraries built with CMake, you will need to change\r\nreferences to `zlib.lib` generated by this project to\r\n`zlibstatic.lib` and `zlibstaticd.lib`, which are generated\r\nby CMake.\r\n\r\n## Building Package Locally\r\n\r\nYou can build a Nuget package locally with `make-package.bat`\r\nlocated in `devops`. This script expects VS2019 Community Edition\r\ninstalled in the default location. If you have other edition of\r\nVisual Studio, edit the file to use the correct path to the\r\n`vcvarsall.bat` file.\r\n\r\nRun `make-package.bat` from the repository root directory with a\r\npackage revision as the first argument. There is no provision to\r\nmanage build numbers from the command line and other tools should\r\nbe used for this.\r\n\r\n## Sample Application (zPipe)\r\n\r\nA Visual Studio project is included in this repository under\r\n`sample-zpipe` to test the Nuget package built by this project.\r\nThis application is copied from `zlib-1.2.11/examples` and\r\nadapted to build as a C++ project.\r\n\r\nThe original C source of this sample application is subject\r\nto zLib's copyright and terms of use.\r\n\r\nIn order to build `zpipe.exe`, open Nuget Package manager in\r\nthe solution and install either the locally-built Nuget package\r\nor the one from [nuget.org][].\r\n\r\n`zpipe.exe` compresses/decompresses standard input/output and\r\ncan be tested with this pipe:\r\n\r\n    echo ABC | zpipe | zpipe -d\r\n\r\nThe output will be `ABC` in this example, which will be compressed\r\nby the first invocation of `zpipe.exe` and decompressed by the\r\nsecond one.\r\n\r\n## What's Debug CRT?\r\n\r\nVisual C/C++ provides C runtime library (CRT), which comes\r\nin several flavors designed for specific purposes. The debug\r\nCRT is intended to help identifying various runtime issues\r\nearly in the development process, such as memory corruption.\r\n\r\nMixing different flavors of the CRT within one application\r\nwill yield undesired side effects ranging from compiler errors\r\nto application crashes.\r\n\r\nThe patched version of `Makefile.msc` in this project builds\r\nzLib debug and release versions using multi-threaded debug DLL\r\nCRT (`/MDd`) and multi-threaded non-debug DLL CRT (`/MD`). See\r\nthis page for additional information about the CRT.\r\n\r\nhttps://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160\r\n\r\nSee `Makefile.msc.patch` in `patches` for changes against the\r\nzLib source.\r\n\r\n[nuget.org]: https://www.nuget.org/packages/StoneSteps.zLib.VS2022.Static/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonestepsinc%2Fzlib-nuget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstonestepsinc%2Fzlib-nuget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstonestepsinc%2Fzlib-nuget/lists"}