Add section on configuration flags to README #1142

pull ZenulAbidin wants to merge 2 commits into bitcoin-core:master from ZenulAbidin:cmake-patch-0001 changing 18 files +175 −87
  1. ZenulAbidin commented at 3:57 pm on October 4, 2022: contributor

    This change eases the use of alternate build systems by moving the variables in src/libsecp256k1-config.h to compiler macros for each invocation, preventing duplication of these variables for each build system.

    This does not include documentation for each configure option, and would need to be added in a separate commit.

  2. real-or-random commented at 10:41 pm on October 4, 2022: contributor

    Hi, thanks for the PR.

    The reason why CI doesn’t like this is that the files precomputed_ecmult[_gen].c are generated via precompute_ecmult[_gen].c. You’ll also need to change the generating code in the latter to not generate the #include lines. Actually this suffices and then make clean-precomp && make precomp should generate the files.

    For the change itself, I think I’m in favor of this because it’s in line with what I said here: #1113 (comment).

  3. ZenulAbidin force-pushed on Oct 5, 2022
  4. ZenulAbidin commented at 5:54 am on October 5, 2022: contributor

    Hi, thanks for the PR.

    The reason why CI doesn’t like this is that the files precomputed_ecmult[_gen].c are generated via precompute_ecmult[_gen].c. You’ll also need to change the generating code in the latter to not generate the #include lines. Actually this suffices and then make clean-precomp && make precomp should generate the files.

    For the change itself, I think I’m in favor of this because it’s in line with what I said here: #1113 (comment).

    Alright, I updated the precompute_ files, and also added the SECP_ prefix to DEFINE_FLAGS.

    I am wondering if it’s a good idea to put the configure option descriptions in the README or in a separate docs file.

  5. apoelstra commented at 1:40 pm on October 5, 2022: contributor

    I am wondering if it’s a good idea to put the configure option descriptions in the README or in a separate docs file.

    My inclination is that they should be beside the options themselves, maybe with some sentinel like BUILD-DEFINE: that the README would tell people to grep for. If the docs are in a separate file I’m sure they’ll come out of sync.

  6. ZenulAbidin commented at 3:54 pm on October 5, 2022: contributor

    My inclination is that they should be beside the options themselves, maybe with some sentinel like BUILD-DEFINE: that the README would tell people to grep for. If the docs are in a separate file I’m sure they’ll come out of sync.

    Will single-line comments in configure.ac with the docstring suffice, such as this?

    0SECP_DEFINE_FLAGS="$SECP_DEFINE_FLAGS -DUSE_ASM_X86_64=1"
    1dnl Define this symbol to enable x86_64 assembly optimizations
    

    But then this raises an issue with duplication. Assuming CMake functionality will be merged, and DRY principles apply, we should make the Autoconf file the source of truth for these docstrings?

  7. real-or-random commented at 4:30 pm on October 5, 2022: contributor

    I think there’s no straight answer where to put the docs if we want to support multiple build systems, and that decision shouldn’t block this PR. Note that this PR doesn’t really remove docs, the doc strings are still in the configure.ac macros and are presented to the user in a nice way in ./configure --help.


    Entering that discussion about where to put the docs:

    Quoting myself from #1113 (comment):

    In the end, we need a least one place (and as few as possible) places where the options are listed and documented, and some duplication will be unavoidable if we want to support more than one of building even if it’s just “autotools” and “manual”.

    Will single-line comments in configure.ac with the docstring suffice, such as this?

    0SECP_DEFINE_FLAGS="$SECP_DEFINE_FLAGS -DUSE_ASM_X86_64=1"
    1dnl Define this symbol to enable x86_64 assembly optimizations
    

    But then this raises an issue with duplication.

    Indeed, I think this will make the problem worse. And once we have autotools and cmake, it’s not clear where the canonical source is, and also the command line arguments will look different…

    I still lean towards what I suggested in #1113 (comment): A table in the README, or maybe in a file referenced from the README, that has a row for every option (see mockup there). If people are motivated, it would be nice to see a worked out PR for this suggestion.

    If we have this table, we could either remove the strings from ./configure --help entirely and leave them in very brief form like “enable ECDH module”. I think either possibility is ok. We’ll anyway have to live with some coupling and duplication: Every time we add/change/remove an option, we need to perform that change at least i) in the actual source, ii) in autotools, iii) and in cmake.

  8. in Makefile.am:70 in 081e69d524 outdated
    66@@ -67,7 +67,7 @@ noinst_HEADERS += examples/random.h
    67 PRECOMPUTED_LIB = libsecp256k1_precomputed.la
    68 noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
    69 libsecp256k1_precomputed_la_SOURCES =  src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
    70-libsecp256k1_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
    71+libsecp256k1_precomputed_la_CPPFLAGS = $(SECP_INCLUDES) $(SECP_DEFINE_FLAGS)
    


    real-or-random commented at 4:32 pm on October 5, 2022:
    I think SECP_CONFIG_DEFINES would be a slightly more descriptive name if you’re willing to make that change.

    ZenulAbidin commented at 5:34 pm on October 5, 2022:
    No problem, I can make that change easily in neovim.
  9. real-or-random approved
  10. real-or-random commented at 4:34 pm on October 5, 2022: contributor
    ACK mod bikeshedding
  11. ZenulAbidin commented at 5:56 pm on October 5, 2022: contributor

    I still lean towards what I suggested in #1113 (comment): A table in the README, or maybe in a file referenced from the README, that has a row for every option (see mockup there). If people are motivated, it would be nice to see a worked out PR for this suggestion.

    If we have this table, we could either remove the strings from ./configure --help entirely and leave them in very brief form like “enable ECDH module”. I think either possibility is ok. We’ll anyway have to live with some coupling and duplication: Every time we add/change/remove an option, we need to perform that change at least i) in the actual source, ii) in autotools, iii) and in cmake.

    I suggest reserving the table for the autoconf/CMake option specifiers, because we can just make the short option description as a heading above it, and the long description as a paragraph below it, so 1) the long description has more reading space, and 2) it embeds in the autogenerated Table of Contents for Markdown files. However, I advise keeping at least a simple option description in the ./configure --help output, like the way it is for --enable-test, --enable-benchmark and many others.

    So basically, instead of this:

    Autotools CMake Manual Description
    –enable-tests -DENABLE_TESTS -DENABLE_TESTS compile tests [default=yes]
    –enable-examples -DENABLE_EXAMPLES -DENABLE_EXAMPLES compile the examples [default=no]

    We can have something like this:

    Configuration options

    -DENABLE_TESTS

    Autotools
    –enable-tests

    Compile tests. (Default: yes)

    -DENABLE_EXAMPLES

    Autotools
    –enable-examples

    Compile the examples. (Default: yes)


    Of course, I did not list CMake entries because that has not been merged yet, but for now, it will be an autotools list, and the manual options will be in the markdown titles.

  12. Remove dependency on src/libsecp256k1-config.h
    This change eases the use of alternate build systems by moving
    the variables in src/libsecp256k1-config.h to compiler macros
    for each invocation, preventing duplication of these variables
    for each build system.
    e53bc0b8e1
  13. Add section for configuration flags b048f21f5f
  14. ZenulAbidin force-pushed on Oct 6, 2022
  15. ZenulAbidin commented at 10:50 pm on October 6, 2022: contributor
    @real-or-random Config options have been added to the README.
  16. ZenulAbidin commented at 4:19 pm on October 7, 2022: contributor
    Also, do you think that the ./configure docs should be trimmed, considering they are a duplicate of the README?
  17. hebasto commented at 2:27 pm on October 28, 2022: member
    Concept ACK.
  18. hebasto commented at 2:54 pm on October 28, 2022: member

    It is possible now to cleanup the .gitignore file:

     0--- a/.gitignore
     1+++ b/.gitignore
     2@@ -44,8 +44,6 @@ coverage.*.html
     3 *.gcno
     4 *.gcov
     5 
     6-src/libsecp256k1-config.h
     7-src/libsecp256k1-config.h.in
     8 build-aux/ar-lib
     9 build-aux/config.guess
    10 build-aux/config.sub
    11@@ -60,5 +58,4 @@ build-aux/m4/ltversion.m4
    12 build-aux/missing
    13 build-aux/compile
    14 build-aux/test-driver
    15-src/stamp-h1
    16 libsecp256k1.pc
    
  19. sipa commented at 8:02 pm on December 6, 2022: contributor

    Concept ACK, and ACK the first commit.

    I’m not really a fan of the current documentation changes, with a dozen tiny tables and subsections added to the readme, which isn’t very readable. I don’t think that should hold up the changes here, though.

    We can merge it as-is, or drop the documentation changes. I’m happy to work on documenting the flags in a follow-up.

  20. hebasto commented at 8:33 pm on December 6, 2022: member

    … drop the documentation changes. I’m happy to work on documenting the flags in a follow-up.

    +1

  21. ZenulAbidin commented at 9:03 pm on December 6, 2022: contributor

    Agreed.

    Perhaps the flags could be documented separately in a separate Markdown file in the sparsely-populated docs folder.

  22. sipa commented at 4:33 pm on December 7, 2022: contributor
    I’ve included the first commit from here in #1169, as it simplifies things a bit there, but I’m happy for this PR to settle first.
  23. sipa cross-referenced this on Dec 7, 2022 from issue Add support for msan instead of valgrind (for memcheck and ctime test) by sipa
  24. real-or-random commented at 10:48 am on December 8, 2022: contributor

    @ZenulAbidin Can you drop the commit that changes the README for now, and (optional, if you want) make the changes to .gitignore proposed here? #1142 (comment)

    Then we could get this merged and work on the doc stuff in a separate issue/PR.

  25. hebasto cross-referenced this on Dec 14, 2022 from issue Drop `src/libsecp256k1-config.h` by hebasto
  26. hebasto commented at 3:18 pm on December 14, 2022: member

    Can you drop the commit that changes the README for now, and (optional, if you want) make the changes to .gitignore proposed here? #1142 (comment)

    See #1178.

  27. ZenulAbidin commented at 4:36 pm on December 14, 2022: contributor

    @hebasto Thanks for that. I was busy with other stuff last week so couldn’t get to this PR in a timely manner.

    I’m going to leave this open for now in case anyone has more feedback about the flags & docs.

  28. sipa referenced this in commit 665ba77e79 on Dec 20, 2022
  29. hebasto commented at 8:47 am on December 20, 2022: member

    @ZenulAbidin

    I’m going to leave this open for now in case anyone has more feedback about the flags & docs.

    As #1178 has been recently merged, maybe update this PR description and title?

  30. real-or-random renamed this:
    Remove dependency on src/libsecp256k1-config.h
    Add section on configuration flags to README
    on Dec 20, 2022
  31. real-or-random cross-referenced this on Mar 8, 2023 from issue build: Add CMake-based build system by hebasto
  32. real-or-random cross-referenced this on Mar 8, 2023 from issue build: Meta-issue for follow-ups to initial CMake merge (#1113) by real-or-random
  33. real-or-random cross-referenced this on Mar 10, 2023 from issue build: Meta-issue for follow-ups to initial CMake merge (#1113) by hebasto
  34. hebasto commented at 7:56 am on July 14, 2023: member
    The changes to the documentation have been incorporated in #1372.

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: 2024-11-24 00:15 UTC

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