Skip to content

build(cmake): use major version only for SOVERSION - #928

Open
ychampion wants to merge 1 commit into
nodejs:mainfrom
ychampion:fix/cmake-soversion-major
Open

ychampion wants to merge 1 commit into
nodejs:mainfrom
ychampion:fix/cmake-soversion-major

Conversation

@ychampion

Copy link
Copy Markdown

Summary

Fixes #925

Currently CMakeLists.txt sets SOVERSION to ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}, which bumps the shared library SONAME on every minor release (e.g., 9.3 -> 9.4 -> 9.5) even though minor versions in SemVer only add backwards-compatible functionality.

This aligns CMakeLists.txt with CMake's SOVERSION convention by setting SOVERSION to ${PROJECT_VERSION_MAJOR} while keeping VERSION at ${PROJECT_VERSION}:

  • VERSION: ${PROJECT_VERSION} (e.g. 9.5.0)
  • SOVERSION: ${PROJECT_VERSION_MAJOR} (e.g. 9, remaining 9 across 9.x minor releases and bumping only on major releases)

Note for maintainers: switching SOVERSION from MAJOR.MINOR to MAJOR changes the SONAME from libllhttp.so.9.5 to libllhttp.so.9 (or libllhttp.10 if held for the next semver-major release).

Verification

  • Staged a release layout (via npm run build + CMakeLists.txt _RELEASE_ substitution) and configured & built both llhttp_shared and llhttp_static targets with CMake + Ninja + GCC:
    • Verified 9.5.0 -> VERSION=9.5.0, SOVERSION=9 (previously 9.5)
    • Verified 9.6.0 -> VERSION=9.6.0, SOVERSION=9 (stable across minor bump)
    • Verified 10.0.0 -> VERSION=10.0.0, SOVERSION=10 (increments on major bump)
    • Verified cmake --build compiles and links both shared and static libraries cleanly
  • Verified npm run build-ts, node --import tsx ./test/headers-test.ts, and ESLint (excluding Windows CRLF linebreak-style on untouched files) pass

Set SOVERSION to PROJECT_VERSION_MAJOR instead of PROJECT_VERSION_MAJOR.PROJECT_VERSION_MINOR so minor SemVer releases do not break shared library SONAME compatibility.

Fixes: nodejs#925
Signed-off-by: ychampion <68075205+ychampion@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

changing SOVERSION with every MINOR

1 participant