{"id":13531495,"url":"https://github.com/uael/sv","last_synced_at":"2025-08-15T21:47:53.911Z","repository":{"id":46051952,"uuid":"90993410","full_name":"uael/sv","owner":"uael","description":"libsv - Public domain cross-platform semantic versioning in c99","archived":false,"fork":false,"pushed_at":"2023-10-07T04:59:39.000Z","size":202,"stargazers_count":67,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T18:09:10.098Z","etag":null,"topics":["c99","cross-platform","library","public-domain","semantic-versioning"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uael.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":"2017-05-11T15:13:41.000Z","updated_at":"2025-02-18T16:19:33.000Z","dependencies_parsed_at":"2022-09-02T14:02:09.727Z","dependency_job_id":null,"html_url":"https://github.com/uael/sv","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uael%2Fsv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uael%2Fsv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uael%2Fsv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uael%2Fsv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uael","download_url":"https://codeload.github.com/uael/sv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142942,"owners_count":21054671,"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":["c99","cross-platform","library","public-domain","semantic-versioning"],"created_at":"2024-08-01T07:01:03.431Z","updated_at":"2025-04-10T02:07:02.648Z","avatar_url":"https://github.com/uael.png","language":"C","funding_links":[],"categories":["Projects","C"],"sub_categories":[],"readme":"# libsv\nlibsv - Public domain cross-platform semantic versioning in c99\n\n[![codecov](https://codecov.io/gh/uael/sv/branch/master/graph/badge.svg)](https://codecov.io/gh/uael/sv)\n\n# Topics\n- [Introduction](#introduction)\n- [License](#license)\n- [Install](#install)\n  - [xmake](#xmake)\n  - [cmake](#cmake)\n  - [autotools](#autotools)\n- [Usage](#usage)\n- [Credits](#credits)\n- [Bugs, vulnerabilities and contributions](#bugs-vulnerabilities-and-contributions)\n- [Resources](#resources)\n- [Badges and static analysis](#badges-and-static-analysis)\n  - [Travis CI](#travis-ci)\n  - [Clang's Static Analyzer](#clangs-static-analyzer)\n\n## Introduction\n\nThis is free and unencumbered software released into the public domain.\nThis  package  installs  a  C  language  library  implementing  semantic versioning for the C language.\n\n## License\n\nSee the [UNLICENSE](https://github.com/uael/sv/blob/master/UNLICENSE) file.\n\n## Install\n\n### xmake\n\n[Install xmake build system (A make-like build utility based on Lua)](http://xmake.io)\n\n```bash\n$ xmake\n$ xmake check\n$ xmake install\n```\n\n### cmake\n\n```bash\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ make\n$ make test\n$ make install\n```\n\n### autotools\n\nTo install from a proper release tarball, do this:\n```bash\n$ cd libsv-3.1\n$ mkdir build\n$ cd build\n$ ../configure\n$ make\n$ make check\n$ make install\n```\nto inspect the available configuration options:\n```bash\n$ ../configure --help\n```\nThe Makefile is designed to allow parallel builds, so we can do:\n```bash\n$ make -j4 all \u0026\u0026 make -j4 check\n```\nwhich,  on  a  4-core  CPU,   should  speed  up  building  and  checking significantly.\nThe  Makefile supports  the  DESTDIR environment  variable to  install files in a temporary location, example: to see what will happen:\n```bash\n$ make -n install DESTDIR=/tmp/libsv\n```\nto really do it:\n```bash\n$ make install DESTDIR=/tmp/libsv\n```\nAfter the installation it is  possible to verify the installed library against the test suite with:\n```bash\n$ make installcheck\n```\nFrom  a repository  checkout or  snapshot  (the ones  from the  Github site): we  must install the  GNU Autotools (GNU Automake,  GNU Autoconf, GNU Libtool),  then we must first  run the script \"autogen.sh\"  from the top source directory, to generate the needed files:\n```bash\n$ cd libsv\n$ sh autogen.sh\n```\nnotice  that  \"autogen.sh\"  will   run  the  programs  \"autoreconf\"  and \"libtoolize\"; the  latter is  selected through the  environment variable \"LIBTOOLIZE\",  whose  value  can  be  customised;  for  example  to  run \"glibtoolize\" rather than \"libtoolize\" we do:\n```bash\n$ LIBTOOLIZE=glibtoolize sh autogen.sh\n```\nAfter this the  procedure is the same  as the one for  building from a proper release tarball, but we have to enable maintainer mode:\n```bash\n$ ../configure --enable-maintainer-mode [options]\n$ make\n$ make check\n$ make install\n```\n\n## Usage\n\n```c\n...\nsemver_t semver = {0};\n\nsemver(\u0026semver, \"v1.2.3-alpha.1\");\n\nassert(1 == semver.major);\nassert(2 == semver.minor);\nassert(3 == semver.patch);\nassert(0 == memcmp(\"alpha\", semver.prerelease.raw, sizeof(\"alpha\")-1));\nassert(0 == memcmp(\"1\", semver.prerelease.next-\u003eraw, sizeof(\"1\")-1));\nassert(true == semver_rmatch(semver, \"1.2.1 || \u003e=1.2.3-alpha \u003c1.2.5\"));\n\nsemver_dtor(\u0026semver);\n...\n```\n\n### Versions\n\nA \"version\" is described by the `v2.0.0` specification found at\n\u003chttp://semver.org/\u003e.\n\nA leading `\"v\"` character is stripped off and ignored.\n\n### Ranges\n\nA `version range` is a set of `comparators` which specify versions\nthat satisfy the range.\n\nA `comparator` is composed of an `operator` and a `version`.  The set\nof primitive `operators` is:\n\n* `\u003c` Less than\n* `\u003c=` Less than or equal to\n* `\u003e` Greater than\n* `\u003e=` Greater than or equal to\n* `=` Equal.  If no operator is specified, then equality is assumed,\n  so this operator is optional, but MAY be included.\n\nFor example, the comparator `\u003e=1.2.7` would match the versions\n`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`\nor `1.1.0`.\n\nComparators can be joined by whitespace to form a `comparator set`,\nwhich is satisfied by the **intersection** of all of the comparators\nit includes.\n\nA range is composed of one or more comparator sets, joined by `||`.  A\nversion matches a range if and only if every comparator in at least\none of the `||`-separated comparator sets is satisfied by the version.\n\nFor example, the range `\u003e=1.2.7 \u003c1.3.0` would match the versions\n`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,\nor `1.1.0`.\n\nThe range `1.2.7 || \u003e=1.2.9 \u003c2.0.0` would match the versions `1.2.7`,\n`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.\n\n#### Prerelease Tags\n\nIf a version has a prerelease tag (for example, `1.2.3-alpha.3`) then\nit will only be allowed to satisfy comparator sets if at least one\ncomparator with the same `[major, minor, patch]` tuple also has a\nprerelease tag.\n\nFor example, the range `\u003e1.2.3-alpha.3` would be allowed to match the\nversion `1.2.3-alpha.7`, but it would *not* be satisfied by\n`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically \"greater\nthan\" `1.2.3-alpha.3` according to the SemVer sort rules.  The version\nrange only accepts prerelease tags on the `1.2.3` version.  The\nversion `3.4.5` *would* satisfy the range, because it does not have a\nprerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.\n\nThe purpose for this behavior is twofold.  First, prerelease versions\nfrequently are updated very quickly, and contain many breaking changes\nthat are (by the author's design) not yet fit for public consumption.\nTherefore, by default, they are excluded from range matching\nsemantics.\n\nSecond, a user who has opted into using a prerelease version has\nclearly indicated the intent to use *that specific* set of\nalpha/beta/rc versions.  By including a prerelease tag in the range,\nthe user is indicating that they are aware of the risk.  However, it\nis still not appropriate to assume that they have opted into taking a\nsimilar risk on the *next* set of prerelease versions.\n\n#### Advanced Range Syntax\n\nAdvanced range syntax desugars to primitive comparators in\ndeterministic ways.\n\nAdvanced ranges may be combined in the same way as primitive\ncomparators using white space or `||`.\n\n##### Hyphen Ranges `X.Y.Z - A.B.C`\n\nSpecifies an inclusive set.\n\n* `1.2.3 - 2.3.4` := `\u003e=1.2.3 \u003c=2.3.4`\n\nIf a partial version is provided as the first version in the inclusive\nrange, then the missing pieces are replaced with zeroes.\n\n* `1.2 - 2.3.4` := `\u003e=1.2.0 \u003c=2.3.4`\n\nIf a partial version is provided as the second version in the\ninclusive range, then all versions that start with the supplied parts\nof the tuple are accepted, but nothing that would be greater than the\nprovided tuple parts.\n\n* `1.2.3 - 2.3` := `\u003e=1.2.3 \u003c2.4.0`\n* `1.2.3 - 2` := `\u003e=1.2.3 \u003c3.0.0`\n\n##### X-Ranges `1.2.x` `1.X` `1.2.*` `*`\n\nAny of `X`, `x`, or `*` may be used to \"stand in\" for one of the\nnumeric values in the `[major, minor, patch]` tuple.\n\n* `*` := `\u003e=0.0.0` (Any version satisfies)\n* `1.x` := `\u003e=1.0.0 \u003c2.0.0` (Matching major version)\n* `1.2.x` := `\u003e=1.2.0 \u003c1.3.0` (Matching major and minor versions)\n\nA partial version range is treated as an X-Range, so the special\ncharacter is in fact optional.\n\n* `\"\"` (empty string) := `*` := `\u003e=0.0.0`\n* `1` := `1.x.x` := `\u003e=1.0.0 \u003c2.0.0`\n* `1.2` := `1.2.x` := `\u003e=1.2.0 \u003c1.3.0`\n\n##### Tilde Ranges `~1.2.3` `~1.2` `~1`\n\nAllows patch-level changes if a minor version is specified on the\ncomparator.  Allows minor-level changes if not.\n\n* `~1.2.3` := `\u003e=1.2.3 \u003c1.(2+1).0` := `\u003e=1.2.3 \u003c1.3.0`\n* `~1.2` := `\u003e=1.2.0 \u003c1.(2+1).0` := `\u003e=1.2.0 \u003c1.3.0` (Same as `1.2.x`)\n* `~1` := `\u003e=1.0.0 \u003c(1+1).0.0` := `\u003e=1.0.0 \u003c2.0.0` (Same as `1.x`)\n* `~0.2.3` := `\u003e=0.2.3 \u003c0.(2+1).0` := `\u003e=0.2.3 \u003c0.3.0`\n* `~0.2` := `\u003e=0.2.0 \u003c0.(2+1).0` := `\u003e=0.2.0 \u003c0.3.0` (Same as `0.2.x`)\n* `~0` := `\u003e=0.0.0 \u003c(0+1).0.0` := `\u003e=0.0.0 \u003c1.0.0` (Same as `0.x`)\n* `~1.2.3-beta.2` := `\u003e=1.2.3-beta.2 \u003c1.3.0` Note that prereleases in\n  the `1.2.3` version will be allowed, if they are greater than or\n  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but\n  `1.2.4-beta.2` would not, because it is a prerelease of a\n  different `[major, minor, patch]` tuple.\n\n#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`\n\nAllows changes that do not modify the left-most non-zero digit in the\n`[major, minor, patch]` tuple.  In other words, this allows patch and\nminor updates for versions `1.0.0` and above, patch updates for\nversions `0.X \u003e=0.1.0`, and *no* updates for versions `0.0.X`.\n\nMany authors treat a `0.x` version as if the `x` were the major\n\"breaking-change\" indicator.\n\nCaret ranges are ideal when an author may make breaking changes\nbetween `0.2.4` and `0.3.0` releases, which is a common practice.\nHowever, it presumes that there will *not* be breaking changes between\n`0.2.4` and `0.2.5`.  It allows for changes that are presumed to be\nadditive (but non-breaking), according to commonly observed practices.\n\n* `^1.2.3` := `\u003e=1.2.3 \u003c2.0.0`\n* `^0.2.3` := `\u003e=0.2.3 \u003c0.3.0`\n* `^0.0.3` := `\u003e=0.0.3 \u003c0.0.4`\n* `^1.2.3-beta.2` := `\u003e=1.2.3-beta.2 \u003c2.0.0` Note that prereleases in\n  the `1.2.3` version will be allowed, if they are greater than or\n  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but\n  `1.2.4-beta.2` would not, because it is a prerelease of a\n  different `[major, minor, patch]` tuple.\n* `^0.0.3-beta` := `\u003e=0.0.3-beta \u003c0.0.4`  Note that prereleases in the\n  `0.0.3` version *only* will be allowed, if they are greater than or\n  equal to `beta`.  So, `0.0.3-pr.2` would be allowed.\n\nWhen parsing caret ranges, a missing `patch` value desugars to the\nnumber `0`, but will allow flexibility within that value, even if the\nmajor and minor versions are both `0`.\n\n* `^1.2.x` := `\u003e=1.2.0 \u003c2.0.0`\n* `^0.0.x` := `\u003e=0.0.0 \u003c0.1.0`\n* `^0.0` := `\u003e=0.0.0 \u003c0.1.0`\n\nA missing `minor` and `patch` values will desugar to zero, but also\nallow flexibility within those values, even if the major version is\nzero.\n\n* `^1.x` := `\u003e=1.0.0 \u003c2.0.0`\n* `^0.x` := `\u003e=0.0.0 \u003c1.0.0`\n\n## Credits\n\nThe stuff was written by Lucas Abel \u003chttps://github.com/uael\u003e and contributors\n- Marco Maggi \u003chttps://github.com/marcomaggi\u003e\n\n## Bugs, vulnerabilities and contributions\n\nBug  and vulnerability  reports are  appreciated, all  the vulnerability reports  are  public; register  them  using  the  Issue Tracker  at  the project's Github  site.  For  contributions and  patches please  use the Pull Requests feature at the project's Github site.\n\nReports about the original code must be registered at:\n\u003chttps://github.com/uael/sv/issues\u003e\n\n## Resources\n\nDevelopment of the original projects takes place at:\n\u003chttps://github.com/uael/sv/\u003e\n\nthe GNU Project software can be found here:\n\u003chttps://www.gnu.org/\u003e\n\n## Badges and static analysis\n\n### Travis CI\n\nTravis CI is  a hosted, distributed continuous  integration service used to build and test software projects  hosted at GitHub.  We can find this project's dashboards at:\n\u003chttps://travis-ci.org/uael/sv\u003e\n\nUsage of this service is configured through the file \".travis.yml\".\n\n### Clang's Static Analyzer\n\nThe Clang Static Analyzer is a source code analysis tool that finds bugs in C, C++, and Objective-C programs.  It is distributed along with Clang and we can find it at:\n\u003chttp://clang-analyzer.llvm.org/\u003e\n\nUsage of this service is implemented with make rules; see the relevant section in the file \"Makefile.am\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuael%2Fsv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuael%2Fsv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuael%2Fsv/lists"}