cmake: configure libsecp256k1.pc during install #1692

pull purpleKarrot wants to merge 1 commits into bitcoin-core:master from purpleKarrot:pkgconf-install-prefix changing 1 files +6 −2
  1. purpleKarrot commented at 5:10 pm on June 27, 2025: contributor
    When installing to a given prefix, make sure that the .pc file contains that prefix rather than the value of CMAKE_INSTALL_PREFIX that the project was configured with.
  2. cmake: configure libsecp256k1.pc during install
    When installing to a given prefix, make sure that the .pc file contains
    that prefix rather than the value of CMAKE_INSTALL_PREFIX that the
    project was configured with.
    7106dce6fd
  3. real-or-random added the label bug on Jun 27, 2025
  4. real-or-random added the label build on Jun 27, 2025
  5. real-or-random commented at 6:29 pm on June 27, 2025: contributor

    Thanks! Can you provide instructions for a test case that is fixed by this?

    cc @hebasto

  6. hebasto commented at 7:45 pm on June 27, 2025: member

    cc @hebasto

    I haven’t tested this PR yet, but the issue I reported to @purpleKarrot offline can be reproduced on the master branch as follows:

     0$ cmake -B build
     1$ cmake --build build
     2$ install_dir=$(mktemp -d)
     3$ cmake --install build --prefix $install_dir
     4$ cat ${install_dir}/lib/pkgconfig/libsecp256k1.pc 
     5prefix=/usr/local
     6exec_prefix=${prefix}
     7libdir=${exec_prefix}/lib
     8includedir=${prefix}/include
     9
    10Name: libsecp256k1
    11Description: Optimized C library for EC operations on curve secp256k1
    12URL: https://github.com/bitcoin-core/secp256k1
    13Version: 0.6.1
    14Cflags: -I${includedir}
    15Libs: -L${libdir} -lsecp256k1
    

    Note prefix=/usr/local, which is obviously incorrect.

  7. purpleKarrot commented at 8:47 pm on June 27, 2025: contributor

    What @hebasto wrote.

    Also, when testing this, try installing as root and then verify whether you can delete the build directory with non-root permission. Also, try installing twice in a row and verify that the second install does not modify the timestamp of the file.


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