Install manpages via make install, also add some autogenerated manpages #8608

pull nomnombtc wants to merge 9 commits into bitcoin:master from nomnombtc:man_automake2 changing 9 files +1244 −1
  1. nomnombtc commented at 12:44 AM on August 27, 2016: contributor

    This adds a new option --enable-man to configure, so manpages can be installed via make install. This option defaults to yes, but opt out of the manpage installation is possible by running ./configure --disable-man (or --enable-man=no)

    As the license situation of the contrib/debian manpages is that most of them are GPL it was not 100% clear if they can be included here, also they are incomplete anyway so I let help2man create a few manpages from the 0.13.0 binaries and included them.

    The script used to generate them has also been added to contrib/devtools.

    This targets #7626 but was also briefly discussed in #8568

  2. add script to generate manpages with help2man d2cd9c033b
  3. add gen-manpages.sh description to README.md 6edf2fdb85
  4. add autogenerated manpages by help2man eb5643b7c7
  5. add doc/man/Makefile.am to include manpages 00dba72cc3
  6. add doc/man to subdir if configure flag --enable-man is set dc84b6f419
  7. add conditional for --enable-man, default is yes a32c102fb1
  8. in configure.ac:None in a32c102fb1 outdated
     166 | @@ -167,6 +167,13 @@ AC_ARG_ENABLE([zmq],
     167 |  
     168 |  AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
     169 |  
     170 | +# Enable manpages
     171 | +AC_ARG_ENABLE(man,
     172 | +    [AS_HELP_STRING([--enable-man],
    


    luke-jr commented at 2:22 AM on August 27, 2016:

    Normally we use --disable-* for the help for options which are enabled by default.


    nomnombtc commented at 10:43 PM on August 27, 2016:

    Makes sense after looking at the other configure options. Would this be better:

    +    [AS_HELP_STRING([--disable-man],
    +                    [do not install man pages (default is to install)])],,
    

    And should I remove "# Enable manpages" comment? only --disable-wallet and --debug has a comment everything else doesn't.


    luke-jr commented at 12:21 AM on August 28, 2016:

    Sounds good to me

  9. in configure.ac:None in a32c102fb1 outdated
     166 | @@ -167,6 +167,13 @@ AC_ARG_ENABLE([zmq],
     167 |  
     168 |  AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
     169 |  
     170 | +# Enable manpages
     171 | +AC_ARG_ENABLE(man,
     172 | +    [AS_HELP_STRING([--enable-man],
     173 | +                    [install man pages [default=yes]])],,
     174 | +    enable_man=yes)
    


    luke-jr commented at 2:22 AM on August 27, 2016:

    (I wonder if it should perhaps be disabled by default when building for Windows?)

  10. in contrib/devtools/README.md:None in a32c102fb1 outdated
      39 | @@ -40,6 +40,12 @@ would be changed to:
      40 |  
      41 |  ```// Copyright (c) 2009-2015 The Bitcoin Core developers```
      42 |  
      43 | +gen-manpages.sh
      44 | +===============
      45 | +
      46 | +A small script to automatically create manpages in ../../doc/man by running the release binaries with the -help option.
      47 | +This requires help2man which can be found at: https://www.gnu.org/software/help2man/
    


    luke-jr commented at 2:25 AM on August 27, 2016:

    Should probably mention the relevant binaries need to be in PATH, adjust it so the BITCOIND and/or BITCOINCLI environment variables are used, and/or just use the binaries in the build dir.


    nomnombtc commented at 12:42 AM on August 28, 2016:

    Hmm, the script was already a bit ugly, but it was very short which was the good thing about it :) Would you like something like this better: http://pastebin.com/j6JFaiaq

    Or I could leave it like it is and write:

    A small script to automatically create manpages in ../../doc/man by running binaries in $PATH with the --help option.


    theuni commented at 3:10 PM on August 31, 2016:

    Why not use a makefile target instead? All of that info would be readily available there.


    nomnombtc commented at 4:52 PM on September 1, 2016:

    Why not use a makefile target instead? All of that info would be readily available there.

    Do you mean something like this where it fills in some stuff in the script, or do you mean integrating help2man into the make buildprocess?

    Because you can do this: https://www.gnu.org/software/help2man/#Makefile-usage until 5 minutes ago I assumed everyone building from source then needs help2man installed, but this sentence suggest otherwise:

    This usage allows a manual page to be generated by the maintainer and included in the distribution without requiring the end-user to have help2man installed.

    Now I am a bit confused :) Guess this needs more research.


    nomnombtc commented at 6:58 PM on September 1, 2016:

    @theuni I am playing around right now with the help2man Makefile method and it seems it indeed only runs help2man: if the manpage files don't exist yet OR a string in the source cpp file changed (I have no idea how it does this - blackmagic?).

    So if the man pages exist and the help options matches the source files, the end user can build without having help2man installed. If this confirms it seems much better than the shell script...

    But it has some side effects, now the commit id is back in the manpage. And some other small problem which my script was working around (matching copyright footer for all manpages)


    theuni commented at 2:14 AM on September 2, 2016:

    @nomnombtc I think they're just saying that if you commit pre-generated files to the repo, users don't have to do it.

    For a makefile target, i mean something like this: https://github.com/bitcoin/bitcoin/blob/master/src/Makefile.qt.include#L408

    In this case, it would look something like (in src/Makefile.am):

    update-man: $(bin_PROGRAMS)
           $(AM_V_at)echo "[COPYRIGHT]" > footer.h2m
           $(AM_V_at)echo "Copyright $(COPYRIGHT_YEAR) $(COPYRIGHT_HOLDERS_FINAL)" >> footer.h2m
           $(AM_V_at)for prog in $^; do help2man -N --version-string=$(PACKAGE_VERSION) --include=footer.h2m -o $(top_builddir)/doc/man/`basename $$prog`.1 $(builddir)/$$prog$(EXEEXT); done
    

    (that's not really tested)

    Since it's in a makefile, you have all of the vars at your disposal without trying to guess program names/paths.


    nomnombtc commented at 11:54 AM on September 2, 2016:

    @theuni

    Oh ok now I get it, I was playing around with something like this:

    bitcoind.1: $(top_builddir)/src/bitcoind.cpp
            -$(HELP2MAN) --no-info --version-string=$(PACKAGE_VERSION) \
              --output=$@ --name='manual page for $(BITCOIN_DAEMON_NAME) $(PACKAGE_VERSION)' \
              $(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
            -sed -i 's/\-$(shell git rev-parse HEAD | cut -c1-7)//g' $@
    
    bitcoin-cli.1: $(top_builddir)/src/bitcoin-cli.cpp
            -$(HELP2MAN) --no-info --version-string=$(PACKAGE_VERSION) \
              --output=$@ --name='manual page for $(BITCOIN_CLI_NAME) $(PACKAGE_VERSION)' \
              $(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT)
            -sed -i 's/\-$(shell git rev-parse HEAD | cut -c1-7)//g' $@
    
    bitcoin-tx.1: $(top_builddir)/src/bitcoin-tx.cpp
            -$(HELP2MAN) --no-info --version-string=$(PACKAGE_VERSION) \
              --output=$@ --name='manual page for $(BITCOIN_TX_NAME) $(PACKAGE_VERSION)' \
              $(top_builddir)/src/$(BITCOIN_TX_NAME)$(EXEEXT)
            -sed -i 's/\-$(shell git rev-parse HEAD | cut -c1-7)//g' $@
    
    dist_man1_MANS=bitcoind.1 bitcoin-cli.1 bitcoin-tx.1
    
    if ENABLE_QT
    bitcoin-qt.1: $(top_builddir)/src/qt/bitcoin.cpp
            -$(HELP2MAN) --no-info --version-string=$(PACKAGE_VERSION) \
              --output=$@ --name='manual page for $(BITCOIN_GUI_NAME) $(PACKAGE_VERSION)' \
              $(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
            -sed -i 's/\-$(shell git rev-parse HEAD | cut -c1-7)//g' $@
    dist_man1_MANS+=bitcoin-qt.1
    endif
    

    Because my hope was to automate it completly, so that maybe the gitian build process generates the manpages in the end.It works pretty ok, but a huge problem is that running help2man on bitcoin-qt needs access to a running X-Server -_-.

    So someone needs to generate and commit the manpages anyway. May as well then use something like your maketarget, at least this is much more elegant than my shell script... :)

    Going to look into it, thanks!

  11. luke-jr commented at 2:27 AM on August 27, 2016: member

    Why include generated files (the manpages in this case) in the git repo, rather than just building them during make? (configure can disable man by default if help2man isn't found)

  12. laanwj commented at 6:30 AM on August 27, 2016: member

    Why include generated files (the manpages in this case) in the git repo, rather than just building them during make? (configure can disable man by default if help2man isn't found)

    Because this (now manual) step requires actually executing the built executables to get their help output. I disagree with making that a default step in the build process. It will also not work with cross-compilation, and besides that it's an ugly thing that build systems simply should not do.

    It would also introduce an extra (build-time) dependency on help2man, which we don't want.

    There's a similar situation for some other generated files which are 'expensive' to produce, such as the built-in seeds list, the translation files, etc. This should be part of the release process but not automatic in the build.

  13. laanwj assigned theuni on Aug 27, 2016
  14. laanwj commented at 6:34 AM on August 27, 2016: member

    utACK, will test.

  15. MarcoFalke commented at 9:19 AM on August 27, 2016: member

    Agree with @laanwj that ​it is helpful to differentiate between generation of the man pages and installation. Keep in mind that this allows to fiddle with the output, in case help2man is not perfect.

  16. change help string --enable-man to --disable-man ae6e754928
  17. jonasschnelli added the label Build system on Aug 29, 2016
  18. jonasschnelli commented at 11:41 AM on August 29, 2016: contributor

    Concept ACK

  19. laanwj commented at 1:57 PM on August 31, 2016: member

    Nits:

    • can we avoid the commit id being included in the generated manpages? This will generate diff noise every time they're regenerated for no good reason. Bitcoin Core RPC client version v0.13.0.0-ga402396
    • doc/release-process.md should contain instructions to generate these pages (after bumping the version!)
    • bitcoin-tx has no man page.

    Apart from that, tested ACK.

  20. theuni commented at 3:21 PM on August 31, 2016: member

    Concept ACK.

    Agreed with the points above. Though, if we're pre-generating the pages and keeping them in-repo, we need to be careful about #ifdefs in help output.

    For example: https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L317

    Also, I'd much rather use a makefile target for generating, similar to the way the other generated files are produced. That helps to keep everything in sync since the vars are shared around.

  21. laanwj commented at 12:03 PM on September 1, 2016: member

    Though, if we're pre-generating the pages and keeping them in-repo, we need to be careful about #ifdefs in help output.

    I just don't like the alternative. If this could be parsed from the C source without executing, I'd be fine with doing generation during build process. In any case that can be done in the future, this is strictly an improvement to how things currently are.

  22. regenerated all manpages with commit tag stripped, also add bitcoin-tx 09546ca0c9
  23. improved gen-manpages.sh, includes bitcoin-tx and strips commit tag, now also runs binaries from build dir by default, added variables for more control d19583f478
  24. nomnombtc commented at 4:20 PM on September 1, 2016: contributor

    can we avoid the commit id being included in the generated manpages? This will generate diff noise every time they're regenerated for no good reason. Bitcoin Core RPC client version v0.13.0.0-ga402396

    Yes I have updated the script somewhat to strip the commit id from the help2man output. It now also has some variables like BITCOIND BITCOINCLI and so on, as luke-jr suggested above somewhere and it now runs the binaries from the build dir, not from $PATH anymore.

    doc/release-process.md should contain instructions to generate these pages (after bumping the version!)

    Okay. Should I just write that it needs to be regenerated prior to release, like this?

    [...]
    Before every minor and major release:
    
    Update bips.md to account for changes since the last release.
    Update version in sources (see below)
    Write release notes (see below)
    Regenerate manpages with script in contrib/devtools
    [...]
    

    bitcoin-tx has no man page.

    Oops. Thanks for noticing this, somehow I forgot about bitcoin-tx. It is included now :)

    I also noticed another annoyance: When build with --with-gui=no it still installs the bitcoin-qt manpage... If we want to prevent this, the Makefile.am in doc/man needs a check for this :(

  25. nomnombtc commented at 6:56 PM on September 2, 2016: contributor

    here is something which is probably better. It uses a Makefile target instead of a shellscript to run help2man and a few other small improvements.

    https://github.com/bitcoin/bitcoin/compare/master...nomnombtc:man_automake4

    Changes compared to this here (8608):

    • Shellscript replaced by Makefile target "update-man" - many thanks to @theuni
    • DISTCHECK_CONFIGURE_FLAGS has been removed from Makefile.am, it seems not needed.
    • AC_ARG_ENABLE and AM_CONDITIONAL in configure.ac was modified to match the look of other options.
    • The Makefile in doc/man now only installs bitcoin-qt.1 if ENABLE_QT is set.
    • Added notes about updating man pages to release-process.md

    Please tell me if you guys like this one better :) If this is ok then only the text for release-process.md is missing. I have something here but it is not ready yet, the formatting is weird of the whole section.

  26. laanwj commented at 8:25 AM on September 13, 2016: member

    Thanks for sticking with this, ACK d19583f

  27. laanwj merged this on Sep 13, 2016
  28. laanwj closed this on Sep 13, 2016

  29. laanwj referenced this in commit 7e9ab9555c on Sep 13, 2016
  30. zkbot referenced this in commit ff9b21edb9 on Mar 2, 2017
  31. zkbot referenced this in commit 8ef121e7ae on Mar 2, 2017
  32. zkbot referenced this in commit b75b2de004 on Mar 2, 2017
  33. nomnombtc deleted the branch on Jul 22, 2017
  34. codablock referenced this in commit a1b531c0d9 on Sep 19, 2017
  35. codablock referenced this in commit 77a4dd1016 on Jan 9, 2018
  36. codablock referenced this in commit 5691cee8dd on Jan 9, 2018
  37. andvgal referenced this in commit de19c00483 on Jan 6, 2019
  38. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:15 UTC

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