build: Add `show-%` target for multi-line variables and debug info #24283

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:220207-print changing 23 files +30 −22
  1. hebasto commented at 9:15 AM on February 7, 2022: member

    This PR is a continuation of bitcoin/bitcoin#17087.

    Our depends builds system uses a bunch of variables which values consist of some lines, i.e., multi-line variables.

    During debugging it is annoying that print-% is unable to handle such variables:

    $ cd depends
    $ make print-sqlite_set_vars
    /bin/sh: 1: Syntax error: Unterminated quoted string
    make: *** [Makefile:5: print-sqlite_set_vars] Error 2
    

    This PR adds show-% target which prints multi-line variable value and its origin and flavor as well:

    $ cd depends
    $ make show-sqlite_set_vars
    - name:   sqlite_set_vars
    - origin: file
    - flavor: simple
    - value, printed from the new line:
    sqlite_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
    sqlite_config_opts_linux=--with-pic
    sqlite_config_opts_freebsd=--with-pic
    sqlite_config_opts_netbsd=--with-pic
    sqlite_config_opts_openbsd=--with-pic
    

    For connoisseurs suggesting make show-qt_set_vars :)


    Other useful examples of usage:

    $ make show-CC
    - name:   CC
    - origin: default
    - flavor: recursive
    - value, printed from the new line:
    cc
    
    $ make show-CC CC=clang
    - name:   CC
    - origin: command line
    - flavor: recursive
    - value, printed from the new line:
    clang
    
    $ CC=clang make show-CC
    - name:   CC
    - origin: environment
    - flavor: recursive
    - value, printed from the new line:
    clang
    
    $ make show-host
    - name:   host
    - origin: file
    - flavor: simple
    - value, printed from the new line:
    x86_64-pc-linux-gnu
    

    Please note that it is unwanted to just modify the print-% rule as it is used in scripts.

  2. hebasto added the label Build system on Feb 7, 2022
  3. maflcko added the label DrahtBot Guix build requested on Feb 7, 2022
  4. hebasto marked this as a draft on Feb 7, 2022
  5. laanwj commented at 2:09 PM on February 9, 2022: member

    Concept ACK. I think this kind of debugging functionality is very useful, especially for complex makefiles such as those used in the depends system.

  6. DrahtBot commented at 5:19 AM on February 11, 2022: contributor

    <!--9cd9c72976c961c55c7acef8f6ba82cd-->

    Guix builds

    File commit eca694a4e78d54ce4e29b388b3e81b06e55c2293<br>(master) commit 37930cc96d774aa585beb0ffd15a968bff3f6296<br>(master and this pull)
    SHA256SUMS.part 52bb278f472c04ff... ecf6af9fdb2c36c6...
    *-aarch64-linux-gnu-debug.tar.gz 1ea67072871fb3e9... b94b8141e2f6b497...
    *-aarch64-linux-gnu.tar.gz ab7737ea08cce568... e677b2e06b9f3eba...
    *-arm-linux-gnueabihf-debug.tar.gz ae6c042bb3938d92... 720cc6307f3e4a3a...
    *-arm-linux-gnueabihf.tar.gz 13c2fd99fa3ff645... ef2dcf56d8ef0f63...
    *-arm64-apple-darwin.tar.gz f2af6d80043feda6... df1cd52f10dde100...
    *-osx-unsigned.dmg 77200c90800d39ed... 8a58f09f6560a72b...
    *-osx-unsigned.tar.gz 9f07da42c43106fb... 985359524a727ad0...
    *-osx64.tar.gz 43d3aee5c66221ba... ff727a0f931924a1...
    *-powerpc64-linux-gnu-debug.tar.gz 4ba7a36e05279e3b... 3cc3cfa73956fd68...
    *-powerpc64-linux-gnu.tar.gz 882fe0c68aad339a... 8c8d14aedfab8046...
    *-powerpc64le-linux-gnu-debug.tar.gz d35588fadf892dea... 50a7b91e7881b3e3...
    *-powerpc64le-linux-gnu.tar.gz 19808899c534b9b0... aadb8d614eff760f...
    *-riscv64-linux-gnu-debug.tar.gz 1693a2d394dccb60... ac140f2b9cd70160...
    *-riscv64-linux-gnu.tar.gz 27cdc3197b74b915... 677c26a94aa694ef...
    *-x86_64-linux-gnu-debug.tar.gz 0ea261146b90e7dc... 5ce6c765b0f9c23a...
    *-x86_64-linux-gnu.tar.gz bca2953d8b7fe08a... 58a391cb8e9c3204...
    *.tar.gz 527dddd72b8fb635... b0484d3379dd40b8...
    guix_build.log 066fdaf5e045c1dc... 54a5b2cbea1be9d4...
    guix_build.log.diff 7fcffb58297acb76...
  7. DrahtBot removed the label DrahtBot Guix build requested on Feb 11, 2022
  8. laanwj commented at 2:01 PM on April 5, 2022: member

    Any reason for keeping this in draft status?

  9. DrahtBot commented at 3:41 AM on April 12, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #25964 (build: fix mingw miniupnpc cflags by fanquake)
    • #21778 (build: LLVM 14 & LLD based macOS toolchain by fanquake)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  10. jonatack commented at 10:33 AM on April 12, 2022: contributor

    Concept ACK

  11. hebasto renamed this:
    build: Add print-all-% target for multi-line variables and debug info
    build: Add `show-%` target for multi-line variables and debug info
    on Apr 16, 2022
  12. hebasto force-pushed on Apr 16, 2022
  13. hebasto commented at 5:59 PM on April 16, 2022: member

    @laanwj

    Any reason for keeping this in draft status?

    The wrong output here:

    $ make show-sqlite_set_vars
    - name:   sqlite_set_vars
    - origin: file
    - flavor: recursive
    - value, printed from the new line:
    zeromq_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
    zeromq_config_opts_linux=--with-pic
    zeromq_config_opts_freebsd=--with-pic
    zeromq_config_opts_netbsd=--with-pic
    zeromq_config_opts_openbsd=--with-pic
    
  14. hebasto force-pushed on Apr 16, 2022
  15. hebasto force-pushed on Apr 16, 2022
  16. hebasto force-pushed on Apr 16, 2022
  17. hebasto marked this as ready for review on Apr 16, 2022
  18. hebasto commented at 7:09 PM on April 16, 2022: member

    Any reason for keeping this in draft status?

    Ready for reviewing now. @laanwj

    Thank you for your reminding.

  19. hebasto commented at 7:18 PM on April 16, 2022: member

    The PR description has been updated.

  20. jarolrod commented at 4:58 AM on April 19, 2022: member

    concept ack

  21. DrahtBot added the label Needs rebase on Jun 27, 2022
  22. in depends/packages/bdb.mk:9 in f323829527 outdated
       5 | @@ -6,7 +6,7 @@ $(package)_sha256_hash=12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b857327
       6 |  $(package)_build_subdir=build_unix
       7 |  $(package)_patches=clang_cxx_11.patch
       8 |  
       9 | -define $(package)_set_vars
      10 | +define $(package)_set_vars :=
    


    laanwj commented at 1:39 PM on June 27, 2022:

    Maybe a dumb question, but what does the added := do?


    hebasto commented at 9:23 AM on July 20, 2022:

    It makes $(package)_set_vars a simply expanded variable which value is defined just after parsing.

  23. hebasto force-pushed on Jul 20, 2022
  24. hebasto commented at 9:34 AM on July 20, 2022: member

    Rebased f323829527dfefd3d108c23983a7c60f8edd20e8 -> 2d290d8a4a2fe3d620bfbaf5c3b719401288a87b (pr24283.03 -> pr24283.04).

  25. hebasto requested review from fanquake on Jul 20, 2022
  26. DrahtBot removed the label Needs rebase on Jul 20, 2022
  27. DrahtBot added the label Needs rebase on Jul 27, 2022
  28. hebasto force-pushed on Jul 27, 2022
  29. hebasto commented at 1:47 PM on July 27, 2022: member

    Rebased 2d290d8a4a2fe3d620bfbaf5c3b719401288a87b -> 6c18d85889ebdd70241d69023d2dade8a2270efc (pr24283.04 -> pr24283.05) due to the conflict with #25697.

  30. DrahtBot removed the label Needs rebase on Jul 27, 2022
  31. DrahtBot added the label Needs rebase on Aug 4, 2022
  32. scripted-diff: Make `$(package)_set_vars` simply expanded variables
    This change guarantees that variable values are correct at any time.
    
    -BEGIN VERIFY SCRIPT-
    s() { sed --in-place --expression="s/$1$/$2/g" $(git grep --files-with-matches "$1" "$3"); }
    s 'define $(package)_set_vars' 'define $(package)_set_vars :=' './depends'
    -END VERIFY SCRIPT-
    344af3d28f
  33. build: Add `show-%` target for multi-line variables and debug info 9d568cceca
  34. hebasto force-pushed on Aug 4, 2022
  35. hebasto commented at 9:16 AM on August 4, 2022: member

    Rebased 6c18d85889ebdd70241d69023d2dade8a2270efc -> 9d568cceca18c00100a3ed9bd735477553501426 (pr24283.05 -> pr24283.06) due to the conflict with #25633.

  36. DrahtBot removed the label Needs rebase on Aug 4, 2022
  37. achow101 commented at 7:04 PM on October 12, 2022: member

    Are you still working on this?

  38. hebasto commented at 7:09 PM on October 12, 2022: member

    Are you still working on this?

    I am. However, closing due to the lack of interest from other developers.

  39. hebasto closed this on Oct 12, 2022

  40. bitcoin locked this on Oct 12, 2023

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-24 21:14 UTC

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