cmake: Emulate Libtool’s behavior on FreeBSD #1685

pull hebasto wants to merge 1 commits into bitcoin-core:master from hebasto:250611-freebsd-lib changing 1 files +1 −1
  1. hebasto commented at 0:17 am on June 11, 2025: member

    Building the master branch @ f24b838bedffe19643fafd817b82fc49472d4877 on FreeBSD 14.3:

    • with Autotools:
     0$ ./autogen.sh
     1$ ./configure --disable-static --prefix /tmp/AUTOTOOLS
     2$ gmake
     3$ gmake install
     4$ tree /tmp/AUTOTOOLS/lib
     5/tmp/AUTOTOOLS/lib
     6├── libsecp256k1.la
     7├── libsecp256k1.so -> libsecp256k1.so.5.0.1
     8├── libsecp256k1.so.5 -> libsecp256k1.so.5.0.1
     9├── libsecp256k1.so.5.0.1
    10└── pkgconfig
    11    └── libsecp256k1.pc
    12
    132 directories, 5 files
    
    • with CMake:
     0$ cmake -B build -DCMAKE_INSTALL_PREFIX=/tmp/CMAKE
     1$ cmake --build build
     2$ cmake --install build
     3$ tree /tmp/CMAKE/lib
     4/tmp/CMAKE/lib
     5├── cmake
     6│   └── libsecp256k1
     7│       ├── libsecp256k1-config-version.cmake
     8│       ├── libsecp256k1-config.cmake
     9│       ├── libsecp256k1-targets-relwithdebinfo.cmake
    10│       └── libsecp256k1-targets.cmake
    11├── libsecp256k1.so -> libsecp256k1.so.5
    12├── libsecp256k1.so.5
    13└── pkgconfig
    14    └── libsecp256k1.pc
    15
    164 directories, 7 files
    

    With this PR:

     0$ cmake -B build -DCMAKE_INSTALL_PREFIX=/tmp/CMAKE+PR
     1$ cmake --build build
     2$ cmake --install build
     3$ tree /tmp/CMAKE+PR/lib
     4/tmp/CMAKE+PR/lib
     5├── cmake
     6│   └── libsecp256k1
     7│       ├── libsecp256k1-config-version.cmake
     8│       ├── libsecp256k1-config.cmake
     9│       ├── libsecp256k1-targets-relwithdebinfo.cmake
    10│       └── libsecp256k1-targets.cmake
    11├── libsecp256k1.so -> libsecp256k1.so.5
    12├── libsecp256k1.so.5 -> libsecp256k1.so.5.0.1
    13├── libsecp256k1.so.5.0.1
    14└── pkgconfig
    15    └── libsecp256k1.pc
    16
    174 directories, 8 files
    

    From FreeBSD Developers’ Handbook:

    If you are adding shared library support to a port or other piece of software that does not have one, the version numbers should follow these rules. Generally, the resulting numbers will have nothing to do with the release version of the software.

    For ports:

    • Prefer using the number already selected by upstream

    • If upstream provides symbol versioning, ensure that we use their script

  2. cmake: Emulate Libtool's behavior on FreeBSD 37dd422b5c
  3. real-or-random added the label build on Jun 11, 2025
  4. real-or-random added the label refactor/smell on Jun 11, 2025
  5. real-or-random approved
  6. real-or-random commented at 7:43 am on June 11, 2025: contributor
    utACK 37dd422b5cecad54db40a7304f03bff552d8d9fb
  7. real-or-random commented at 7:44 am on June 11, 2025: contributor
    What do you think about the alternative version of making this the else branch if neither on Windows nor on macOS?
  8. hebasto commented at 8:23 am on June 11, 2025: member

    What do you think about the alternative version of making this the else branch if neither on Windows nor on macOS?

    That was my initial thought too. However, shared library naming conventions differ on other systems, such as OpenBSD and NetBSD. So I chose the current approach to self‑document which systems are tested.

  9. hebasto commented at 9:14 am on June 11, 2025: member

    What do you think about the alternative version of making this the else branch if neither on Windows nor on macOS?

    That was my initial thought too. However, shared library naming conventions differ on other systems, such as OpenBSD and NetBSD. So I chose the current approach to self‑document which systems are tested.

    I’ve included a reference to the FreeBSD docs in the PR description.

  10. real-or-random merged this on Jun 24, 2025
  11. real-or-random closed this on Jun 24, 2025

  12. hebasto deleted the branch on Jun 24, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-28 19:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me