autotools: Gui split #2700

pull theuni wants to merge 8 commits into bitcoin:master from theuni:gui-split changing 11 files +240 −228
  1. theuni commented at 7:06 PM on May 26, 2013: member

    This is the beginning of an autotools build-system refactor. My first step is to be able to create a common static lib for the binaries (console/qt/test) to link against, meaning that each of those will need its own entry-point object file.

    This series gets rid of the QT_GUI define in favor of letting the build-system link in the proper startup file, and a global var to determine how the binary was started.

    I've tried to match this project's formatting and general practices.

  2. BitcoinPullTester commented at 7:24 PM on May 26, 2013: none

    Automatic sanity-testing: FAILED BUILD/TEST, see http://jenkins.bluematt.me/pull-tester/37d4ab5e11da48e7627b446a2fae716555c58f18 for binaries and test log.

    This could happen for one of several reasons:

    1. It chanages paths in makefile.linux-mingw or otherwise changes build scripts in a way that made them incompatible with the automated testing scripts (please tweak those patches in contrib/test-scripts)
    2. It adds/modifies tests which test network rules (thanks for doing that), which conflicts with a patch applied at test time
    3. It does not build on either Linux i386 or Win32 (via MinGW cross compile)
    4. The test suite fails on either Linux i386 or Win32
    5. The block test-cases failed (lookup the first bNN identifier which failed in https://github.com/TheBlueMatt/test-scripts/blob/master/FullBlockTestGenerator.java)

    If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here.

    This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  3. BitcoinPullTester commented at 8:43 PM on May 26, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/feb4b7ef8d3ffb49b9bca41928051f7a8f6b4f29 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. jonasschnelli commented at 1:54 PM on May 27, 2013: contributor

    What's the benefit of this refactor? I like ifdefs. This change will mean we have GUI only code in the non-GUI binary (and vicaversa).

  5. laanwj commented at 2:41 PM on May 27, 2013: member

    @jonasschnelli: Compilation speed and sanity. This allows compiling the core objects only once and storing them in an archive (library) to be used by the all of bitcoin-qt, bitcoind and the tests.

    There are only very few differences left under QT_GUI defines (some help messages, and the default key which is going away anyway) so I honestly don't see the "GUI code in non-GUI" problem.

  6. sipa commented at 3:03 PM on May 27, 2013: member

    Any QT_GUI ifdef in the core code means that the core <-> GUI split wasn't done correctly in the first place. The core semantics shouldn't depend on whether there is a GUI on top of it or not...

  7. in src/init_noui.cpp:None in feb4b7ef8d outdated
       0 | @@ -0,0 +1,23 @@
       1 | +// Copyright (c) 2009-2010 Satoshi Nakamoto
       2 | +// Copyright (c) 2009-2012 The Bitcoin developers
       3 | +// Distributed under the MIT/X11 software license, see the accompanying
       4 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5 | +
       6 | +#include "init.h"
       7 | +
       8 | +extern void noui_connect();
    


    laanwj commented at 3:59 PM on May 27, 2013:

    Suggestion: move AppInit to this file as well. It is a bit empty, and AppInit is only used by the bitcoind (not by either bitcoin-qt or the tests), so it fits here.


    theuni commented at 8:04 PM on May 27, 2013:

    I left AppInit where it was because there's no logical reason to split it out (meaning no risk of symbol collisions if left in the static archive). It could feasibly be used to start a non-graphical session via the qt binary using something like 'bitcoin-qt --no-gui' if such behavior was ever desired in the future. But if there's opposition, sure, I can do that.


    laanwj commented at 7:18 AM on May 28, 2013:

    Such a feature (start a daemon session from bitcoin-qt) will never be supported. There is already the debug console window and the --server option.

    Functions that are only used by either the UI or daemon should be moved to their respective frontends (unless there is a very good reason not to, like keeping methods acting on an object together, but I disagree there is one in this case).


    theuni commented at 8:01 AM on May 28, 2013:

    OK. Will move.

  8. gavinandresen commented at 6:51 PM on May 27, 2013: contributor

    ACK on the concept; I haven't compiled/tested.

  9. jonasschnelli commented at 7:04 PM on May 27, 2013: contributor

    ACK compile and run (Bitcoin-Qt.app and bitcoind) smooth on osx 10.8.

  10. theuni commented at 8:13 PM on May 27, 2013: member

    @jonasschnelli you said: "I like ifdefs". If that's the resounding attitude here, I'll need to reevaluate my autotools work. Ifdefs are a portability nightmare if used to control runtime behavior. In this case, depending on the compiler/linker/settings used, the unreachable paths might be stripped away just as if ifdefs had been used.

    Would you mind explaining your position, and if it's common for bitcoin development? I have no problem adapting (even if i disagree), but it may negate the reasoning for my work.

  11. luke-jr commented at 8:30 PM on May 27, 2013: member

    @theuni I don't think @jonasschnelli 's ifdef love is representative of most developers here. It makes sense for some optional build-time features (UPnP, IPv6), but not so much in this case.

  12. jonasschnelli commented at 8:31 PM on May 27, 2013: contributor

    @theuni: no. just go on (even when i – generally – like #ifdef's). I just like binaries that only containing code which will be runned through. But for this case ifdefs are not the right thing.

  13. theuni commented at 8:40 PM on May 27, 2013: member

    Roger, thanks. I have more to say on the subject, but I'll do it in code/PR form as I go rather than discussing vague concepts here.

  14. jgarzik commented at 1:21 PM on May 28, 2013: contributor

    #ifdefs are evaluated on a case-by-case basis, if they make sense. If the GUI supports a runtime switch that forces daemon mode, then "#ifdef GUI" construct is not applicable for that build. It depends on the build and platform. Clearly, #ifdef GUI is applicable to a bitcoind-only build.

    Thus, just giving that one example, you can see where #ifdef is, and is not, applicable. Personal preference never enters into the equation. If #ifdef is applicable, it is used. Otherwise it is not.

  15. jgarzik commented at 1:22 PM on May 28, 2013: contributor

    ACK on the general concept

  16. theuni commented at 8:06 PM on May 28, 2013: member

    Ok, I've pushed changes to address comments here. I'll squash it down if everyone is ok with the above.

  17. BitcoinPullTester commented at 8:54 PM on May 28, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/c5e9ebcfb206deb19db166db4063120f220a3f3b for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  18. sipa commented at 2:41 AM on May 30, 2013: member

    Any reason why the init_noui code isn't just in noui?

  19. laanwj commented at 7:15 AM on May 30, 2013: member

    Agree with @sipa. We could call the resulting file bitcoind.cpp, which is more descriptive than noui.cpp.

  20. sipa commented at 7:17 AM on May 30, 2013: member

    Good idea.

  21. theuni commented at 7:17 AM on May 30, 2013: member

    yep, makes perfect sense. will do.

  22. build: prepare to move DetectShutdownThread a9380c72be
  23. build: split the non-gui startup routines into a new file
    This will allow each to have its own main(), meaning that we can build a common
    base client and simply link in the correct startup object to create the
    appropriate binary.
    c862d2ff22
  24. build: add global var for whether or not the gui is enabled 13c84b3bd5
  25. build: cosmetic: split usage string for easier formatting c98c88b3ab
  26. build: use runtime setting for displaying the help message rather than QT_GUI define 7f61f1ac78
  27. build: use runtime setting for wallet rather than QT_GUI define ee4b170c92
  28. build: cosmetics after last commit 34994ebcb0
  29. build: kill off the QT_GUI define 6887bb9ad7
  30. theuni commented at 7:56 AM on June 4, 2013: member

    renamed init_noui.cpp to bitcoind.cpp, rebased to current HEAD, and squashed logically.

    Anything else needed?

  31. theuni commented at 7:59 AM on June 4, 2013: member

    Grr, I just reread the comment above and realized I didn't make the change you guys were after. doing now.

  32. theuni commented at 8:09 AM on June 4, 2013: member

    Actually, the noui stuff can't move into bitcoind.cpp, as that would defeat the purpose of this rework. That would mean that test_bitcoin would have to link in bitcoind.o for noui_connect(), while also pulling in a conflicting main().

    The object containing main() needs to stay as thin as possible.

  33. BitcoinPullTester commented at 8:49 AM on June 4, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/6887bb9ad7f6722a64e9fbdf0a780f362dc796a1 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  34. sipa commented at 2:12 AM on June 5, 2013: member

    ACK

  35. laanwj commented at 4:31 PM on June 5, 2013: member

    ACK

  36. jgarzik commented at 5:24 PM on June 5, 2013: contributor

    ACK

    Coordination note: Recommend waiting until #2154 is merged, to merge this.

  37. theuni commented at 5:35 PM on June 5, 2013: member

    @jgarzik This is holding up my autotools pull request (it depends on this work), and it looks like #2154 could be a while. Could i convince you to change your mind on that?

  38. jgarzik commented at 5:46 PM on June 5, 2013: contributor

    #2154 won't be a while. See that pull req already discussing a hold on other pull reqs.

  39. sipa commented at 5:48 PM on June 5, 2013: member

    Just tested: #2700 and #2154 do not conflict with each other, so this can be merged independently.

  40. jgarzik commented at 5:56 PM on June 5, 2013: contributor

    Great, best of all worlds :)

  41. jgarzik referenced this in commit c94bd68547 on Jun 5, 2013
  42. jgarzik merged this on Jun 5, 2013
  43. jgarzik closed this on Jun 5, 2013

  44. theuni commented at 6:06 PM on June 5, 2013: member

    great, thanks

  45. theuni deleted the branch on Jun 6, 2013
  46. 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-13 21:16 UTC

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