cmake: Emulate Libtool's behavior on NetBSD and OpenBSD#1860
Conversation
|
Here are GHA jobs that show ABI versioning: https://github.com/hebasto/secp256k1/actions/runs/27071316706. Undrafted. |
|
Fancy checking the OpenBSD part? |
| @@ -0,0 +1,28 @@ | |||
| # This emulates Libtool to make sure Libtool and CMake agree on the ABI version, | |||
| # see below "Calculate the version variables" in autotools-aux/ltmain.sh. | |||
| function(secp256k1_set_libtool_abi_version target current revision age) | |||
There was a problem hiding this comment.
naming: All other custom functions in cmake/ don't have the secp256k1_ prefix and the filename matches the function name.
There was a problem hiding this comment.
Pull request overview
This PR refactors CMake-side shared library ABI/version handling into a dedicated module and extends the Libtool-compatibility logic to cover NetBSD and OpenBSD, continuing the work from #1685 to keep Autotools/Libtool and CMake installs consistent.
Changes:
- Factor Libtool-compatible ABI version property logic into a new
cmake/LibtoolCompatibleABI.cmakemodule. - Update the
secp256k1target to use the new helper function rather than inline platform conditionals. - Add NetBSD/OpenBSD-specific versioning behavior intended to match Libtool’s platform rules.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/CMakeLists.txt |
Replaces inline ABI/version property logic with a call into the new Libtool-compatibility module. |
cmake/LibtoolCompatibleABI.cmake |
New helper implementing per-OS ABI/version property rules (Linux/FreeBSD/NetBSD/OpenBSD/macOS/Windows). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| elseif(APPLE) | ||
| math(EXPR _compatibility "${current} + 1") | ||
| set_target_properties(${target} PROPERTIES | ||
| MACHO_COMPATIBILITY_VERSION ${_compatibility} | ||
| MACHO_CURRENT_VERSION ${_compatibility}.${revision} | ||
| ) |
There was a problem hiding this comment.
Hm, the LLM has a point:
For shared libraries, the MACHO_COMPATIBILITY_VERSION and MACHO_CURRENT_VERSION properties can be used to override the compatibility version and current version respectively. Note that SOVERSION will still be used to form the install_name and both SOVERSION and VERSION may also affect the file and symlink names.
| # This emulates Libtool to make sure Libtool and CMake agree on the ABI version. | ||
| # The `version_type` variable is set in autotools-aux/m4/libtool.m4. | ||
| # For the `major` and `versuffix` variables, see below "Calculate the version | ||
| # variables" in autotools-aux/ltmain.sh. |
13a403c to
1eab757
Compare
|
The recent feedback has been addressed. Here are GHA jobs that show ABI versioning on OpenBSD, NetBSD and macOS: https://github.com/hebasto/secp256k1/actions/runs/27205923502. |
This is a continuation of #1685.
Additionally, the logic has been factored out into its own module and the documentation has been also improved.