diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 000000000..ca7be436d --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,5 @@ +[bumpversion] +current_version = 0.3.16 +commit = True +tag = True + diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index f96de0894..000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/.gitignore b/.gitignore index 932f17077..3a126adef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,13 @@ +.idea + *.tar.gz *.exe -src/lbrycrd +src/bitcoin src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx src/test/test_lbrycrd -src/test/test_lbrycrd_fuzzy -src/qt/lbrycrd-qt src/qt/test/test_lbrycrd-qt # autoreconf @@ -45,11 +45,7 @@ src/qt/forms/ui_*.h src/qt/test/moc*.cpp -src/qt/bitcoin-qt.config -src/qt/bitcoin-qt.creator -src/qt/bitcoin-qt.creator.user -src/qt/bitcoin-qt.files -src/qt/bitcoin-qt.includes +lbrycrd-dependencies/* .deps .dirstamp @@ -62,6 +58,8 @@ src/qt/bitcoin-qt.includes *.pyc *.o *.o-* +*.patch +.bitcoin *.a *.pb.cc *.pb.h @@ -76,17 +74,19 @@ src/qt/bitcoin-qt.includes #libtool object files *.lo *.la +start_time # Compilation and Qt preprocessor part *.qm Makefile +lbrycrd-qt bitcoin-qt Bitcoin-Qt.app -background.tiff* # Unit-tests Makefile.test bitcoin-qt_test +src/test/buildenv.py # Resources cpp qrc_*.cpp @@ -107,17 +107,18 @@ coverage_percent.txt linux-coverage-build linux-build win32-build -test/config.ini -test/cache/* +qa/pull-tester/run-bitcoind-for-test.sh +qa/pull-tester/tests_config.py +qa/pull-tester/cache/* +qa/pull-tester/test.*/* +qa/tmp +cache/ +share/BitcoindComparisonTool.jar !src/leveldb*/Makefile /doc/doxygen/ libbitcoinconsensus.pc -contrib/devtools/split-debug.sh -.idea cmake-build-*/ - -compile_commands\.json diff --git a/.travis.yml b/.travis.yml index 71c326411..829422909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,88 +1,69 @@ -language: minimal -filter_secrets: false -cache: - directories: - - ${HOME}/ccache - -stages: - - build - - test - -jobs: +matrix: include: - - - &build-template - stage: build - name: linux - env: NAME=linux DOCKER_IMAGE=lbry/build_lbrycrd_gcc EXT= - os: linux - dist: xenial - language: minimal - services: - - docker - install: - - mkdir -p ${HOME}/ccache - - docker pull $DOCKER_IMAGE - script: - - echo "build..." - - docker run -v "$(pwd):/lbrycrd" -v "${HOME}/ccache:/ccache" -w /lbrycrd -e CCACHE_DIR=/ccache ${DOCKER_IMAGE} packaging/build_${NAME}_64bit.sh - before_deploy: - - mkdir -p dist - - sudo zip -Xj dist/lbrycrd-${NAME}.zip src/lbrycrdd${EXT} src/lbrycrd-cli${EXT} src/lbrycrd-tx${EXT} - - sudo zip -Xj dist/lbrycrd-${NAME}-test.zip src/test/test_lbrycrd${EXT} src/test/test_lbrycrd_fuzzy${EXT} - - sha256sum dist/lbrycrd-${NAME}.zip - - sha256sum dist/lbrycrd-${NAME}-test.zip - deploy: - - provider: s3 - access_key_id: AKIAICKFHNTR5RITASAQ - secret_access_key: - secure: Qfgs8vGnEUvgiZNP2S9zY8qHEzaDOceF/XTv32jRBOISWfTqOTE56DZbOp8WKHPAqn0dx04jKA1NfV9f06sXU1NVbiJ2VYISo6XAk0n3RBJL3/mhNxvut/zM2DHkFPljWTkWEColS0ZyA3m4eUyJvAw/i+mOBT/zDD/oIlS5Uo5l/x3LmF9fYBuei0ucwSQeNOr2wCMIl+pXrIU7B3lEzXh1asayW6A9y7DOqMLnrSQ7TLlSssbnhuhDVpFx0xxX/U2NPraotbGKdo3wwMbms/lluBe60I/LsDNp9/SZXMDXh2YLGUImr97octwpdzIMjF+kU7QAZJzM7grz8PU9+MQh2V5sn6Xsww2x4PdkmHGz/2FMzhrCrlPf5JCaPBH49G+w4/29HYmMrlimOOVx4qXCpQ/XtWWne/d6MF0qqT6JhdPuD9ohmTpxcHRkCe2fxUw6Yn3dj+/+YoCywAcwcBm5jLpAotmWoCmmcnm9rvB7bIuPPZAjJUZViCnyvwY4Tj3Fb+sOuK4b/O5D2+cuS+WgQRkN/RspYlXrXTIh8Efv/yhW5L9WdzG1OExJDw2hX5VTccRRgIKZxZp80U2eYqn2M07+1nU+ShX4kgiSon46k5cfacLgzLKWEyCxWSSTbsYcwRxvDEjtYy4wxAYx8+J3dgQPs/opDXoQTJMjud0= - bucket: build.lbry.io - upload-dir: lbrycrd/${TRAVIS_BRANCH} - acl: public_read - local_dir: dist - skip_cleanup: true - on: - repo: lbryio/lbrycrd - all_branches: true - - - <<: *build-template - name: windows - env: NAME=windows DOCKER_IMAGE=lbry/build_lbrycrd EXT=.exe - - - <<: *build-template - name: osx - env: NAME=darwin DOCKER_IMAGE=lbry/build_lbrycrd EXT= - before_install: - - mkdir -p ./depends/SDKs && pushd depends/SDKs && curl -C - ${MAC_OS_SDK} | tar --skip-old-files -xJ && popd - - - &test-template - stage: test - env: NAME=linux - os: linux - dist: xenial - language: minimal - git: - clone: false - install: - - mkdir -p testrun && cd testrun - - curl http://build.lbry.io/lbrycrd/${TRAVIS_BRANCH}/lbrycrd-${NAME}-test.zip -o temp.zip - - unzip temp.zip - script: TRIEHASH_FUZZER_BLOCKS=1000 ./test_lbrycrd - - - <<: *test-template - # os: windows # doesn't support secrets at the moment - os: linux - dist: xenial - env: NAME=windows - services: - - docker - script: - - docker pull lbry/wine - - docker run -v "$(pwd):/test" -e "WINEDEBUG=-all" -e "TRIEHASH_FUZZER_BLOCKS=1000" -it lbry/wine wine "/test/test_lbrycrd.exe" - - - <<: *test-template - os: osx - osx_image: xcode8.3 - env: NAME=darwin - + - os: linux + sudo: required + dist: trusty + language: c + env: TARGET=linux + - os: linux + sudo: required + dist: trusty + language: c + env: TARGET=windows + - os: osx + language: c + osx_image: xcode7.3 + env: TARGET=osx +cache: + apt: true + ccache: true + directories: + - build + - depends/built +before_install: +- date +%s > "${TRAVIS_BUILD_DIR}/start_time" +- ls -lh build +- du -h -d 2 build +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ccache; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi +install: true +script: +- mkdir -p "dist/${TRAVIS_BRANCH}" +- if [[ "${TARGET}" == "osx" ]]; then ./reproducible_build.sh -t -o -c; fi +- if [[ "${TARGET}" == "linux" ]]; then ./reproducible_build.sh -t -o -c -f; fi +- if [[ "${TARGET}" == "windows" ]]; then ./packaging/build_windows.sh; fi +- if [[ "${TARGET}" == "osx" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi +- if [[ "${TARGET}" == "linux" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi +- if [[ "${TARGET}" == "windows" ]]; then zip -j "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" src/lbrycrdd.exe src/lbrycrd-cli.exe src/lbrycrd-tx.exe; fi +- if [[ "${TARGET}" == "osx" ]]; then shasum -a 256 dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- if [[ "${TARGET}" == "linux" ]]; then sha256sum -b dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- if [[ "${TARGET}" == "windows" ]]; then sha256sum -b dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip > dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt; fi +- cat dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}-sha256.txt +before_cache: +- ls -lh build +- du -h -d 2 build +deploy: +- provider: releases + draft: true + file: "dist/${TRAVIS_BRANCH}/lbrycrd-${TARGET}.zip" + name: "${TRAVIS_BRANCH}" + skip_cleanup: true + target_commitish: $TRAVIS_COMMIT + tag_name: $TRAVIS_TAG + on: + tags: true + api_key: + secure: "Ni5WZNR5CefWXpyDUQLMQbQ2LH4Iot+0SqIoM9c4maW06al1M8vu57vWuj2cESsW7JsaBehCE45Cwmo5kWyEjAiZY8sIMmvixkMP/8uPWuLgNmnIbm7U+d0j652DmZshDYtt8EomqV2RhAx/rmBnzGkruLOw9WTp9ZdBN3WbTt/IpZ2gMgVbGWYGOx+uRw7/yGw8m4gShQheto/dycbyyR3XV2WP9wuLmNYkcQ6JumSoQdDWXcvVfbCwylGq2sLDKwhvfTr4iwYyYsWdmhfdEQl0WcIv5C8xgdiY2vzhi2LmLqFbS/fvKNC26Tfo4bOHFG/eOnvqc+yyEB8B/xqW9Gs+A0TUh/3N30vHYZGcpiDU35DwAN5bZ1+s+mr/ZrNzBJ5BgT8io3g0Ko8gykbDvFQVpg7kxFsqA1YCikEpG86lVGk6clTa5guJvAHse+DfnbWO1nfDxYQXW0md861m0txk8RpTC/TVNyH/lL/vsS7LB67EHhRdZY+O1+5sUGMdtvvhMoxJYCwQGpLkh43KRsKynkMUR94w2O9hc8cknXdV3wrndVz00XNdcur6y4D7HTll1tBrF68CA2yKUSY5hsjtPmdlN+DW8ou/rJiKOpQZ/Xzp69AQEheOFfDPItxQRYxWj0dMOk8eszf0wFvi1N7J/hT/IHnuX5ITfa/T4NE=" +- provider: s3 + access_key_id: AKIAICKFHNTR5RITASAQ + secret_access_key: + secure: Qfgs8vGnEUvgiZNP2S9zY8qHEzaDOceF/XTv32jRBOISWfTqOTE56DZbOp8WKHPAqn0dx04jKA1NfV9f06sXU1NVbiJ2VYISo6XAk0n3RBJL3/mhNxvut/zM2DHkFPljWTkWEColS0ZyA3m4eUyJvAw/i+mOBT/zDD/oIlS5Uo5l/x3LmF9fYBuei0ucwSQeNOr2wCMIl+pXrIU7B3lEzXh1asayW6A9y7DOqMLnrSQ7TLlSssbnhuhDVpFx0xxX/U2NPraotbGKdo3wwMbms/lluBe60I/LsDNp9/SZXMDXh2YLGUImr97octwpdzIMjF+kU7QAZJzM7grz8PU9+MQh2V5sn6Xsww2x4PdkmHGz/2FMzhrCrlPf5JCaPBH49G+w4/29HYmMrlimOOVx4qXCpQ/XtWWne/d6MF0qqT6JhdPuD9ohmTpxcHRkCe2fxUw6Yn3dj+/+YoCywAcwcBm5jLpAotmWoCmmcnm9rvB7bIuPPZAjJUZViCnyvwY4Tj3Fb+sOuK4b/O5D2+cuS+WgQRkN/RspYlXrXTIh8Efv/yhW5L9WdzG1OExJDw2hX5VTccRRgIKZxZp80U2eYqn2M07+1nU+ShX4kgiSon46k5cfacLgzLKWEyCxWSSTbsYcwRxvDEjtYy4wxAYx8+J3dgQPs/opDXoQTJMjud0= + bucket: build.lbry.io + upload-dir: lbrycrd + acl: public_read + local_dir: dist + skip_cleanup: true + on: + repo: lbryio/lbrycrd + all_branches: true diff --git a/.tx/config b/.tx/config index c0931c0f3..d6cc3aab8 100644 --- a/.tx/config +++ b/.tx/config @@ -1,7 +1,7 @@ [main] host = https://www.transifex.com -[bitcoin.qt-translation-017x] +[bitcoin.qt-translation-012x] file_filter = src/qt/locale/bitcoin_.ts source_file = src/qt/locale/bitcoin_en.ts source_lang = en diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..ac283aec0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.7) +project(lbrycrd_clion) # Do not use for full compile. This is for CLion syntax checking only. + +set (CMAKE_CXX_STANDARD 98) # 03 is not supported by cmake, but this will soon be 11 (after upstream bitcoin merge) +# I thought that setting the standard would disable the clang-tidy c++11 tips; nope. + +set(BOOST_ROOT "build/boost" CACHE PATH "Boost library path") +set(Boost_NO_SYSTEM_PATHS on CACHE BOOL "Do not search system for Boost") +find_package(Boost REQUIRED COMPONENTS filesystem program_options thread chrono) # locale coming shortly + +file(GLOB sources + src/*.h src/*.cpp + src/wallet/*.h src/wallet/*.cpp + src/support/*.h src/support/*.cpp src/support/allocators/*.h + src/script/*.h src/script/*.cpp + src/rpc/*.h src/rpc/*.cpp + src/primitives/*.h src/primitives/*.cpp + src/policy/*.h src/policy/*.cpp + src/crypto/*.h src/crypto/*.cpp + src/consensus/*.h src/consensus/*.cpp + src/compat/*.h src/compat/*.cpp + ) +list(FILTER sources EXCLUDE REGEX "src/bitcoin*.cpp$") + +include_directories(${Boost_INCLUDE_DIRS} + build/bdb/include + build/libevent/include + build/openssl/include + src/support/allocators + src/support + src/rpc + src/policy + src/wallet src/script + src/leveldb/helpers/memenv + src/leveldb/include + src/config + src/crypto + src/compat + src/obj + src/univalue/include + src/secp256k1/include + src/ + ) + +add_compile_definitions(HAVE_CONFIG_H) + +add_executable(lbrycrd-cli src/bitcoin-cli.cpp ${sources}) +add_executable(lbrycrd-tx src/bitcoin-tx.cpp ${sources}) +add_executable(lbrycrdd src/bitcoind.cpp ${sources}) + +file(GLOB tests src/test/*.cpp) +foreach(test ${tests}) + get_filename_component(filename ${test} NAME_WE) + add_executable(${filename} ${test} ${sources}) + target_include_directories(${filename} PRIVATE src/test) +endforeach(test) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d5dc3221..53d6527d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,306 +1,110 @@ Contributing to Bitcoin Core ============================ -The Bitcoin Core project operates an open contributor model where anyone is -welcome to contribute towards development in the form of peer review, testing -and patches. This document explains the practical process and guidelines for -contributing. +The Bitcoin Core project operates an open contributor model where anyone is welcome to contribute towards development in the form of peer review, testing and patches. This document explains the practical process and guidelines for contributing. -Firstly in terms of structure, there is no particular concept of "Core -developers" in the sense of privileged people. Open source often naturally -revolves around meritocracy where longer term contributors gain more trust from -the developer community. However, some hierarchy is necessary for practical -purposes. As such there are repository "maintainers" who are responsible for -merging pull requests as well as a "lead maintainer" who is responsible for the -release cycle, overall merging, moderation and appointment of maintainers. - -If you're looking for somewhere to start contributing, check out the -[good first issue](https://github.com/bitcoin/bitcoin/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) -list. - -Communication Channels ----------------------- - -Most communication about Bitcoin Core development happens on IRC, in the -#bitcoin-core-dev channel on Freenode. The easiest way to participate on IRC is -with the web client, [webchat.freenode.net](https://webchat.freenode.net/). Chat -history logs can be found -on [botbot.me](https://botbot.me/freenode/bitcoin-core-dev/). - -Discussion about code base improvements happens in GitHub issues and on pull -requests. - -The developer -[mailing list](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev) -should be used to discuss complicated or controversial changes before working on -a patch set. +Firstly in terms of structure, there is no particular concept of “Core developers” in the sense of privileged people. Open source often naturally revolves around meritocracy where longer term contributors gain more trust from the developer community. However, some hierarchy is necessary for practical purposes. As such there are repository “maintainers” who are responsible for merging pull requests as well as a “lead maintainer” who is responsible for the release cycle, overall merging, moderation and appointment of maintainers. Contributor Workflow -------------------- -The codebase is maintained using the "contributor workflow" where everyone -without exception contributes patch proposals using "pull requests". This -facilitates social contribution, easy testing and peer review. +The codebase is maintained using the “contributor workflow” where everyone without exception contributes patch proposals using “pull requests”. This facilitates social contribution, easy testing and peer review. To contribute a patch, the workflow is as follows: - 1. Fork repository - 1. Create topic branch - 1. Commit patches + - Fork repository + - Create topic branch + - Commit patches -The project coding conventions in the [developer notes](doc/developer-notes.md) -must be adhered to. +The project coding conventions in [doc/developer-notes.md](doc/developer-notes.md) must be adhered to. -In general [commits should be atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) -and diffs should be easy to read. For this reason do not mix any formatting -fixes or code moves with actual code changes. +In general [commits should be atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) and diffs should be easy to read. For this reason do not mix any formatting fixes or code moves with actual code changes. -Commit messages should be verbose by default consisting of a short subject line -(50 chars max), a blank line and detailed explanatory text as separate -paragraph(s), unless the title alone is self-explanatory (like "Corrected typo -in init.cpp") in which case a single title line is sufficient. Commit messages should be -helpful to people reading your code in the future, so explain the reasoning for -your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/). +Commit messages should be verbose by default consisting of a short subject line (50 chars max), a blank line and detailed explanatory text as separate paragraph(s); unless the title alone is self-explanatory (like "Corrected typo in main.cpp") then a single title line is sufficient. Commit messages should be helpful to people reading your code in the future, so explain the reasoning for your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/). -If a particular commit references another issue, please add the reference. For -example: `refs #1234` or `fixes #4321`. Using the `fixes` or `closes` keywords -will cause the corresponding issue to be closed when the pull request is merged. +If a particular commit references another issue, please add the reference, for example "refs #1234", or "fixes #4321". Using "fixes or closes" keywords will cause the corresponding issue to be closed when the pull request is merged. -Please refer to the [Git manual](https://git-scm.com/doc) for more information -about Git. +Please refer to the [Git manual](https://git-scm.com/doc) for more information about Git. - Push changes to your fork - Create pull request -The title of the pull request should be prefixed by the component or area that -the pull request affects. Valid areas as: - - - *Consensus* for changes to consensus critical code - - *Docs* for changes to the documentation - - *Qt* for changes to bitcoin-qt - - *Mining* for changes to the mining code - - *Net* or *P2P* for changes to the peer-to-peer network code - - *RPC/REST/ZMQ* for changes to the RPC, REST or ZMQ APIs - - *Scripts and tools* for changes to the scripts and tools - - *Tests* for changes to the bitcoin unit tests or QA tests - - *Trivial* should **only** be used for PRs that do not change generated - executable code. Notably, refactors (change of function arguments and code - reorganization) and changes in behavior should **not** be marked as trivial. - Examples of trivial PRs are changes to: - - comments - - whitespace - - variable names - - logging and messages - - *Utils and libraries* for changes to the utils and libraries - - *Wallet* for changes to the wallet code - -Examples: +The title of the pull request should be prefixed by the component or area that the pull request affects. Examples: Consensus: Add new opcode for BIP-XXXX OP_CHECKAWESOMESIG Net: Automatically create hidden service, listen on Tor Qt: Add feed bump button - Trivial: Fix typo in init.cpp + Trivial: fix typo -Note that translations should not be submitted as pull requests, please see -[Translation Process](https://github.com/bitcoin/bitcoin/blob/master/doc/translation_process.md) -for more information on helping with translations. +If a pull request is specifically not to be considered for merging (yet) please prefix the title with [WIP] or use [Tasks Lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments) in the body of the pull request to indicate tasks are pending. -If a pull request is not to be considered for merging (yet), please -prefix the title with [WIP] or use [Tasks Lists](https://help.github.com/articles/basic-writing-and-formatting-syntax/#task-lists) -in the body of the pull request to indicate tasks are pending. +The body of the pull request should contain enough description about what the patch does together with any justification/reasoning. You should include references to any discussions (for example other tickets or mailing list discussions). -The body of the pull request should contain enough description about what the -patch does together with any justification/reasoning. You should include -references to any discussions (for example other tickets or mailing list -discussions). - -At this stage one should expect comments and review from other contributors. You -can add more commits to your pull request by committing them locally and pushing -to your fork until you have satisfied all feedback. - -Note: Code review is a burdensome but important part of the development process, and as such, certain types of pull requests are rejected. In general, if the **improvements** do not warrant the **review effort** required, the PR has a high chance of being rejected. It is up to the PR author to convince the reviewers that the changes warrant the review effort, and if reviewers are "Concept NAK'ing" the PR, the author may need to present arguments and/or do research backing their suggested changes. - -Squashing Commits ---------------------------- -If your pull request is accepted for merging, you may be asked by a maintainer -to squash and or [rebase](https://git-scm.com/docs/git-rebase) your commits -before it will be merged. The basic squashing workflow is shown below. - - git checkout your_branch_name - git rebase -i HEAD~n - # n is normally the number of commits in the pull request. - # Set commits (except the one in the first line) from 'pick' to 'squash', save and quit. - # On the next screen, edit/refine commit messages. - # Save and quit. - git push -f # (force push to GitHub) - -If you have problems with squashing (or other workflows with `git`), you can -alternatively enable "Allow edits from maintainers" in the right GitHub -sidebar and ask for help in the pull request. - -Please refrain from creating several pull requests for the same change. -Use the pull request that is already open (or was created earlier) to amend -changes. This preserves the discussion and review that happened earlier for -the respective change set. - -The length of time required for peer review is unpredictable and will vary from -pull request to pull request. +At this stage one should expect comments and review from other contributors. You can add more commits to your pull request by committing them locally and pushing to your fork until you have satisfied all feedback. If your pull request is accepted for merging, you may be asked by a maintainer to squash and or rebase your commits before it will be merged. The length of time required for peer review is unpredictable and will vary from patch to patch. Pull Request Philosophy ----------------------- -Patchsets should always be focused. For example, a pull request could add a -feature, fix a bug, or refactor code; but not a mixture. Please also avoid super -pull requests which attempt to do too much, are overly large, or overly complex -as this makes review difficult. +Patchsets should always be focused. For example, a pull request could add a feature, fix a bug, or refactor code; but not a mixture. Please also avoid super pull requests which attempt to do too much, are overly large, or overly complex as this makes review difficult. -### Features +###Features -When adding a new feature, thought must be given to the long term technical debt -and maintenance that feature may require after inclusion. Before proposing a new -feature that will require maintenance, please consider if you are willing to -maintain it (including bug fixing). If features get orphaned with no maintainer -in the future, they may be removed by the Repository Maintainer. +When adding a new feature, thought must be given to the long term technical debt and maintenance that feature may require after inclusion. Before proposing a new feature that will require maintenance, please consider if you are willing to maintain it (including bug fixing). If features get orphaned with no maintainer in the future, they may be removed by the Repository Maintainer. -### Refactoring +###Refactoring -Refactoring is a necessary part of any software project's evolution. The -following guidelines cover refactoring pull requests for the project. +Refactoring is a necessary part of any software project's evolution. The following guidelines cover refactoring pull requests for the project. -There are three categories of refactoring, code only moves, code style fixes, -code refactoring. In general refactoring pull requests should not mix these -three kinds of activity in order to make refactoring pull requests easy to -review and uncontroversial. In all cases, refactoring PRs must not change the -behaviour of code within the pull request (bugs must be preserved as is). +There are three categories of refactoring, code only moves, code style fixes, code refactoring. In general refactoring pull requests should not mix these three kinds of activity in order to make refactoring pull requests easy to review and uncontroversial. In all cases, refactoring PRs must not change the behaviour of code within the pull request (bugs must be preserved as is). -Project maintainers aim for a quick turnaround on refactoring pull requests, so -where possible keep them short, uncomplex and easy to verify. - -Pull requests that refactor the code should not be made by new contributors. It -requires a certain level of experience to know where the code belongs to and to -understand the full ramification (including rebase effort of open pull requests). - -Trivial pull requests or pull requests that refactor the code with no clear -benefits may be immediately closed by the maintainers to reduce unnecessary -workload on reviewing. +Project maintainers aim for a quick turnaround on refactoring pull requests, so where possible keep them short, uncomplex and easy to verify. "Decision Making" Process ------------------------- -The following applies to code changes to the Bitcoin Core project (and related -projects such as libsecp256k1), and is not to be confused with overall Bitcoin -Network Protocol consensus changes. +The following applies to code changes to the Bitcoin Core project (and related projects such as libsecp256k1), and is not to be confused with overall Bitcoin Network Protocol consensus changes. -Whether a pull request is merged into Bitcoin Core rests with the project merge -maintainers and ultimately the project lead. +Whether a pull request is merged into Bitcoin Core rests with the project merge maintainers and ultimately the project lead. -Maintainers will take into consideration if a patch is in line with the general -principles of the project; meets the minimum standards for inclusion; and will -judge the general consensus of contributors. +Maintainers will take into consideration if a patch is in line with the general principles of the project; meets the minimum standards for inclusion; and will judge the general consensus of contributors. In general, all pull requests must: - - Have a clear use case, fix a demonstrable bug or serve the greater good of - the project (for example refactoring for modularisation); - - Be well peer reviewed; - - Have unit tests and functional tests where appropriate; - - Follow code style guidelines ([C++](doc/developer-notes.md), [functional tests](test/functional/README.md)); - - Not break the existing test suite; - - Where bugs are fixed, where possible, there should be unit tests - demonstrating the bug and also proving the fix. This helps prevent regression. + - have a clear use case, fix a demonstrable bug or serve the greater good of the project (for example refactoring for modularisation); + - be well peer reviewed; + - have unit tests and functional tests where appropriate; + - follow code style guidelines; + - not break the existing test suite; + - where bugs are fixed, where possible, there should be unit tests demonstrating the bug and also proving the fix. This helps prevent regression. -Patches that change Bitcoin consensus rules are considerably more involved than -normal because they affect the entire ecosystem and so must be preceded by -extensive mailing list discussions and have a numbered BIP. While each case will -be different, one should be prepared to expend more time and effort than for -other kinds of patches because of increased peer review and consensus building -requirements. +Patches that change Bitcoin consensus rules are considerably more involved than normal because they affect the entire ecosystem and so must be preceded by extensive mailing list discussions and have a numbered BIP. While each case will be different, one should be prepared to expend more time and effort than for other kinds of patches because of increased peer review and consensus building requirements. -### Peer Review +###Peer Review -Anyone may participate in peer review which is expressed by comments in the pull -request. Typically reviewers will review the code for obvious errors, as well as -test out the patch set and opine on the technical merits of the patch. Project -maintainers take into account the peer review when determining if there is -consensus to merge a pull request (remember that discussions may have been -spread out over GitHub, mailing list and IRC discussions). The following -language is used within pull-request comments: +Anyone may participate in peer review which is expressed by comments in the pull request. Typically reviewers will review the code for obvious errors, as well as test out the patch set and opine on the technical merits of the patch. Project maintainers take into account the peer review when determining if there is consensus to merge a pull request (remember that discussions may have been spread out over github, mailing list and IRC discussions). The following language is used within pull-request comments: - ACK means "I have tested the code and I agree it should be merged"; - - NACK means "I disagree this should be merged", and must be accompanied by - sound technical justification (or in certain cases of copyright/patent/licensing - issues, legal justification). NACKs without accompanying reasoning may be - disregarded; - - utACK means "I have not tested the code, but I have reviewed it and it looks - OK, I agree it can be merged"; + - NACK means "I disagree this should be merged", and must be accompanied by sound technical justification. NACKs without accompanying reasoning may be disregarded; + - utACK means "I have not tested the code, but I have reviewed it and it looks OK, I agree it can be merged"; - Concept ACK means "I agree in the general principle of this pull request"; - Nit refers to trivial, often non-blocking issues. Reviewers should include the commit hash which they reviewed in their comments. -Project maintainers reserve the right to weigh the opinions of peer reviewers -using common sense judgement and also may weight based on meritocracy: Those -that have demonstrated a deeper commitment and understanding towards the project -(over time) or have clear domain expertise may naturally have more weight, as -one would expect in all walks of life. +Project maintainers reserve the right to weigh the opinions of peer reviewers using common sense judgement and also may weight based on meritocracy: Those that have demonstrated a deeper commitment and understanding towards the project (over time) or have clear domain expertise may naturally have more weight, as one would expect in all walks of life. -Where a patch set affects consensus critical code, the bar will be set much -higher in terms of discussion and peer review requirements, keeping in mind that -mistakes could be very costly to the wider community. This includes refactoring -of consensus critical code. +Where a patch set affects consensus critical code, the bar will be set much higher in terms of discussion and peer review requirements, keeping in mind that mistakes could be very costly to the wider community. This includes refactoring of consensus critical code. -Where a patch set proposes to change the Bitcoin consensus, it must have been -discussed extensively on the mailing list and IRC, be accompanied by a widely -discussed BIP and have a generally widely perceived technical consensus of being -a worthwhile change based on the judgement of the maintainers. - -### Finding Reviewers - -As most reviewers are themselves developers with their own projects, the review -process can be quite lengthy, and some amount of patience is required. If you find -that you've been waiting for a pull request to be given attention for several -months, there may be a number of reasons for this, some of which you can do something -about: - - - It may be because of a feature freeze due to an upcoming release. During this time, - only bug fixes are taken into consideration. If your pull request is a new feature, - it will not be prioritized until the release is over. Wait for release. - - It may be because the changes you are suggesting do not appeal to people. Rather than - nits and critique, which require effort and means they care enough to spend time on your - contribution, thundering silence is a good sign of widespread (mild) dislike of a given change - (because people don't assume *others* won't actually like the proposal). Don't take - that personally, though! Instead, take another critical look at what you are suggesting - and see if it: changes too much, is too broad, doesn't adhere to the - [developer notes](doc/developer-notes.md), is dangerous or insecure, is messily written, etc. - Identify and address any of the issues you find. Then ask e.g. on IRC if someone could give - their opinion on the concept itself. - - It may be because your code is too complex for all but a few people. And those people - may not have realized your pull request even exists. A great way to find people who - are qualified and care about the code you are touching is the - [Git Blame feature](https://help.github.com/articles/tracing-changes-in-a-file/). Simply - find the person touching the code you are touching before you and see if you can find - them and give them a nudge. Don't be incessant about the nudging though. - - Finally, if all else fails, ask on IRC or elsewhere for someone to give your pull request - a look. If you think you've been waiting an unreasonably long amount of time (month+) for - no particular reason (few lines changed, etc), this is totally fine. Try to return the favor - when someone else is asking for feedback on their code, and universe balances out. +Where a patch set proposes to change the Bitcoin consensus, it must have been discussed extensively on the mailing list and IRC, be accompanied by a widely discussed BIP and have a generally widely perceived technical consensus of being a worthwhile change based on the judgement of the maintainers. Release Policy -------------- The project leader is the release manager for each Bitcoin Core release. - -Copyright ---------- - -By contributing to this repository, you agree to license your work under the -MIT license unless specified otherwise in `contrib/debian/copyright` or at -the top of the file itself. Any work contributed where you are not the original -author must contain its license header with the original author(s) and source. diff --git a/COPYING b/COPYING index 9704b9c94..c6be8e547 100644 --- a/COPYING +++ b/COPYING @@ -1,7 +1,6 @@ The MIT License (MIT) -Copyright (c) 2009-2018 The Bitcoin Core developers -Copyright (c) 2009-2018 Bitcoin Developers +Copyright (c) 2009-2016 The Bitcoin Core developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 520a47d96..000000000 --- a/INSTALL.md +++ /dev/null @@ -1,5 +0,0 @@ -Building Bitcoin -================ - -See doc/build-*.md for instructions on building the various -elements of the Bitcoin Core reference implementation of Bitcoin. diff --git a/LICENSE b/LICENSE index dc60f89cd..11687b7fe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015-2019 LBRY Inc +Copyright (c) 2015-2018 LBRY Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, diff --git a/Makefile.am b/Makefile.am index 23bac4daa..5783c1fdd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,8 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - ACLOCAL_AMFLAGS = -I build-aux/m4 SUBDIRS = src -if ENABLE_MAN -SUBDIRS += doc/man -endif .PHONY: deploy FORCE +GZIP_ENV="-9n" export PYTHONPATH if BUILD_BITCOIN_LIBS @@ -19,13 +13,12 @@ endif BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT) BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT) BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT) -BITCOIN_TX_BIN=$(top_builddir)/src/$(BITCOIN_TX_NAME)$(EXEEXT) BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT) empty := space := $(empty) $(empty) -OSX_APP=LBRYcrd-Qt.app +OSX_APP=Bitcoin-Qt.app OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) OSX_DMG = $(OSX_VOLNAME).dmg OSX_BACKGROUND_SVG=background.svg @@ -35,18 +28,10 @@ OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns -OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed +OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md) -DIST_CONTRIB = $(top_srcdir)/contrib/bitcoin-cli.bash-completion \ - $(top_srcdir)/contrib/bitcoin-tx.bash-completion \ - $(top_srcdir)/contrib/bitcoind.bash-completion \ - $(top_srcdir)/contrib/init \ - $(top_srcdir)/contrib/install_db4.sh -DIST_SHARE = \ - $(top_srcdir)/share/genbuild.sh \ - $(top_srcdir)/share/rpcauth BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \ $(top_srcdir)/contrib/devtools/security-check.py @@ -62,24 +47,36 @@ OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \ $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \ $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh -COVERAGE_INFO = baseline.info \ - test_bitcoin_filtered.info total_coverage.info \ - baseline_filtered.info functional_test.info functional_test_filtered.info \ - test_bitcoin_coverage.info test_bitcoin.info +COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \ + leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \ + baseline_filtered.info block_test_filtered.info rpc_test.info rpc_test_filtered.info \ + leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info dist-hook: + -$(MAKE) -C $(top_distdir)/src/leveldb clean + -$(MAKE) -C $(top_distdir)/src/secp256k1 distclean -$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf - +distcheck-hook: + $(MKDIR_P) $(top_distdir)/_build/src/leveldb + cp -rf $(top_srcdir)/src/leveldb/* $(top_distdir)/_build/src/leveldb/ + -$(MAKE) -C $(top_distdir)/_build/src/leveldb clean + +distcleancheck: + @: + $(BITCOIN_WIN_INSTALLER): all-recursive $(MKDIR_P) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release @test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \ echo error: could not build $@ @echo built $@ +$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE + $(MAKE) -C src $(patsubst src/%,%,$@) + $(OSX_APP)/Contents/PkgInfo: $(MKDIR_P) $(@D) @echo "APPL????" > $@ @@ -96,9 +93,9 @@ $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ -$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: all-recursive +$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN) $(MKDIR_P) $(@D) - STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $@ + STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@ $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(MKDIR_P) $(@D) @@ -112,16 +109,9 @@ osx_volname: echo $(OSX_VOLNAME) >$@ if BUILD_DARWIN -$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) $(OSX_BACKGROUND_IMAGE) +$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2 -volname $(OSX_VOLNAME) -$(OSX_BACKGROUND_IMAGE).png: contrib/macdeploy/$(OSX_BACKGROUND_SVG) - sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d 36 -p 36 -o $@ -$(OSX_BACKGROUND_IMAGE)@2x.png: contrib/macdeploy/$(OSX_BACKGROUND_SVG) - sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d 72 -p 72 -o $@ -$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE).png $(OSX_BACKGROUND_IMAGE)@2x.png - tiffutil -cathidpicheck $^ -out $@ - deploydir: $(OSX_DMG) else APP_DIST_DIR=$(top_builddir)/dist @@ -169,135 +159,82 @@ $(BITCOIND_BIN): FORCE $(BITCOIN_CLI_BIN): FORCE $(MAKE) -C src $(@F) -$(BITCOIN_TX_BIN): FORCE - $(MAKE) -C src $(@F) - if USE_LCOV -LCOV_FILTER_PATTERN=-p "/usr/include/" -p "src/leveldb/" -p "src/bench/" -p "src/univalue" -p "src/crypto/ctaes" -p "src/secp256k1" baseline.info: $(LCOV) -c -i -d $(abs_builddir)/src -o $@ baseline_filtered.info: baseline.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ + $(LCOV) -r $< "/usr/include/*" -o $@ -test_bitcoin.info: baseline_filtered.info +leveldb_baseline.info: baseline_filtered.info + $(LCOV) -c -i -d $(abs_builddir)/src/leveldb -b $(abs_builddir)/src/leveldb -o $@ + +leveldb_baseline_filtered.info: leveldb_baseline.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtered.info + $(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@ + +test_bitcoin.info: baseline_filtered_combined.info $(MAKE) -C src/ check - $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src -t test_bitcoin -o $@ - $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src + $(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb test_bitcoin_filtered.info: test_bitcoin.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ + $(LCOV) -r $< "/usr/include/*" -o $@ -functional_test.info: test_bitcoin_filtered.info - -@TIMEOUT=15 test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS) - $(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t functional-tests -o $@ - $(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src +block_test.info: test_bitcoin_filtered.info + $(MKDIR_P) qa/tmp + -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS) + $(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb -functional_test_filtered.info: functional_test.info - $(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@ - $(LCOV) -a $@ $(LCOV_OPTS) -o $@ +block_test_filtered.info: block_test.info + $(LCOV) -r $< "/usr/include/*" -o $@ -test_bitcoin_coverage.info: baseline_filtered.info test_bitcoin_filtered.info - $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -o $@ +rpc_test.info: test_bitcoin_filtered.info + -@TIMEOUT=15 python qa/pull-tester/rpc-tests.py $(EXTENDED_RPC_TESTS) + $(LCOV) -c -d $(abs_builddir)/src --t rpc-tests -o $@ + $(LCOV) -z -d $(abs_builddir)/src + $(LCOV) -z -d $(abs_builddir)/src/leveldb -total_coverage.info: test_bitcoin_filtered.info functional_test_filtered.info - $(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_bitcoin_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt +rpc_test_filtered.info: rpc_test.info + $(LCOV) -r $< "/usr/include/*" -o $@ + +test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@ + +total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info rpc_test_filtered.info + $(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -a rpc_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info - $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D) + $(GENHTML) -s $< -o $(@D) @touch $@ total.coverage/.dirstamp: total_coverage.info - $(GENHTML) -s $(LCOV_OPTS) $< -o $(@D) + $(GENHTML) -s $< -o $(@D) @touch $@ cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp endif +if USE_COMPARISON_TOOL +check-local: + $(MKDIR_P) qa/tmp + @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS) 2>&1 +endif + dist_noinst_SCRIPTS = autogen.sh -EXTRA_DIST = $(DIST_SHARE) test/functional/test_runner.py test/functional $(DIST_CONTRIB) $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS) - -EXTRA_DIST += \ - test/util/bitcoin-util-test.py \ - test/util/data/bitcoin-util-test.json \ - test/util/data/blanktxv1.hex \ - test/util/data/blanktxv1.json \ - test/util/data/blanktxv2.hex \ - test/util/data/blanktxv2.json \ - test/util/data/tt-delin1-out.hex \ - test/util/data/tt-delin1-out.json \ - test/util/data/tt-delout1-out.hex \ - test/util/data/tt-delout1-out.json \ - test/util/data/tt-locktime317000-out.hex \ - test/util/data/tt-locktime317000-out.json \ - test/util/data/tx394b54bb.hex \ - test/util/data/txcreate1.hex \ - test/util/data/txcreate1.json \ - test/util/data/txcreate2.hex \ - test/util/data/txcreate2.json \ - test/util/data/txcreatedata1.hex \ - test/util/data/txcreatedata1.json \ - test/util/data/txcreatedata2.hex \ - test/util/data/txcreatedata2.json \ - test/util/data/txcreatedata_seq0.hex \ - test/util/data/txcreatedata_seq0.json \ - test/util/data/txcreatedata_seq1.hex \ - test/util/data/txcreatedata_seq1.json \ - test/util/data/txcreatemultisig1.hex \ - test/util/data/txcreatemultisig1.json \ - test/util/data/txcreatemultisig2.hex \ - test/util/data/txcreatemultisig2.json \ - test/util/data/txcreatemultisig3.hex \ - test/util/data/txcreatemultisig3.json \ - test/util/data/txcreatemultisig4.hex \ - test/util/data/txcreatemultisig4.json \ - test/util/data/txcreatemultisig5.json \ - test/util/data/txcreateoutpubkey1.hex \ - test/util/data/txcreateoutpubkey1.json \ - test/util/data/txcreateoutpubkey2.hex \ - test/util/data/txcreateoutpubkey2.json \ - test/util/data/txcreateoutpubkey3.hex \ - test/util/data/txcreateoutpubkey3.json \ - test/util/data/txcreatescript1.hex \ - test/util/data/txcreatescript1.json \ - test/util/data/txcreatescript2.hex \ - test/util/data/txcreatescript2.json \ - test/util/data/txcreatescript3.hex \ - test/util/data/txcreatescript3.json \ - test/util/data/txcreatescript4.hex \ - test/util/data/txcreatescript4.json \ - test/util/data/txcreatesignv1.hex \ - test/util/data/txcreatesignv1.json \ - test/util/data/txcreatesignv2.hex \ - test/util/rpcauth-test.py +EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.py qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS) CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) .INTERMEDIATE: $(COVERAGE_INFO) -DISTCHECK_CONFIGURE_FLAGS = --enable-man - -doc/doxygen/.stamp: doc/Doxyfile FORCE - $(MKDIR_P) $(@D) - $(DOXYGEN) $^ - $(AM_V_at) touch $@ - -if HAVE_DOXYGEN -docs: doc/doxygen/.stamp -else -docs: - @echo "error: doxygen not found" -endif - -clean-docs: - rm -rf doc/doxygen - -clean-local: clean-docs - rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ test/tmp/ cache/ $(OSX_APP) - rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache - +clean-local: + rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ qa/tmp/ cache/ $(OSX_APP) diff --git a/README.md b/README.md index 10d1d95c1..3507d2223 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,44 @@ # LBRYcrd - The LBRY blockchain -[![Build Status](https://travis-ci.org/lbryio/lbrycrd.svg?branch=master)](https://travis-ci.org/lbryio/lbrycrd) -[![MIT licensed](https://img.shields.io/dub/l/vibe-d.svg?style=flat)](https://github.com/lbryio/lbry-desktop/blob/master/LICENSE) +![alt text](lbrycrdd_daemon_screenshot.png "lbrycrdd daemon screenshot") -LBRYcrd uses a blockchain similar to bitcoin's to implement an index and payment system for content on the LBRY network. It is a fork of [bitcoin core](https://github.com/bitcoin/bitcoin). In addition to the libraries used by bitcoin, LBRYcrd also uses [icu4c](https://github.com/unicode-org/icu/tree/master/icu4c). - -Please read the [lbry.tech overview](https://lbry.tech/overview) for a general understanding of the LBRY pieces. From there you could read the [LBRY spec](https://spec.lbry.com/) for specifics on the data in the blockchain. - -## Table of Contents - -1. [Installation](#installation) -2. [Usage](#usage) - 1. [Examples](#examples) - 2. [Data directory](#data-directory) -3. [Running from Source](#running-from-source) - 1. [Ubuntu with pulled static dependencies](#ubuntu-with-pulled-static-dependencies) - 2. [Ubuntu with local shared dependencies](#ubuntu-with-local-shared-dependencies) - 3. [MacOS (cross-compiled)](<#macos-(cross-compiled)>) - 4. [MacOS with local shared dependencies](#macos-with-local-shared-dependencies) - 5. [Windows (cross-compiled)](<#windows-(cross-compiled)>) - 6. [Use with CLion](#use-with-clion) -4. [Contributing](#contributing) - - [Testnet](#testnet) -5. [Mailing List](#mailing-list) -6. [License](#license) -7. [Security](#security) -8. [Contact](#contact) +LBRYcrd uses a blockchain similar to bitcoin's to implement an index and payment system for content on the LBRY network. It is a fork of bitcoin core. ## Installation -Latest binaries are available from https://github.com/lbryio/lbrycrd/releases. There is no installation procedure; the CLI binaries will run as-is and will have any uncommon dependencies statically linked into the binary. The QT GUI is not supported. LBRYcrd is distributed as a collection of executable files; traditional installers are not provided. +Latest binaries are available from https://github.com/lbryio/lbrycrd/releases. There is no installation procedure, the binaries run as is. ## Usage The `lbrycrdd` executable will start a LBRYcrd node and connect you to the LBRYcrd network. Use the `lbrycrd-cli` executable -to interact with lbrycrdd through the command line. Command-line help for both executables are available through -the "--help" flag (e.g. `lbrycrdd --help`). Examples: +to interact with lbrycrdd through the command line. Help pages for both executable are available through +the "--help" flag (e.g. `lbrycrd-cli --help`). -#### Examples +### Example Usage Run `./lbrycrdd -server -daemon` to start lbrycrdd in the background. -Run `./lbrycrd-cli -getinfo` to check for some basic information about your LBRYcrd node. +Run `./lbrycrd-cli getinfo` to check for some basic informations about your LBRYcrd node. Run `./lbrycrd-cli help` to get a list of all commands that you can run. To get help on specific commands run `./lbrycrd-cli [command_name] help` -Test locally: +### Data directory -```sh -./lbrycrdd -server -regtest -txindex # run this in its own window -./lbrycrd-cli -regtest generate 120 # mine 20 spendable coins -./lbrycrd-cli -regtest claimname my_name deadbeef 1 # hold a name claim with 1 coin -./lbrycrd-cli -regtest generate 1 # get that claim into the block -./lbrycrd-cli -regtest listnameclaims # show owned claims -./lbrycrd-cli -regtest getclaimsforname my_name # show claims under that name -./lbrycrd-cli -regtest stop # kill lbrycrdd -rm -fr ~/.lbrycrd/regtest/ # destroy regtest data -``` +Lbrycrdd will use the below default data directories -For further understanding of a "regtest" setup, see the local stack setup instructions here: https://lbry.tech/resources/regtest-setup +Windows < Vista: C:\Documents and Settings\Username\Application Data\lbrycrd -The CLI help is also browsable online at https://lbry.tech/api/blockchain +Windows >= Vista: C:\Users\Username\AppData\Roaming\lbrycrd -#### Data directory +Mac: ~/Library/Application Support/lbrycrd -Lbrycrdd will use the below default data directories (changeable with -datadir): +Unix: ~/.lbrycrd -```sh -Windows: %APPDATA%\lbrycrd -Mac: ~/Library/Application Support/lbrycrd -Unix: ~/.lbrycrd -``` +The data directory contains various things such as your default wallet (wallet.dat), debug logs (debug.log), and blockchain data. You can optionally +create a configuration file lbrycrd.conf in the default data directory which will be used by default when running lbrycrdd. +For a list of configuration parameters run `./lbrycrdd --help`. Below is a sample lbrycrd.conf to enable JSON RPC server on lbrycrdd. -The data directory contains various things such as your default wallet (wallet.dat), debug logs (debug.log), and blockchain data. You can optionally create a configuration file lbrycrd.conf in the default data directory which will be used by default when running lbrycrdd. - -For a list of configuration parameters, run `./lbrycrdd --help`. Below is a sample lbrycrd.conf to enable JSON RPC server on lbrycrdd. - -```sh -rpcuser=lbry +```rpcuser=lbry rpcpassword=xyz123456790 daemon=1 server=1 @@ -86,122 +47,20 @@ txindex=1 ## Running from Source -The easiest way to compile is to utilize the Docker image that contains the necessary compilers: lbry/build_lbrycrd. This will allow you to reproduce the build as made on our build servers. In this sample we map a local lbrycrd folder and a local ccache folder inside the image: -```sh -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd -docker run -v "$(pwd):/lbrycrd" --rm -v "${HOME}/ccache:/ccache" -w /lbrycrd -e CCACHE_DIR=/ccache lbry/build_lbrycrd packaging/build_linux_64bit.sh -``` +Run `./reproducible_build.sh -c -t`. This will build the binaries and put them into the `./src` directory. -Some examples of compiling directly: - -#### Ubuntu with pulled static dependencies - -```sh -sudo apt install build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd -./packaging/build_linux_64bit.sh -./src/test/test_lbrycrd - -``` - -Other Linux distros would be similar. The build shell script is fairly trivial; take a peek at its contents. - -#### Ubuntu with local shared dependencies - -Note: using untested dependencies may lead to conflicting results. - -```sh -sudo add-apt-repository ppa:bitcoin/bitcoin -sudo apt-get update -sudo apt-get install libdb4.8-dev libdb4.8++-dev libicu-dev libssl-dev libevent-dev \ - build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \ - libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev - -# optionally include libminiupnpc-dev libzmq3-dev - -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd -./autogen.sh -./configure --enable-static --disable-shared --with-pic --without-gui CXXFLAGS="-O3 -march=native" -make -j$(nproc) -./src/lbrycrdd -server ... - -``` - -#### MacOS (cross-compiled) - -```sh -sudo apt-get install clang llvm git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \ - libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev - -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd -# download MacOS SDK from your favorite source -mkdir depends/SDKs -tar ... extract SDK to depends/SDKs/MacOSX10.11.sdk -./packaging/build_darwin_64bit.sh - -``` - -Look in packaging/build_darwin_64bit.sh for further understanding. - -#### MacOS with local shared dependencies - -```sh -brew install boost berkeley-db@4 icu4c libevent -# fix conflict with gawk pulled first: -brew reinstall readline -brew reinstall gawk - -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd/depends -make NO_QT=1 -cd .. -./autogen.sh -CONFIG_SITE=$(pwd)/depends/x86_64-apple-darwin15.6.0/share/config.site ./configure --enable-static --disable-shared --with-pic --without-gui --enable-reduce-exports CXXFLAGS=-O2 -make -j$(sysctl -n hw.ncpu) - -``` - -#### Windows (cross-compiled) - -Compiling on MS Windows (outside of WSL) is not supported. The Windows build is cross-compiled from Linux like so: - -```sh -sudo apt-get install build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \ - g++-mingw-w64-x86-64 mingw-w64-x86-64-dev - -update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix - -git clone https://github.com/lbryio/lbrycrd.git -cd lbrycrd -./packaging/build_windows_64bit.sh - -``` - -If you encounter any errors, please check `doc/build-*.md` for further instructions. If you're still stuck, [create an issue](https://github.com/lbryio/lbrycrd/issues/new) with the output of that command, your system info, and any other information you think might be helpful. The scripts in the packaging folder are simple and will grant extra light on the build process as needed. - -#### Use with CLion - -CLion has not traditionally supported Autotools projects, although some progress on that is now in the works. We do include a cmake build file for compiling lbrycrd. See contrib/cmake. Alas, CLion doesn't support external projects in cmake, so that particular approach is also insufficient. CLion does support "compile_commands.json" projects. Fortunately, this can be easily generated for lbrycrd like so: - -```sh -pip install --user compiledb -./autogen.sh && ./configure --enable-static=no --enable-shared --with-pic --without-gui CXXFLAGS="-O0 -g" CFLAGS="-O0 -g" # or whatever normal lbrycrd config -compiledb make -j10 -``` - -Then open the newly generated compile_commands.json file as a project in CLion. Debugging is supported if you compiled with `-g`. To enable that you will need to create a target in CLion by going to File -> Settings -> Build -> Custom Build Targets. Add an empty target with your choice of name. From there you can go to "Edit Configurations", typically found in a drop-down at the top of the editor. Add a Custom Build Application, select your new target, select the compiled file (i.e. test_lbrycrd or lbrycrdd, etc), and then add any necessary command line parameters. Ensure that there is nothing in the "Before launch" section. +If you encounter any errors, please check `doc/build-*.md` for further instructions. If you're still stuck, [create an issue](https://github.com/lbryio/lbrycrd/issues/new) with the output of that command, your system info, and any other information you think might be helpful. ## Contributing -Contributions to this project are welcome, encouraged, and compensated. For more details, see [https://lbry.tech/contribute](https://lbry.tech/contribute) +Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing) +The codebase is in C++03, C++11 is currently not supported but we will be migrating to it in the near future. Recommended GCC version is 4.8 or greater. We follow the same coding guidelines as documented by Bitcoin Core, see [here](/doc/developer-notes.md). To run an automated code formatting check, try: `git diff -U0 master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1`. This will check any commits not on master for proper code formatting. -We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit message must contain the string "NOT FOR UPSTREAM MERGE". +We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from +Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit +message must contain the string "NOT FOR UPSTREAM MERGE". The `master` branch is regularly built and tested, but is not guaranteed to be completely stable. [Releases](https://github.com/lbryio/lbrycrd/releases) are created @@ -210,20 +69,15 @@ regularly to indicate new official, stable release versions. Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people -lots of money. Developers are strongly encouraged to write [unit tests](/src/test/README.md) for new code and to -submit new unit tests for old code. Unit tests are compiled by default and can be run with `src/test/test_lbrycrd` +lots of money. Developers are strongly encouraged to write [unit tests](/doc/unit-tests.md) for new code, and to +submit new unit tests for old code. Unit tests can be compiled and run +(assuming they weren't disabled in configure) with: `make check` -The Travis CI system makes sure that every pull request is built, and that unit and sanity tests are automatically run. See https://travis-ci.org/lbryio/lbrycrd +The Travis CI system makes sure that every pull request is built, and that unit and sanity tests are automatically run. ### Testnet -Testnet is maintained for testing purposes and can be accessed using the command `./lbrycrdd -testnet`. If you would like to obtain testnet credits, please contact brannon@lbry.com or grin@lbry.com . - -It is easy to solo mine on testnet. (It's easy on mainnet too, but much harder to win.) For instructions see [SGMiner](https://github.com/lbryio/sgminer-gm) and [Mining Contributions](https://github.com/lbryio/lbrycrd/tree/master/contrib/mining) - -## Mailing List - -We maintain a mailing list for notifications of upgrades, security issues, and soft/hard forks. To join, visit [https://lbry.com/forklist](https://lbry.com/forklist). +Testnet is maintained for testing purposes and can be accessed using the command `./lbrycrdd -testnet`. If you would like testnet credits, please contact kay@lbry.io or grin@lbry.io. ## License @@ -231,9 +85,11 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE). ## Security -We take security seriously. Please contact [security@lbry.com](mailto:security@lbry.com) regarding any security issues. -Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it. +We take security seriously. Please contact security@lbry.io regarding any security issues. +Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it. + +## Contact & Support + +The primary contact for this project is [@kaykurokawa](https://github.com/kaykurokawa) (kay@lbry.io) -## Contact -The primary contact for this project is [@BrannonKing](https://github.com/BrannonKing) (brannon@lbry.com) diff --git a/autogen.sh b/autogen.sh index 5b2aa0ffc..46e36ff5b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,13 +1,8 @@ #!/bin/sh -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C set -e srcdir="$(dirname $0)" cd "$srcdir" -if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="$(which glibtoolize 2>/dev/null)"; then +if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then LIBTOOLIZE="${GLIBTOOLIZE}" export LIBTOOLIZE fi diff --git a/build-aux/m4/ax_boost_base.m4 b/build-aux/m4/ax_boost_base.m4 index 650c94fa6..45d948933 100644 --- a/build-aux/m4/ax_boost_base.m4 +++ b/build-aux/m4/ax_boost_base.m4 @@ -33,7 +33,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 27 +#serial 26 AC_DEFUN([AX_BOOST_BASE], [ @@ -96,7 +96,7 @@ if test "x$want_boost" = "xyes"; then libsubdirs="lib64 libx32 lib lib64" ;; ppc64|s390x|sparc64|aarch64|ppc64le) - libsubdirs="lib64 lib lib64" + libsubdirs="lib64 lib lib64 ppc64le" ;; esac diff --git a/build-aux/m4/ax_boost_chrono.m4 b/build-aux/m4/ax_boost_chrono.m4 index 6ea77b9b3..318ecea17 100644 --- a/build-aux/m4/ax_boost_chrono.m4 +++ b/build-aux/m4/ax_boost_chrono.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_boost_chrono.html +# http://www.gnu.org/software/autoconf-archive/ax_boost_chrono.html # =========================================================================== # # SYNOPSIS @@ -8,7 +8,7 @@ # # DESCRIPTION # -# Test for Chrono library from the Boost C++ libraries. The macro requires +# Test for System library from the Boost C++ libraries. The macro requires # a preceding call to AX_BOOST_BASE. Further documentation is available at # . # @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 4 +#serial 1 AC_DEFUN([AX_BOOST_CHRONO], [ @@ -68,7 +68,7 @@ AC_DEFUN([AX_BOOST_CHRONO], CXXFLAGS_SAVE=$CXXFLAGS AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::chrono::system_clock::time_point* time = new boost::chrono::system_clock::time_point; delete time;]])], + [[boost::chrono::system_clock::time_point time;]])], ax_cv_boost_chrono=yes, ax_cv_boost_chrono=no) CXXFLAGS=$CXXFLAGS_SAVE AC_LANG_POP([C++]) @@ -81,6 +81,7 @@ AC_DEFUN([AX_BOOST_CHRONO], LDFLAGS_SAVE=$LDFLAGS if test "x$ax_boost_user_chrono_lib" = "x"; then + ax_lib= for libextension in `ls $BOOSTLIBDIR/libboost_chrono*.so* $BOOSTLIBDIR/libboost_chrono*.dylib* $BOOSTLIBDIR/libboost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_chrono.*\)\.so.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.a.*$;\1;'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, @@ -105,7 +106,7 @@ AC_DEFUN([AX_BOOST_CHRONO], fi if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) + AC_MSG_ERROR(Could not find a version of the boost_chrono library!) fi if test "x$link_chrono" = "xno"; then AC_MSG_ERROR(Could not link against $ax_lib !) diff --git a/build-aux/m4/ax_boost_locale.m4 b/build-aux/m4/ax_boost_locale.m4 deleted file mode 100644 index a99e82dc0..000000000 --- a/build-aux/m4/ax_boost_locale.m4 +++ /dev/null @@ -1,120 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_boost_locale.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_LOCALE -# -# DESCRIPTION -# -# Test for System library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_LOCALE_LIB) -# -# And sets: -# -# HAVE_BOOST_LOCALE -# -# LICENSE -# -# Copyright (c) 2012 Xiyue Deng -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_BOOST_LOCALE], -[ - AC_ARG_WITH([boost-locale], - AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@], - [use the Locale library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-locale=boost_locale-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_locale_lib="" - else - want_boost="yes" - ax_boost_user_locale_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Locale library is available, - ax_cv_boost_locale, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::locale::generator gen; - std::locale::global(gen(""));]])], - ax_cv_boost_locale=yes, ax_cv_boost_locale=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_locale" = "xyes"; then - AC_SUBST(BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - LDFLAGS_SAVE=$LDFLAGS - if test "x$ax_boost_user_locale_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], - [link_locale="no"]) - done - if test "x$link_locale" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], - [link_locale="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break], - [link_locale="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_locale" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) - diff --git a/build-aux/m4/ax_boost_program_options.m4 b/build-aux/m4/ax_boost_program_options.m4 new file mode 100644 index 000000000..2bdb59371 --- /dev/null +++ b/build-aux/m4/ax_boost_program_options.m4 @@ -0,0 +1,108 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_boost_program_options.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_BOOST_PROGRAM_OPTIONS +# +# DESCRIPTION +# +# Test for program options library from the Boost C++ libraries. The macro +# requires a preceding call to AX_BOOST_BASE. Further documentation is +# available at . +# +# This macro calls: +# +# AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) +# +# And sets: +# +# HAVE_BOOST_PROGRAM_OPTIONS +# +# LICENSE +# +# Copyright (c) 2009 Thomas Porschberg +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 24 + +AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], +[ + AC_ARG_WITH([boost-program-options], + AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@], + [use the program options library from boost - it is possible to specify a certain library for the linker + e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]), + [ + if test "$withval" = "no"; then + want_boost="no" + elif test "$withval" = "yes"; then + want_boost="yes" + ax_boost_user_program_options_lib="" + else + want_boost="yes" + ax_boost_user_program_options_lib="$withval" + fi + ], + [want_boost="yes"] + ) + + if test "x$want_boost" = "xyes"; then + AC_REQUIRE([AC_PROG_CC]) + export want_boost + CPPFLAGS_SAVED="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" + export CPPFLAGS + LDFLAGS_SAVED="$LDFLAGS" + LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" + export LDFLAGS + AC_CACHE_CHECK([whether the Boost::Program_Options library is available], + ax_cv_boost_program_options, + [AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include + ]], + [[boost::program_options::error err("Error message"); + return 0;]])], + ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no) + AC_LANG_POP([C++]) + ]) + if test "$ax_cv_boost_program_options" = yes; then + AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available]) + BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` + if test "x$ax_boost_user_program_options_lib" = "x"; then + for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + if test "x$link_program_options" != "xyes"; then + for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a.*$;\1;'` ; do + ax_lib=${libextension} + AC_CHECK_LIB($ax_lib, exit, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + fi + else + for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do + AC_CHECK_LIB($ax_lib, main, + [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], + [link_program_options="no"]) + done + fi + if test "x$ax_lib" = "x"; then + AC_MSG_ERROR(Could not find a version of the boost_program_options library!) + fi + if test "x$link_program_options" != "xyes"; then + AC_MSG_ERROR([Could not link against [$ax_lib] !]) + fi + fi + CPPFLAGS="$CPPFLAGS_SAVED" + LDFLAGS="$LDFLAGS_SAVED" + fi +]) diff --git a/build-aux/m4/ax_boost_unit_test_framework.m4 b/build-aux/m4/ax_boost_unit_test_framework.m4 index 3d8e93e96..4efd1e2f1 100644 --- a/build-aux/m4/ax_boost_unit_test_framework.m4 +++ b/build-aux/m4/ax_boost_unit_test_framework.m4 @@ -1,6 +1,6 @@ -# ================================================================================= -# https://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html -# ================================================================================= +# ================================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html +# ================================================================================ # # SYNOPSIS # @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 21 +#serial 19 AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], [ @@ -66,7 +66,7 @@ AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], [AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[using boost::unit_test::test_suite; - test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); if (test == NULL) { return 1; } else { return 0; }]])], + test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); return 0;]])], ax_cv_boost_unit_test_framework=yes, ax_cv_boost_unit_test_framework=no) AC_LANG_POP([C++]) ]) @@ -76,6 +76,7 @@ AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], if test "x$ax_boost_user_unit_test_framework_lib" = "x"; then saved_ldflags="${LDFLAGS}" + ax_lib= for monitor_library in `ls $BOOSTLIBDIR/libboost_unit_test_framework*.so* $BOOSTLIBDIR/libboost_unit_test_framework*.dylib* $BOOSTLIBDIR/libboost_unit_test_framework*.a* 2>/dev/null` ; do if test -r $monitor_library ; then libextension=`echo $monitor_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a.*$;\1;'` @@ -124,7 +125,7 @@ AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], done fi if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) + AC_MSG_ERROR(Could not find a version of the boost_unit_test_framework library!) fi if test "x$link_unit_test_framework" != "xyes"; then AC_MSG_ERROR(Could not link against $ax_lib !) diff --git a/build-aux/m4/ax_cxx_compile_stdcxx.m4 b/build-aux/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index f147cee3b..000000000 --- a/build-aux/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,568 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 4 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [], - [$1], [14], [], - [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - m4_if([$4], [], [ax_cxx_compile_cxx$1_try_default=true], - [$4], [default], [ax_cxx_compile_cxx$1_try_default=true], - [$4], [nodefault], [ax_cxx_compile_cxx$1_try_default=false], - [m4_fatal([invalid fourth argument `$4' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$4], [nodefault], [], [dnl - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi]) - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++$1 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_seperators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) diff --git a/build-aux/m4/ax_pthread.m4 b/build-aux/m4/ax_pthread.m4 index 4c4051ea3..d218d1af7 100644 --- a/build-aux/m4/ax_pthread.m4 +++ b/build-aux/m4/ax_pthread.m4 @@ -82,7 +82,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 23 +#serial 22 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -100,22 +100,22 @@ ax_pthread_ok=no # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different @@ -152,50 +152,50 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- case $host_os in - freebsd*) + freebsd*) - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; - hpux*) + hpux*) - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; - openedition*) + openedition*) - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; - solaris*) + solaris*) - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). - ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" - ;; + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; esac # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) @@ -208,17 +208,17 @@ AS_IF([test "x$GCC" = "xyes"], # correctly enabled case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; + aix* | freebsd*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; - *) - ax_pthread_check_macro="--" - ;; + *) + ax_pthread_check_macro="--" + ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], @@ -231,13 +231,13 @@ AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" @@ -249,222 +249,222 @@ ax_pthread_clang_warning=no if test "x$ax_pthread_clang" = "xyes"; then - # Clang takes -pthread; it has never supported any other flag + # Clang takes -pthread; it has never supported any other flag - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) - PTHREAD_CFLAGS="-pthread" - PTHREAD_LIBS= + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= - ax_pthread_ok=yes + ax_pthread_ok=yes - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac fi # $ax_pthread_clang = yes if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; - -mt,pthread) - AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) - PTHREAD_CFLAGS="-mt" - PTHREAD_LIBS="-lpthread" - ;; + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) - ;; - esac - fi + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" @@ -475,11 +475,11 @@ AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : else - ax_pthread_ok=no - $2 + ax_pthread_ok=no + $2 fi AC_LANG_POP ])dnl AX_PTHREAD diff --git a/build-aux/m4/bitcoin_find_bdb48.m4 b/build-aux/m4/bitcoin_find_bdb48.m4 index ea9c795da..2aa493a6a 100644 --- a/build-aux/m4/bitcoin_find_bdb48.m4 +++ b/build-aux/m4/bitcoin_find_bdb48.m4 @@ -1,78 +1,66 @@ -dnl Copyright (c) 2013-2015 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - AC_DEFUN([BITCOIN_FIND_BDB48],[ - AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection]) - AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection]) - - if test "x$BDB_CFLAGS" = "x"; then - AC_MSG_CHECKING([for Berkeley DB C++ headers]) - BDB_CPPFLAGS= - bdbpath=X - bdb48path=X - bdbdirlist= - for _vn in 4.8 48 4 5 5.3 ''; do - for _pfx in b lib ''; do - bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" - done + AC_MSG_CHECKING([for Berkeley DB C++ headers]) + BDB_CPPFLAGS= + BDB_LIBS= + bdbpath=X + bdb48path=X + bdbdirlist= + for _vn in 4.8 48 4 5 ''; do + for _pfx in b lib ''; do + bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" done - for searchpath in $bdbdirlist ''; do - test -n "${searchpath}" && searchpath="${searchpath}/" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4) - #error "failed to find bdb 4.8+" - #endif - ]])],[ - if test "x$bdbpath" = "xX"; then - bdbpath="${searchpath}" - fi - ],[ - continue - ]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8) - #error "failed to find bdb 4.8" - #endif - ]])],[ - bdb48path="${searchpath}" - break - ],[]) - done - if test "x$bdbpath" = "xX"; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) - elif test "x$bdb48path" = "xX"; then - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) - AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[ - AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!]) - ],[ - AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)]) - ]) - else - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) - bdbpath="${bdb48path}" - fi + done + for searchpath in $bdbdirlist ''; do + test -n "${searchpath}" && searchpath="${searchpath}/" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <${searchpath}db_cxx.h> + ]],[[ + #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4) + #error "failed to find bdb 4.8+" + #endif + ]])],[ + if test "x$bdbpath" = "xX"; then + bdbpath="${searchpath}" + fi + ],[ + continue + ]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <${searchpath}db_cxx.h> + ]],[[ + #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8) + #error "failed to find bdb 4.8" + #endif + ]])],[ + bdb48path="${searchpath}" + break + ],[]) + done + if test "x$bdbpath" = "xX"; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) + elif test "x$bdb48path" = "xX"; then + BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) + AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[ + AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!]) + ],[ + AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)]) + ]) else - BDB_CPPFLAGS=${BDB_CFLAGS} + BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) + bdbpath="${bdb48path}" fi AC_SUBST(BDB_CPPFLAGS) + # TODO: Ideally this could find the library version and make sure it matches the headers being used + for searchlib in db_cxx-4.8 db_cxx; do + AC_CHECK_LIB([$searchlib],[main],[ + BDB_LIBS="-l${searchlib}" + break + ]) + done if test "x$BDB_LIBS" = "x"; then - # TODO: Ideally this could find the library version and make sure it matches the headers being used - for searchlib in db_cxx-4.8 db_cxx db4_cxx; do - AC_CHECK_LIB([$searchlib],[main],[ - BDB_LIBS="-l${searchlib}" - break - ]) - done - if test "x$BDB_LIBS" = "x"; then - AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) - fi + AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) fi AC_SUBST(BDB_LIBS) ]) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 05df8621d..efffa4887 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -1,12 +1,8 @@ -dnl Copyright (c) 2013-2016 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - dnl Helper for cases where a qt dependency is not met. dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit. AC_DEFUN([BITCOIN_QT_FAIL],[ - if test "x$bitcoin_qt_want_version" = xauto && test "x$bitcoin_qt_force" != xyes; then - if test "x$bitcoin_enable_qt" != xno; then + if test "x$bitcoin_qt_want_version" = "xauto" && test x$bitcoin_qt_force != xyes; then + if test x$bitcoin_enable_qt != xno; then AC_MSG_WARN([$1; bitcoin-qt frontend will not be built]) fi bitcoin_enable_qt=no @@ -17,7 +13,7 @@ AC_DEFUN([BITCOIN_QT_FAIL],[ ]) AC_DEFUN([BITCOIN_QT_CHECK],[ - if test "x$bitcoin_enable_qt" != xno && test "x$bitcoin_qt_want_version" != xno; then + if test "x$bitcoin_enable_qt" != "xno" && test x$bitcoin_qt_want_version != xno; then true $1 else @@ -35,12 +31,12 @@ dnl Inputs: $4: If "yes", don't fail if $2 is not found. dnl Output: $1 is set to the path of $2 if found. $2 are searched in order. AC_DEFUN([BITCOIN_QT_PATH_PROGS],[ BITCOIN_QT_CHECK([ - if test "x$3" != x; then + if test "x$3" != "x"; then AC_PATH_PROGS($1,$2,,$3) else AC_PATH_PROGS($1,$2) fi - if test "x$$1" = x && test "x$4" != xyes; then + if test "x$$1" = "x" && test "x$4" != "xyes"; then BITCOIN_QT_FAIL([$1 not found]) fi ]) @@ -53,11 +49,11 @@ dnl CAUTION: Do not use this inside of a conditional. AC_DEFUN([BITCOIN_QT_INIT],[ dnl enable qt support AC_ARG_WITH([gui], - [AS_HELP_STRING([--with-gui@<:@=no|qt5|auto@:>@], - [build bitcoin-qt GUI (default=auto)])], + [AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@], + [build bitcoin-qt GUI (default=auto, qt5 tried first)])], [ bitcoin_qt_want_version=$withval - if test "x$bitcoin_qt_want_version" = xyes; then + if test x$bitcoin_qt_want_version = xyes; then bitcoin_qt_force=yes bitcoin_qt_want_version=auto fi @@ -89,22 +85,23 @@ dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test AC_DEFUN([BITCOIN_QT_CONFIGURE],[ use_pkgconfig=$1 - if test "x$use_pkgconfig" = x; then + if test x$use_pkgconfig = x; then use_pkgconfig=yes fi - if test "x$use_pkgconfig" = xyes; then - BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG]) + if test x$use_pkgconfig = xyes; then + BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG([$2])]) else BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG]) fi dnl This is ugly and complicated. Yuck. Works as follows: - dnl For Qt5, we can check a header to find out whether Qt is build - dnl statically. When Qt is built statically, some plugins must be linked into - dnl the final binary as well. - dnl With Qt5, languages moved into core and the WindowsIntegration plugin was - dnl added. + dnl We can't discern whether Qt4 builds are static or not. For Qt5, we can + dnl check a header to find out. When Qt is built statically, some plugins must + dnl be linked into the final binary as well. These plugins have changed between + dnl Qt4 and Qt5. With Qt5, languages moved into core and the WindowsIntegration + dnl plugin was added. Since we can't tell if Qt4 is static or not, it is + dnl assumed for windows builds. dnl _BITCOIN_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the dnl results to QT_LIBS. BITCOIN_QT_CHECK([ @@ -112,67 +109,69 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ TEMP_CXXFLAGS=$CXXFLAGS CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CXXFLAGS="$PIC_FLAGS $CXXFLAGS" - _BITCOIN_QT_IS_STATIC - if test "x$bitcoin_cv_static_qt" = xyes; then - _BITCOIN_QT_FIND_STATIC_PLUGINS - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) - AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ + if test x$bitcoin_qt_got_major_vers = x5; then + _BITCOIN_QT_IS_STATIC + if test x$bitcoin_cv_static_qt = xyes; then + _BITCOIN_QT_FIND_STATIC_PLUGINS + AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) + AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]],[[ #if QT_VERSION >= 0x050400 - choke + choke; #endif - ]])], - [bitcoin_cv_need_acc_widget=yes], - [bitcoin_cv_need_acc_widget=no]) - ]) - if test "x$bitcoin_cv_need_acc_widget" = xyes; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) + ]])], + [bitcoin_cv_need_acc_widget=yes], + [bitcoin_cv_need_acc_widget=no]) + ]) + if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then + _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) + fi + if test x$TARGET_OS = xwindows; then + _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) + AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) + elif test x$TARGET_OS = xlinux; then + _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) + AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb]) + elif test x$TARGET_OS = xdarwin; then + AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)]) + _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa]) + AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa]) + fi fi - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal]) - AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists]) - if test "x$TARGET_OS" = xwindows; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) - AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) - elif test "x$TARGET_OS" = xlinux; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) - AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb]) - elif test "x$TARGET_OS" = xdarwin; then - AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)]) - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa]) - AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa]) + else + if test x$TARGET_OS = xwindows; then + AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) + _BITCOIN_QT_CHECK_STATIC_PLUGINS([ + Q_IMPORT_PLUGIN(qcncodecs) + Q_IMPORT_PLUGIN(qjpcodecs) + Q_IMPORT_PLUGIN(qtwcodecs) + Q_IMPORT_PLUGIN(qkrcodecs) + Q_IMPORT_PLUGIN(AccessibleFactory)], + [-lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -lqtaccessiblewidgets]) fi fi CPPFLAGS=$TEMP_CPPFLAGS CXXFLAGS=$TEMP_CXXFLAGS ]) - if test "x$use_pkgconfig$qt_bin_path" = xyes; then - qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`" + if test x$use_pkgconfig$qt_bin_path = xyes; then + if test x$bitcoin_qt_got_major_vers = x5; then + qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`" + fi fi - if test "x$use_hardening" != xno; then + if test x$use_hardening != xno; then BITCOIN_QT_CHECK([ AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) TEMP_CPPFLAGS=$CPPFLAGS TEMP_CXXFLAGS=$CXXFLAGS CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CXXFLAGS="$PIE_FLAGS $CXXFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif + #if defined(QT_REDUCE_RELOCATIONS) + choke; + #endif ]])], [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] @@ -185,16 +184,11 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) TEMP_CPPFLAGS=$CPPFLAGS CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke - #endif + #if defined(QT_REDUCE_RELOCATIONS) + choke; + #endif ]])], [ AC_MSG_RESULT(no)], [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] @@ -203,11 +197,11 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ ]) fi - BITCOIN_QT_PATH_PROGS([MOC], [moc-qt5 moc5 moc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([UIC], [uic-qt5 uic5 uic], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt5 lrelease5 lrelease], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt5 lupdate5 lupdate],$qt_bin_path, yes) + BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path) + BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path) + BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path) + BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt${bitcoin_qt_got_major_vers} lrelease${bitcoin_qt_got_major_vers} lrelease], $qt_bin_path) + BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt${bitcoin_qt_got_major_vers} lupdate${bitcoin_qt_got_major_vers} lupdate],$qt_bin_path, yes) MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)' case $host in @@ -230,23 +224,23 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ BITCOIN_QT_CHECK([ bitcoin_enable_qt=yes bitcoin_enable_qt_test=yes - if test "x$have_qt_test" = xno; then + if test x$have_qt_test = xno; then bitcoin_enable_qt_test=no fi bitcoin_enable_qt_dbus=no - if test "x$use_dbus" != xno && test "x$have_qt_dbus" = xyes; then + if test x$use_dbus != xno && test x$have_qt_dbus = xyes; then bitcoin_enable_qt_dbus=yes fi - if test "x$use_dbus" = xyes && test "x$have_qt_dbus" = xno; then - AC_MSG_ERROR([libQtDBus not found. Install libQtDBus or remove --with-qtdbus.]) + if test x$use_dbus = xyes && test x$have_qt_dbus = xno; then + AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.") fi - if test "x$LUPDATE" = x; then - AC_MSG_WARN([lupdate is required to update qt translations]) + if test x$LUPDATE = x; then + AC_MSG_WARN("lupdate is required to update qt translations") fi ],[ bitcoin_enable_qt=no ]) - AC_MSG_RESULT([$bitcoin_enable_qt (Qt5)]) + AC_MSG_RESULT([$bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})]) AC_SUBST(QT_PIE_FLAGS) AC_SUBST(QT_INCLUDES) @@ -256,7 +250,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ AC_SUBST(QT_DBUS_LIBS) AC_SUBST(QT_TEST_INCLUDES) AC_SUBST(QT_TEST_LIBS) - AC_SUBST(QT_SELECT, qt5) + AC_SUBST(QT_SELECT, qt${bitcoin_qt_got_major_vers}) AC_SUBST(MOC_DEFS) ]) @@ -269,64 +263,39 @@ dnl Requires: INCLUDES must be populated as necessary. dnl Output: bitcoin_cv_qt5=yes|no AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[ AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]], [[ - #if QT_VERSION < 0x050000 || QT_VERSION_MAJOR < 5 - choke + #if QT_VERSION < 0x050000 + choke me + #else + return 0; #endif ]])], [bitcoin_cv_qt5=yes], [bitcoin_cv_qt5=no]) ])]) -dnl Internal. Check if the included version of Qt is greater than Qt58. -dnl Requires: INCLUDES must be populated as necessary. -dnl Output: bitcoin_cv_qt5=yes|no -AC_DEFUN([_BITCOIN_QT_CHECK_QT58],[ - AC_CACHE_CHECK(for > Qt 5.7, bitcoin_cv_qt58,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if QT_VERSION_MINOR < 8 - choke - #endif - ]])], - [bitcoin_cv_qt58=yes], - [bitcoin_cv_qt58=no]) -])]) - - dnl Internal. Check if the linked version of Qt was built as static libs. -dnl Requires: Qt5. +dnl Requires: Qt5. This check cannot determine if Qt4 is static. dnl Requires: INCLUDES and LIBS must be populated as necessary. dnl Output: bitcoin_cv_static_qt=yes|no dnl Output: Defines QT_STATICPLUGIN if plugins are static. AC_DEFUN([_BITCOIN_QT_IS_STATIC],[ AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION OR QT_VERSION_STR - # include - #endif - ]], - [[ - #if !defined(QT_STATIC) - choke - #endif - ]])], - [bitcoin_cv_static_qt=yes], - [bitcoin_cv_static_qt=no]) - ]) - if test "x$bitcoin_cv_static_qt" = xyes; then + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]], + [[ + #if defined(QT_STATIC) + return 0; + #else + choke me + #endif + ]])], + [bitcoin_cv_static_qt=yes], + [bitcoin_cv_static_qt=no]) + ]) + if test xbitcoin_cv_static_qt = xyes; then AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins]) fi ]) @@ -351,71 +320,36 @@ AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[ ]) dnl Internal. Find paths necessary for linking qt static plugins +dnl Inputs: bitcoin_qt_got_major_vers. 4 or 5. dnl Inputs: qt_plugin_path. optional. dnl Outputs: QT_LIBS is appended AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ - if test "x$qt_plugin_path" != x; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" - if test -d "$qt_plugin_path/accessible"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" + if test x$bitcoin_qt_got_major_vers = x5; then + if test x$qt_plugin_path != x; then + QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" + if test -d "$qt_plugin_path/accessible"; then + QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" + fi fi - if test "x$use_pkgconfig" = xyes; then - : dnl m4_ifdef([PKG_CHECK_MODULES],[ - if test x$bitcoin_cv_qt58 = xno; then - PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) - else - PKG_CHECK_MODULES([QTFONTDATABASE], [Qt5FontDatabaseSupport], [QT_LIBS="-lQt5FontDatabaseSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTEVENTDISPATCHER], [Qt5EventDispatcherSupport], [QT_LIBS="-lQt5EventDispatcherSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTTHEME], [Qt5ThemeSupport], [QT_LIBS="-lQt5ThemeSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTDEVICEDISCOVERY], [Qt5DeviceDiscoverySupport], [QT_LIBS="-lQt5DeviceDiscoverySupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTACCESSIBILITY], [Qt5AccessibilitySupport], [QT_LIBS="-lQt5AccessibilitySupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTFB], [Qt5FbSupport], [QT_LIBS="-lQt5FbSupport $QT_LIBS"]) - fi - if test "x$TARGET_OS" = xlinux; then + if test x$use_pkgconfig = xyes; then + PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) + if test x$TARGET_OS = xlinux; then PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) if ${PKG_CONFIG} --exists "Qt5Core >= 5.5" 2>/dev/null; then PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"]) fi - elif test "x$TARGET_OS" = xdarwin; then - PKG_CHECK_MODULES([QTCLIPBOARD], [Qt5ClipboardSupport], [QT_LIBS="-lQt5ClipboardSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTGRAPHICS], [Qt5GraphicsSupport], [QT_LIBS="-lQt5GraphicsSupport $QT_LIBS"]) - PKG_CHECK_MODULES([QTCGL], [Qt5CglSupport], [QT_LIBS="-lQt5CglSupport $QT_LIBS"]) - fi - ]) - else - if test "x$TARGET_OS" = xwindows; then - AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #ifndef QT_VERSION - # include - #endif - ]], - [[ - #if QT_VERSION < 0x050600 || QT_VERSION_MINOR < 6 - choke - #endif - ]])], - [bitcoin_cv_need_platformsupport=yes], - [bitcoin_cv_need_platformsupport=no]) - ]) - if test "x$bitcoin_cv_need_platformsupport" = xyes; then - if test x$bitcoin_cv_qt58 = xno; then - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found))) - else - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FontDatabaseSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFontDatabaseSupport not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}EventDispatcherSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXEventDispatcherSupport not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}ThemeSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXThemeSupport not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FbSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFbSupport not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}DeviceDiscoverySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXDeviceDiscoverySupport not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}AccessibilitySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXAccessibilitySupport not found))) - QT_LIBS="$QT_LIBS -lversion -ldwmapi -luxtheme" - fi - fi + elif test x$TARGET_OS = xdarwin; then + PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"]) fi fi - fi + ]) + else + if test x$qt_plugin_path != x; then + QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" + QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs" + fi + fi ]) dnl Internal. Find Qt libraries using pkg-config. @@ -424,22 +358,46 @@ dnl first. dnl Inputs: $1: If bitcoin_qt_want_version is "auto", check for this version dnl first. dnl Outputs: All necessary QT_* variables are set. +dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5". dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ m4_ifdef([PKG_CHECK_MODULES],[ - QT_LIB_PREFIX=Qt5 + auto_priority_version=$1 + if test x$auto_priority_version = x; then + auto_priority_version=qt5 + fi + if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then + QT_LIB_PREFIX=Qt5 + bitcoin_qt_got_major_vers=5 + else + QT_LIB_PREFIX=Qt + bitcoin_qt_got_major_vers=4 + fi qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets" + qt4_modules="QtCore QtGui QtNetwork" BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT5], [$qt5_modules], [QT_INCLUDES="$QT5_CFLAGS"; QT_LIBS="$QT5_LIBS" have_qt=yes],[have_qt=no]) + if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then + PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes],[have_qt=no]) + elif test x$bitcoin_qt_want_version = xqt4 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt4 ); then + PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no]) + fi - if test "x$have_qt" != xyes; then + dnl qt version is set to 'auto' and the preferred version wasn't found. Now try the other. + if test x$have_qt = xno && test x$bitcoin_qt_want_version = xauto; then + if test x$auto_priority_version = xqt5; then + PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt; bitcoin_qt_got_major_vers=4], [have_qt=no]) + else + PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt5; bitcoin_qt_got_major_vers=5], [have_qt=no]) + fi + fi + if test x$have_qt != xyes; then have_qt=no BITCOIN_QT_FAIL([Qt dependencies not found]) fi ]) BITCOIN_QT_CHECK([ PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) - if test "x$use_dbus" != xno; then + if test x$use_dbus != xno; then PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) fi ]) @@ -452,6 +410,7 @@ dnl from the discovered headers. dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to use. dnl If "auto", the version will be discovered by _BITCOIN_QT_CHECK_QT5. dnl Outputs: All necessary QT_* variables are set. +dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5". dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ TEMP_CPPFLAGS="$CPPFLAGS" @@ -459,7 +418,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ CXXFLAGS="$PIC_FLAGS $CXXFLAGS" TEMP_LIBS="$LIBS" BITCOIN_QT_CHECK([ - if test "x$qt_include_path" != x; then + if test x$qt_include_path != x; then QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus" CPPFLAGS="$QT_INCLUDES $CPPFLAGS" fi @@ -470,52 +429,54 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))]) BITCOIN_QT_CHECK([ - if test "x$bitcoin_qt_want_version" = xauto; then + if test x$bitcoin_qt_want_version = xauto; then _BITCOIN_QT_CHECK_QT5 - _BITCOIN_QT_CHECK_QT58 fi - QT_LIB_PREFIX=Qt5 + if test x$bitcoin_cv_qt5 = xyes || test x$bitcoin_qt_want_version = xqt5; then + QT_LIB_PREFIX=Qt5 + bitcoin_qt_got_major_vers=5 + else + QT_LIB_PREFIX=Qt + bitcoin_qt_got_major_vers=4 + fi ]) BITCOIN_QT_CHECK([ LIBS= - if test "x$qt_lib_path" != x; then + if test x$qt_lib_path != x; then LIBS="$LIBS -L$qt_lib_path" fi - if test "x$TARGET_OS" = xwindows; then + if test x$TARGET_OS = xwindows; then AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found)) fi ]) BITCOIN_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([jpeg_create_decompress] ,[qtjpeg jpeg],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in]))) - if test x$bitcoin_cv_qt58 = xno; then - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in]))) - else - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtlibpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre2_match_16], [qtpcre2 libqtpcre2],,AC_MSG_WARN([libqtpcre2 not found. Assuming qt has it built-in]))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([png] ,[main],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([jpeg] ,[main],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in]))) + BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in]))) + BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled]))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXCore not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXGui not found))) + BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXNetwork not found))) + if test x$bitcoin_qt_got_major_vers = x5; then + BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXWidgets not found))) fi - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng qtharfbuzz harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled]))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Core not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Gui not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Network not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib${QT_LIB_PREFIX}Widgets not found))) QT_LIBS="$LIBS" LIBS="$TEMP_LIBS" BITCOIN_QT_CHECK([ LIBS= - if test "x$qt_lib_path" != x; then + if test x$qt_lib_path != x; then LIBS="-L$qt_lib_path" fi AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no) AC_CHECK_HEADER([QTest],, have_qt_test=no) QT_TEST_LIBS="$LIBS" - if test "x$use_dbus" != xno; then + if test x$use_dbus != xno; then LIBS= - if test "x$qt_lib_path" != x; then + if test x$qt_lib_path != x; then LIBS="-L$qt_lib_path" fi AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no) diff --git a/build-aux/m4/bitcoin_subdir_to_include.m4 b/build-aux/m4/bitcoin_subdir_to_include.m4 index 7841042ac..66f106c7d 100644 --- a/build-aux/m4/bitcoin_subdir_to_include.m4 +++ b/build-aux/m4/bitcoin_subdir_to_include.m4 @@ -1,7 +1,3 @@ -dnl Copyright (c) 2013-2014 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE]) dnl SUBDIRECTORY-NAME must end with a path separator AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[ diff --git a/build-aux/m4/l_atomic.m4 b/build-aux/m4/l_atomic.m4 deleted file mode 100644 index 75c43f9a9..000000000 --- a/build-aux/m4/l_atomic.m4 +++ /dev/null @@ -1,46 +0,0 @@ -dnl Copyright (c) 2015 Tim Kosse -dnl Copying and distribution of this file, with or without modification, are -dnl permitted in any medium without royalty provided the copyright notice -dnl and this notice are preserved. This file is offered as-is, without any -dnl warranty. - -# Some versions of gcc/libstdc++ require linking with -latomic if -# using the C++ atomic library. -# -# Sourced from http://bugs.debian.org/797228 - -m4_define([_CHECK_ATOMIC_testbody], [[ - #include - #include - - int main() { - std::atomic a{}; - - int64_t v = 5; - int64_t r = a.fetch_add(v); - return static_cast(r); - } -]]) - -AC_DEFUN([CHECK_ATOMIC], [ - - AC_LANG_PUSH(C++) - - AC_MSG_CHECKING([whether std::atomic can be used without link library]) - - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - LIBS="$LIBS -latomic" - AC_MSG_CHECKING([whether std::atomic needs -latomic]) - AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[ - AC_MSG_RESULT([yes]) - ],[ - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([cannot figure out how to use std::atomic]) - ]) - ]) - - AC_LANG_POP -]) diff --git a/build.sh b/build.sh deleted file mode 100755 index c22b7e5b5..000000000 --- a/build.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -function HELP { - echo "Use this command to build lbrycrd." - echo "Dependencies will be pulled and built first." - echo "Use autogen & configure directly to avoid this and use system shared libraries instead." - echo - echo "Optional arguments:" - echo "-jN: number of parallel build jobs" - echo "-q: compile the QT GUI (not working at present)" - echo "-d: force a rebuild of dependencies" - echo "-u: run the unit tests when done" - echo "-g: include debug symbols" - echo "-h: show help" - exit 1 -} - -REBUILD_DEPENDENCIES=false -RUN_UNIT_TESTS=false -COMPILE_WITH_DEBUG=false -DO_NOT_COMPILE_THE_GUI="NO_QT=1" -WITH_COMPILE_THE_GUI=no - -if test -z $PARALLEL_JOBS; then - PARALLEL_JOBS=$(expr $(getconf _NPROCESSORS_ONLN) / 2 + 1) -fi - -while getopts j:qdugh FLAG; do - case ${FLAG} in - j) - PARALLEL_JOBS=$OPTARG - ;; - q) - DO_NOT_COMPILE_THE_GUI= - WITH_COMPILE_THE_GUI=qt5 - ;; - g) - COMPILE_WITH_DEBUG=true - ;; - u) - RUN_UNIT_TESTS=true - ;; - d) - REBUILD_DEPENDENCIES=true - ;; - h) - HELP - ;; - \?) - HELP - ;; - esac -done - -echo "Compiling with ${PARALLEL_JOBS} jobs in parallel." - -BUILD_FLAGS=(CXXFLAGS="-O3 -march=native") -if test "$COMPILE_WITH_DEBUG" = true; then - BUILD_FLAGS=(--with-debug CXXFLAGS="-Og -g") -fi - -cd depends -if test "$REBUILD_DEPENDENCIES" = true; then - make clean -fi -make -j${PARALLEL_JOBS} ${DO_NOT_COMPILE_THE_GUI} V=1 -cd .. - -LC_ALL=C autoreconf --install - -CONFIG_SITE=$(pwd)/depends/$($(pwd)/depends/config.guess)/share/config.site ./configure --enable-reduce-exports \ - --enable-static --disable-shared --with-pic --with-gui=${WITH_COMPILE_THE_GUI} "${BUILD_FLAGS[@]}" - -if test $? -eq 0; then - make -j${PARALLEL_JOBS} -fi - -if test $? -eq 0 && "$RUN_UNIT_TESTS" = true; then - ./src/test/test_lbrycrd -fi \ No newline at end of file diff --git a/configure.ac b/configure.ac index 1daad77fc..082f6c5d3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,15 +1,15 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) -define(_CLIENT_VERSION_MINOR, 17) -define(_CLIENT_VERSION_REVISION, 3) -define(_CLIENT_VERSION_BUILD, 3) +define(_CLIENT_VERSION_MINOR, 12) +define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_BUILD, 2) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2021) +define(_COPYRIGHT_YEAR, 2016) define(_COPYRIGHT_HOLDERS,[The %s developers]) -define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]]) -AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/lbryio/lbrycrd/issues],[lbrycrd],[https://lbry.com/]) -AC_CONFIG_SRCDIR([src/validation.cpp]) +define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRY]]) +AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/lbryio/lbrycrd/issues],[lbrycrd],[https://lbry.io/]) +AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([build-aux/m4]) @@ -19,12 +19,6 @@ BITCOIN_GUI_NAME=lbrycrd-qt BITCOIN_CLI_NAME=lbrycrd-cli BITCOIN_TX_NAME=lbrycrd-tx -dnl Unless the user specified ARFLAGS, force it to be cr -AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to if not set]) -if test "x${ARFLAGS+set}" != "xset"; then - ARFLAGS="cr" -fi - AC_CANONICAL_HOST AH_TOP([#ifndef BITCOIN_CONFIG_H]) @@ -51,6 +45,7 @@ else CXXFLAGS_overridden=no fi AC_PROG_CXX +m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) dnl By default, libtool for mingw refuses to link static libs into a dll for dnl fear of mixing pic/non-pic objects, and import/export complications. Since @@ -60,20 +55,6 @@ case $host in lt_cv_deplibs_check_method="pass_all" ;; esac -dnl Require C++11 compiler (no GNU extensions) -AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault]) -dnl Check if -latomic is required for -CHECK_ATOMIC - -dnl Unless the user specified OBJCXX, force it to be the same as CXX. This ensures -dnl that we get the same -std flags for both. -m4_ifdef([AC_PROG_OBJCXX],[ -if test "x${OBJCXX+set}" = "x"; then - OBJCXX="${CXX}" -fi -AC_PROG_OBJCXX -]) - dnl Libtool init checks. LT_INIT([pic-only]) @@ -83,8 +64,8 @@ AC_PATH_TOOL(RANLIB, ranlib) AC_PATH_TOOL(STRIP, strip) AC_PATH_TOOL(GCOV, gcov) AC_PATH_PROG(LCOV, lcov) -dnl Python 3.x is supported from 3.4 on (see https://github.com/bitcoin/bitcoin/issues/7893) -AC_PATH_PROGS([PYTHON], [python3.7 python3.6 python3.5 python3.4 python3 python]) +AC_PATH_PROG(JAVA, java) +AC_PATH_PROGS([PYTHON], [python3 python2.7 python2 python]) AC_PATH_PROG(GENHTML, genhtml) AC_PATH_PROG([GIT], [git]) AC_PATH_PROG(CCACHE,ccache) @@ -92,15 +73,12 @@ AC_PATH_PROG(XGETTEXT,xgettext) AC_PATH_PROG(HEXDUMP,hexdump) AC_PATH_TOOL(READELF, readelf) AC_PATH_TOOL(CPPFILT, c++filt) -AC_PATH_TOOL(OBJCOPY, objcopy) -AC_PATH_PROG(DOXYGEN, doxygen) -if test -z "$DOXYGEN"; then - AC_MSG_WARN([Doxygen not found]) -fi -AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files) +dnl pkg-config check. +PKG_PROG_PKG_CONFIG + # Enable wallet AC_ARG_ENABLE([wallet], [AS_HELP_STRING([--disable-wallet], @@ -135,10 +113,20 @@ AC_ARG_ENABLE(bench, [use_bench=$enableval], [use_bench=yes]) -AC_ARG_ENABLE([extended-functional-tests], - AS_HELP_STRING([--enable-extended-functional-tests],[enable expensive functional tests when using lcov (default no)]), - [use_extended_functional_tests=$enableval], - [use_extended_functional_tests=no]) +AC_ARG_WITH([comparison-tool], + AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]), + [use_comparison_tool=$withval], + [use_comparison_tool=no]) + +AC_ARG_ENABLE([comparison-tool-reorg-tests], + AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]), + [use_comparison_tool_reorg_tests=$enableval], + [use_comparison_tool_reorg_tests=no]) + +AC_ARG_ENABLE([extended-rpc-tests], + AS_HELP_STRING([--enable-extended-rpc-tests],[enable expensive RPC tests when using lcov (default no)]), + [use_extended_rpc_tests=$enableval], + [use_extended_rpc_tests=no]) AC_ARG_WITH([qrencode], [AS_HELP_STRING([--with-qrencode], @@ -146,17 +134,11 @@ AC_ARG_WITH([qrencode], [use_qr=$withval], [use_qr=auto]) -AC_ARG_WITH([icu], - [AS_HELP_STRING([--with-icu], - [Required ICU root path])], - [ICU_PREFIX=$withval], - [ICU_PREFIX=auto]) - AC_ARG_ENABLE([hardening], [AS_HELP_STRING([--disable-hardening], - [do not attempt to harden the resulting executables (default is to harden when possible)])], + [do not attempt to harden the resulting executables (default is to harden)])], [use_hardening=$enableval], - [use_hardening=auto]) + [use_hardening=yes]) AC_ARG_ENABLE([reduce-exports], [AS_HELP_STRING([--enable-reduce-exports], @@ -173,31 +155,15 @@ AC_ARG_ENABLE([ccache], AC_ARG_ENABLE([lcov], [AS_HELP_STRING([--enable-lcov], [enable lcov testing (default is no)])], - [use_lcov=$enableval], + [use_lcov=yes], [use_lcov=no]) -AC_ARG_ENABLE([lcov-branch-coverage], - [AS_HELP_STRING([--enable-lcov-branch-coverage], - [enable lcov testing branch coverage (default is no)])], - [use_lcov_branch=yes], - [use_lcov_branch=no]) - AC_ARG_ENABLE([glibc-back-compat], [AS_HELP_STRING([--enable-glibc-back-compat], [enable backwards compatibility with glibc])], [use_glibc_compat=$enableval], [use_glibc_compat=no]) -AC_ARG_ENABLE([asm], - [AS_HELP_STRING([--enable-asm], - [Enable assembly routines (default is yes)])], - [use_asm=$enableval], - [use_asm=yes]) - -if test "x$use_asm" = xyes; then - AC_DEFINE(USE_ASM, 1, [Define this symbol to build in assembly routines]) -fi - AC_ARG_WITH([system-univalue], [AS_HELP_STRING([--with-system-univalue], [Build with system UniValue (default is no)])], @@ -212,12 +178,6 @@ AC_ARG_ENABLE([zmq], AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) -AC_ARG_ENABLE(man, - [AS_HELP_STRING([--disable-man], - [do not install man pages (default is to install)])],, - enable_man=yes) -AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) - # Enable debug AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], @@ -225,183 +185,28 @@ AC_ARG_ENABLE([debug], [enable_debug=$enableval], [enable_debug=no]) -# Enable different -fsanitize options -AC_ARG_WITH([sanitizers], - [AS_HELP_STRING([--with-sanitizers], - [comma separated list of extra sanitizers to build with (default is none enabled)])], - [use_sanitizers=$withval]) - -# Enable gprof profiling -AC_ARG_ENABLE([gprof], - [AS_HELP_STRING([--enable-gprof], - [use gprof profiling compiler flags (default is no)])], - [enable_gprof=$enableval], - [enable_gprof=no]) - -# Turn warnings into errors -AC_ARG_ENABLE([werror], - [AS_HELP_STRING([--enable-werror], - [Treat certain compiler warnings as errors (default is no)])], - [enable_werror=$enableval], - [enable_werror=no]) - -AC_LANG_PUSH([C++]) -AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) - if test "x$enable_debug" = xyes; then - # Clear default -g -O2 flags - if test "x$CXXFLAGS_overridden" = xno; then - CXXFLAGS="" - fi - # Prefer -Og, fall back to -O0 if that is unavailable. - AX_CHECK_COMPILE_FLAG( - [-Og], - [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -Og"]], - [AX_CHECK_COMPILE_FLAG([-O0],[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])], - [[$CXXFLAG_WERROR]]) + CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER" + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -g3 -O0" + fi - # Prefer -g3, fall back to -g if that is unavailable. - AX_CHECK_COMPILE_FLAG( - [-g3], - [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"]], - [AX_CHECK_COMPILE_FLAG([-g],[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g"]],,[[$CXXFLAG_WERROR]])], - [[$CXXFLAG_WERROR]]) - - AX_CHECK_PREPROC_FLAG([-DDEBUG],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG"]],,[[$CXXFLAG_WERROR]]) - AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"]],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-ftrapv],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"],,[[$CXXFLAG_WERROR]]) -fi - -if test x$use_sanitizers != x; then - # First check if the compiler accepts flags. If an incompatible pair like - # -fsanitize=address,thread is used here, this check will fail. This will also - # fail if a bad argument is passed, e.g. -fsanitize=undfeined - AX_CHECK_COMPILE_FLAG( - [[-fsanitize=$use_sanitizers]], - [[SANITIZER_CXXFLAGS=-fsanitize=$use_sanitizers]], - [AC_MSG_ERROR([compiler did not accept requested flags])]) - - # Some compilers (e.g. GCC) require additional libraries like libasan, - # libtsan, libubsan, etc. Make sure linking still works with the sanitize - # flag. This is a separate check so we can give a better error message when - # the sanitize flags are supported by the compiler but the actual sanitizer - # libs are missing. - AX_CHECK_LINK_FLAG( - [[-fsanitize=$use_sanitizers]], - [[SANITIZER_LDFLAGS=-fsanitize=$use_sanitizers]], - [AC_MSG_ERROR([linker did not accept requested flags, you are missing required libraries])]) -fi - -ERROR_CXXFLAGS= -if test "x$enable_werror" = "xyes"; then - if test "x$CXXFLAG_WERROR" = "x"; then - AC_MSG_ERROR("enable-werror set but -Werror is not usable") - fi - AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Werror=thread-safety-analysis],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=thread-safety-analysis"],,[[$CXXFLAG_WERROR]]) + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -g3 -O0" + fi fi +## TODO: Remove these hard-coded paths and flags. They are here for the sake of +## compatibility with the legacy buildsystem. +## if test "x$CXXFLAGS_overridden" = "xno"; then - AX_CHECK_COMPILE_FLAG([-Wall],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wextra],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wformat],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wvla],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wformat-security],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wthread-safety-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety-analysis"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]]) - - ## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all - ## unknown options if any other warning is produced. Test the -Wfoo case, and - ## set the -Wno-foo case if it works. - AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wdeprecated-register],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-register"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]]) + CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-self-assign" fi - -# Check for optional instruction set support. Enabling these does _not_ imply that all code will -# be compiled with them, rather that specific objects/libs may use them after checking for runtime -# compatibility. -AX_CHECK_COMPILE_FLAG([-msse4.2],[[SSE42_CXXFLAGS="-msse4.2"]],,[[$CXXFLAG_WERROR]]) -AX_CHECK_COMPILE_FLAG([-msse4.1],[[SSE41_CXXFLAGS="-msse4.1"]],,[[$CXXFLAG_WERROR]]) -AX_CHECK_COMPILE_FLAG([-mavx -mavx2],[[AVX2_CXXFLAGS="-mavx -mavx2"]],,[[$CXXFLAG_WERROR]]) -AX_CHECK_COMPILE_FLAG([-msse4 -msha],[[SHANI_CXXFLAGS="-msse4 -msha"]],,[[$CXXFLAG_WERROR]]) - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $SSE42_CXXFLAGS" -AC_MSG_CHECKING(for assembler crc32 support) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #if defined(_MSC_VER) - #include - #elif defined(__GNUC__) && defined(__SSE4_2__) - #include - #endif - ]],[[ - uint64_t l = 0; - l = _mm_crc32_u8(l, 0); - l = _mm_crc32_u32(l, 0); - l = _mm_crc32_u64(l, 0); - return l; - ]])], - [ AC_MSG_RESULT(yes); enable_hwcrc32=yes], - [ AC_MSG_RESULT(no)] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $SSE41_CXXFLAGS" -AC_MSG_CHECKING(for SSE4.1 intrinsics) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - __m128i l = _mm_set1_epi32(0); - return _mm_extract_epi32(l, 3); - ]])], - [ AC_MSG_RESULT(yes); enable_sse41=yes; AC_DEFINE(ENABLE_SSE41, 1, [Define this symbol to build code that uses SSE4.1 intrinsics]) ], - [ AC_MSG_RESULT(no)] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $AVX2_CXXFLAGS" -AC_MSG_CHECKING(for AVX2 intrinsics) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - __m256i l = _mm256_set1_epi32(0); - return _mm256_extract_epi32(l, 7); - ]])], - [ AC_MSG_RESULT(yes); enable_avx2=yes; AC_DEFINE(ENABLE_AVX2, 1, [Define this symbol to build code that uses AVX2 intrinsics]) ], - [ AC_MSG_RESULT(no)] -) -CXXFLAGS="$TEMP_CXXFLAGS" - -TEMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $SHANI_CXXFLAGS" -AC_MSG_CHECKING(for SHA-NI intrinsics) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]],[[ - __m128i i = _mm_set1_epi32(0); - __m128i j = _mm_set1_epi32(1); - __m128i k = _mm_set1_epi32(2); - return _mm_extract_epi32(_mm_sha256rnds2_epu32(i, i, k), 0); - ]])], - [ AC_MSG_RESULT(yes); enable_shani=yes; AC_DEFINE(ENABLE_SHANI, 1, [Define this symbol to build code that uses SHA-NI intrinsics]) ], - [ AC_MSG_RESULT(no)] -) -CXXFLAGS="$TEMP_CXXFLAGS" - CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" AC_ARG_WITH([utils], [AS_HELP_STRING([--with-utils], - [build lbrycrd-cli lbrycrd-tx (default=yes)])], + [build bitcoin-cli bitcoin-tx (default=yes)])], [build_bitcoin_utils=$withval], [build_bitcoin_utils=yes]) @@ -417,6 +222,8 @@ AC_ARG_WITH([daemon], [build_bitcoind=$withval], [build_bitcoind=yes]) +AC_LANG_PUSH([C++]) + use_pkgconfig=yes case $host in *mingw*) @@ -425,25 +232,25 @@ case $host in use_pkgconfig=no TARGET_OS=windows - AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(libmingwthrd missing)) - AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(libkernel32 missing)) - AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(libuser32 missing)) - AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(libgdi32 missing)) - AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(libcomdlg32 missing)) - AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(libwinspool missing)) - AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(libwinmm missing)) - AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(libshell32 missing)) - AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(libcomctl32 missing)) - AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(libole32 missing)) - AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(liboleaut32 missing)) - AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(libuuid missing)) - AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(librpcrt4 missing)) - AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(libadvapi32 missing)) - AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(libws2_32 missing)) - AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(libmswsock missing)) - AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(libshlwapi missing)) - AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing)) - AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing)) + AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) # -static is interpreted by libtool, where it has a different meaning. # In libtool-speak, it's -all-static. @@ -460,7 +267,7 @@ case $host in fi CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB" - LEVELDB_TARGET_FLAGS="-DOS_WINDOWS" + LEVELDB_TARGET_FLAGS="TARGET_OS=OS_WINDOWS_CROSSCOMPILE" if test "x$CXXFLAGS_overridden" = "xno"; then CXXFLAGS="$CXXFLAGS -w" fi @@ -482,7 +289,7 @@ case $host in ;; *darwin*) TARGET_OS=darwin - LEVELDB_TARGET_FLAGS="-DOS_MACOSX" + LEVELDB_TARGET_FLAGS="TARGET_OS=Darwin" if test x$cross_compiling != xyes; then BUILD_OS=darwin AC_CHECK_PROG([PORT],port, port) @@ -496,7 +303,6 @@ case $host in fi fi - AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert) AC_CHECK_PROG([BREW],brew, brew) if test x$BREW = xbrew; then dnl These Homebrew packages may be keg-only, meaning that they won't be found @@ -547,52 +353,28 @@ case $host in CPPFLAGS="$CPPFLAGS -DMAC_OSX" OBJCXXFLAGS="$CXXFLAGS" ;; - *android*) - dnl make sure android stays above linux for hosts like *linux-android* - LEVELDB_TARGET_FLAGS="-DOS_ANDROID" - ;; *linux*) TARGET_OS=linux - LEVELDB_TARGET_FLAGS="-DOS_LINUX" - ;; - *kfreebsd*) - LEVELDB_TARGET_FLAGS="-DOS_KFREEBSD" - ;; - *freebsd*) - LEVELDB_TARGET_FLAGS="-DOS_FREEBSD" - ;; - *openbsd*) - LEVELDB_TARGET_FLAGS="-DOS_OPENBSD" - ;; - *netbsd*) - LEVELDB_TARGET_FLAGS="-DOS_NETBSD" - ;; - *dragonfly*) - LEVELDB_TARGET_FLAGS="-DOS_DRAGONFLYBSD" - ;; - *solaris*) - LEVELDB_TARGET_FLAGS="-DOS_SOLARIS" - ;; - *hpux*) - LEVELDB_TARGET_FLAGS="-DOS_HPUX" ;; *) - AC_MSG_ERROR(Cannot build leveldb for $host. Please file a bug report.) ;; esac -if test x$use_pkgconfig = xyes; then - m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)]) - m4_ifdef([PKG_PROG_PKG_CONFIG], [ - PKG_PROG_PKG_CONFIG - if test x"$PKG_CONFIG" = "x"; then - AC_MSG_ERROR(pkg-config not found.) - fi - ]) +if test x$use_comparison_tool != xno; then + AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool) fi -if test x$use_extended_functional_tests != xno; then - AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, --extended) +if test x$use_comparison_tool_reorg_tests != xno; then + if test x$use_comparison_tool = x; then + AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified") + fi + AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1) +else + AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0) +fi + +if test x$use_extended_rpc_tests != xno; then + AC_SUBST(EXTENDED_RPC_TESTS, -extended) fi if test x$use_lcov = xyes; then @@ -602,23 +384,21 @@ if test x$use_lcov = xyes; then if test x$GCOV = x; then AC_MSG_ERROR("lcov testing requested but gcov not found") fi + if test x$JAVA = x; then + AC_MSG_ERROR("lcov testing requested but java not found") + fi if test x$PYTHON = x; then AC_MSG_ERROR("lcov testing requested but python not found") fi if test x$GENHTML = x; then AC_MSG_ERROR("lcov testing requested but genhtml not found") fi + if test x$use_comparison_tool = x; then + AC_MSG_ERROR("lcov testing requested but comparison tool was not specified") + fi LCOV="$LCOV --gcov-tool=$GCOV" - AX_CHECK_LINK_FLAG([[--coverage]], [LDFLAGS="$LDFLAGS --coverage"], - [AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")]) AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) - AC_DEFINE(USE_COVERAGE, 1, [Define this symbol if coverage is enabled]) - CXXFLAGS="$CXXFLAGS -Og" -fi - -if test x$use_lcov_branch != xno; then - AC_SUBST(LCOV_OPTS, "$LCOV_OPTS --rc lcov_branch_coverage=1") fi dnl Check for endianness @@ -646,10 +426,6 @@ if test x$ac_cv_sys_large_files != x && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" fi -AS_IF([test x$enable_static != x && test x$LDFLAGS != xdarwin], [ - # darwin should be using -stdlib=libc++ (and may need a -static instead) - AX_CHECK_LINK_FLAG([[-static-libstdc++]], [LDFLAGS="$LDFLAGS -static-libstdc++"]) -]) AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"]) AX_GCC_FUNC_ATTRIBUTE([visibility]) @@ -660,7 +436,7 @@ if test x$use_glibc_compat != xno; then #glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link #in anyway for back-compat. - AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(librt missing)) + AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(lib missing)) #__fdelt_chk's params and return type have changed from long unsigned int to long int. # See which one is present here. @@ -675,40 +451,18 @@ if test x$use_glibc_compat != xno; then [ fdelt_type="long int"]) AC_MSG_RESULT($fdelt_type) AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk]) - AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"]) - AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"]) else AC_SEARCH_LIBS([clock_gettime],[rt]) fi -if test "x$enable_gprof" = xyes; then - dnl -pg is incompatible with -pie. Since hardening and profiling together doesn't make sense, - dnl we simply make them mutually exclusive here. Additionally, hardened toolchains may force - dnl -pie by default, in which case it needs to be turned off with -no-pie. - - if test x$use_hardening = xyes; then - AC_MSG_ERROR(gprof profiling is not compatible with hardening. Reconfigure with --disable-hardening or --disable-gprof) - fi - use_hardening=no - AX_CHECK_COMPILE_FLAG([-pg],[GPROF_CXXFLAGS="-pg"], - [AC_MSG_ERROR(gprof profiling requested but not available)], [[$CXXFLAG_WERROR]]) - - AX_CHECK_LINK_FLAG([[-no-pie]], [GPROF_LDFLAGS="-no-pie"]) - AX_CHECK_LINK_FLAG([[-pg]],[GPROF_LDFLAGS="$GPROF_LDFLAGS -pg"], - [AC_MSG_ERROR(gprof profiling requested but not available)], [[$GPROF_LDFLAGS]]) -fi - if test x$TARGET_OS != xwindows; then # All windows code is PIC, forcing it on just adds useless compile warnings AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"]) fi -# All versions of gcc that we commonly use for building are subject to bug -# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set -# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag) -AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"]) if test x$use_hardening != xno; then - use_hardening=yes + AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) + AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[ AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ @@ -719,18 +473,17 @@ if test x$use_hardening != xno; then AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"]) AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"]) - AX_CHECK_LINK_FLAG([[-Wl,--high-entropy-va]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"]) AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"]) AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"]) - AX_CHECK_LINK_FLAG([[-fPIE -pie]], [PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],, [[$CXXFLAG_WERROR]]) + + if test x$TARGET_OS != xwindows; then + AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"]) + AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"]) + fi case $host in *mingw*) - AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(libssp missing)) - ;; - *) - AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) - AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) + AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing)) ;; esac fi @@ -741,12 +494,11 @@ if test x$TARGET_OS = xdarwin; then fi AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h]) +AC_SEARCH_LIBS([getaddrinfo_a], [anl], [AC_DEFINE(HAVE_GETADDRINFO_A, 1, [Define this symbol if you have getaddrinfo_a])]) +AC_SEARCH_LIBS([inet_pton], [nsl resolv], [AC_DEFINE(HAVE_INET_PTON, 1, [Define this symbol if you have inet_pton])]) AC_CHECK_DECLS([strnlen]) -# Check for daemon(3), unrelated to --with-daemon (although used by it) -AC_CHECK_DECLS([daemon]) - AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,, [#if HAVE_ENDIAN_H #include @@ -759,21 +511,11 @@ AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,, #include #endif]) -AC_CHECK_DECLS([__builtin_clz, __builtin_clzl, __builtin_clzll]) - -dnl Check for malloc_info (for memory statistics information in getmemoryinfo) -AC_MSG_CHECKING(for getmemoryinfo) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ int f = malloc_info(0, NULL); ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MALLOC_INFO, 1,[Define this symbol if you have malloc_info]) ], - [ AC_MSG_RESULT(no)] -) - -dnl Check for mallopt(M_ARENA_MAX) (to set glibc arenas) -AC_MSG_CHECKING(for mallopt M_ARENA_MAX) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ mallopt(M_ARENA_MAX, 1); ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MALLOPT_ARENA_MAX, 1,[Define this symbol if you have mallopt with M_ARENA_MAX]) ], +dnl Check for MSG_NOSIGNAL +AC_MSG_CHECKING(for MSG_NOSIGNAL) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[ int f = MSG_NOSIGNAL; ]])], + [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,[Define this symbol if you have MSG_NOSIGNAL]) ], [ AC_MSG_RESULT(no)] ) @@ -794,71 +536,6 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([ ] ) -TEMP_LDFLAGS="$LDFLAGS" -LDFLAGS="$TEMP_LDFLAGS $PTHREAD_LIBS" -AC_MSG_CHECKING([for thread_local support]) -AC_LINK_IFELSE([AC_LANG_SOURCE([ - #include - static thread_local int foo = 0; - static void run_thread() { foo++;} - int main(){ - for(int i = 0; i < 10; i++) { std::thread(run_thread).detach();} - return foo; - } - ])], - [ - AC_DEFINE(HAVE_THREAD_LOCAL,1,[Define if thread_local is supported.]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ] -) -LDFLAGS="$TEMP_LDFLAGS" - -# Check for different ways of gathering OS randomness -AC_MSG_CHECKING(for Linux getrandom syscall) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include - #include ]], - [[ syscall(SYS_getrandom, nullptr, 32, 0); ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_GETRANDOM, 1,[Define this symbol if the Linux getrandom system call is available]) ], - [ AC_MSG_RESULT(no)] -) - -AC_MSG_CHECKING(for getentropy) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ getentropy(nullptr, 32) ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_GETENTROPY, 1,[Define this symbol if the BSD getentropy system call is available]) ], - [ AC_MSG_RESULT(no)] -) - -AC_MSG_CHECKING(for getentropy via random.h) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[ getentropy(nullptr, 32) ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_GETENTROPY_RAND, 1,[Define this symbol if the BSD getentropy system call is available with sys/random.h]) ], - [ AC_MSG_RESULT(no)] -) - -AC_MSG_CHECKING(for sysctl KERN_ARND) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[ static const int name[2] = {CTL_KERN, KERN_ARND}; - sysctl(name, 2, nullptr, nullptr, nullptr, 0); ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL_ARND, 1,[Define this symbol if the BSD sysctl(KERN_ARND) is available]) ], - [ AC_MSG_RESULT(no)] -) - -AC_MSG_CHECKING(for if type char equals int8_t) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[ static_assert(std::is_same::value, ""); ]])], - [ AC_MSG_RESULT(yes); AC_DEFINE(CHAR_EQUALS_INT8, 1,[Define this symbol if type char equals int8_t]) ], - [ AC_MSG_RESULT(no)] -) - -# Check for reduced exports if test x$use_reduce_exports = xyes; then AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"], [AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])]) @@ -881,7 +558,7 @@ dnl Check for libminiupnpc (optional) if test x$use_upnp != xno; then AC_CHECK_HEADERS( [miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h], - [AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])], + [AC_CHECK_LIB([miniupnpc], [main],[MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])], [have_miniupnpc=no] ) fi @@ -889,9 +566,9 @@ fi BITCOIN_QT_INIT dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus -BITCOIN_QT_CONFIGURE([$use_pkgconfig]) +BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt5]) -if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononono; then +if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests = xnononono; then use_boost=no else use_boost=yes @@ -899,24 +576,14 @@ fi if test x$use_boost = xyes; then -dnl Minimum required Boost version -define(MINIMUM_REQUIRED_BOOST, 1.47.0) - dnl Check for boost libs -AX_BOOST_BASE([MINIMUM_REQUIRED_BOOST]) -if test x$want_boost = xno; then - AC_MSG_ERROR([[only libbitcoinconsensus can be built without boost]]) -fi +AX_BOOST_BASE AX_BOOST_SYSTEM AX_BOOST_FILESYSTEM +AX_BOOST_PROGRAM_OPTIONS AX_BOOST_THREAD AX_BOOST_CHRONO -AX_BOOST_LOCALE -dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic -dnl counter implementations. In 1.63 and later the std::atomic approach is default. -m4_pattern_allow(DBOOST_AC_USE_STD_ATOMIC) dnl otherwise it's treated like a macro -BOOST_CPPFLAGS="-DBOOST_SP_USE_STD_ATOMIC -DBOOST_AC_USE_STD_ATOMIC $BOOST_CPPFLAGS" if test x$use_reduce_exports = xyes; then AC_MSG_CHECKING([for working boost reduced exports]) @@ -978,7 +645,8 @@ fi if test x$use_boost = xyes; then -BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_LOCALE_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB" +BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRAM_OPTIONS_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB" + dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums dnl using c++98 constructs. Unfortunately, this implementation detail leaked into @@ -996,14 +664,14 @@ TEMP_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" AC_MSG_CHECKING([for mismatched boost c++11 scoped enums]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include - #include + #include "boost/config.hpp" + #include "boost/version.hpp" #if !defined(BOOST_NO_SCOPED_ENUMS) && !defined(BOOST_NO_CXX11_SCOPED_ENUMS) && BOOST_VERSION < 105700 #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_CXX11_SCOPED_ENUMS #define CHECK #endif - #include + #include "boost/filesystem.hpp" ]],[[ #if defined(CHECK) boost::filesystem::copy_file("foo", "bar"); @@ -1068,33 +736,18 @@ fi fi -# the plan for dealing with ICU: -# if the user specifies an ICU prefix, use that one. -# if the user did not specify an ICU prefix but did specify a general prefix use that one. -# otherwise use pkg_config if it's available. -# well, actually, things seem to work fine without this fallback to pkg_config so we'll leave that out for now. -# note: in order to use AC_CHECK_LIB we have to override CPPFLAGS and LDFLAGS -# however, we don't want to keep those overridden after our checks; -# we want to rely on ICU_CPPFLAGS and ICU_LIBS after that -# to further complicate matters there are at least three different naming conventions for ICU libraries -# to simplify things we'll just check one from each convention - -AS_IF([test "x${prefix}" != "xNONE" && test "x$ICU_PREFIX" == "xauto"], [ - ICU_PREFIX="${prefix}" -]) - -AS_IF([test "x$ICU_PREFIX" != "xauto"], [ - ICU_CPPFLAGS="$(PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=$ICU_PREFIX/lib/pkgconfig PKG_CONFIG_PATH=$ICU_PREFIX/share/pkgconfig pkg-config icu-io icu-uc icu-i18n --cflags)" - ICU_LIBS="$(PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=$ICU_PREFIX/lib/pkgconfig PKG_CONFIG_PATH=$ICU_PREFIX/share/pkgconfig pkg-config icu-io icu-uc icu-i18n --libs)" -]) - if test x$use_pkgconfig = xyes; then - : dnl + + if test x"$PKG_CONFIG" = "x"; then + AC_MSG_ERROR(pkg-config not found.) + fi + + : #NOP m4_ifdef( [PKG_CHECK_MODULES], [ - PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)]) - PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)]) + PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)]) + PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)]) BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])]) if test x$use_qr != xno; then BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) @@ -1115,15 +768,9 @@ if test x$use_pkgconfig = xyes; then else AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions]) fi - - if test "x$ICU_PREFIX" == "xauto"; then - PKG_CHECK_MODULES([ICU], [icu-io, icu-uc, icu-i18n]) - fi ] ) -else # probably compiling on Windows or cross-compiling for it: - AC_MSG_NOTICE([Configuring for MinGW]) - +else AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing)) AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing)) @@ -1152,15 +799,6 @@ else # probably compiling on Windows or cross-compiling for it: AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions]) fi - if test "x$use_zmq" = "xyes"; then - dnl Assume libzmq was built for static linking - case $host in - *mingw*) - ZMQ_CFLAGS="$ZMQ_CFLAGS -DZMQ_STATIC" - ;; - esac - fi - BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found))) if test x$use_qr != xno; then BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])]) @@ -1168,24 +806,8 @@ else # probably compiling on Windows or cross-compiling for it: fi fi -AC_MSG_NOTICE([Using ICU_CPPFLAGS="$ICU_CPPFLAGS"]) -AC_MSG_NOTICE([Using ICU_LIBS="$ICU_LIBS"]) - -save_CXXFLAGS="${CXXFLAGS}" -CXXFLAGS="${CXXFLAGS} ${CRYPTO_CFLAGS} ${SSL_CFLAGS}" -AC_CHECK_DECLS([EVP_MD_CTX_new],,,[AC_INCLUDES_DEFAULT -#include -]) -CXXFLAGS="${save_CXXFLAGS}" - dnl univalue check -need_bundled_univalue=yes - -if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononono; then - need_bundled_univalue=no -else - if test x$system_univalue != xno ; then found_univalue=no if test x$use_pkgconfig = xyes; then @@ -1193,7 +815,7 @@ if test x$system_univalue != xno ; then m4_ifdef( [PKG_CHECK_MODULES], [ - PKG_CHECK_MODULES([UNIVALUE],[libunivalue >= 1.0.4],[found_univalue=yes],[true]) + PKG_CHECK_MODULES([UNIVALUE],[libunivalue],[found_univalue=yes],[true]) ] ) else @@ -1207,7 +829,6 @@ if test x$system_univalue != xno ; then if test x$found_univalue = xyes ; then system_univalue=yes - need_bundled_univalue=no elif test x$system_univalue = xyes ; then AC_MSG_ERROR([univalue not found]) else @@ -1215,24 +836,29 @@ if test x$system_univalue != xno ; then fi fi -if test x$need_bundled_univalue = xyes ; then +if test x$system_univalue = xno ; then UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include' UNIVALUE_LIBS='univalue/libunivalue.la' fi - -fi - -AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$need_bundled_univalue = xyes]) +AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$system_univalue = xno]) AC_SUBST(UNIVALUE_CFLAGS) AC_SUBST(UNIVALUE_LIBS) +CXXFLAGS_TEMP="$CXXFLAGS" +LIBS_TEMP="$LIBS" +CXXFLAGS="$CXXFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS" +LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS" +AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),) +CXXFLAGS="$CXXFLAGS_TEMP" +LIBS="$LIBS_TEMP" + BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) AC_MSG_CHECKING([whether to build bitcoind]) AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) AC_MSG_RESULT($build_bitcoind) -AC_MSG_CHECKING([whether to build utils (lbrycrd-cli lbrycrd-tx)]) +AC_MSG_CHECKING([whether to build utils (bitcoin-cli bitcoin-tx)]) AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes]) AC_MSG_RESULT($build_bitcoin_utils) @@ -1333,7 +959,7 @@ if test x$bitcoin_enable_qt != xno; then AC_MSG_WARN("xgettext is required to update qt translations") fi - AC_MSG_CHECKING([whether to build test_lbrycrd-qt]) + AC_MSG_CHECKING([whether to build test_bitcoin-qt]) if test x$use_gui_tests$bitcoin_enable_qt_test = xyesyes; then AC_MSG_RESULT([yes]) BUILD_TEST_QT="yes" @@ -1344,7 +970,7 @@ fi AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) -AC_MSG_CHECKING([whether to build test_lbrycrd]) +AC_MSG_CHECKING([whether to build test_bitcoin]) if test x$use_tests = xyes; then AC_MSG_RESULT([yes]) BUILD_TEST="yes" @@ -1360,8 +986,8 @@ else AC_MSG_RESULT([no]) fi -if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$use_bench$use_tests = xnononononono; then - AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests]) +if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$use_tests = xnonononono; then + AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui or --enable-tests]) fi AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) @@ -1374,13 +1000,10 @@ AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes]) AM_CONDITIONAL([ENABLE_BENCH],[test x$use_bench = xyes]) AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) +AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno]) +AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes]) -AM_CONDITIONAL([ENABLE_HWCRC32],[test x$enable_hwcrc32 = xyes]) -AM_CONDITIONAL([ENABLE_SSE41],[test x$enable_sse41 = xyes]) -AM_CONDITIONAL([ENABLE_AVX2],[test x$enable_avx2 = xyes]) -AM_CONDITIONAL([ENABLE_SHANI],[test x$enable_shani = xyes]) -AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes]) AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) @@ -1407,50 +1030,22 @@ AC_SUBST(BITCOIN_CLI_NAME) AC_SUBST(BITCOIN_TX_NAME) AC_SUBST(RELDFLAGS) -AC_SUBST(DEBUG_CPPFLAGS) -AC_SUBST(WARN_CXXFLAGS) -AC_SUBST(NOWARN_CXXFLAGS) -AC_SUBST(DEBUG_CXXFLAGS) -AC_SUBST(COMPAT_LDFLAGS) -AC_SUBST(ERROR_CXXFLAGS) -AC_SUBST(GPROF_CXXFLAGS) -AC_SUBST(GPROF_LDFLAGS) AC_SUBST(HARDENED_CXXFLAGS) AC_SUBST(HARDENED_CPPFLAGS) AC_SUBST(HARDENED_LDFLAGS) AC_SUBST(PIC_FLAGS) AC_SUBST(PIE_FLAGS) -AC_SUBST(SANITIZER_CXXFLAGS) -AC_SUBST(SANITIZER_LDFLAGS) -AC_SUBST(SSE42_CXXFLAGS) -AC_SUBST(SSE41_CXXFLAGS) -AC_SUBST(AVX2_CXXFLAGS) -AC_SUBST(SHANI_CXXFLAGS) AC_SUBST(LIBTOOL_APP_LDFLAGS) AC_SUBST(USE_UPNP) AC_SUBST(USE_QRCODE) AC_SUBST(BOOST_LIBS) -AC_SUBST(ICU_CPPFLAGS) -AC_SUBST(ICU_LIBS) AC_SUBST(TESTDEFS) AC_SUBST(LEVELDB_TARGET_FLAGS) AC_SUBST(MINIUPNPC_CPPFLAGS) AC_SUBST(MINIUPNPC_LIBS) -AC_SUBST(CRYPTO_LIBS) -AC_SUBST(SSL_CFLAGS) -AC_SUBST(SSL_LIBS) -AC_SUBST(EVENT_LIBS) -AC_SUBST(EVENT_PTHREADS_LIBS) -AC_SUBST(ZMQ_LIBS) -AC_SUBST(PROTOBUF_LIBS) -AC_SUBST(QR_LIBS) -AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini]) -AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh]) -AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])]) -AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py]) -AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) -AC_CONFIG_LINKS([test/util/bitcoin-util-test.py:test/util/bitcoin-util-test.py]) -AC_CONFIG_LINKS([test/util/rpcauth-test.py:test/util/rpcauth-test.py]) +AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py]) +AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh]) +AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py]) dnl boost's m4 checks do something really nasty: they export these vars. As a dnl result, they leak into secp256k1's configure and crazy things happen. @@ -1475,11 +1070,11 @@ PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR" unset PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP" -if test x$need_bundled_univalue = xyes; then +if test x$system_univalue = xno; then AC_CONFIG_SUBDIRS([src/univalue]) fi -ac_configure_args="${ac_configure_args} --enable-static --disable-shared --with-pic --with-bignum=no --enable-module-recovery --disable-jni" +ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery" AC_CONFIG_SUBDIRS([src/secp256k1]) AC_OUTPUT @@ -1498,36 +1093,7 @@ esac dnl Replace the BUILDDIR path with the correct Windows path if compiling on Native Windows case ${OS} in *Windows*) - sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' test/config.ini > test/config-2.ini - mv test/config-2.ini test/config.ini + sed 's/BUILDDIR="\/\([[a-z]]\)/BUILDDIR="\1:/' qa/pull-tester/tests_config.py > qa/pull-tester/tests_config-2.py + mv qa/pull-tester/tests_config-2.py qa/pull-tester/tests_config.py ;; esac - -echo -echo "Options used to compile and link:" -echo " with wallet = $enable_wallet" -echo " with gui / qt = $bitcoin_enable_qt" -if test x$bitcoin_enable_qt != xno; then - echo " with qr = $use_qr" -fi -echo " with zmq = $use_zmq" -echo " with test = $use_tests" -echo " with bench = $use_bench" -echo " with upnp = $use_upnp" -echo " use asm = $use_asm" -echo " sanitizers = $use_sanitizers" -echo " debug enabled = $enable_debug" -echo " gprof enabled = $enable_gprof" -echo " werror = $enable_werror" -echo -echo " target os = $TARGET_OS" -echo " build os = $BUILD_OS" -echo -echo " CC = $CC" -echo " CFLAGS = $CFLAGS" -echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS" -echo " CXX = $CXX" -echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS" -echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS" -echo " ARFLAGS = $ARFLAGS" -echo diff --git a/contrib/README.md b/contrib/README.md index 891591976..32b3a170a 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,9 +1,17 @@ +Wallet Tools +--------------------- + +### [SpendFrom](/contrib/spendfrom) ### + +Use the raw transactions API to send coins received on a particular +address (or addresses). + Repository Tools --------------------- ### [Developer tools](/contrib/devtools) ### Specific tools for developers working on this repository. -Contains the script `github-merge.py` for merging GitHub pull requests securely and signing them using GPG. +Contains the script `github-merge.py` for merging github pull requests securely and signing them using GPG. ### [Verify-Commits](/contrib/verify-commits) ### Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script. @@ -21,13 +29,12 @@ Utility to generate the pnSeed[] array that is compiled into the client. Build Tools and Keys --------------------- -### Packaging ### -The [Debian](/contrib/debian) subfolder contains the copyright file. - -All other packaging related files can be found in the [bitcoin-core/packaging](https://github.com/bitcoin-core/packaging) repository. +### [Debian](/contrib/debian) ### +Contains files used to package bitcoind/bitcoin-qt +for Debian-based Linux systems. If you compile bitcoind/bitcoin-qt yourself, there are some useful files here. ### [Gitian-descriptors](/contrib/gitian-descriptors) ### -Files used during the gitian build process. For more information about gitian, see the [the Bitcoin Core documentation repository](https://github.com/bitcoin-core/docs). +Notes on getting Gitian builds up and running using KVM. ### [Gitian-keys](/contrib/gitian-keys) PGP keys used for signing Bitcoin Core [Gitian release](/doc/release-process.md) results. @@ -35,8 +42,8 @@ PGP keys used for signing Bitcoin Core [Gitian release](/doc/release-process.md) ### [MacDeploy](/contrib/macdeploy) ### Scripts and notes for Mac builds. -### [Gitian-build](/contrib/gitian-build.py) ### -Script for running full Gitian builds. +### [RPM](/contrib/rpm) ### +RPM spec file for building bitcoin-core on RPM based distributions Test and Verify Tools --------------------- @@ -44,5 +51,5 @@ Test and Verify Tools ### [TestGen](/contrib/testgen) ### Utilities to generate test vectors for the data-driven Bitcoin tests. -### [Verify Binaries](/contrib/verifybinaries) ### -This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org. +### [Verify SF Binaries](/contrib/verifysfbinaries) ### +This script attempts to download and verify the signature file SHA256SUMS.asc from SourceForge. diff --git a/contrib/bitcoin-cli.bash-completion b/contrib/bitcoin-cli.bash-completion deleted file mode 100644 index 732981fe7..000000000 --- a/contrib/bitcoin-cli.bash-completion +++ /dev/null @@ -1,154 +0,0 @@ -# bash programmable completion for bitcoin-cli(1) -# Copyright (c) 2012-2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -# call $bitcoin-cli for RPC -_bitcoin_rpc() { - # determine already specified args necessary for RPC - local rpcargs=() - for i in ${COMP_LINE}; do - case "$i" in - -conf=*|-datadir=*|-regtest|-rpc*|-testnet) - rpcargs=( "${rpcargs[@]}" "$i" ) - ;; - esac - done - $bitcoin_cli "${rpcargs[@]}" "$@" -} - -# Add wallet accounts to COMPREPLY -_bitcoin_accounts() { - local accounts - accounts=$(_bitcoin_rpc listaccounts | awk -F '"' '{ print $2 }') - COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) ) -} - -_bitcoin_cli() { - local cur prev words=() cword - local bitcoin_cli - - # save and use original argument to invoke bitcoin-cli for -help, help and RPC - # as bitcoin-cli might not be in $PATH - bitcoin_cli="$1" - - COMPREPLY=() - _get_comp_words_by_ref -n = cur prev words cword - - if ((cword > 5)); then - case ${words[cword-5]} in - sendtoaddress) - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) - return 0 - ;; - esac - fi - - if ((cword > 4)); then - case ${words[cword-4]} in - importaddress|listtransactions|setban) - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) - return 0 - ;; - signrawtransaction) - COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) - return 0 - ;; - esac - fi - - if ((cword > 3)); then - case ${words[cword-3]} in - addmultisigaddress) - _bitcoin_accounts - return 0 - ;; - getbalance|gettxout|importaddress|importpubkey|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock) - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) - return 0 - ;; - esac - fi - - if ((cword > 2)); then - case ${words[cword-2]} in - addnode) - COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) - return 0 - ;; - setban) - COMPREPLY=( $( compgen -W "add remove" -- "$cur" ) ) - return 0 - ;; - fundrawtransaction|getblock|getblockheader|getmempoolancestors|getmempooldescendants|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction) - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) - return 0 - ;; - move|setaccount) - _bitcoin_accounts - return 0 - ;; - esac - fi - - case "$prev" in - backupwallet|dumpwallet|importwallet) - _filedir - return 0 - ;; - getaddednodeinfo|getrawmempool|lockunspent|setgenerate) - COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) - return 0 - ;; - getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany) - _bitcoin_accounts - return 0 - ;; - esac - - case "$cur" in - -conf=*) - cur="${cur#*=}" - _filedir - return 0 - ;; - -datadir=*) - cur="${cur#*=}" - _filedir -d - return 0 - ;; - -*=*) # prevent nonsense completions - return 0 - ;; - *) - local helpopts commands - - # only parse -help if senseful - if [[ -z "$cur" || "$cur" =~ ^- ]]; then - helpopts=$($bitcoin_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) - fi - - # only parse help if senseful - if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then - commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') - fi - - COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) - - # Prevent space if an argument is desired - if [[ $COMPREPLY == *= ]]; then - compopt -o nospace - fi - return 0 - ;; - esac -} && -complete -F _bitcoin_cli bitcoin-cli - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/bitcoin-tx.bash-completion b/contrib/bitcoin-tx.bash-completion deleted file mode 100644 index a83d2979e..000000000 --- a/contrib/bitcoin-tx.bash-completion +++ /dev/null @@ -1,57 +0,0 @@ -# bash programmable completion for bitcoin-tx(1) -# Copyright (c) 2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -_bitcoin_tx() { - local cur prev words=() cword - local bitcoin_tx - - # save and use original argument to invoke bitcoin-tx for -help - # it might not be in $PATH - bitcoin_tx="$1" - - COMPREPLY=() - _get_comp_words_by_ref -n =: cur prev words cword - - case "$cur" in - load=*:*) - cur="${cur#load=*:}" - _filedir - return 0 - ;; - *=*) # prevent attempts to complete other arguments - return 0 - ;; - esac - - if [[ "$cword" == 1 || ( "$prev" != "-create" && "$prev" == -* ) ]]; then - # only options (or an uncompletable hex-string) allowed - # parse bitcoin-tx -help for options - local helpopts - helpopts=$($bitcoin_tx -help | sed -e '/^ -/ p' -e d ) - COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) ) - else - # only commands are allowed - # parse -help for commands - local helpcmds - helpcmds=$($bitcoin_tx -help | sed -e '1,/Commands:/d' -e 's/=.*/=/' -e '/^ [a-z]/ p' -e d ) - COMPREPLY=( $( compgen -W "$helpcmds" -- "$cur" ) ) - fi - - # Prevent space if an argument is desired - if [[ $COMPREPLY == *= ]]; then - compopt -o nospace - fi - - return 0 -} && -complete -F _bitcoin_tx bitcoin-tx - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion index cccd4bde0..1338d2f2b 100644 --- a/contrib/bitcoind.bash-completion +++ b/contrib/bitcoind.bash-completion @@ -1,21 +1,102 @@ -# bash programmable completion for bitcoind(1) and bitcoin-qt(1) -# Copyright (c) 2012-2016 The Bitcoin Core developers +# bash programmable completion for bitcoind(1) and bitcoin-cli(1) +# Copyright (c) 2012,2014 Christian von Roques # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. +have bitcoind && { + +# call $bitcoind for RPC +_bitcoin_rpc() { + # determine already specified args necessary for RPC + local rpcargs=() + for i in ${COMP_LINE}; do + case "$i" in + -conf=*|-proxy*|-rpc*) + rpcargs=( "${rpcargs[@]}" "$i" ) + ;; + esac + done + $bitcoind "${rpcargs[@]}" "$@" +} + +# Add bitcoin accounts to COMPREPLY +_bitcoin_accounts() { + local accounts + accounts=$(_bitcoin_rpc listaccounts | awk '/".*"/ { a=$1; gsub(/"/, "", a); print a}') + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) ) +} + _bitcoind() { local cur prev words=() cword local bitcoind - # save and use original argument to invoke bitcoind for -help - # it might not be in $PATH + # save and use original argument to invoke bitcoind + # bitcoind might not be in $PATH bitcoind="$1" COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword + if ((cword > 4)); then + case ${words[cword-4]} in + listtransactions) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + signrawtransaction) + COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) + return 0 + ;; + esac + fi + + if ((cword > 3)); then + case ${words[cword-3]} in + addmultisigaddress) + _bitcoin_accounts + return 0 + ;; + getbalance|gettxout|importaddress|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + esac + fi + + if ((cword > 2)); then + case ${words[cword-2]} in + addnode) + COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) + return 0 + ;; + getblock|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + move|setaccount) + _bitcoin_accounts + return 0 + ;; + esac + fi + + case "$prev" in + backupwallet|dumpwallet|importwallet) + _filedir + return 0 + ;; + getmempool|lockunspent|setgenerate) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany) + _bitcoin_accounts + return 0 + ;; + esac + case "$cur" in - -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*) + -conf=*|-pid=*|-loadblock=*|-wallet=*) cur="${cur#*=}" _filedir return 0 @@ -29,14 +110,20 @@ _bitcoind() { return 0 ;; *) + local helpopts commands - # only parse -help if sensible + # only parse --help if senseful if [[ -z "$cur" || "$cur" =~ ^- ]]; then - local helpopts - helpopts=$($bitcoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) - COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) ) + helpopts=$($bitcoind --help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) fi + # only parse help if senseful + if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then + commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') + fi + + COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) + # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace @@ -44,8 +131,10 @@ _bitcoind() { return 0 ;; esac -} && -complete -F _bitcoind bitcoind bitcoin-qt +} + +complete -F _bitcoind bitcoind bitcoin-cli +} # Local variables: # mode: shell-script diff --git a/contrib/cmake/CMakeLists.txt b/contrib/cmake/CMakeLists.txt deleted file mode 100644 index e1e1e96c2..000000000 --- a/contrib/cmake/CMakeLists.txt +++ /dev/null @@ -1,185 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -project(lbrycrd) -set(CMAKE_CXX_STANDARD 11) - -include(cmake/CPM.cmake) -include(ExternalProject) - -set(OPTIONS "" CACHE STRING "lbrycrdd configure options") -set(CPPFLAGS "" CACHE STRING "lbrycrdd compiler options") -set(LDFLAGS "" CACHE STRING "lbrycrdd linker options") -set(DISABLE_TESTS OFF CACHE BOOL "compilation without tests") -set(DISABLE_WALLET OFF CACHE BOOL "compilation without wallet support") -set(DISABLE_BENCH OFF CACHE BOOL "compilation without bench support") - -if(NOT ${CPM_USE_LOCAL_PACKAGES}) - set(OPTIONS "${OPTIONS} --enable-static --disable-shared") -else() - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") -endif() - -set(OPTIONS "--without-gui ${OPTIONS} --with-pic") - -if (${DISABLE_TESTS}) - set(OPTIONS "${OPTIONS} --disable-tests") -endif() - -if (${DISABLE_WALLET}) - set(OPTIONS "${OPTIONS} --disable-wallet") -endif() - -if (${DISABLE_BENCH}) - set(OPTIONS "${OPTIONS} --disable-bench") -endif() - -string(TOLOWER ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR} ARCH) - -CPMAddPackage( - NAME OpenSSL - GITHUB_REPOSITORY openssl/openssl - VERSION 1.0.2 - GIT_TAG OpenSSL_1_0_2r - DOWNLOAD_ONLY TRUE -) - -if(OpenSSL_ADDED) - ExternalProject_Add(OpenSSL - PREFIX openssl - SOURCE_DIR ${OpenSSL_SOURCE_DIR} - CONFIGURE_COMMAND ${OpenSSL_SOURCE_DIR}/Configure ${ARCH} no-shared no-dso no-engines -fPIC --prefix= - BUILD_IN_SOURCE 1 - ) - set(DEPENDS ${DEPENDS} OpenSSL) - ExternalProject_Get_Property(OpenSSL INSTALL_DIR) - set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib") - set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include") - set(OPENSSL_CPPFLAGS "CPPFLAGS=-I${INSTALL_DIR}/include") - set(OPENSSL_LDFLAGS "LDFLAGS=-L${INSTALL_DIR}/lib") -endif(OpenSSL_ADDED) - -CPMAddPackage( - NAME Libevent - GITHUB_REPOSITORY libevent/libevent - VERSION 2.1.8 - GIT_TAG release-2.1.8-stable - DOWNLOAD_ONLY TRUE -) - -if(Libevent_ADDED) - ExternalProject_Add(Libevent - PREFIX libevent - DEPENDS ${DEPENDS} - SOURCE_DIR ${Libevent_SOURCE_DIR} - CONFIGURE_COMMAND ${Libevent_SOURCE_DIR}/autogen.sh - && ${Libevent_SOURCE_DIR}/configure ${OPENSSL_CPPFLAGS} --enable-cxx --disable-shared --with-pic ${OPENSSL_LDFLAGS} --prefix= - BUILD_IN_SOURCE 1 - ) - set(DEPENDS ${DEPENDS} Libevent) - ExternalProject_Get_Property(Libevent INSTALL_DIR) - set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib") - set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include") -endif(Libevent_ADDED) - -if(NOT ${DISABLE_WALLET}) - CPMAddPackage( - NAME BerkeleyDB - VERSION 4.8.30 - URL https://download.oracle.com/berkeley-db/db-4.8.30.NC.zip - URL_HASH SHA256=43ecd76886992ea416fdadc54b7f2b83ef249d9a6964bd07708ccae42d0226ce - DOWNLOAD_ONLY TRUE - ) - - if(NOT ${BerkeleyDB_VERSION} VERSION_LESS "5.0") - set(OPTIONS "${OPTIONS} --with-incompatible-bdb") - endif() - - if(BerkeleyDB_ADDED) - ExternalProject_Add(BerkeleyDB - PREFIX bdb - SOURCE_DIR ${BerkeleyDB_SOURCE_DIR} - PATCH_COMMAND sed -i "s/__atomic_compare_exchange/__atomic_compare_exchange_db/" ${BerkeleyDB_SOURCE_DIR}/dbinc/atomic.h - CONFIGURE_COMMAND ${BerkeleyDB_SOURCE_DIR}/dist/configure --enable-cxx --disable-shared --with-pic --prefix= - ) - set(DEPENDS ${DEPENDS} BerkeleyDB) - ExternalProject_Get_Property(BerkeleyDB INSTALL_DIR) - set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib") - set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include") - endif(BerkeleyDB_ADDED) -endif() - -set(BOOST_LIBS chrono,filesystem,system,locale,thread) - -string(REPLACE "," ";" BOOST_COMPONENTS ${BOOST_LIBS}) - -if(NOT ${DISABLE_TESTS}) - set(BOOST_LIBS ${BOOST_LIBS},test) - set(BOOST_COMPONENTS ${BOOST_COMPONENTS};unit_test_framework) -endif() - -CPMAddPackage( - NAME Boost - GITHUB_REPOSITORY boostorg/boost - VERSION 1.64.0 - COMPONENTS ${BOOST_COMPONENTS} - GIT_TAG boost-1.69.0 - GIT_SUBMODULES libs/* tools/* - DOWNLOAD_ONLY TRUE -) - -# if boost is found system wide we expect to be compiled against icu, so we can skip it -if(Boost_ADDED) - - CPMAddPackage( - NAME ICU - GITHUB_REPOSITORY unicode-org/icu - VERSION 63.2 - GIT_TAG release-63-2 - DOWNLOAD_ONLY TRUE - ) - - if(ICU_ADDED) - ExternalProject_Add(ICU - PREFIX icu - SOURCE_DIR ${ICU_SOURCE_DIR} - CONFIGURE_COMMAND ${ICU_SOURCE_DIR}/icu4c/source/configure --disable-extras --disable-strict --enable-static - --disable-shared --disable-tests --disable-samples --disable-dyload --disable-layoutex CFLAGS=-fPIC CPPFLAGS=-fPIC --prefix= - ) - set(DEPENDS ${DEPENDS} ICU) - ExternalProject_Get_Property(ICU INSTALL_DIR) - set(ICU_PATH ${INSTALL_DIR}) - set(OPTIONS "${OPTIONS} --with-icu=${ICU_PATH}") - set(LDFLAGS "${LDFLAGS} -L${ICU_PATH}/lib") - set(CPPFLAGS "${CPPFLAGS} -I${ICU_PATH}/include") - endif(ICU_ADDED) - - ExternalProject_Add(Boost - PREFIX boost - DEPENDS ${DEPENDS} - SOURCE_DIR ${Boost_SOURCE_DIR} - CONFIGURE_COMMAND ${Boost_SOURCE_DIR}/bootstrap.sh --with-icu=${ICU_PATH} --with-libraries=${BOOST_LIBS} && ${Boost_SOURCE_DIR}/b2 headers - BUILD_COMMAND ${Boost_SOURCE_DIR}/b2 install threading=multi -sNO_BZIP2=1 -sNO_ZLIB=1 link=static linkflags="-L${ICU_PATH}/lib -licuio -licuuc -licudata -licui18n" cxxflags=-fPIC boost.locale.iconv=off boost.locale.posix=off boost.locale.icu=on boost.locale.std=off -sICU_PATH=${ICU_PATH} --prefix= - INSTALL_COMMAND "" - BUILD_IN_SOURCE 1 - ) - set(DEPENDS ${DEPENDS} Boost) - ExternalProject_Get_Property(Boost INSTALL_DIR) - set(OPTIONS "${OPTIONS} --with-boost=${INSTALL_DIR}") - set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib") - set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include") - set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${Boost_SOURCE_DIR}/bin.v2) -endif(Boost_ADDED) - -set(CPPFLAGS "${CPPFLAGS} -Wno-parentheses -Wno-unused-local-typedefs -Wno-deprecated -Wno-implicit-fallthrough -Wno-unused-parameter") - -separate_arguments(OPTIONS) - -ExternalProject_Add(lbrycrdd - PREFIX lbrycrdd - DEPENDS ${DEPENDS} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../.. - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../../autogen.sh - && ${CMAKE_CURRENT_SOURCE_DIR}/../../configure ${OPTIONS} CPPFLAGS=${CPPFLAGS} LDFLAGS=${LDFLAGS} --prefix= - BUILD_IN_SOURCE 1 - BUILD_ALWAYS 1 -) diff --git a/contrib/cmake/cmake/CPM.cmake b/contrib/cmake/cmake/CPM.cmake deleted file mode 100644 index a54b6fe79..000000000 --- a/contrib/cmake/cmake/CPM.cmake +++ /dev/null @@ -1,210 +0,0 @@ -# TheLartians/CPM - A simple Git dependency manager -# ================================================= -# See https://github.com/TheLartians/CPM for usage and update instructions. -# -# MIT License -# ----------- -#[[ - Copyright (c) 2019 Lars Melchior - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -]] - -cmake_minimum_required(VERSION 3.10 FATAL_ERROR) - -set(CURRENT_CPM_VERSION 0.11.1) - -if(CPM_DIRECTORY) - if(NOT ${CPM_DIRECTORY} MATCHES ${CMAKE_CURRENT_LIST_DIR}) - if (${CPM_VERSION} VERSION_LESS ${CURRENT_CPM_VERSION}) - CPM_HANDLE_OLD_VERSION(${CURRENT_CPM_VERSION}) - endif() - return() - endif() -endif() - -set(CPM_VERSION ${CURRENT_CPM_VERSION} CACHE INTERNAL "") -set(CPM_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "") -set(CPM_PACKAGES "" CACHE INTERNAL "") - -option(CPM_USE_LOCAL_PACKAGES "Use locally installed packages (find_package)" ON) -option(CPM_LOCAL_PACKAGES_ONLY "Use only locally installed packages" OFF) - -include(FetchContent) -include(CMakeParseArguments) - -# Initialize logging prefix -if(NOT CPM_INDENT) - set(CPM_INDENT "CPM:") -endif() - -# The main workhorse of CPM -function(CPMAddPackage) - - set(oneValueArgs - NAME - VERSION - GIT_TAG - DOWNLOAD_ONLY - GITHUB_REPOSITORY - GITLAB_REPOSITORY - ) - - set(multiValueArgs - OPTIONS - COMPONENTS - ) - - cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(${CPM_USE_LOCAL_PACKAGES} OR ${CPM_LOCAL_PACKAGES_ONLY}) - find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION} OPTIONAL_COMPONENTS ${CPM_ARGS_COMPONENTS} QUIET) - - if(${CPM_ARGS_NAME}_FOUND) - message(STATUS "CPM: adding local package ${CPM_ARGS_NAME}@${${CPM_ARGS_NAME}_VERSION}") - set(${CPM_ARGS_NAME}_VERSION "${${CPM_ARGS_NAME}_VERSION}" PARENT_SCOPE) - return() - endif() - - if(${CPM_LOCAL_PACKAGES_ONLY}) - message(SEND_ERROR "CPM: ${CPM_ARGS_NAME} not found via find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION})") - endif() - endif() - - if (NOT CPM_ARGS_VERSION) - set(CPM_ARGS_VERSION 0) - endif() - - if (NOT CPM_ARGS_GIT_TAG) - set(CPM_ARGS_GIT_TAG v${CPM_ARGS_VERSION}) - endif() - - list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_TAG ${CPM_ARGS_GIT_TAG}) - - if(CPM_ARGS_DOWNLOAD_ONLY) - set(DOWNLOAD_ONLY ${CPM_ARGS_DOWNLOAD_ONLY}) - else() - set(DOWNLOAD_ONLY NO) - endif() - - if (CPM_ARGS_GITHUB_REPOSITORY) - list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_REPOSITORY "https://github.com/${CPM_ARGS_GITHUB_REPOSITORY}.git") - endif() - - if (CPM_ARGS_GITLAB_REPOSITORY) - list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_REPOSITORY "https://gitlab.com/${CPM_ARGS_GITLAB_REPOSITORY}.git") - endif() - - if (${CPM_ARGS_NAME} IN_LIST CPM_PACKAGES) - CPM_GET_PACKAGE_VERSION(${CPM_ARGS_NAME}) - if(${CPM_PACKAGE_VERSION} VERSION_LESS ${CPM_ARGS_VERSION}) - message(WARNING "${CPM_INDENT} requires a newer version of ${CPM_ARGS_NAME} (${CPM_ARGS_VERSION}) than currently included (${CPM_PACKAGE_VERSION}).") - endif() - if (CPM_ARGS_OPTIONS) - foreach(OPTION ${CPM_ARGS_OPTIONS}) - CPM_PARSE_OPTION(${OPTION}) - if(NOT "${${OPTION_KEY}}" STREQUAL ${OPTION_VALUE}) - message(WARNING "${CPM_INDENT} ignoring package option for ${CPM_ARGS_NAME}: ${OPTION_KEY} = ${OPTION_VALUE} (${${OPTION_KEY}})") - endif() - endforeach() - endif() - CPM_FETCH_PACKAGE(${CPM_ARGS_NAME} ${DOWNLOAD_ONLY}) - CPMGetProperties(${CPM_ARGS_NAME}) - set(${CPM_ARGS_NAME}_VERSION ${CPM_ARGS_VERSION} PARENT_SCOPE) - set(${CPM_ARGS_NAME}_SOURCE_DIR "${${CPM_ARGS_NAME}_SOURCE_DIR}" PARENT_SCOPE) - set(${CPM_ARGS_NAME}_BINARY_DIR "${${CPM_ARGS_NAME}_BINARY_DIR}" PARENT_SCOPE) - set(${CPM_ARGS_NAME}_ADDED NO PARENT_SCOPE) - return() - endif() - - CPMRegisterPackage(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION}) - - if (CPM_ARGS_OPTIONS) - foreach(OPTION ${CPM_ARGS_OPTIONS}) - CPM_PARSE_OPTION(${OPTION}) - set(${OPTION_KEY} ${OPTION_VALUE} CACHE INTERNAL "") - endforeach() - endif() - - CPM_DECLARE_PACKAGE(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION} ${CPM_ARGS_GIT_TAG} "${CPM_ARGS_UNPARSED_ARGUMENTS}") - CPM_FETCH_PACKAGE(${CPM_ARGS_NAME} ${DOWNLOAD_ONLY}) - CPMGetProperties(${CPM_ARGS_NAME}) - set(${CPM_ARGS_NAME}_VERSION ${CPM_ARGS_VERSION} PARENT_SCOPE) - set(${CPM_ARGS_NAME}_SOURCE_DIR "${${CPM_ARGS_NAME}_SOURCE_DIR}" PARENT_SCOPE) - set(${CPM_ARGS_NAME}_BINARY_DIR "${${CPM_ARGS_NAME}_BINARY_DIR}" PARENT_SCOPE) - set(${CPM_ARGS_NAME}_ADDED YES PARENT_SCOPE) -endfunction() - -function (CPM_DECLARE_PACKAGE PACKAGE VERSION GIT_TAG) - message(STATUS "${CPM_INDENT} adding package ${PACKAGE}@${VERSION} (${GIT_TAG})") - - FetchContent_Declare( - ${PACKAGE} - ${ARGN} - ) -endfunction() - -function (CPM_FETCH_PACKAGE PACKAGE DOWNLOAD_ONLY) - set(CPM_OLD_INDENT "${CPM_INDENT}") - set(CPM_INDENT "${CPM_INDENT} ${PACKAGE}:") - if(${DOWNLOAD_ONLY}) - if(NOT "${PACKAGE}_POPULATED") - FetchContent_Populate(${PACKAGE}) - endif() - else() - FetchContent_MakeAvailable(${PACKAGE}) - endif() - set(CPM_INDENT "${CPM_OLD_INDENT}") -endfunction() - -function (CPMGetProperties PACKAGE) - FetchContent_GetProperties(${PACKAGE}) - string(TOLOWER ${PACKAGE} lpackage) - set(${PACKAGE}_SOURCE_DIR "${${lpackage}_SOURCE_DIR}" PARENT_SCOPE) - set(${PACKAGE}_BINARY_DIR "${${lpackage}_BINARY_DIR}" PARENT_SCOPE) -endfunction() - -function(CPMRegisterPackage PACKAGE VERSION) - list(APPEND CPM_PACKAGES ${PACKAGE}) - set(CPM_PACKAGES ${CPM_PACKAGES} CACHE INTERNAL "") - set("CPM_PACKAGE_${PACKAGE}_VERSION" ${VERSION} CACHE INTERNAL "") -endfunction() - -function(CPM_GET_PACKAGE_VERSION PACKAGE) - set(CPM_PACKAGE_VERSION "${CPM_PACKAGE_${PACKAGE}_VERSION}" PARENT_SCOPE) -endfunction() - -function(CPM_PARSE_OPTION OPTION) - string(REGEX MATCH "^[^ ]+" OPTION_KEY ${OPTION}) - string(LENGTH ${OPTION_KEY} OPTION_KEY_LENGTH) - math(EXPR OPTION_KEY_LENGTH "${OPTION_KEY_LENGTH}+1") - string(SUBSTRING ${OPTION} "${OPTION_KEY_LENGTH}" "-1" OPTION_VALUE) - set(OPTION_KEY "${OPTION_KEY}" PARENT_SCOPE) - set(OPTION_VALUE "${OPTION_VALUE}" PARENT_SCOPE) -endfunction() - -function (CPM_HANDLE_OLD_VERSION NEW_CPM_VERSION) - - message(AUTHOR_WARNING "${CPM_INDENT} \ -A dependency is using a more recent CPM (${NEW_CPM_VERSION}) than the current project (${CPM_VERSION}). \ -It is recommended to upgrade CPM to the most recent version. \ -See https://github.com/TheLartians/CPM for more information." - ) - -endfunction() diff --git a/contrib/cmake/cmake/FindBerkeleyDB.cmake b/contrib/cmake/cmake/FindBerkeleyDB.cmake deleted file mode 100644 index a583b0fa3..000000000 --- a/contrib/cmake/cmake/FindBerkeleyDB.cmake +++ /dev/null @@ -1,171 +0,0 @@ -# Author: sum01 -# Git: https://github.com/sum01/FindBerkeleyDB -# Read the README.md for the full info. - -# NOTE: If Berkeley DB ever gets a Pkg-config ".pc" file, add pkg_check_modules() here - -# Checks if environment paths are empty, set them if they aren't -if(NOT "$ENV{BERKELEYDB_ROOT}" STREQUAL "") - set(_BERKELEYDB_HINTS "$ENV{BERKELEYDB_ROOT}") -elseif(NOT "$ENV{Berkeleydb_ROOT}" STREQUAL "") - set(_BERKELEYDB_HINTS "$ENV{Berkeleydb_ROOT}") -elseif(NOT "$ENV{BERKELEYDBROOT}" STREQUAL "") - set(_BERKELEYDB_HINTS "$ENV{BERKELEYDBROOT}") -else() - # Set just in case, as it's used regardless if it's empty or not - set(_BERKELEYDB_HINTS "") -endif() - -# Allow user to pass a path instead of guessing -if(BerkeleyDB_ROOT_DIR) - set(_BERKELEYDB_PATHS "${BerkeleyDB_ROOT_DIR}") -elseif(CMAKE_SYSTEM_NAME MATCHES ".*[wW]indows.*") - # MATCHES is used to work on any devies with windows in the name - # Shameless copy-paste from FindOpenSSL.cmake v3.8 - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) - list(APPEND _BERKELEYDB_HINTS "${_programfiles}") - - # There's actually production release and version numbers in the file path. - # For example, if they're on v6.2.32: C:/Program Files/Oracle/Berkeley DB 12cR1 6.2.32/ - # But this still works to find it, so I'm guessing it can accept partial path matches. - - foreach(_TARGET_BERKELEYDB_PATH "Oracle/Berkeley DB" "Berkeley DB") - list(APPEND _BERKELEYDB_PATHS - "${_programfiles}/${_TARGET_BERKELEYDB_PATH}" - "C:/Program Files (x86)/${_TARGET_BERKELEYDB_PATH}" - "C:/Program Files/${_TARGET_BERKELEYDB_PATH}" - "C:/${_TARGET_BERKELEYDB_PATH}" - ) - endforeach() -else() - # Paths for anything other than Windows - # Cellar/berkeley-db is for macOS from homebrew installation - list(APPEND _BERKELEYDB_PATHS - "/usr" - "/usr/local" - "/usr/local/Cellar/berkeley-db" - "/opt" - "/opt/local" - ) -endif() - -# Find includes path -find_path(BerkeleyDB_INCLUDE_DIRS - NAMES "db.h" - HINTS ${_BERKELEYDB_HINTS} - PATH_SUFFIXES "include" "includes" - PATHS ${_BERKELEYDB_PATHS} -) - -# Checks if the version file exists, save the version file to a var, and fail if there's no version file -if(BerkeleyDB_INCLUDE_DIRS) - # Read the version file db.h into a variable - file(READ "${BerkeleyDB_INCLUDE_DIRS}/db.h" _BERKELEYDB_DB_HEADER) - # Parse the DB version into variables to be used in the lib names - string(REGEX REPLACE ".*DB_VERSION_MAJOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MAJOR "${_BERKELEYDB_DB_HEADER}") - string(REGEX REPLACE ".*DB_VERSION_MINOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MINOR "${_BERKELEYDB_DB_HEADER}") - # Patch version example on non-crypto installs: x.x.xNC - string(REGEX REPLACE ".*DB_VERSION_PATCH ([0-9]+(NC)?).*" "\\1" BerkeleyDB_VERSION_PATCH "${_BERKELEYDB_DB_HEADER}") -else() - if(BerkeleyDB_FIND_REQUIRED) - # If the find_package(BerkeleyDB REQUIRED) was used, fail since we couldn't find the header - message(FATAL_ERROR "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.") - elseif(NOT BerkeleyDB_FIND_QUIETLY) - message(WARNING "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.") - endif() - # Set some garbage values to the versions since we didn't find a file to read - set(BerkeleyDB_VERSION_MAJOR "0") - set(BerkeleyDB_VERSION_MINOR "0") - set(BerkeleyDB_VERSION_PATCH "0") -endif() - -# The actual returned/output version variable (the others can be used if needed) -set(BerkeleyDB_VERSION "${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}.${BerkeleyDB_VERSION_PATCH}") - -# Finds the target library for berkeley db, since they all follow the same naming conventions -macro(_berkeleydb_get_lib _BERKELEYDB_OUTPUT_VARNAME _TARGET_BERKELEYDB_LIB) - # Different systems sometimes have a version in the lib name... - # and some have a dash or underscore before the versions. - # CMake recommends to put unversioned names before versioned names - find_library(${_BERKELEYDB_OUTPUT_VARNAME} - NAMES - "${_TARGET_BERKELEYDB_LIB}" - "lib${_TARGET_BERKELEYDB_LIB}" - "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}" - "lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}" - "lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}" - "lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}" - HINTS ${_BERKELEYDB_HINTS} - PATH_SUFFIXES - "lib" - "lib64" - "libs" - "libs64" - PATHS ${_BERKELEYDB_PATHS} - ) - # If the library was found, add it to our list of libraries - if(${_BERKELEYDB_OUTPUT_VARNAME}) - # If found, append to our libraries variable - # The ${{}} is because the first expands to target the real variable, the second expands the variable's contents... - # and the real variable's contents is the path to the lib. Thus, it appends the path of the lib to BerkeleyDB_LIBRARIES. - list(APPEND BerkeleyDB_LIBRARIES "${${_BERKELEYDB_OUTPUT_VARNAME}}") - endif() -endmacro() - -# Find and set the paths of the specific library to the variable -_berkeleydb_get_lib(BerkeleyDB_LIBRARY "db") -# NOTE: Windows doesn't have a db_cxx lib, but instead compiles the cxx code into the "db" lib -_berkeleydb_get_lib(BerkeleyDB_Cxx_LIBRARY "db_cxx") -# NOTE: I don't think Linux/Unix gets an SQL lib -_berkeleydb_get_lib(BerkeleyDB_Sql_LIBRARY "db_sql") -_berkeleydb_get_lib(BerkeleyDB_Stl_LIBRARY "db_stl") - -# Needed for find_package_handle_standard_args() -include(FindPackageHandleStandardArgs) -# Fails if required vars aren't found, or if the version doesn't meet specifications. -find_package_handle_standard_args(BerkeleyDB - FOUND_VAR BerkeleyDB_FOUND - REQUIRED_VARS - BerkeleyDB_INCLUDE_DIRS - BerkeleyDB_LIBRARY - BerkeleyDB_LIBRARIES - VERSION_VAR BerkeleyDB_VERSION -) - -# Only show the variables in the GUI if they click "advanced". -# Does nothing when using the CLI -mark_as_advanced(FORCE - BerkeleyDB_FOUND - BerkeleyDB_INCLUDE_DIRS - BerkeleyDB_LIBRARIES - BerkeleyDB_VERSION - BerkeleyDB_VERSION_MAJOR - BerkeleyDB_VERSION_MINOR - BerkeleyDB_VERSION_PATCH - BerkeleyDB_LIBRARY - BerkeleyDB_Cxx_LIBRARY - BerkeleyDB_Stl_LIBRARY - BerkeleyDB_Sql_LIBRARY -) - -# Create an imported lib for easy linking by external projects -if(BerkeleyDB_FOUND AND BerkeleyDB_LIBRARIES AND NOT TARGET Oracle::BerkeleyDB) - add_library(Oracle::BerkeleyDB UNKNOWN IMPORTED) - set_target_properties(Oracle::BerkeleyDB PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${BerkeleyDB_INCLUDE_DIRS}" - IMPORTED_LOCATION "${BerkeleyDB_LIBRARY}" - INTERFACE_LINK_LIBRARIES "${BerkeleyDB_LIBRARIES}" - ) -endif() - -include(FindPackageMessage) -# A message that tells the user what includes/libs were found, and obeys the QUIET command. -find_package_message(BerkeleyDB - "Found BerkeleyDB libraries: ${BerkeleyDB_LIBRARIES}" - "[${BerkeleyDB_LIBRARIES}[${BerkeleyDB_INCLUDE_DIRS}]]" -) diff --git a/contrib/cmake/cmake/FindLibevent.cmake b/contrib/cmake/cmake/FindLibevent.cmake deleted file mode 100644 index e8a3cef22..000000000 --- a/contrib/cmake/cmake/FindLibevent.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# - Try to find libevent -#.rst -# FindLibevent -# ------------ -# -# Find Libevent include directories and libraries. Invoke as:: -# -# find_package(Libevent -# [version] [EXACT] # Minimum or exact version -# [REQUIRED] # Fail if Libevent is not found -# [COMPONENT ...]) # Libraries to look for -# -# Valid components are one or more of:: libevent core extra pthreads openssl. -# Note that 'libevent' contains both core and extra. You must specify one of -# them for the other components. -# -# This module will define the following variables:: -# -# LIBEVENT_FOUND - True if headers and requested libraries were found -# LIBEVENT_INCLUDE_DIRS - Libevent include directories -# LIBEVENT_LIBRARIES - Libevent libraries to be linked -# LIBEVENT__FOUND - Component was found ( is uppercase) -# LIBEVENT__LIBRARY - Library to be linked for Libevent component . - -find_package(PkgConfig QUIET) -pkg_check_modules(PC_LIBEVENT QUIET libevent) - -# Look for the Libevent 2.0 or 1.4 headers -find_path(LIBEVENT_INCLUDE_DIR - NAMES - event2/event-config.h - event-config.h - HINTS - ${PC_LIBEVENT_INCLUDE_DIRS} -) - -if(LIBEVENT_INCLUDE_DIR) - set(_version_regex "^#define[ \t]+_EVENT_VERSION[ \t]+\"([^\"]+)\".*") - if(EXISTS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h") - # Libevent 2.0 - file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h" - LIBEVENT_VERSION REGEX "${_version_regex}") - if("${LIBEVENT_VERSION}" STREQUAL "") - set(LIBEVENT_VERSION ${PC_LIBEVENT_VERSION}) - endif() - else() - # Libevent 1.4 - file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event-config.h" - LIBEVENT_VERSION REGEX "${_version_regex}") - endif() - string(REGEX REPLACE "${_version_regex}" "\\1" - LIBEVENT_VERSION "${LIBEVENT_VERSION}") - unset(_version_regex) -endif() - -set(_LIBEVENT_REQUIRED_VARS) -foreach(COMPONENT ${Libevent_FIND_COMPONENTS}) - set(_LIBEVENT_LIBNAME libevent) - # Note: compare two variables to avoid a CMP0054 policy warning - if(COMPONENT STREQUAL _LIBEVENT_LIBNAME) - set(_LIBEVENT_LIBNAME event) - else() - set(_LIBEVENT_LIBNAME "event_${COMPONENT}") - endif() - string(TOUPPER "${COMPONENT}" COMPONENT_UPPER) - find_library(LIBEVENT_${COMPONENT_UPPER}_LIBRARY - NAMES ${_LIBEVENT_LIBNAME} - HINTS ${PC_LIBEVENT_LIBRARY_DIRS} - ) - if(LIBEVENT_${COMPONENT_UPPER}_LIBRARY) - set(Libevent_${COMPONENT}_FOUND 1) - endif() - list(APPEND _LIBEVENT_REQUIRED_VARS LIBEVENT_${COMPONENT_UPPER}_LIBRARY) -endforeach() -unset(_LIBEVENT_LIBNAME) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LIBEVENT_FOUND to TRUE -# if all listed variables are TRUE and the requested version matches. -find_package_handle_standard_args(Libevent REQUIRED_VARS - ${_LIBEVENT_REQUIRED_VARS} - LIBEVENT_INCLUDE_DIR - VERSION_VAR LIBEVENT_VERSION - HANDLE_COMPONENTS) - -if(LIBEVENT_FOUND) - set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR}) - set(LIBEVENT_LIBRARIES) - foreach(COMPONENT ${Libevent_FIND_COMPONENTS}) - string(TOUPPER "${COMPONENT}" COMPONENT_UPPER) - list(APPEND LIBEVENT_LIBRARIES ${LIBEVENT_${COMPONENT_UPPER}_LIBRARY}) - set(LIBEVENT_${COMPONENT_UPPER}_FOUND ${Libevent_${COMPONENT}_FOUND}) - endforeach() -endif() - -mark_as_advanced(LIBEVENT_INCLUDE_DIR ${_LIBEVENT_REQUIRED_VARS}) -unset(_LIBEVENT_REQUIRED_VARS) diff --git a/contrib/debian/README.md b/contrib/debian/README.md new file mode 100644 index 000000000..fab9cc238 --- /dev/null +++ b/contrib/debian/README.md @@ -0,0 +1,21 @@ + +Debian +==================== +This directory contains files used to package bitcoind/bitcoin-qt +for Debian-based Linux systems. If you compile bitcoind/bitcoin-qt yourself, there are some useful files here. + +## bitcoin: URI support ## + + +bitcoin-qt.desktop (Gnome / Open Desktop) +To install: + + sudo desktop-file-install bitcoin-qt.desktop + sudo update-desktop-database + +If you build yourself, you will either need to modify the paths in +the .desktop file or copy or symlink your bitcoin-qt binary to `/usr/bin` +and the `../../share/pixmaps/bitcoin128.png` to `/usr/share/pixmaps` + +bitcoin-qt.protocol (KDE) + diff --git a/contrib/debian/bitcoin-qt.desktop b/contrib/debian/bitcoin-qt.desktop new file mode 100644 index 000000000..61e1aca6a --- /dev/null +++ b/contrib/debian/bitcoin-qt.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Bitcoin +Comment=Bitcoin P2P Cryptocurrency +Comment[fr]=Bitcoin, monnaie virtuelle cryptographique pair à pair +Comment[tr]=Bitcoin, eşten eşe kriptografik sanal para birimi +Exec=bitcoin-qt %u +Terminal=false +Type=Application +Icon=bitcoin128 +MimeType=x-scheme-handler/bitcoin; +Categories=Office;Finance; diff --git a/contrib/debian/bitcoin-qt.install b/contrib/debian/bitcoin-qt.install new file mode 100644 index 000000000..e0b32373b --- /dev/null +++ b/contrib/debian/bitcoin-qt.install @@ -0,0 +1,6 @@ +usr/local/bin/bitcoin-qt usr/bin +share/pixmaps/bitcoin32.xpm usr/share/pixmaps +share/pixmaps/bitcoin16.xpm usr/share/pixmaps +share/pixmaps/bitcoin128.png usr/share/pixmaps +debian/bitcoin-qt.desktop usr/share/applications +debian/bitcoin-qt.protocol usr/share/kde4/services/ diff --git a/contrib/debian/bitcoin-qt.lintian-overrides b/contrib/debian/bitcoin-qt.lintian-overrides new file mode 100644 index 000000000..7fb230eca --- /dev/null +++ b/contrib/debian/bitcoin-qt.lintian-overrides @@ -0,0 +1,2 @@ +# Linked code is Expat - only Debian packaging is GPL-2+ +bitcoin-qt: possible-gpl-code-linked-with-openssl diff --git a/contrib/debian/bitcoin-qt.protocol b/contrib/debian/bitcoin-qt.protocol new file mode 100644 index 000000000..014588d53 --- /dev/null +++ b/contrib/debian/bitcoin-qt.protocol @@ -0,0 +1,11 @@ +[Protocol] +exec=bitcoin-qt '%u' +protocol=bitcoin +input=none +output=none +helper=true +listing= +reading=false +writing=false +makedir=false +deleting=false diff --git a/contrib/debian/bitcoin-tx.install b/contrib/debian/bitcoin-tx.install new file mode 100644 index 000000000..2c21052a6 --- /dev/null +++ b/contrib/debian/bitcoin-tx.install @@ -0,0 +1 @@ +usr/local/bin/bitcoin-tx usr/bin diff --git a/contrib/debian/bitcoind.bash-completion b/contrib/debian/bitcoind.bash-completion new file mode 100644 index 000000000..0f84707b6 --- /dev/null +++ b/contrib/debian/bitcoind.bash-completion @@ -0,0 +1 @@ +contrib/bitcoind.bash-completion bitcoind diff --git a/contrib/debian/bitcoind.examples b/contrib/debian/bitcoind.examples new file mode 100644 index 000000000..4ded67d98 --- /dev/null +++ b/contrib/debian/bitcoind.examples @@ -0,0 +1 @@ +debian/examples/bitcoin.conf diff --git a/contrib/debian/bitcoind.install b/contrib/debian/bitcoind.install new file mode 100644 index 000000000..798ea851f --- /dev/null +++ b/contrib/debian/bitcoind.install @@ -0,0 +1,2 @@ +usr/local/bin/bitcoind usr/bin +usr/local/bin/bitcoin-cli usr/bin diff --git a/contrib/debian/bitcoind.lintian-overrides b/contrib/debian/bitcoind.lintian-overrides new file mode 100644 index 000000000..3f9f140bd --- /dev/null +++ b/contrib/debian/bitcoind.lintian-overrides @@ -0,0 +1,2 @@ +# Linked code is Expat - only Debian packaging is GPL-2+ +bitcoind: possible-gpl-code-linked-with-openssl diff --git a/contrib/debian/bitcoind.manpages b/contrib/debian/bitcoind.manpages new file mode 100644 index 000000000..6d3e68385 --- /dev/null +++ b/contrib/debian/bitcoind.manpages @@ -0,0 +1,3 @@ +debian/manpages/bitcoind.1 +debian/manpages/bitcoin.conf.5 +debian/manpages/bitcoin-cli.1 diff --git a/contrib/debian/changelog b/contrib/debian/changelog new file mode 100644 index 000000000..110bfe03e --- /dev/null +++ b/contrib/debian/changelog @@ -0,0 +1,459 @@ +bitcoin (0.11.0-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo (BlueMatt) Tue, 14 Jul 2015 14:39:00 -1000 + +bitcoin (0.10.2-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo (BlueMatt) Mon, 29 Jun 2015 17:33:00 -1000 + +bitcoin (0.10.1-precise3) precise; urgency=medium + + * Fix build dep (include python). + + -- Matt Corallo (BlueMatt) Tue, 5 May 2015 09:28:00 -1000 + +bitcoin (0.10.1-precise2) precise; urgency=medium + + * Fix miniupnpc dep. + + -- Matt Corallo (BlueMatt) Tue, 5 May 2015 00:33:00 -1000 + +bitcoin (0.10.1-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo (BlueMatt) Tue, 5 May 2015 00:07:00 -1000 + +bitcoin (0.10.0-precise1) precise; urgency=medium + + * New upstream releases. + + -- Matt Corallo (BlueMatt) Wed, 18 Feb 2015 13:22:00 -1000 + +bitcoin (0.9.4-precise1) precise; urgency=high + + * New upstream releases. + + -- Matt Corallo (laptop - only while traveling) Mon, 12 Jan 2015 23:30:00 -1000 + +bitcoin (0.9.3-precise1) precise; urgency=medium + + * New upstream releases. + + -- Matt Corallo (BlueMatt) Fri, 26 Sep 2014 12:01:00 -0700 + +bitcoin (0.9.1-precise1) precise; urgency=medium + + * New upstream release. + * Backport pull #4019 + + -- Matt Corallo Sat, 19 Apr 2014 17:29:00 -0400 + +bitcoin (0.9.0-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo Thu, 20 Mar 2014 13:10:00 -0400 + +bitcoin (0.8.6-precise1) precise; urgency=medium + + * New upstream release. + * Make .desktop paths non-fixed (suggested by prusnak@github) + + -- Matt Corallo Fri, 13 Dec 2013 13:31:00 -0400 + +bitcoin (0.8.5-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo Sun, 15 Sep 2013 14:02:00 -0400 + +bitcoin (0.8.4-precise1) precise; urgency=medium + + * New upstream release. + + -- Matt Corallo Wed, 4 Sep 2013 10:25:00 -0400 + +bitcoin (0.8.3-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Wed, 26 Jun 2013 00:18:00 +0100 + +bitcoin (0.8.2-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Wed, 29 Mar 2013 23:23:00 +0100 + +bitcoin (0.8.1-natty3) natty; urgency=low + + * New pixmaps + + -- Jonas Schnelli Mon, 13 May 2013 16:14:00 +0100 + +bitcoin (0.8.1-natty2) natty; urgency=low + + * Remove dumb broken launcher script + + -- Matt Corallo Sun, 24 Mar 2013 20:01:00 -0400 + +bitcoin (0.8.1-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Tue, 19 Mar 2013 13:03:00 -0400 + +bitcoin (0.8.0-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Sat, 23 Feb 2013 16:01:00 -0500 + +bitcoin (0.7.2-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Sat, 15 Dec 2012 10:59:00 -0400 + +bitcoin (0.7.1-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Wed, 24 Oct 2012 15:06:00 -0400 + +bitcoin (0.7.0-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Mon, 17 Sep 2012 13:45:00 +0200 + +bitcoin (0.6.3-natty1) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Mon, 25 Jun 2012 23:47:00 +0200 + +bitcoin (0.6.2-natty1) natty; urgency=low + + * Update package description and launch scripts. + + -- Matt Corallo Sat, 2 Jun 2012 16:41:00 +0200 + +bitcoin (0.6.2-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Tue, 8 May 2012 16:27:00 -0500 + +bitcoin (0.6.1-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Sun, 6 May 2012 20:09:00 -0500 + +bitcoin (0.6.0-natty0) natty; urgency=low + + * New upstream release. + * Add GNOME/KDE support for bitcoin-qt's bitcoin: URI support. + Thanks to luke-jr for the KDE .protocol file. + + -- Matt Corallo Sat, 31 Mar 2012 15:35:00 -0500 + +bitcoin (0.5.3-natty1) natty; urgency=low + + * Mark for upload to PPA. + + -- Matt Corallo Wed, 14 Mar 2012 23:06:00 -0400 + +bitcoin (0.5.3-natty0) natty; urgency=low + + * New upstream release. + + -- Luke Dashjr Tue, 10 Jan 2012 15:57:00 -0500 + +bitcoin (0.5.2-natty1) natty; urgency=low + + * Remove mentions on anonymity in package descriptions and manpage. + These should never have been there, bitcoin isn't anonymous without + a ton of work that virtually no users will ever be willing and + capable of doing + + -- Matt Corallo Sat, 7 Jan 2012 13:37:00 -0500 + +bitcoin (0.5.2-natty0) natty; urgency=low + + * New upstream release. + + -- Luke Dashjr Fri, 16 Dec 2011 17:57:00 -0500 + +bitcoin (0.5.1-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Fri, 16 Dec 2011 13:27:00 -0500 + +bitcoin (0.5.0-natty0) natty; urgency=low + + * New upstream release. + + -- Matt Corallo Mon, 21 Nov 2011 11:32:00 -0500 + +bitcoin (0.5.0~rc7-natty0) natty; urgency=low + + * New upstream release candidate. + + -- Matt Corallo Sun, 20 Nov 2011 17:08:00 -0500 + +bitcoin (0.5.0~rc3-natty0) natty; urgency=low + + * New upstream release candidate. + * Don't set rpcpassword for bitcoin-qt. + + -- Matt Corallo Tue, 8 Nov 2011 11:56:00 -0400 + +bitcoin (0.5.0~rc1-natty1) natty; urgency=low + + * Add test_bitcoin to build test + * Fix clean + * Remove unnecessary build-dependancies + + -- Matt Corallo Wed, 26 Oct 2011 14:37:18 -0400 + +bitcoin (0.5.0~rc1-natty0) natty; urgency=low + + * Mark for natty + * Fix broken build + * Fix copyright listing + * Remove bitcoin: URL handler until bitcoin actually has support for it (Oops) + + -- Matt Corallo Wed, 26 Oct 2011 14:37:18 -0400 + +bitcoin (0.5.0~rc1-2) experimental; urgency=low + + * Add bitcoin-qt + + -- Matt Corallo Tue, 25 Oct 2011 15:24:18 -0400 + +bitcoin (0.5.0~rc1-1) experimental; urgency=low + + * New upstream prerelease. + * Add Github as alternate upstream source in watch file. + * Stop build-depending on libcrypto++-dev, and drop patch 1000: + Upstream no longer use crypto++. + * Drop patch 1003: Upstream builds dynamic by default now. + * Update copyright file: Drop notes on longer included sources. + + -- Jonas Smedegaard Fri, 14 Oct 2011 00:16:18 +0200 + +bitcoin (0.4.0-1) unstable; urgency=low + + * New upstream release. + * Stop repackaging source tarballs: No DFSG-violating stripping left. + * Update copyright file: + + Add Github URL to Source. + * Drop dpkg-source local-options hint: Declared options are default + since dpkg-source 1.16.1. + + Add irc URL to Upstream-Contact. + + Add comment on Bitcoin Developers to catch-all Files section. + + Add Files sections for newly readded src/cryptopp/* (new custom + BSD-like license), and newly added doc/build-osx.txt and + src/makefile.osx (Expat). + * Bump debhelper compatibility level to 7. + * Suppress binary icns and gpg files. + * Enable regression tests: + + Build-depend on libboost-test-dev. + + Extend patch 1003 to also dynamically link test binary. + + Build and invoke test binary unless tests are disabled. + * Tighten build-dependency on cdbs: Recent version needed to support + debhelper 7. + * Relax build-depend unversioned on debhelper: needed version + satisfied even in oldstable. + * Stop suppress optional build-dependencies: Satisfied in stable. + Build-depend on devscripts (enabling copyright-check). + + -- Jonas Smedegaard Wed, 05 Oct 2011 01:48:53 +0200 + +bitcoin (0.3.24~dfsg-1) unstable; urgency=low + + * New upstream release. + + [ Jonas Smedegaard ] + * Improve various usage hints: + + Explicitly mention in long description that bitcoind contains + daemon and command-line interface. + + Extend README.Debian with section on lack of GUI, and add primary + headline. + + Avoid installing upstream README: contains no parts relevant for + Debian usage. + Thanks to richard for suggestions (see bug#629443). + * Favor final releases over prereleases in rules and watch file. + Thanks to Jan Dittberner. + * Track -src (not -linux) tarballs in rules and watch file. + Thanks to Jan Dittberner. + * Drop patches 1004 and 1005 (integrated upstream) and simplify + CXXFLAGS in rules file. + * Stop stripping no longer included source-less binaries from upstream + tarballs. + + [ Jan Dittberner ] + * refresh debian/patches/1000_use_system_crypto++.patch + + -- Jonas Smedegaard Tue, 19 Jul 2011 15:08:54 +0200 + +bitcoin (0.3.21~dfsg-2) unstable; urgency=low + + * Enable UPNP support: + + Drop patch 1006. + + Build-depend on libminiupnpc-dev. + Thanks to Matt Corallo. + + -- Jonas Smedegaard Sat, 28 May 2011 15:52:44 +0200 + +bitcoin (0.3.21~dfsg-1) unstable; urgency=low + + * New upstream release. + * Refresh patches. + * Drop patch 1002: no longer needed, as upstream use pkgconfig now. + * Add patch 1006 to really unset USE_UPNP as aparently intended. + * Adjust cleanup rule to preserve .gitignore files. + * Update copyright file: + + Bump format to draft 174 of DEP-5. + + Shorten comments. + * Bump policy compliance to standards-version 3.9.2. + * Shorten Vcs-Browser paragraph in control file. + * Fix mention daemon (not CLI tools) in short description. + * Stop conflicting with or replace bitcoin-cli: Only transitional, no + longer needed. + * Link against unversioned berkeleydb. Update NEWS and README.Debian + accordingly (and improve wording while at it). + Closes: Bug#621425. Thanks to Ondřej Surý. + * This release also implicitly updates linkage against libcrypto++, + which closes: bug#626953, #627024. + * Disable linkage against not yet Debian packaged MiniUPnP. + * Silence seemingly harmless noise about unused variables. + + -- Jonas Smedegaard Tue, 17 May 2011 15:31:24 +0200 + +bitcoin (0.3.20.2~dfsg-2) unstable; urgency=medium + + * Fix have wrapper script execute real binary (not loop executing + itself). + Closes: bug#617290. Thanks to Philippe Gauthier and Etienne Laurin. + * Set urgency=medium as the only (user-exposed) binary is useless + without this fix and has been for some time. + + -- Jonas Smedegaard Wed, 16 Mar 2011 09:11:06 +0100 + +bitcoin (0.3.20.2~dfsg-1) unstable; urgency=low + + * New upstream release. + * Fix provide and replace former package name bitcoin-cli. + Closes: bug#618439. Thanks to Shane Wegner. + + -- Jonas Smedegaard Tue, 15 Mar 2011 11:41:43 +0100 + +bitcoin (0.3.20.01~dfsg-1) unstable; urgency=low + + * New upstream release. + + [ Micah Anderson ] + * Add myself as uploader. + + [ Jonas Smedegaard ] + * Add wrapper for bitcoind to ease initial startup. + * Update patches: + + Drop patch 2002: Applied upstream. + + Add patch 1005 to add phtread linker option. + Closes: bug#615619. Thanks to Shane Wegner. + + Refresh patches. + * Extend copyright years in rules file header. + * Rewrite copyright file using draft svn166 of DEP5 format. + * Rename binary package to bitcoind (from bincoin-cli). + Closes: bug#614025. Thanks to Luke-Jr. + + -- Jonas Smedegaard Tue, 01 Mar 2011 15:55:04 +0100 + +bitcoin (0.3.19~dfsg-6) unstable; urgency=low + + * Fix override aggressive optimizations. + * Fix tighten build-dependencies to really fit backporting to Lenny: + + Add fallback build-dependency on libdb4.6++-dev. + + Tighten unversioned Boost build-dependencies to recent versions, + To force use of versioned Boost when backporting to Lenny. + ...needs more love, though: actual build fails. + + -- Jonas Smedegaard Mon, 17 Jan 2011 19:48:35 +0100 + +bitcoin (0.3.19~dfsg-5) unstable; urgency=low + + * Fix lower Boost fallback-build-dependencies to 1.35, really + available in Lenny. + * Correct comment in rules file regarding reason for versioned Boost + fallback-build-dependency. + * Add patch 2002 adding -mt decoration to Boost flags, to ease + backporting to Lenny. + * Respect DEB_BUILD_OPTIONS, and suppress arch-specific optimizations: + + Add patch 1004 to allow overriding optimization flags. + + Set optimization flags conditionally at build time. + + Drop patch 2002 unconditionally suppressing arch-optimizations. + + -- Jonas Smedegaard Mon, 17 Jan 2011 16:04:48 +0100 + +bitcoin (0.3.19~dfsg-4) unstable; urgency=low + + [ Micah Anderson ] + * Provide example bitcoin.conf. + * Add bitcoind(1) and bitcoin.conf(5) man pages. + + [ Jonas Smedegaard ] + * Ease backporting: + + Suppress optional build-dependencies. + + Add fallback build-dependencies on the most recent Boost libs + available in Lenny (where unversioned Boost libs are missing). + * Add Micah as copyright holder for manpages, licensed as GPL-3+. + * Bump copyright format to Subversion candidate draft 162 of DEP5. + + -- Jonas Smedegaard Mon, 17 Jan 2011 14:00:48 +0100 + +bitcoin (0.3.19~dfsg-3) unstable; urgency=low + + * Document in copyright file files excluded from repackaged source. + * Update copyright file: + + Bump DEP5 format hint to Subversion draft rev. 153. + + Consistently wrap at 72 chars. + + Refer to GPL-2 file (not GPL symlink). + * Link against Berkeley DB 4.8 (not 4.7): + + Build-depend on libdb4.8++-dev (and on on libdb4.7++-dev). + + Suggest libdb4.8-util and db4.7-util. + + Add README.Debian note on (untested) upgrade routine. + + Add NEWS entry on changed db version, referring to README.Debian. + + -- Jonas Smedegaard Fri, 07 Jan 2011 22:50:57 +0100 + +bitcoin (0.3.19~dfsg-2) unstable; urgency=low + + * Adjust build options to use optimized miner only for amd64. Fixes + FTBFS on i386 (and other archs, if compiling anywhere else at all). + * Avoid static linking. + * Adjust patch 2001 to avoid only arch-specific optimizations (keep + -O3). + * Extend long description to mention disk consumption and initial use + of IRC. + All of above changes thanks to Helmuth Grohne. + * Add lintian override regarding OpenSSL and GPL: Linked code is Expat + - only Debian packaging is GPL-2+. + + -- Jonas Smedegaard Wed, 29 Dec 2010 00:27:54 +0100 + +bitcoin (0.3.19~dfsg-1) unstable; urgency=low + + [ Jonas Smedegaard ] + * Initial release. + Closes: bug#578157. + + -- Jonas Smedegaard Tue, 28 Dec 2010 15:49:22 +0100 diff --git a/src/univalue/test/round4.json b/contrib/debian/compat similarity index 100% rename from src/univalue/test/round4.json rename to contrib/debian/compat diff --git a/contrib/debian/control b/contrib/debian/control new file mode 100644 index 000000000..fce6bc011 --- /dev/null +++ b/contrib/debian/control @@ -0,0 +1,67 @@ +Source: bitcoin +Section: utils +Priority: optional +Maintainer: Jonas Smedegaard +Uploaders: Micah Anderson +Build-Depends: debhelper, + devscripts, + automake, + libtool, + bash-completion, + libboost-system-dev (>> 1.35) | libboost-system1.35-dev, + libdb4.8++-dev, + libssl-dev, + pkg-config, + libminiupnpc8-dev | libminiupnpc-dev (>> 1.6), + libboost-filesystem-dev (>> 1.35) | libboost-filesystem1.35-dev, + libboost-program-options-dev (>> 1.35) | libboost-program-options1.35-dev, + libboost-thread-dev (>> 1.35) | libboost-thread1.35-dev, + libboost-test-dev (>> 1.35) | libboost-test1.35-dev, + qt4-qmake, + libqt4-dev, + libqrencode-dev, + libprotobuf-dev, protobuf-compiler, + python +Standards-Version: 3.9.2 +Homepage: https://bitcoincore.org/ +Vcs-Git: git://github.com/bitcoin/bitcoin.git +Vcs-Browser: https://github.com/bitcoin/bitcoin + +Package: bitcoind +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: peer-to-peer network based digital currency - daemon + Bitcoin is an experimental new digital currency that enables instant + payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer + technology to operate with no central authority: managing transactions + and issuing money are carried out collectively by the network. Bitcoin Core + is the name of the open source software which enables the use of this currency. + . + This package provides the daemon, bitcoind, and the CLI tool + bitcoin-cli to interact with the daemon. + +Package: bitcoin-qt +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: peer-to-peer network based digital currency - Qt GUI + Bitcoin is an experimental new digital currency that enables instant + payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer + technology to operate with no central authority: managing transactions + and issuing money are carried out collectively by the network. Bitcoin Core + is the name of the open source software which enables the use of this currency. + . + This package provides Bitcoin-Qt, a GUI for Bitcoin based on Qt. + +Package: bitcoin-tx +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: peer-to-peer digital currency - standalone transaction tool + Bitcoin is an experimental new digital currency that enables instant + payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer + technology to operate with no central authority: managing transactions + and issuing money are carried out collectively by the network. Bitcoin Core + is the name of the open source software which enables the use of this currency. + . + This package provides bitcoin-tx, a command-line transaction creation + tool which can be used without a bitcoin daemon. Some means of + exchanging minimal transaction data with peers is still required. diff --git a/contrib/debian/copyright b/contrib/debian/copyright index 21cca7d9a..c039a7bae 100644 --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -5,7 +5,7 @@ Upstream-Contact: Satoshi Nakamoto Source: https://github.com/bitcoin/bitcoin Files: * -Copyright: 2009-2018, Bitcoin Core Developers +Copyright: 2009-2016, Bitcoin Core Developers License: Expat Comment: The Bitcoin Core Developers encompasses the current developers listed on bitcoin.org, as well as the numerous contributors to the project. @@ -15,13 +15,9 @@ Copyright: 2010-2011, Jonas Smedegaard 2011, Matt Corallo License: GPL-2+ -Files: src/secp256k1/build-aux/m4/ax_jni_include_dir.m4 -Copyright: 2008 Don Anderson -License: GNU-All-permissive-License - -Files: src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 -Copyright: 2008 Paolo Bonzini -License: GNU-All-permissive-License +Files: debian/manpages/* +Copyright: Micah Anderson +License: GPL-3+ Files: src/qt/res/icons/add.png src/qt/res/icons/address-book.png @@ -55,10 +51,7 @@ Comment: Site: https://github.com/stephenhutchings/typicons.font Files: src/qt/res/icons/connect*.png src/qt/res/src/connect-*.svg - src/qt/res/icons/network_disabled.png - src/qt/res/src/network_disabled.svg Copyright: Marco Falke - Luke Dashjr License: Expat Comment: Inspired by Stephan Hutchings Typicons @@ -66,18 +59,14 @@ Files: src/qt/res/icons/tx_mined.png src/qt/res/src/mine.svg src/qt/res/icons/fontbigger.png src/qt/res/icons/fontsmaller.png - src/qt/res/icons/hd_disabled.png - src/qt/res/src/hd_disabled.svg - src/qt/res/icons/hd_enabled.png - src/qt/res/src/hd_enabled.svg Copyright: Jonas Schnelli License: Expat Comment: Files: src/qt/res/icons/clock*.png src/qt/res/icons/eye_*.png - src/qt/res/icons/tx_in*.png src/qt/res/icons/verify.png + src/qt/res/icons/tx_in*.png src/qt/res/src/clock_*.svg src/qt/res/src/tx_*.svg src/qt/res/src/verify.svg @@ -93,11 +82,6 @@ Copyright: Bitboy, Jonas Schnelli License: public-domain Comment: Site: https://bitcointalk.org/?topic=1756.0 -Files: src/qt/res/icons/proxy.png - src/qt/res/src/proxy.svg -Copyright: Cristian Mircea Messel -Licese: public-domain - License: Expat Permission is hereby granted, free of charge, to any person obtaining a @@ -119,12 +103,6 @@ License: Expat TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -License: GNU-All-permissive-License - Copying and distribution of this file, with or without modification, are - permitted in any medium without royalty provided the copyright notice - and this notice are preserved. This file is offered as-is, without any - warranty. - License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/share/examples/bitcoin.conf b/contrib/debian/examples/bitcoin.conf similarity index 72% rename from share/examples/bitcoin.conf rename to contrib/debian/examples/bitcoin.conf index 4dd73162a..2831c0729 100644 --- a/share/examples/bitcoin.conf +++ b/contrib/debian/examples/bitcoin.conf @@ -67,30 +67,9 @@ # This option can be specified multiple times (default: bind to all interfaces) #rpcbind= -# If no rpcpassword is set, rpc cookie auth is sought. The default `-rpccookiefile` name -# is .cookie and found in the `-datadir` being used for bitcoind. This option is typically used -# when the server and client are run as the same user. -# -# If not, you must set rpcuser and rpcpassword to secure the JSON-RPC api. The first -# method(DEPRECATED) is to set this pair for the server and client: +# You must set rpcuser and rpcpassword to secure the JSON-RPC api #rpcuser=Ulysseys #rpcpassword=YourSuperGreatPasswordNumber_DO_NOT_USE_THIS_OR_YOU_WILL_GET_ROBBED_385593 -# -# The second method `rpcauth` can be added to server startup argument. It is set at initialization time -# using the output from the script in share/rpcauth/rpcauth.py after providing a username: -# -# ./share/rpcauth/rpcauth.py alice -# String to be appended to bitcoin.conf: -# rpcauth=alice:f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae -# Your password: -# DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E= -# -# On client-side, you add the normal user/password pair to send commands: -#rpcuser=alice -#rpcpassword=DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E= -# -# You can even add multiple entries of these to the server conf file, and client can use any of them: -# rpcauth=bob:b2dd077cb54591a2f3139e69a897ac$4e71f08d48b4347cf8eff3815c0e25ae2e9a4340474079f55705f40574f4ec99 # How many seconds bitcoin will wait for a complete RPC HTTP request. # after the HTTP connection is established. @@ -116,7 +95,12 @@ # running on another host using this option: #rpcconnect=127.0.0.1 -# Create transactions that have enough fees so they are likely to begin confirmation within n blocks (default: 6). +# Transaction Fee Changes in 0.10.0 + +# Send transactions as zero-fee transactions if possible (default: 0) +#sendfreetransactions=0 + +# Create transactions that have enough fees (or priority) so they are likely to begin confirmation within n blocks (default: 1). # This setting is over-ridden by the -paytxfee option. #txconfirmtarget=n @@ -131,13 +115,6 @@ # be validated sooner. #paytxfee=0.00 -# Enable pruning to reduce storage requirements by deleting old blocks. -# This mode is incompatible with -txindex and -rescan. -# 0 = default (no pruning). -# 1 = allows manual pruning via RPC. -# >=550 = target to stay under in MiB. -#prune=550 - # User interface options # Start Bitcoin minimized diff --git a/contrib/debian/gbp.conf b/contrib/debian/gbp.conf new file mode 100644 index 000000000..a7281f94b --- /dev/null +++ b/contrib/debian/gbp.conf @@ -0,0 +1,5 @@ +# Configuration file for git-buildpackage and friends + +[DEFAULT] +pristine-tar = True +sign-tags = True diff --git a/contrib/debian/manpages/bitcoin-cli.1 b/contrib/debian/manpages/bitcoin-cli.1 new file mode 100644 index 000000000..16c338dd3 --- /dev/null +++ b/contrib/debian/manpages/bitcoin-cli.1 @@ -0,0 +1,21 @@ +.TH BITCOIN-CLI "1" "February 2016" "bitcoin-cli 0.12" +.SH NAME +bitcoin-cli \- a remote procedure call client for Bitcoin Core. +.SH SYNOPSIS +bitcoin-cli [options] [params] \- Send command to Bitcoin Core. +.TP +bitcoin-cli [options] help \- Asks Bitcoin Core for a list of supported commands. +.SH DESCRIPTION +This manual page documents the bitcoin-cli program. bitcoin-cli is an RPC client used to send commands to Bitcoin Core. + +.SH OPTIONS +.TP +\fB\-?\fR +Show possible options. + +.SH "SEE ALSO" +\fBbitcoind\fP, \fBbitcoin.conf\fP +.SH AUTHOR +This manual page was written by Ciemon Dunville . Permission is granted to copy, distribute and/or modify this document under the terms of the MIT License. + +The complete text of the MIT License can be found on the web at \fIhttp://opensource.org/licenses/MIT\fP. diff --git a/contrib/debian/manpages/bitcoin-qt.1 b/contrib/debian/manpages/bitcoin-qt.1 new file mode 100644 index 000000000..685a28208 --- /dev/null +++ b/contrib/debian/manpages/bitcoin-qt.1 @@ -0,0 +1,13 @@ +.TH BITCOIN-QT "1" "February 2016" "bitcoin-qt 0.12" +.SH NAME +bitcoin-qt \- peer-to-peer network based digital currency +.SH DESCRIPTION +.SS "Usage:" +.IP +bitcoin\-qt [command\-line options] +.SH OPTIONS +.TP +\-? +List options. +.SH "SEE ALSO" +bitcoind(1) diff --git a/contrib/debian/manpages/bitcoin.conf.5 b/contrib/debian/manpages/bitcoin.conf.5 new file mode 100644 index 000000000..839dc26c1 --- /dev/null +++ b/contrib/debian/manpages/bitcoin.conf.5 @@ -0,0 +1,19 @@ +.TH BITCOIN.CONF "5" "February 2016" "bitcoin.conf 0.12" +.SH NAME +bitcoin.conf \- bitcoin configuration file +.SH SYNOPSIS +All command-line options (except for '\-conf') may be specified in a configuration file, and all configuration file options may also be specified on the command line. Command-line options override values set in the configuration file. +.TP +The configuration file is a list of 'setting=value' pairs, one per line, with optional comments starting with the '#' character. Please refer to bitcoind(1) for a up to date list of valid options. +.TP +The configuration file is not automatically created; you can create it using your favorite plain-text editor. By default, bitcoind(1) will look for a file named bitcoin.conf(5) in the bitcoin data directory, but both the data directory and the configuration file path may be changed using the '\-datadir' and '\-conf' command-line arguments. +.SH LOCATION +bitcoin.conf should be located in $HOME/.bitcoin + +.SH "SEE ALSO" +bitcoind(1) +.SH AUTHOR +This manual page was written by Micah Anderson for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. + +On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. + diff --git a/contrib/debian/manpages/bitcoind.1 b/contrib/debian/manpages/bitcoind.1 new file mode 100644 index 000000000..5c3e52f44 --- /dev/null +++ b/contrib/debian/manpages/bitcoind.1 @@ -0,0 +1,30 @@ +.TH BITCOIND "1" "February 2016" "bitcoind 0.12" +.SH NAME +bitcoind \- peer-to-peer network based digital currency +.SH SYNOPSIS +bitcoin [options] [params] +.TP +bitcoin [options] help \- Get help for a command +.SH DESCRIPTION +This manual page documents the bitcoind program. Bitcoin is an experimental new digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Bitcoin Core is the name of open source software which enables the use of this currency. + +.SH OPTIONS +.TP +\-? +List of possible options. +.SH COMMANDS +.TP +\fBhelp\fR +List commands. + +.TP +\fBhelp 'command'\fR +Get help for a command. + +.SH "SEE ALSO" +bitcoin.conf(5) +.SH AUTHOR +This manual page was written by Micah Anderson for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. + +On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. + diff --git a/contrib/debian/patches/README b/contrib/debian/patches/README new file mode 100644 index 000000000..80c158437 --- /dev/null +++ b/contrib/debian/patches/README @@ -0,0 +1,3 @@ +0xxx: Grabbed from upstream development. +1xxx: Possibly relevant for upstream adoption. +2xxx: Only relevant for official Debian release. diff --git a/contrib/debian/patches/series b/contrib/debian/patches/series new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/contrib/debian/patches/series @@ -0,0 +1 @@ + diff --git a/contrib/debian/rules b/contrib/debian/rules new file mode 100755 index 000000000..52b357cf0 --- /dev/null +++ b/contrib/debian/rules @@ -0,0 +1,24 @@ +#!/usr/bin/make -f +# -*- mode: makefile; coding: utf-8 -*- + +#DEB_MAKE_CHECK_TARGET = test_bitcoin +#build/bitcoind:: +# $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),,src/test_bitcoin) + +DEB_INSTALL_EXAMPLES_bitcoind += debian/examples/* +DEB_INSTALL_MANPAGES_bitcoind += debian/manpages/* + +%: + dh --with bash-completion $@ + +override_dh_auto_clean: + if [ -f Makefile ]; then $(MAKE) distclean; fi + rm -rf Makefile.in aclocal.m4 configure src/Makefile.in src/bitcoin-config.h.in src/build-aux src/qt/Makefile.in src/qt/test/Makefile.in src/test/Makefile.in + +# Yea, autogen should be run on the source archive, but I like doing git archive +override_dh_auto_configure: + ./autogen.sh + ./configure + +override_dh_auto_test: + make check diff --git a/contrib/debian/source/format b/contrib/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/contrib/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/contrib/debian/watch b/contrib/debian/watch new file mode 100644 index 000000000..4d9e0cfa5 --- /dev/null +++ b/contrib/debian/watch @@ -0,0 +1,5 @@ +# Run the "uscan" command to check for upstream updates and more. +version=3 +# use qa.debian.org redirector; see man uscan +opts=uversionmangle=s/(\d)(alpha|beta|rc)/$1~$2/,dversionmangle=s/~dfsg\d*// \ + http://githubredir.debian.net/github/bitcoin/bitcoin v(.*).tar.gz diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index a0b622534..1103ca86c 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -2,6 +2,17 @@ Contents ======== This directory contains tools for developers working on this repository. +check-doc.py +============ + +Check if all command line args are documented. The return value indicates the +number of undocumented args. + +clang-format.py +=============== + +A script to format cpp source code according to [.clang-format](../../src/.clang-format). This should only be applied to new files or files which are currently not actively developed on. Also, git subtrees are not subject to formatting. + clang-format-diff.py =================== @@ -14,78 +25,36 @@ the script should be called from the git root folder as follows. git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v ``` -copyright\_header.py +fix-copyright-headers.py +======================== + +Every year newly updated files need to have its copyright headers updated to reflect the current year. +If you run this script from the root folder it will automatically update the year on the copyright header for all +source files if these have a git commit from the current year. + +For example a file changed in 2015 (with 2015 being the current year): + +```// Copyright (c) 2009-2013 The Bitcoin Core developers``` + +would be changed to: + +```// Copyright (c) 2009-2015 The Bitcoin Core developers``` + +git-subtree-check.sh ==================== -Provides utilities for managing copyright headers of `The Bitcoin Core -developers` in repository source files. It has three subcommands: +Run this script from the root of the repository to verify that a subtree matches the contents of +the commit it claims to have been updated to. -``` -$ ./copyright_header.py report [verbose] -$ ./copyright_header.py update -$ ./copyright_header.py insert -``` -Running these subcommands without arguments displays a usage string. +To use, make sure that you have fetched the upstream repository branch in which the subtree is +maintained: +* for `src/secp256k1`: https://github.com/bitcoin/secp256k1.git (branch master) +* for `src/leveldb`: https://github.com/bitcoin/leveldb.git (branch bitcoin-fork) +* for `src/univalue`: https://github.com/bitcoin/univalue.git (branch master) -copyright\_header.py report \ [verbose] ---------------------------------------------------------- +Usage: `git-subtree-check.sh DIR COMMIT` -Produces a report of all copyright header notices found inside the source files -of a repository. Useful to quickly visualize the state of the headers. -Specifying `verbose` will list the full filenames of files of each category. - -copyright\_header.py update \ [verbose] ---------------------------------------------------------- -Updates all the copyright headers of `The Bitcoin Core developers` which were -changed in a year more recent than is listed. For example: -``` -// Copyright (c) - The Bitcoin Core developers -``` -will be updated to: -``` -// Copyright (c) - The Bitcoin Core developers -``` -where `` is obtained from the `git log` history. - -This subcommand also handles copyright headers that have only a single year. In -those cases: -``` -// Copyright (c) The Bitcoin Core developers -``` -will be updated to: -``` -// Copyright (c) - The Bitcoin Core developers -``` -where the update is appropriate. - -copyright\_header.py insert \ ------------------------------------- -Inserts a copyright header for `The Bitcoin Core developers` at the top of the -file in either Python or C++ style as determined by the file extension. If the -file is a Python file and it has `#!` starting the first line, the header is -inserted in the line below it. - -The copyright dates will be set to be `-` where -`` is according to the `git log` history. If -`` is equal to ``, it will be set as a single -year rather than two hyphenated years. - -If the file already has a copyright for `The Bitcoin Core developers`, the -script will exit. - -gen-manpages.sh -=============== - -A small script to automatically create manpages in ../../doc/man by running the release binaries with the -help option. -This requires help2man which can be found at: https://www.gnu.org/software/help2man/ - -With in-tree builds this tool can be run from any directory within the -repostitory. To use this tool with out-of-tree builds set `BUILDDIR`. For -example: - -```bash -BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh -``` +`COMMIT` may be omitted, in which case `HEAD` is used. github-merge.py =============== @@ -110,7 +79,7 @@ check or whatever). This means that there are no potential race conditions (where a pullreq gets updated while you're reviewing it, but before you click -merge), and when using GPG signatures, that even a compromised GitHub +merge), and when using GPG signatures, that even a compromised github couldn't mess with the sources. Setup @@ -121,14 +90,6 @@ Configuring the github-merge tool for the bitcoin repository is done in the foll git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing) git config --global user.signingkey mykeyid (if you want to GPG sign) -Create and verify timestamps of merge commits ---------------------------------------------- -To create or verify timestamps on the merge commits, install the OpenTimestamps -client via `pip3 install opentimestamps-client`. Then, dowload the gpg wrapper -`ots-git-gpg-wrapper.sh` and set it as git's `gpg.program`. See -[the ots git integration documentation](https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage) -for further details. - optimize-pngs.py ================ @@ -171,14 +132,3 @@ It will do the following automatically: - add missing translations to the build system (TODO) See doc/translation-process.md for more information. - -circular-dependencies.py -======================== - -Run this script from the root of the source tree (`src/`) to find circular dependencies in the source code. -This looks only at which files include other files, treating the `.cpp` and `.h` file as one unit. - -Example usage: - - cd .../src - ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp} diff --git a/contrib/devtools/check-doc.py b/contrib/devtools/check-doc.py new file mode 100755 index 000000000..8c73cf1e8 --- /dev/null +++ b/contrib/devtools/check-doc.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# Copyright (c) 2015 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +''' +This checks if all command line args are documented. +Return value is 0 to indicate no error. + +Author: @MarcoFalke +''' + +from subprocess import check_output +import re + +FOLDER_GREP = 'src' +FOLDER_TEST = 'src/test/' +CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/%s' % FOLDER_GREP +CMD_GREP_ARGS = r"egrep -r -I '(map(Multi)?Args(\.count\(|\[)|Get(Bool)?Arg\()\"\-[^\"]+?\"' %s | grep -v '%s'" % (CMD_ROOT_DIR, FOLDER_TEST) +CMD_GREP_DOCS = r"egrep -r -I 'HelpMessageOpt\(\"\-[^\"=]+?(=|\")' %s" % (CMD_ROOT_DIR) +REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"') +REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")') +# list unsupported, deprecated and duplicate args as they need no documentation +SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay']) + +def main(): + used = check_output(CMD_GREP_ARGS, shell=True) + docd = check_output(CMD_GREP_DOCS, shell=True) + + args_used = set(re.findall(REGEX_ARG,used)) + args_docd = set(re.findall(REGEX_DOC,docd)).union(SET_DOC_OPTIONAL) + args_need_doc = args_used.difference(args_docd) + args_unknown = args_docd.difference(args_used) + + print "Args used : %s" % len(args_used) + print "Args documented : %s" % len(args_docd) + print "Args undocumented: %s" % len(args_need_doc) + print args_need_doc + print "Args unknown : %s" % len(args_unknown) + print args_unknown + + exit(len(args_need_doc)) + +if __name__ == "__main__": + main() diff --git a/contrib/devtools/circular-dependencies.py b/contrib/devtools/circular-dependencies.py deleted file mode 100755 index abfa5ed5a..000000000 --- a/contrib/devtools/circular-dependencies.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import re - -MAPPING = { - 'core_read.cpp': 'core_io.cpp', - 'core_write.cpp': 'core_io.cpp', -} - -def module_name(path): - if path in MAPPING: - path = MAPPING[path] - if path.endswith(".h"): - return path[:-2] - if path.endswith(".c"): - return path[:-2] - if path.endswith(".cpp"): - return path[:-4] - return None - -files = dict() -deps = dict() - -RE = re.compile("^#include <(.*)>") - -# Iterate over files, and create list of modules -for arg in sys.argv[1:]: - module = module_name(arg) - if module is None: - print("Ignoring file %s (does not constitute module)\n" % arg) - else: - files[arg] = module - deps[module] = set() - -# Iterate again, and build list of direct dependencies for each module -# TODO: implement support for multiple include directories -for arg in sorted(files.keys()): - module = files[arg] - with open(arg, 'r', encoding="utf8") as f: - for line in f: - match = RE.match(line) - if match: - include = match.group(1) - included_module = module_name(include) - if included_module is not None and included_module in deps and included_module != module: - deps[module].add(included_module) - -# Loop to find the shortest (remaining) circular dependency -have_cycle = False -while True: - shortest_cycle = None - for module in sorted(deps.keys()): - # Build the transitive closure of dependencies of module - closure = dict() - for dep in deps[module]: - closure[dep] = [] - while True: - old_size = len(closure) - old_closure_keys = sorted(closure.keys()) - for src in old_closure_keys: - for dep in deps[src]: - if dep not in closure: - closure[dep] = closure[src] + [src] - if len(closure) == old_size: - break - # If module is in its own transitive closure, it's a circular dependency; check if it is the shortest - if module in closure and (shortest_cycle is None or len(closure[module]) + 1 < len(shortest_cycle)): - shortest_cycle = [module] + closure[module] - if shortest_cycle is None: - break - # We have the shortest circular dependency; report it - module = shortest_cycle[0] - print("Circular dependency: %s" % (" -> ".join(shortest_cycle + [module]))) - # And then break the dependency to avoid repeating in other cycles - deps[shortest_cycle[-1]] = deps[shortest_cycle[-1]] - set([module]) - have_cycle = True - -sys.exit(1 if have_cycle else 0) diff --git a/contrib/devtools/clang-format-diff.py b/contrib/devtools/clang-format-diff.py index 77e845a9b..13d2573b9 100755 --- a/contrib/devtools/clang-format-diff.py +++ b/contrib/devtools/clang-format-diff.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # #===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===# # @@ -69,9 +69,10 @@ Example usage for git/svn users: import argparse import difflib -import io import re +import string import subprocess +import StringIO import sys @@ -127,14 +128,14 @@ def main(): line_count = int(match.group(3)) if line_count == 0: continue - end_line = start_line + line_count - 1 + end_line = start_line + line_count - 1; lines_by_file.setdefault(filename, []).extend( ['-lines', str(start_line) + ':' + str(end_line)]) # Reformat files containing changes in place. - for filename, lines in lines_by_file.items(): + for filename, lines in lines_by_file.iteritems(): if args.i and args.verbose: - print('Formatting {}'.format(filename)) + print 'Formatting', filename command = [binary, filename] if args.i: command.append('-i') @@ -142,23 +143,20 @@ def main(): command.append('-sort-includes') command.extend(lines) command.extend(['-style=file', '-fallback-style=none']) - p = subprocess.Popen(command, - stdout=subprocess.PIPE, - stderr=None, - stdin=subprocess.PIPE, - universal_newlines=True) + p = subprocess.Popen(command, stdout=subprocess.PIPE, + stderr=None, stdin=subprocess.PIPE) stdout, stderr = p.communicate() if p.returncode != 0: - sys.exit(p.returncode) + sys.exit(p.returncode); if not args.i: - with open(filename, encoding="utf8") as f: + with open(filename) as f: code = f.readlines() - formatted_code = io.StringIO(stdout).readlines() + formatted_code = StringIO.StringIO(stdout).readlines() diff = difflib.unified_diff(code, formatted_code, filename, filename, '(before formatting)', '(after formatting)') - diff_string = ''.join(diff) + diff_string = string.join(diff, '') if len(diff_string) > 0: sys.stdout.write(diff_string) diff --git a/contrib/devtools/clang-format.py b/contrib/devtools/clang-format.py new file mode 100755 index 000000000..31fdff013 --- /dev/null +++ b/contrib/devtools/clang-format.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +''' +Wrapper script for clang-format + +Copyright (c) 2015 MarcoFalke +Copyright (c) 2015 The Bitcoin Core developers +Distributed under the MIT software license, see the accompanying +file COPYING or http://www.opensource.org/licenses/mit-license.php. +''' + +import os +import sys +import subprocess + +accepted_file_extensions = ('.h', '.cpp') # Files to format + +def check_command_line_args(argv): + required_args = ['{clang-format-exe}', '{files}'] + example_args = ['clang-format-3.x', 'src/main.cpp', 'src/wallet/*'] + + if(len(argv) < len(required_args) + 1): + for word in (['Usage:', argv[0]] + required_args): + print word, + print '' + for word in (['E.g:', argv[0]] + example_args): + print word, + print '' + sys.exit(1) + +def run_clang_format(clang_format_exe, files): + for target in files: + if os.path.isdir(target): + for path, dirs, files in os.walk(target): + run_clang_format(clang_format_exe, (os.path.join(path, f) for f in files)) + elif target.endswith(accepted_file_extensions): + print "Formatting " + target + subprocess.check_call([clang_format_exe, '-i', '-style=file', target], stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT) + else: + print "Skip " + target + +def main(argv): + check_command_line_args(argv) + clang_format_exe = argv[1] + files = argv[2:] + run_clang_format(clang_format_exe, files) + +if __name__ == "__main__": + main(sys.argv) diff --git a/contrib/devtools/copyright_header.py b/contrib/devtools/copyright_header.py deleted file mode 100755 index c5fcddea0..000000000 --- a/contrib/devtools/copyright_header.py +++ /dev/null @@ -1,612 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2016-2018 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -import re -import fnmatch -import sys -import subprocess -import datetime -import os - -################################################################################ -# file filtering -################################################################################ - -EXCLUDE = [ - # libsecp256k1: - 'src/secp256k1/include/secp256k1.h', - 'src/secp256k1/include/secp256k1_ecdh.h', - 'src/secp256k1/include/secp256k1_recovery.h', - 'src/secp256k1/include/secp256k1_schnorr.h', - 'src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c', - 'src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.h', - 'src/secp256k1/src/java/org_bitcoin_Secp256k1Context.c', - 'src/secp256k1/src/java/org_bitcoin_Secp256k1Context.h', - # univalue: - 'src/univalue/test/object.cpp', - 'src/univalue/lib/univalue_escapes.h', - # auto generated: - 'src/qt/bitcoinstrings.cpp', - 'src/chainparamsseeds.h', - # other external copyrights: - 'src/tinyformat.h', - 'src/leveldb/util/env_win.cc', - 'src/crypto/ctaes/bench.c', - 'test/functional/test_framework/bignum.py', - # python init: - '*__init__.py', -] -EXCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in EXCLUDE])) - -INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py'] -INCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in INCLUDE])) - -def applies_to_file(filename): - return ((EXCLUDE_COMPILED.match(filename) is None) and - (INCLUDE_COMPILED.match(filename) is not None)) - -################################################################################ -# obtain list of files in repo according to INCLUDE and EXCLUDE -################################################################################ - -GIT_LS_CMD = 'git ls-files' - -def call_git_ls(): - out = subprocess.check_output(GIT_LS_CMD.split(' ')) - return [f for f in out.decode("utf-8").split('\n') if f != ''] - -def get_filenames_to_examine(): - filenames = call_git_ls() - return sorted([filename for filename in filenames if - applies_to_file(filename)]) - -################################################################################ -# define and compile regexes for the patterns we are looking for -################################################################################ - - -COPYRIGHT_WITH_C = 'Copyright \(c\)' -COPYRIGHT_WITHOUT_C = 'Copyright' -ANY_COPYRIGHT_STYLE = '(%s|%s)' % (COPYRIGHT_WITH_C, COPYRIGHT_WITHOUT_C) - -YEAR = "20[0-9][0-9]" -YEAR_RANGE = '(%s)(-%s)?' % (YEAR, YEAR) -YEAR_LIST = '(%s)(, %s)+' % (YEAR, YEAR) -ANY_YEAR_STYLE = '(%s|%s)' % (YEAR_RANGE, YEAR_LIST) -ANY_COPYRIGHT_STYLE_OR_YEAR_STYLE = ("%s %s" % (ANY_COPYRIGHT_STYLE, - ANY_YEAR_STYLE)) - -ANY_COPYRIGHT_COMPILED = re.compile(ANY_COPYRIGHT_STYLE_OR_YEAR_STYLE) - -def compile_copyright_regex(copyright_style, year_style, name): - return re.compile('%s %s %s' % (copyright_style, year_style, name)) - -EXPECTED_HOLDER_NAMES = [ - "Satoshi Nakamoto\n", - "The Bitcoin Core developers\n", - "The Bitcoin Core developers \n", - "Bitcoin Core Developers\n", - "the Bitcoin Core developers\n", - "The Bitcoin developers\n", - "The LevelDB Authors\. All rights reserved\.\n", - "BitPay Inc\.\n", - "BitPay, Inc\.\n", - "University of Illinois at Urbana-Champaign\.\n", - "MarcoFalke\n", - "Pieter Wuille\n", - "Pieter Wuille +\*\n", - "Pieter Wuille, Gregory Maxwell +\*\n", - "Pieter Wuille, Andrew Poelstra +\*\n", - "Andrew Poelstra +\*\n", - "Wladimir J. van der Laan\n", - "Jeff Garzik\n", - "Diederik Huys, Pieter Wuille +\*\n", - "Thomas Daede, Cory Fields +\*\n", - "Jan-Klaas Kollhof\n", - "Sam Rushing\n", - "ArtForz -- public domain half-a-node\n", -] - -DOMINANT_STYLE_COMPILED = {} -YEAR_LIST_STYLE_COMPILED = {} -WITHOUT_C_STYLE_COMPILED = {} - -for holder_name in EXPECTED_HOLDER_NAMES: - DOMINANT_STYLE_COMPILED[holder_name] = ( - compile_copyright_regex(COPYRIGHT_WITH_C, YEAR_RANGE, holder_name)) - YEAR_LIST_STYLE_COMPILED[holder_name] = ( - compile_copyright_regex(COPYRIGHT_WITH_C, YEAR_LIST, holder_name)) - WITHOUT_C_STYLE_COMPILED[holder_name] = ( - compile_copyright_regex(COPYRIGHT_WITHOUT_C, ANY_YEAR_STYLE, - holder_name)) - -################################################################################ -# search file contents for copyright message of particular category -################################################################################ - -def get_count_of_copyrights_of_any_style_any_holder(contents): - return len(ANY_COPYRIGHT_COMPILED.findall(contents)) - -def file_has_dominant_style_copyright_for_holder(contents, holder_name): - match = DOMINANT_STYLE_COMPILED[holder_name].search(contents) - return match is not None - -def file_has_year_list_style_copyright_for_holder(contents, holder_name): - match = YEAR_LIST_STYLE_COMPILED[holder_name].search(contents) - return match is not None - -def file_has_without_c_style_copyright_for_holder(contents, holder_name): - match = WITHOUT_C_STYLE_COMPILED[holder_name].search(contents) - return match is not None - -################################################################################ -# get file info -################################################################################ - -def read_file(filename): - return open(os.path.abspath(filename), 'r', encoding="utf8").read() - -def gather_file_info(filename): - info = {} - info['filename'] = filename - c = read_file(filename) - info['contents'] = c - - info['all_copyrights'] = get_count_of_copyrights_of_any_style_any_holder(c) - - info['classified_copyrights'] = 0 - info['dominant_style'] = {} - info['year_list_style'] = {} - info['without_c_style'] = {} - for holder_name in EXPECTED_HOLDER_NAMES: - has_dominant_style = ( - file_has_dominant_style_copyright_for_holder(c, holder_name)) - has_year_list_style = ( - file_has_year_list_style_copyright_for_holder(c, holder_name)) - has_without_c_style = ( - file_has_without_c_style_copyright_for_holder(c, holder_name)) - info['dominant_style'][holder_name] = has_dominant_style - info['year_list_style'][holder_name] = has_year_list_style - info['without_c_style'][holder_name] = has_without_c_style - if has_dominant_style or has_year_list_style or has_without_c_style: - info['classified_copyrights'] = info['classified_copyrights'] + 1 - return info - -################################################################################ -# report execution -################################################################################ - -SEPARATOR = '-'.join(['' for _ in range(80)]) - -def print_filenames(filenames, verbose): - if not verbose: - return - for filename in filenames: - print("\t%s" % filename) - -def print_report(file_infos, verbose): - print(SEPARATOR) - examined = [i['filename'] for i in file_infos] - print("%d files examined according to INCLUDE and EXCLUDE fnmatch rules" % - len(examined)) - print_filenames(examined, verbose) - - print(SEPARATOR) - print('') - zero_copyrights = [i['filename'] for i in file_infos if - i['all_copyrights'] == 0] - print("%4d with zero copyrights" % len(zero_copyrights)) - print_filenames(zero_copyrights, verbose) - one_copyright = [i['filename'] for i in file_infos if - i['all_copyrights'] == 1] - print("%4d with one copyright" % len(one_copyright)) - print_filenames(one_copyright, verbose) - two_copyrights = [i['filename'] for i in file_infos if - i['all_copyrights'] == 2] - print("%4d with two copyrights" % len(two_copyrights)) - print_filenames(two_copyrights, verbose) - three_copyrights = [i['filename'] for i in file_infos if - i['all_copyrights'] == 3] - print("%4d with three copyrights" % len(three_copyrights)) - print_filenames(three_copyrights, verbose) - four_or_more_copyrights = [i['filename'] for i in file_infos if - i['all_copyrights'] >= 4] - print("%4d with four or more copyrights" % len(four_or_more_copyrights)) - print_filenames(four_or_more_copyrights, verbose) - print('') - print(SEPARATOR) - print('Copyrights with dominant style:\ne.g. "Copyright (c)" and ' - '"" or "-":\n') - for holder_name in EXPECTED_HOLDER_NAMES: - dominant_style = [i['filename'] for i in file_infos if - i['dominant_style'][holder_name]] - if len(dominant_style) > 0: - print("%4d with '%s'" % (len(dominant_style), - holder_name.replace('\n', '\\n'))) - print_filenames(dominant_style, verbose) - print('') - print(SEPARATOR) - print('Copyrights with year list style:\ne.g. "Copyright (c)" and ' - '", , ...":\n') - for holder_name in EXPECTED_HOLDER_NAMES: - year_list_style = [i['filename'] for i in file_infos if - i['year_list_style'][holder_name]] - if len(year_list_style) > 0: - print("%4d with '%s'" % (len(year_list_style), - holder_name.replace('\n', '\\n'))) - print_filenames(year_list_style, verbose) - print('') - print(SEPARATOR) - print('Copyrights with no "(c)" style:\ne.g. "Copyright" and "" or ' - '"-":\n') - for holder_name in EXPECTED_HOLDER_NAMES: - without_c_style = [i['filename'] for i in file_infos if - i['without_c_style'][holder_name]] - if len(without_c_style) > 0: - print("%4d with '%s'" % (len(without_c_style), - holder_name.replace('\n', '\\n'))) - print_filenames(without_c_style, verbose) - - print('') - print(SEPARATOR) - - unclassified_copyrights = [i['filename'] for i in file_infos if - i['classified_copyrights'] < i['all_copyrights']] - print("%d with unexpected copyright holder names" % - len(unclassified_copyrights)) - print_filenames(unclassified_copyrights, verbose) - print(SEPARATOR) - -def exec_report(base_directory, verbose): - original_cwd = os.getcwd() - os.chdir(base_directory) - filenames = get_filenames_to_examine() - file_infos = [gather_file_info(f) for f in filenames] - print_report(file_infos, verbose) - os.chdir(original_cwd) - -################################################################################ -# report cmd -################################################################################ - -REPORT_USAGE = """ -Produces a report of all copyright header notices found inside the source files -of a repository. - -Usage: - $ ./copyright_header.py report [verbose] - -Arguments: - - The base directory of a bitcoin source code repository. - [verbose] - Includes a list of every file of each subcategory in the report. -""" - -def report_cmd(argv): - if len(argv) == 2: - sys.exit(REPORT_USAGE) - - base_directory = argv[2] - if not os.path.exists(base_directory): - sys.exit("*** bad : %s" % base_directory) - - if len(argv) == 3: - verbose = False - elif argv[3] == 'verbose': - verbose = True - else: - sys.exit("*** unknown argument: %s" % argv[2]) - - exec_report(base_directory, verbose) - -################################################################################ -# query git for year of last change -################################################################################ - -GIT_LOG_CMD = "git log --pretty=format:%%ai %s" - -def call_git_log(filename): - out = subprocess.check_output((GIT_LOG_CMD % filename).split(' ')) - return out.decode("utf-8").split('\n') - -def get_git_change_years(filename): - git_log_lines = call_git_log(filename) - if len(git_log_lines) == 0: - return [datetime.date.today().year] - # timestamp is in ISO 8601 format. e.g. "2016-09-05 14:25:32 -0600" - return [line.split(' ')[0].split('-')[0] for line in git_log_lines] - -def get_most_recent_git_change_year(filename): - return max(get_git_change_years(filename)) - -################################################################################ -# read and write to file -################################################################################ - -def read_file_lines(filename): - f = open(os.path.abspath(filename), 'r', encoding="utf8") - file_lines = f.readlines() - f.close() - return file_lines - -def write_file_lines(filename, file_lines): - f = open(os.path.abspath(filename), 'w', encoding="utf8") - f.write(''.join(file_lines)) - f.close() - -################################################################################ -# update header years execution -################################################################################ - -COPYRIGHT = 'Copyright \(c\)' -YEAR = "20[0-9][0-9]" -YEAR_RANGE = '(%s)(-%s)?' % (YEAR, YEAR) -HOLDER = 'The Bitcoin Core developers' -UPDATEABLE_LINE_COMPILED = re.compile(' '.join([COPYRIGHT, YEAR_RANGE, HOLDER])) - -def get_updatable_copyright_line(file_lines): - index = 0 - for line in file_lines: - if UPDATEABLE_LINE_COMPILED.search(line) is not None: - return index, line - index = index + 1 - return None, None - -def parse_year_range(year_range): - year_split = year_range.split('-') - start_year = year_split[0] - if len(year_split) == 1: - return start_year, start_year - return start_year, year_split[1] - -def year_range_to_str(start_year, end_year): - if start_year == end_year: - return start_year - return "%s-%s" % (start_year, end_year) - -def create_updated_copyright_line(line, last_git_change_year): - copyright_splitter = 'Copyright (c) ' - copyright_split = line.split(copyright_splitter) - # Preserve characters on line that are ahead of the start of the copyright - # notice - they are part of the comment block and vary from file-to-file. - before_copyright = copyright_split[0] - after_copyright = copyright_split[1] - - space_split = after_copyright.split(' ') - year_range = space_split[0] - start_year, end_year = parse_year_range(year_range) - if end_year == last_git_change_year: - return line - return (before_copyright + copyright_splitter + - year_range_to_str(start_year, last_git_change_year) + ' ' + - ' '.join(space_split[1:])) - -def update_updatable_copyright(filename): - file_lines = read_file_lines(filename) - index, line = get_updatable_copyright_line(file_lines) - if not line: - print_file_action_message(filename, "No updatable copyright.") - return - last_git_change_year = get_most_recent_git_change_year(filename) - new_line = create_updated_copyright_line(line, last_git_change_year) - if line == new_line: - print_file_action_message(filename, "Copyright up-to-date.") - return - file_lines[index] = new_line - write_file_lines(filename, file_lines) - print_file_action_message(filename, - "Copyright updated! -> %s" % last_git_change_year) - -def exec_update_header_year(base_directory): - original_cwd = os.getcwd() - os.chdir(base_directory) - for filename in get_filenames_to_examine(): - update_updatable_copyright(filename) - os.chdir(original_cwd) - -################################################################################ -# update cmd -################################################################################ - -UPDATE_USAGE = """ -Updates all the copyright headers of "The Bitcoin Core developers" which were -changed in a year more recent than is listed. For example: - -// Copyright (c) - The Bitcoin Core developers - -will be updated to: - -// Copyright (c) - The Bitcoin Core developers - -where is obtained from the 'git log' history. - -This subcommand also handles copyright headers that have only a single year. In those cases: - -// Copyright (c) The Bitcoin Core developers - -will be updated to: - -// Copyright (c) - The Bitcoin Core developers - -where the update is appropriate. - -Usage: - $ ./copyright_header.py update - -Arguments: - - The base directory of a bitcoin source code repository. -""" - -def print_file_action_message(filename, action): - print("%-52s %s" % (filename, action)) - -def update_cmd(argv): - if len(argv) != 3: - sys.exit(UPDATE_USAGE) - - base_directory = argv[2] - if not os.path.exists(base_directory): - sys.exit("*** bad base_directory: %s" % base_directory) - exec_update_header_year(base_directory) - -################################################################################ -# inserted copyright header format -################################################################################ - -def get_header_lines(header, start_year, end_year): - lines = header.split('\n')[1:-1] - lines[0] = lines[0] % year_range_to_str(start_year, end_year) - return [line + '\n' for line in lines] - -CPP_HEADER = ''' -// Copyright (c) %s The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. -''' - -def get_cpp_header_lines_to_insert(start_year, end_year): - return reversed(get_header_lines(CPP_HEADER, start_year, end_year)) - -PYTHON_HEADER = ''' -# Copyright (c) %s The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. -''' - -def get_python_header_lines_to_insert(start_year, end_year): - return reversed(get_header_lines(PYTHON_HEADER, start_year, end_year)) - -################################################################################ -# query git for year of last change -################################################################################ - -def get_git_change_year_range(filename): - years = get_git_change_years(filename) - return min(years), max(years) - -################################################################################ -# check for existing core copyright -################################################################################ - -def file_already_has_core_copyright(file_lines): - index, _ = get_updatable_copyright_line(file_lines) - return index != None - -################################################################################ -# insert header execution -################################################################################ - -def file_has_hashbang(file_lines): - if len(file_lines) < 1: - return False - if len(file_lines[0]) <= 2: - return False - return file_lines[0][:2] == '#!' - -def insert_python_header(filename, file_lines, start_year, end_year): - if file_has_hashbang(file_lines): - insert_idx = 1 - else: - insert_idx = 0 - header_lines = get_python_header_lines_to_insert(start_year, end_year) - for line in header_lines: - file_lines.insert(insert_idx, line) - write_file_lines(filename, file_lines) - -def insert_cpp_header(filename, file_lines, start_year, end_year): - header_lines = get_cpp_header_lines_to_insert(start_year, end_year) - for line in header_lines: - file_lines.insert(0, line) - write_file_lines(filename, file_lines) - -def exec_insert_header(filename, style): - file_lines = read_file_lines(filename) - if file_already_has_core_copyright(file_lines): - sys.exit('*** %s already has a copyright by The Bitcoin Core developers' - % (filename)) - start_year, end_year = get_git_change_year_range(filename) - if style == 'python': - insert_python_header(filename, file_lines, start_year, end_year) - else: - insert_cpp_header(filename, file_lines, start_year, end_year) - -################################################################################ -# insert cmd -################################################################################ - -INSERT_USAGE = """ -Inserts a copyright header for "The Bitcoin Core developers" at the top of the -file in either Python or C++ style as determined by the file extension. If the -file is a Python file and it has a '#!' starting the first line, the header is -inserted in the line below it. - -The copyright dates will be set to be: - -"-" - -where is according to the 'git log' history. If - is equal to , the date will be set to be: - -"" - -If the file already has a copyright for "The Bitcoin Core developers", the -script will exit. - -Usage: - $ ./copyright_header.py insert - -Arguments: - - A source file in the bitcoin repository. -""" - -def insert_cmd(argv): - if len(argv) != 3: - sys.exit(INSERT_USAGE) - - filename = argv[2] - if not os.path.isfile(filename): - sys.exit("*** bad filename: %s" % filename) - _, extension = os.path.splitext(filename) - if extension not in ['.h', '.cpp', '.cc', '.c', '.py']: - sys.exit("*** cannot insert for file extension %s" % extension) - - if extension == '.py': - style = 'python' - else: - style = 'cpp' - exec_insert_header(filename, style) - -################################################################################ -# UI -################################################################################ - -USAGE = """ -copyright_header.py - utilities for managing copyright headers of 'The Bitcoin -Core developers' in repository source files. - -Usage: - $ ./copyright_header - -Subcommands: - report - update - insert - -To see subcommand usage, run them without arguments. -""" - -SUBCOMMANDS = ['report', 'update', 'insert'] - -if __name__ == "__main__": - if len(sys.argv) == 1: - sys.exit(USAGE) - subcommand = sys.argv[1] - if subcommand not in SUBCOMMANDS: - sys.exit(USAGE) - if subcommand == 'report': - report_cmd(sys.argv) - elif subcommand == 'update': - update_cmd(sys.argv) - elif subcommand == 'insert': - insert_cmd(sys.argv) diff --git a/contrib/devtools/fix-copyright-headers.py b/contrib/devtools/fix-copyright-headers.py new file mode 100755 index 000000000..b6414a551 --- /dev/null +++ b/contrib/devtools/fix-copyright-headers.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +''' +Run this script to update all the copyright headers of files +that were changed this year. + +For example: + +// Copyright (c) 2009-2012 The Bitcoin Core developers + +it will change it to + +// Copyright (c) 2009-2015 The Bitcoin Core developers +''' +import os +import time +import re + +year = time.gmtime()[0] +CMD_GIT_DATE = 'git log --format=@%%at -1 %s | date +"%%Y" -u -f -' +CMD_REGEX= "perl -pi -e 's/(20\d\d)(?:-20\d\d)? The Bitcoin/$1-%s The Bitcoin/' %s" +REGEX_CURRENT= re.compile("%s The Bitcoin" % year) +CMD_LIST_FILES= "find %s | grep %s" + +FOLDERS = ["./qa", "./src"] +EXTENSIONS = [".cpp",".h", ".py"] + +def get_git_date(file_path): + r = os.popen(CMD_GIT_DATE % file_path) + for l in r: + # Result is one line, so just return + return l.replace("\n","") + return "" + +n=1 +for folder in FOLDERS: + for extension in EXTENSIONS: + for file_path in os.popen(CMD_LIST_FILES % (folder, extension)): + file_path = os.getcwd() + file_path[1:-1] + if file_path.endswith(extension): + git_date = get_git_date(file_path) + if str(year) == git_date: + # Only update if current year is not found + if REGEX_CURRENT.search(open(file_path, "r").read()) is None: + print n,"Last git edit", git_date, "-", file_path + os.popen(CMD_REGEX % (year,file_path)) + n = n + 1 diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh deleted file mode 100755 index b5de5a395..000000000 --- a/contrib/devtools/gen-manpages.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C -TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} -BUILDDIR=${BUILDDIR:-$TOPDIR} - -BINDIR=${BINDIR:-$BUILDDIR/src} -MANDIR=${MANDIR:-$TOPDIR/doc/man} - -BITCOIND=${BITCOIND:-$BINDIR/bitcoind} -BITCOINCLI=${BITCOINCLI:-$BINDIR/bitcoin-cli} -BITCOINTX=${BITCOINTX:-$BINDIR/bitcoin-tx} -BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt} - -[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 - -# The autodetected version git tag can screw up manpage output a little bit -BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')) - -# Create a footer file with copyright content. -# This gets autodetected fine for bitcoind if --version-string is not set, -# but has different outcomes for bitcoin-qt and bitcoin-cli. -echo "[COPYRIGHT]" > footer.h2m -$BITCOIND --version | sed -n '1!p' >> footer.h2m - -for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $BITCOINQT; do - cmdname="${cmd##*/}" - help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd} - sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1 -done - -rm -f footer.h2m diff --git a/contrib/devtools/generate_json_api_jrgen.py b/contrib/devtools/generate_json_api_jrgen.py index 34a0f4818..5f19a4d26 100755 --- a/contrib/devtools/generate_json_api_jrgen.py +++ b/contrib/devtools/generate_json_api_jrgen.py @@ -59,13 +59,12 @@ def get_obj_from_dirty_text(full_object: str): last_name = property_name elif len(left) > 1: match = re.match(r'^(\[)?"(?P\w.*?)"(\])?.*', left) - if match is not None: - last_name = match.group('name') - if match.group(1) is not None and match.group(3) is not None: - left = '[' - property_refined_type = 'string' - if 'string' not in line: - raise NotImplementedError('Not implemented: ' + line) + last_name = match.group('name') + if match.group(1) is not None and match.group(3) is not None: + left = '[' + property_refined_type = 'string' + if 'string' not in line: + raise NotImplementedError('Not implemented: ' + line) if left.endswith('['): object_stack.append({'type': 'array', 'items': {'type': property_refined_type}}) @@ -97,15 +96,7 @@ def get_obj_from_dirty_text(full_object: str): ret = obj if ret is not None: if i + 1 < len(lines) - 1: - print('WARNING: unparsable data...', file=sys.stderr) - lines = lines[i+1:] - if not lines[0]: - lines = lines[1:] - nret = get_obj_from_dirty_text("\n".join(lines)) - if not nret: - nret = get_obj_from_dirty_text("\n".join(lines[1:])) - if nret: - ret.update(nret) + print('Ignoring this data (below the parsed object): ' + "\n".join(lines[i+1:]), file=sys.stderr) return ret except Exception as e: print('Exception: ' + str(e), file=sys.stderr) @@ -122,7 +113,7 @@ def get_type(arg_type: str, full_line: str): arg_type = arg_type.lower() if 'array' in arg_type: return 'array', required, None - if 'numeric' in arg_type or 'number' in arg_type: + if 'numeric' in arg_type: return 'number', required, None if 'bool' in arg_type: return 'boolean', required, None @@ -132,11 +123,6 @@ def get_type(arg_type: str, full_line: str): properties = get_obj_from_dirty_text(full_line) if full_line is not None else None return 'object', required, properties - if arg_type.startswith('optional'): - return 'optional', required, None - if arg_type.startswith('json'): - return 'json', required, None - print('Unable to derive type from: ' + arg_type, file=sys.stderr) return None, False, None @@ -288,4 +274,4 @@ def write_api(): if __name__ == '__main__': - write_api() + write_api() \ No newline at end of file diff --git a/contrib/devtools/generate_json_api_v1.py b/contrib/devtools/generate_json_api_v1.py index f2cd1deac..e886a808c 100755 --- a/contrib/devtools/generate_json_api_v1.py +++ b/contrib/devtools/generate_json_api_v1.py @@ -13,22 +13,17 @@ def get_type(arg_type, full_line): if arg_type is None: return 'string' - arg_type = arg_type.lower().split(',')[0].strip() + arg_type = arg_type.lower() if 'numeric' in arg_type: return 'number' if 'bool' in arg_type: return 'boolean' - if 'array' in arg_type: - return 'array' + if 'string' in arg_type: + return 'string' if 'object' in arg_type: return 'object' - supported_types = ['number', 'string', 'object', 'array', 'optional'] - if arg_type in supported_types: - return arg_type - - print("get_type: WARNING", arg_type, "is not supported type", file=sys.stderr) - return arg_type + raise Exception('Not implemented: ' + arg_type) def parse_params(args): @@ -39,7 +34,7 @@ def parse_params(args): continue arg_parsed = re_argline.fullmatch(line) if arg_parsed is None: - continue + raise Exception("Unparsable argument: " + line) arg_name, arg_type, arg_desc = arg_parsed.group('name', 'type', 'desc') if not arg_type: raise Exception('Not implemented: ' + arg_type) @@ -55,29 +50,6 @@ def parse_params(args): return arguments -def process_examples(examples: str): - if not examples: - return [] - examples = examples.strip() - splits = examples.split('\n') - result = [] - inner = {} - for s in splits: - if not s: - continue - if '> curl' in s: - inner['curl'] = s.strip() - elif '> lbrycrd' in s: - inner['cli'] = s.strip() - else: - if 'title' in inner: - result.append(inner) - inner = {} - inner['title'] = s.strip() - result.append(inner) - return result - - def get_api(section_name, command, command_help): parsed = re_full.fullmatch(command_help) @@ -89,7 +61,8 @@ def get_api(section_name, command, command_help): arguments = parse_params(args) cmd_desc = re.sub('\s+', ' ', desc.strip()) if desc else '' - examp_desc = process_examples(exmp) + if exmp and '--skip_examples' not in sys.argv: + cmd_desc += '\nExamples:\n' + exmp.strip() cmd_resl = resl.strip() if resl else None ret = { @@ -97,7 +70,6 @@ def get_api(section_name, command, command_help): 'namespace': section_name, 'description': cmd_desc, 'arguments': arguments, - 'examples': examp_desc } if cmd_resl is not None: ret['returns'] = cmd_resl diff --git a/contrib/devtools/generated/api_jrgen.json b/contrib/devtools/generated/api_jrgen.json index 8a1f3bbf3..d350a4edd 100644 --- a/contrib/devtools/generated/api_jrgen.json +++ b/contrib/devtools/generated/api_jrgen.json @@ -4,7 +4,7 @@ "jsonrpc": "1.0", "info": { "title": "lbrycrd RPC API", - "version": "LBRYcrd Core RPC client version v0.17.1.0-ab5c074ba-dirty", + "version": "LBRYcrd Core RPC client version v0.12.2.0-6fa9ee58-dirty", "description": [] }, "definitions": {}, @@ -22,14 +22,19 @@ "type": "string", "description": "The transaction containing the unspent txout which should be spent." }, - "address": { + "lbrycrdaddress": { "type": "string", "description": "The lbrycrd address to send to." + }, + "amount": { + "type": "number", + "description": "The amount to send to the lbrycrd address. eg 0.1" } }, "required": [ "txid", - "address" + "lbrycrdaddress", + "amount" ] }, "result": { @@ -50,14 +55,19 @@ "type": "string", "description": "The transaction containing the unspent txout which should be spent." }, - "address": { + "lbrycrdaddress": { "type": "string", "description": "The lbrycrd address to send to." + }, + "amount": { + "type": "number", + "description": "The amount to send to the lbrycrd address. eg 0.1" } }, "required": [ "txid", - "address" + "lbrycrdaddress", + "amount" ] }, "result": { @@ -65,29 +75,6 @@ "description": "The new transaction id." } }, - "checknormalization": { - "summary": "Given an unnormalized name of a claim, return normalized version of it", - "description": [], - "tags": [ - "Claimtrie" - ], - "params": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "the name to normalize" - } - }, - "required": [ - "name" - ] - }, - "result": { - "type": "string", - "description": "fully normalized name" - } - }, "claimname": { "summary": "Create a transaction which issues a claim assigning a value to a name. The claim will be authoritative if the transaction amount is greater than the transaction amount of all other unspent transactions which issue a claim over the same name, and it will remain authoritative as long as it remains unspent and there are no other greater unspent transactions issuing a claim over the same name. The amount is a real and is rounded to the nearest 0.00000001", "description": [], @@ -144,15 +131,11 @@ "properties": { "name": { "type": "string", - "description": "the original name of the claim (before normalization)" - }, - "normalized_name": { - "type": "string", - "description": "the name of this claim (after normalization)" + "description": "the name of the claim" }, "value": { "type": "string", - "description": "metadata of the claim" + "description": "claim metadata" }, "claimId": { "type": "string", @@ -174,6 +157,14 @@ "type": "number", "description": "txout amount plus amount from all supports associated with the claim" }, + "height": { + "type": "number", + "description": "the height of the block in which this claim transaction is located" + }, + "valid at height": { + "type": "number", + "description": "the height at which the claim is valid" + }, "supports": { "type": "array", "items": { @@ -198,21 +189,9 @@ "amount": { "type": "number", "description": "the amount of the support" - }, - "value": { - "type": "string", - "description": "the metadata of the support if any" } } } - }, - "height": { - "type": "number", - "description": "the height of the block in which this claim transaction is located" - }, - "valid at height": { - "type": "number", - "description": "the height at which the claim is valid" } } } @@ -229,10 +208,6 @@ "name": { "type": "string", "description": "the name for which to get claims and supports" - }, - "blockhash": { - "type": "string", - "description": "get claims for name at the block specified by this block hash. If none is given, the latest active block will be used." } }, "required": [ @@ -242,14 +217,10 @@ "result": { "type": "object", "properties": { - "nLastTakeoverHeight": { + "nLastTakeoverheight": { "type": "number", "description": "the last height at which ownership of the name changed" }, - "normalized_name": { - "type": "string", - "description": "the name of these claims after normalization" - }, "claims": { "type": "array", "items": { @@ -279,10 +250,6 @@ "type": "number", "description": "the amount of the claim" }, - "value": { - "type": "string", - "description": "the metadata of the claim" - }, "nEffectiveAmount": { "type": "number", "description": "the total effective amount of the claim, taking into effect whether the claim or support has reached its nValidAtHeight" @@ -311,22 +278,14 @@ "nAmount": { "type": "number", "description": "the amount of the support" - }, - "value": { - "type": "string", - "description": "the metadata of the support if any" } } } - }, - "name": { - "type": "string", - "description": "the original name of this claim before normalization" } } } }, - "supports without claims": { + "unmatched supports": { "type": "array", "items": { "type": "object", @@ -382,7 +341,7 @@ "properties": { "nOut": { "type": "number", - "description": "the index of the claim or support in the transaction's list of outputs" + "description": "the index of the claim or support in the transaction's list out outputs" }, "claim type": { "type": "string", @@ -392,10 +351,6 @@ "type": "string", "description": "the name claimed or supported" }, - "claimId": { - "type": "string", - "description": "if a claim, its ID" - }, "value": { "type": "string", "description": "if a name claim, the value of the claim" @@ -437,7 +392,7 @@ } }, "getclaimsintrie": { - "summary": "Return all names in the trie.", + "summary": "Return all claims in the name trie.", "description": [], "tags": [ "Claimtrie" @@ -445,16 +400,104 @@ "params": { "type": "object", "properties": { - "blockhash": { - "type": "string", - "description": "get claims in the trie at the block specified by this block hash. If none is given, the latest active block will be used." + "minconf": { + "type": "number", + "description": "the number of required confirmations", + "default": 1 } }, "required": [] }, "result": { "type": "array", - "description": "all names in the trie that have claims" + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "the name claimed" + }, + "claims": { + "type": "array", + "items": { + "type": "object", + "properties": { + "claimId": { + "type": "string", + "description": "the claimId of the claim" + }, + "txid": { + "type": "string", + "description": "the txid of the claim" + }, + "n": { + "type": "number", + "description": "the vout value of the claim" + }, + "amount": { + "type": "number", + "description": "txout amount" + }, + "height": { + "type": "number", + "description": "the height of the block in which this transaction is located" + }, + "value": { + "type": "string", + "description": "the value of this claim" + } + } + } + } + } + } + } + }, + "getclaimtrie": { + "summary": "Return the entire name trie.", + "description": [], + "tags": [ + "Claimtrie" + ], + "params": { + "type": "object", + "properties": { + "minconf": { + "type": "number", + "description": "the number of required confirmations", + "default": 1 + } + }, + "required": [] + }, + "result": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "the name of the node" + }, + "hash": { + "type": "string", + "description": "the hash of the node" + }, + "txid": { + "type": "string", + "description": "(if value exists) the hash of the transaction which has successfully claimed this name" + }, + "n": { + "type": "number", + "description": "(if value exists) vout value" + }, + "value": { + "type": "number", + "description": "(if value exists) txout value" + }, + "height": { + "type": "number", + "description": "(if value exists) the height of the block in which this transaction is located" + } + } } }, "getnameproof": { @@ -565,7 +608,7 @@ } }, "getvalueforname": { - "summary": "Return the winning value associated with a name, if one exists", + "summary": "Return the value associated with a name, if one exists", "description": [], "tags": [ "Claimtrie" @@ -577,9 +620,10 @@ "type": "string", "description": "the name to look up" }, - "blockhash": { - "type": "string", - "description": "get the value associated with the name at the block specified by this block hash. If none is given, the latest active block will be used." + "minconf": { + "type": "number", + "description": "the number of required confirmations", + "default": 1 } }, "required": [ @@ -588,7 +632,7 @@ }, "result": { "type": "string", - "description": "the value of the name, if it exists \"claimId\" (string) the claimId for this name claim \"txid\" (string) the hash of the transaction which successfully claimed the name \"n\" (numeric) vout value \"amount\" (numeric) txout amount \"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim \"height\" (numeric) the height of the block in which this transaction is located \"name\" (string) the original name of this claim (before normalization)" + "description": "the value of the name, if it exists \"claimId\" (string) the claimId for this name claim \"txid\" (string) the hash of the transaction which successfully claimed the name \"n\" (numeric) vout value \"amount\" (numeric) txout amount \"effective amount\" (numeric) txout amount plus amount from all supports associated with the claim \"height\" (numeric) the height of the block in which this transaction is located" } }, "listnameclaims": { @@ -610,7 +654,7 @@ }, "minconf": { "type": "number", - "description": "Only include transactions confirmed at least this many times.", + "description": "Only include transactions confirmed at least this many time.", "default": 1 } }, @@ -698,7 +742,7 @@ } }, "supportclaim": { - "summary": "Increase the value of a claim. Whichever claim has the greatest value, including all support values, will be the authoritative claim, according to the rest of the rules. The name is the name which is claimed by the claim that will be supported, the txid is the txid of the claim that will be supported, nout is the transaction output which contains the claim to be supported, and amount is the amount which will be added to the value of the claim. If the claim is currently the authoritative claim, this support will go into effect immediately . Otherwise, it will go into effect after 100 blocks. The support will be in effect until it is spent, and will lose its effect when the claim is spent or expires. The amount is a real and is rounded to the nearest .00000001", + "summary": "Increase the value of a claim. Whichever claim has the greatest value, including all support values, will be the authoritative claim, according to the rest of the rules. The name is the name which is claimed by the claim that will be supported, the txid is the txid of the claim that will be supported, nout is the transaction output which contains the claim to be supported, and amount is the amount which will be added to the value of the claim. If the claim is currently the authoritative claim, this support will go into effect immediately. Otherwise, it will go into effect after 100 blocks. The support will be in effect until it is spent, and will lose its effect when the claim is spent or expires. The amount is a real and is rounded to the nearest .00000001", "description": [], "tags": [ "Claimtrie" @@ -717,10 +761,6 @@ "amount": { "type": "number", "description": "The amount in LBC to use to support the claim." - }, - "value": { - "type": "string", - "description": "The metadata of the support encoded in hexadecimal." } }, "required": [ @@ -768,7 +808,7 @@ } }, "getbestblockhash": { - "summary": "Returns the hash of the best (tip) block in the longest blockchain.", + "summary": "Returns the hash of the best (tip) block in the longest block chain. Result \"hex\" (string) the block hash hex encoded", "description": [ "", "> lbrycrd-cli getbestblockhash ", @@ -782,14 +822,10 @@ "type": "object", "properties": {}, "required": [] - }, - "result": { - "type": "string", - "description": "the block hash hex encoded" } }, "getblock": { - "summary": "If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'. If verbosity is 1, returns an Object with information about block . If verbosity is 2, returns an Object with information about block and information about each transaction.", + "summary": "If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'. If verbose is true, returns an Object with information about block .", "description": [ "", "> lbrycrd-cli getblock \"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"", @@ -802,27 +838,104 @@ "params": { "type": "object", "properties": { - "blockhash": { + "hash": { "type": "string", "description": "The block hash" }, - "verbosity": { - "type": "number", - "description": "0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data", - "default": 1 + "verbose": { + "type": "boolean", + "description": "true for a json object, false for the hex encoded data", + "default": true } }, "required": [ - "blockhash" + "hash" ] }, "result": { - "type": "string", - "description": "A string that is serialized, hex-encoded data for block 'hash'. Result (for verbosity = 1): { \"hash\" : \"hash\", (string) the block hash (same as provided) \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain \"size\" : n, (numeric) The block size \"strippedsize\" : n, (numeric) The block size excluding witness data \"weight\" : n (numeric) The block weight as defined in BIP 141 \"height\" : n, (numeric) The block height or index \"version\" : n, (numeric) The block version \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal \"merkleroot\" : \"xxxx\", (string) The merkle root \"nameclaimroot\" : \"xxxx\", (string) The hash of the root of the name claim trie \"tx\" : [ (array of string) The transaction ids \"transactionid\" (string) The transaction id ,... ], \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT) \"nonce\" : n, (numeric) The nonce \"bits\" : \"1d00ffff\", (string) The bits \"difficulty\" : x.xxx, (numeric) The difficulty \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex) \"nTx\" : n, (numeric) The number of transactions in the block. \"previousblockhash\" : \"hash\", (string) The hash of the previous block \"nextblockhash\" : \"hash\" (string) The hash of the next block } Result (for verbosity = 2): { ..., Same output as verbosity = 1. \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result. ,... ], ,... Same output as verbosity = 1. }" + "type": "object", + "properties": { + "hash": { + "type": "string", + "description": "the block hash (same as provided)" + }, + "confirmations": { + "type": "number", + "description": "The number of confirmations, or -1 if the block is not on the main chain" + }, + "size": { + "type": "number", + "description": "The block size" + }, + "height": { + "type": "number", + "description": "The block height or index" + }, + "version": { + "type": "number", + "description": "The block version" + }, + "versionHex": { + "type": "string", + "description": "The block version formatted in hexadecimal" + }, + "merkleroot": { + "type": "string", + "description": "The merkle root" + }, + "nameclaimroot": { + "type": "string", + "description": "The hash of the root of the name claim trie" + }, + "tx": { + "type": "array", + "items": { + "type": "array", + "properties": { + "transactionid": { + "type": "string", + "description": "The transaction id" + } + } + } + }, + "time": { + "type": "number", + "description": "The block time in seconds since epoch (Jan 1 1970 GMT)" + }, + "mediantime": { + "type": "number", + "description": "The median block time in seconds since epoch (Jan 1 1970 GMT)" + }, + "nonce": { + "type": "number", + "description": "The nonce" + }, + "bits": { + "type": "string", + "description": "The bits" + }, + "difficulty": { + "type": "number", + "description": "The difficulty" + }, + "chainwork": { + "type": "string", + "description": "Expected number of hashes required to produce the chain up to this block (in hex)" + }, + "previousblockhash": { + "type": "string", + "description": "The hash of the previous block" + }, + "nextblockhash": { + "type": "string", + "description": "The hash of the next block" + } + } } }, "getblockchaininfo": { - "summary": "Returns an object containing various state info regarding blockchain processing.", + "summary": "Returns an object containing various state info regarding block chain processing.", "description": [ "", "> lbrycrd-cli getblockchaininfo ", @@ -868,33 +981,17 @@ "type": "number", "description": "estimate of verification progress [0..1]" }, - "initialblockdownload": { - "type": "boolean", - "description": "(debug information) estimate of whether this node is in Initial Block Download mode." - }, "chainwork": { "type": "string", "description": "total amount of work in active chain, in hexadecimal" }, - "size_on_disk": { - "type": "number", - "description": "the estimated size of the block and undo files on disk" - }, "pruned": { "type": "boolean", "description": "if the blocks are subject to pruning" }, "pruneheight": { "type": "number", - "description": "lowest-height complete block stored (only present if pruning is enabled)" - }, - "automatic_pruning": { - "type": "boolean", - "description": "whether automatic pruning is enabled (only present if pruning is enabled)" - }, - "prune_target_size": { - "type": "number", - "description": "the target size used by pruning (only present if automatic pruning is enabled)" + "description": "heighest block available" }, "softforks": { "type": "array", @@ -909,12 +1006,24 @@ "type": "number", "description": "block version" }, - "reject": { + "enforce": { "type": "object", "properties": { "status": { "type": "boolean", "description": "true if threshold reached" + }, + "found": { + "type": "number", + "description": "number of blocks with the new version found" + }, + "required": { + "type": "number", + "description": "number of blocks required to trigger" + }, + "window": { + "type": "number", + "description": "maximum size of examined window of recent blocks" } } } @@ -933,11 +1042,11 @@ "properties": { "status": { "type": "string", - "description": "one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"" + "description": "one of \"defined\", \"started\", \"lockedin\", \"active\", \"failed\"" }, "bit": { "type": "number", - "description": "the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)" + "description": "the bit, 0-28, in the block version field used to signal this soft fork" }, "startTime": { "type": "number", @@ -946,49 +1055,16 @@ "timeout": { "type": "number", "description": "the median time past of a block at which the deployment is considered failed if not yet locked in" - }, - "since": { - "type": "number", - "description": "height of the first block to which the status applies" - }, - "statistics": { - "type": "object", - "properties": { - "period": { - "type": "number", - "description": "the length in blocks of the BIP9 signalling period" - }, - "threshold": { - "type": "number", - "description": "the number of blocks with the version bit set required to activate the feature" - }, - "elapsed": { - "type": "number", - "description": "the number of blocks elapsed since the beginning of the current period" - }, - "count": { - "type": "number", - "description": "the number of blocks with the version bit set in the current period" - }, - "possible": { - "type": "boolean", - "description": "returns false if there are not enough blocks left in this period to pass activation threshold" - } - } } } } } - }, - "warnings": { - "type": "string", - "description": "any network and blockchain warnings." } } } }, "getblockcount": { - "summary": "Returns the number of blocks in the longest blockchain.", + "summary": "Returns the number of blocks in the longest block chain.", "description": [ "", "> lbrycrd-cli getblockcount ", @@ -1009,7 +1085,7 @@ } }, "getblockhash": { - "summary": "Returns hash of block in best-block-chain at height provided.", + "summary": "Returns hash of block in best-block-chain at index provided.", "description": [ "", "> lbrycrd-cli getblockhash 1000", @@ -1022,13 +1098,13 @@ "params": { "type": "object", "properties": { - "height": { + "index": { "type": "number", - "description": "The height index" + "description": "The block index" } }, "required": [ - "height" + "index" ] }, "result": { @@ -1091,10 +1167,6 @@ "type": "string", "description": "The merkle root" }, - "nameclaimroot": { - "type": "string", - "description": "The hash of the root of the name claim trie" - }, "time": { "type": "number", "description": "The block time in seconds since epoch (Jan 1 1970 GMT)" @@ -1115,14 +1187,6 @@ "type": "number", "description": "The difficulty" }, - "chainwork": { - "type": "string", - "description": "Expected number of hashes required to produce the current chain (in hex)" - }, - "nTx": { - "type": "number", - "description": "The number of transactions in the block." - }, "previousblockhash": { "type": "string", "description": "The hash of the previous block" @@ -1130,157 +1194,10 @@ "nextblockhash": { "type": "string", "description": "The hash of the next block" - } - } - } - }, - "getblockstats": { - "summary": "Compute per block statistics for a given window. All amounts are in satoshis. It won't work for some heights with pruning. It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.", - "description": [ - "", - "> lbrycrd-cli getblockstats 1000 '[\"minfeerate\",\"avgfeerate\"]'", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblockstats\", \"params\": [1000 '[\"minfeerate\",\"avgfeerate\"]'] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "hash_or_height": { - "type": "number", - "description": "The block hash or height of the target block" }, - "stats": { - "type": "array", - "description": "Values to plot, by default all values (see result below)\n [\n \"height\", (string, optional) Selected statistic\n \"time\", (string, optional) Selected statistic\n ,...\n ]" - } - }, - "required": [ - "hash_or_height" - ] - }, - "result": { - "type": "object", - "properties": { - "avgfee": { - "type": "number", - "description": "Average fee in the block" - }, - "avgfeerate": { - "type": "number", - "description": "Average feerate (in satoshis per virtual byte)" - }, - "avgtxsize": { - "type": "number", - "description": "Average transaction size" - }, - "blockhash": { + "chainwork": { "type": "string", - "description": "The block hash (to check for potential reorgs)" - }, - "feerate_percentiles": { - "type": "array", - "items": { - "type": "array" - } - }, - "height": { - "type": "number", - "description": "The height of the block" - }, - "ins": { - "type": "number", - "description": "The number of inputs (excluding coinbase)" - }, - "maxfee": { - "type": "number", - "description": "Maximum fee in the block" - }, - "maxfeerate": { - "type": "number", - "description": "Maximum feerate (in satoshis per virtual byte)" - }, - "maxtxsize": { - "type": "number", - "description": "Maximum transaction size" - }, - "medianfee": { - "type": "number", - "description": "Truncated median fee in the block" - }, - "mediantime": { - "type": "number", - "description": "The block median time past" - }, - "mediantxsize": { - "type": "number", - "description": "Truncated median transaction size" - }, - "minfee": { - "type": "number", - "description": "Minimum fee in the block" - }, - "minfeerate": { - "type": "number", - "description": "Minimum feerate (in satoshis per virtual byte)" - }, - "mintxsize": { - "type": "number", - "description": "Minimum transaction size" - }, - "outs": { - "type": "number", - "description": "The number of outputs" - }, - "subsidy": { - "type": "number", - "description": "The block subsidy" - }, - "swtotal_size": { - "type": "number", - "description": "Total size of all segwit transactions" - }, - "swtotal_weight": { - "type": "number", - "description": "Total weight of all segwit transactions divided by segwit scale factor (4)" - }, - "swtxs": { - "type": "number", - "description": "The number of segwit transactions" - }, - "time": { - "type": "number", - "description": "The block time" - }, - "total_out": { - "type": "number", - "description": "Total amount in all outputs (excluding coinbase and thus reward [ie subsidy + totalfee])" - }, - "total_size": { - "type": "number", - "description": "Total size of all non-coinbase transactions" - }, - "total_weight": { - "type": "number", - "description": "Total weight of all non-coinbase transactions divided by segwit scale factor (4)" - }, - "totalfee": { - "type": "number", - "description": "The fee total" - }, - "txs": { - "type": "number", - "description": "The number of transactions (excluding coinbase)" - }, - "utxo_increase": { - "type": "number", - "description": "The increase/decrease in the number of unspent outputs" - }, - "utxo_size_inc": { - "type": "number", - "description": "The increase/decrease in size for the utxo index (not discounting op_return and similar)" + "description": "Expected number of hashes required to produce the current chain (in hex)" } } } @@ -1318,65 +1235,6 @@ } } }, - "getchaintxstats": { - "summary": "Compute statistics about the total number and rate of transactions in the chain.", - "description": [ - "", - "> lbrycrd-cli getchaintxstats ", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getchaintxstats\", \"params\": [2016] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "nblocks": { - "type": "number", - "description": "Size of the window in number of blocks (default: one month)." - }, - "blockhash": { - "type": "string", - "description": "The hash of the block that ends the window." - } - }, - "required": [] - }, - "result": { - "type": "object", - "properties": { - "time": { - "type": "number", - "description": "The timestamp for the final block in the window in UNIX format." - }, - "txcount": { - "type": "number", - "description": "The total number of transactions in the chain up to that point." - }, - "window_final_block_hash": { - "type": "string", - "description": "The hash of the final block in the window." - }, - "window_block_count": { - "type": "number", - "description": "Size of the window in number of blocks." - }, - "window_tx_count": { - "type": "number", - "description": "The number of transactions in the window. Only returned if \"window_block_count\" is > 0." - }, - "window_interval": { - "type": "number", - "description": "The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0." - }, - "txrate": { - "type": "number", - "description": "The average rate of transactions per second in the window. Only returned if \"window_interval\" is > 0." - } - } - } - }, "getdifficulty": { "summary": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.", "description": [ @@ -1398,374 +1256,6 @@ "description": "the proof-of-work difficulty as a multiple of the minimum difficulty." } }, - "getmempoolancestors": { - "summary": "If txid is in the mempool, returns all in-mempool ancestors.", - "description": [ - "", - "> lbrycrd-cli getmempoolancestors \"mytxid\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmempoolancestors\", \"params\": [\"mytxid\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The transaction id (must be in mempool)" - }, - "verbose": { - "type": "boolean", - "description": "True for a json object, false for array of transaction ids", - "default": false - } - }, - "required": [ - "txid" - ] - }, - "result": { - "type": "object", - "items": { - "type": "object", - "properties": { - "transactionid": { - "type": "string", - "description": "The transaction id of an in-mempool ancestor transaction" - } - } - }, - "properties": { - "transactionid": { - "type": "object", - "properties": { - "size": { - "type": "number", - "description": "virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted." - }, - "fee": { - "type": "number", - "description": "transaction fee in LBC (DEPRECATED)" - }, - "modifiedfee": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority (DEPRECATED)" - }, - "time": { - "type": "number", - "description": "local time transaction entered pool in seconds since 1 Jan 1970 GMT" - }, - "height": { - "type": "number", - "description": "block height when transaction entered pool" - }, - "descendantcount": { - "type": "number", - "description": "number of in-mempool descendant transactions (including this one)" - }, - "descendantsize": { - "type": "number", - "description": "virtual transaction size of in-mempool descendants (including this one)" - }, - "descendantfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED)" - }, - "ancestorcount": { - "type": "number", - "description": "number of in-mempool ancestor transactions (including this one)" - }, - "ancestorsize": { - "type": "number", - "description": "virtual transaction size of in-mempool ancestors (including this one)" - }, - "ancestorfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED)" - }, - "wtxid": { - "type": "string", - "description": "hash of serialized transaction, including witness data" - }, - "fees": { - "type": "object", - "properties": { - "base": { - "type": "number", - "description": "transaction fee in LBC" - }, - "modified": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority in LBC" - }, - "ancestor": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) in LBC" - }, - "descendant": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) in LBC" - } - } - }, - "depends": { - "type": "array", - "items": { - "type": "array" - } - }, - "spentby": { - "type": "array", - "items": { - "type": "array" - } - } - } - } - } - } - }, - "getmempooldescendants": { - "summary": "If txid is in the mempool, returns all in-mempool descendants.", - "description": [ - "", - "> lbrycrd-cli getmempooldescendants \"mytxid\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmempooldescendants\", \"params\": [\"mytxid\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The transaction id (must be in mempool)" - }, - "verbose": { - "type": "boolean", - "description": "True for a json object, false for array of transaction ids", - "default": false - } - }, - "required": [ - "txid" - ] - }, - "result": { - "type": "object", - "items": { - "type": "object", - "properties": { - "transactionid": { - "type": "string", - "description": "The transaction id of an in-mempool descendant transaction" - } - } - }, - "properties": { - "transactionid": { - "type": "object", - "properties": { - "size": { - "type": "number", - "description": "virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted." - }, - "fee": { - "type": "number", - "description": "transaction fee in LBC (DEPRECATED)" - }, - "modifiedfee": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority (DEPRECATED)" - }, - "time": { - "type": "number", - "description": "local time transaction entered pool in seconds since 1 Jan 1970 GMT" - }, - "height": { - "type": "number", - "description": "block height when transaction entered pool" - }, - "descendantcount": { - "type": "number", - "description": "number of in-mempool descendant transactions (including this one)" - }, - "descendantsize": { - "type": "number", - "description": "virtual transaction size of in-mempool descendants (including this one)" - }, - "descendantfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED)" - }, - "ancestorcount": { - "type": "number", - "description": "number of in-mempool ancestor transactions (including this one)" - }, - "ancestorsize": { - "type": "number", - "description": "virtual transaction size of in-mempool ancestors (including this one)" - }, - "ancestorfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED)" - }, - "wtxid": { - "type": "string", - "description": "hash of serialized transaction, including witness data" - }, - "fees": { - "type": "object", - "properties": { - "base": { - "type": "number", - "description": "transaction fee in LBC" - }, - "modified": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority in LBC" - }, - "ancestor": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) in LBC" - }, - "descendant": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) in LBC" - } - } - }, - "depends": { - "type": "array", - "items": { - "type": "array" - } - }, - "spentby": { - "type": "array", - "items": { - "type": "array" - } - } - } - } - } - } - }, - "getmempoolentry": { - "summary": "Returns mempool data for given transaction", - "description": [ - "", - "> lbrycrd-cli getmempoolentry \"mytxid\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmempoolentry\", \"params\": [\"mytxid\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The transaction id (must be in mempool)" - } - }, - "required": [ - "txid" - ] - }, - "result": { - "type": "object", - "properties": { - "size": { - "type": "number", - "description": "virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted." - }, - "fee": { - "type": "number", - "description": "transaction fee in LBC (DEPRECATED)" - }, - "modifiedfee": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority (DEPRECATED)" - }, - "time": { - "type": "number", - "description": "local time transaction entered pool in seconds since 1 Jan 1970 GMT" - }, - "height": { - "type": "number", - "description": "block height when transaction entered pool" - }, - "descendantcount": { - "type": "number", - "description": "number of in-mempool descendant transactions (including this one)" - }, - "descendantsize": { - "type": "number", - "description": "virtual transaction size of in-mempool descendants (including this one)" - }, - "descendantfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED)" - }, - "ancestorcount": { - "type": "number", - "description": "number of in-mempool ancestor transactions (including this one)" - }, - "ancestorsize": { - "type": "number", - "description": "virtual transaction size of in-mempool ancestors (including this one)" - }, - "ancestorfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED)" - }, - "wtxid": { - "type": "string", - "description": "hash of serialized transaction, including witness data" - }, - "fees": { - "type": "object", - "properties": { - "base": { - "type": "number", - "description": "transaction fee in LBC" - }, - "modified": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority in LBC" - }, - "ancestor": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) in LBC" - }, - "descendant": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) in LBC" - } - } - }, - "depends": { - "type": "array", - "items": { - "type": "array" - } - }, - "spentby": { - "type": "array", - "items": { - "type": "array" - } - } - } - } - }, "getmempoolinfo": { "summary": "Returns details on the active state of the TX memory pool.", "description": [ @@ -1791,7 +1281,7 @@ }, "bytes": { "type": "number", - "description": "Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted" + "description": "Sum of all tx sizes" }, "usage": { "type": "number", @@ -1803,17 +1293,13 @@ }, "mempoolminfee": { "type": "number", - "description": "Minimum fee rate in LBC/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee" - }, - "minrelaytxfee": { - "type": "number", - "description": "Current minimum relay fee for transactions" + "description": "Minimum fee for tx to be accepted" } } } }, "getrawmempool": { - "summary": "Returns all transaction ids in memory pool as a json array of string transaction ids. Hint: use getmempoolentry to fetch a specific transaction from the mempool.", + "summary": "Returns all transaction ids in memory pool as a json array of string transaction ids.", "description": [ "", "> lbrycrd-cli getrawmempool true", @@ -1828,14 +1314,14 @@ "properties": { "verbose": { "type": "boolean", - "description": "True for a json object, false for array of transaction ids", + "description": "true for a json object, false for array of transaction ids", "default": false } }, "required": [] }, "result": { - "type": "object", + "type": "array", "items": { "type": "object", "properties": { @@ -1844,94 +1330,6 @@ "description": "The transaction id" } } - }, - "properties": { - "transactionid": { - "type": "object", - "properties": { - "size": { - "type": "number", - "description": "virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted." - }, - "fee": { - "type": "number", - "description": "transaction fee in LBC (DEPRECATED)" - }, - "modifiedfee": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority (DEPRECATED)" - }, - "time": { - "type": "number", - "description": "local time transaction entered pool in seconds since 1 Jan 1970 GMT" - }, - "height": { - "type": "number", - "description": "block height when transaction entered pool" - }, - "descendantcount": { - "type": "number", - "description": "number of in-mempool descendant transactions (including this one)" - }, - "descendantsize": { - "type": "number", - "description": "virtual transaction size of in-mempool descendants (including this one)" - }, - "descendantfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED)" - }, - "ancestorcount": { - "type": "number", - "description": "number of in-mempool ancestor transactions (including this one)" - }, - "ancestorsize": { - "type": "number", - "description": "virtual transaction size of in-mempool ancestors (including this one)" - }, - "ancestorfees": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED)" - }, - "wtxid": { - "type": "string", - "description": "hash of serialized transaction, including witness data" - }, - "fees": { - "type": "object", - "properties": { - "base": { - "type": "number", - "description": "transaction fee in LBC" - }, - "modified": { - "type": "number", - "description": "transaction fee with fee deltas used for mining priority in LBC" - }, - "ancestor": { - "type": "number", - "description": "modified fees (see above) of in-mempool ancestors (including this one) in LBC" - }, - "descendant": { - "type": "number", - "description": "modified fees (see above) of in-mempool descendants (including this one) in LBC" - } - } - }, - "depends": { - "type": "array", - "items": { - "type": "array" - } - }, - "spentby": { - "type": "array", - "items": { - "type": "array" - } - } - } - } } } }, @@ -1964,9 +1362,9 @@ "type": "number", "description": "vout number" }, - "include_mempool": { + "includemempool": { "type": "boolean", - "description": "Whether to include the mempool. Default: true. Note that an unspent output that is spent in the mempool won't appear." + "description": "Whether to include the mem pool" } }, "required": [ @@ -1979,7 +1377,7 @@ "properties": { "bestblock": { "type": "string", - "description": "The hash of the block at the tip of the chain" + "description": "the block hash" }, "confirmations": { "type": "number", @@ -2013,7 +1411,7 @@ "items": { "type": "array", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", "description": "lbrycrd address" } @@ -2022,6 +1420,10 @@ } } }, + "version": { + "type": "number", + "description": "The version" + }, "coinbase": { "type": "boolean", "description": "Coinbase or not" @@ -2030,7 +1432,7 @@ } }, "gettxoutproof": { - "summary": "Returns a hex-encoded proof that \"txid\" was included in a block. NOTE: By default this function only works sometimes. This is when there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option or specify the block in which the transaction is included manually (by blockhash).", + "summary": "Returns a hex-encoded proof that \"txid\" was included in a block. NOTE: By default this function only works sometimes. This is when there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option or specify the block in which the transaction is included in manually (by blockhash). Return the raw transaction data.", "description": [], "tags": [ "Blockchain" @@ -2042,7 +1444,7 @@ "type": "string", "description": "A json array of txids to filter [ \"txid\" (string) A transaction hash ,... ]" }, - "blockhash": { + "block hash": { "type": "string", "description": "If specified, looks for txid in the block with this hash" } @@ -2081,28 +1483,24 @@ }, "bestblock": { "type": "string", - "description": "The hash of the block at the tip of the chain" + "description": "the best block hash hex" }, "transactions": { "type": "number", - "description": "The number of transactions with unspent outputs" + "description": "The number of transactions" }, "txouts": { "type": "number", - "description": "The number of unspent transaction outputs" + "description": "The number of output transactions" }, - "bogosize": { + "bytes_serialized": { "type": "number", - "description": "A meaningless metric for UTXO set size" + "description": "The serialized size" }, - "hash_serialized_2": { + "hash_serialized": { "type": "string", "description": "The serialized hash" }, - "disk_size": { - "type": "number", - "description": "The estimated size of the chainstate on disk" - }, "total_amount": { "type": "number", "description": "The total amount" @@ -2110,130 +1508,6 @@ } } }, - "preciousblock": { - "summary": "Treats a block as if it were received before others with the same work. A later preciousblock call can override the effect of an earlier one. The effects of preciousblock are not retained across restarts.", - "description": [ - "", - "> lbrycrd-cli preciousblock \"blockhash\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"preciousblock\", \"params\": [\"blockhash\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "blockhash": { - "type": "string", - "description": "the hash of the block to mark as precious" - } - }, - "required": [ - "blockhash" - ] - } - }, - "pruneblockchain": { - "summary": "", - "description": [ - "", - "> lbrycrd-cli pruneblockchain 1000", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"pruneblockchain\", \"params\": [1000] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": { - "height": { - "type": "number", - "description": "The block height to prune up to. May be set to a discrete height, or a unix timestamp to prune blocks whose block time is at least 2 hours older than the provided timestamp." - } - }, - "required": [ - "height" - ] - }, - "result": { - "type": "number", - "description": "Height of the last block pruned." - } - }, - "savemempool": { - "summary": "Dumps the mempool to disk. It will fail until the previous dump is fully loaded.", - "description": [ - "", - "> lbrycrd-cli savemempool ", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"savemempool\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": {}, - "required": [] - } - }, - "scantxoutset": { - "summary": "EXPERIMENTAL warning: this call may be removed or changed in future releases. Scans the unspent transaction output set for entries that match certain output descriptors.", - "description": [ - "", - " addr(
) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)", - " raw() Outputs whose scriptPubKey equals the specified hex scripts", - " combo() P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey", - " pkh() P2PKH outputs for the given pubkey", - " sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys", - "", - "In the above, either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one", - "or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all", - "unhardened or hardened child keys.", - "In the latter case, a range needs to be specified by below if different from 1000.", - "For more information on output descriptors, see the documentation in the doc/descriptors.md file.", - "", - "Arguments:", - "1. \"action\" (string, required) The action to execute", - " \"start\" for starting a scan", - " \"abort\" for aborting the current scan (returns true when abort was successful)", - " \"status\" for progress report (in %) of the current scan", - "2. \"scanobjects\" (array, required) Array of scan objects", - " [ Every scan object is either a string descriptor or an object:", - " \"descriptor\", (string, optional) An output descriptor", - " { (object, optional) An object with output descriptor and metadata", - " \"desc\": \"descriptor\", (string, required) An output descriptor", - " \"range\": n, (numeric, optional) Up to what child index HD chains should be explored (default: 1000)", - " },", - " ...", - " ]", - "", - "Result:", - "{", - " \"unspents\": [", - " {", - " \"txid\" : \"transactionid\", (string) The transaction id", - " \"vout\": n, (numeric) the vout value", - " \"scriptPubKey\" : \"script\", (string) the script key", - " \"amount\" : x.xxx, (numeric) The total amount in LBC of the unspent output", - " \"height\" : n, (numeric) Height of the unspent transaction output", - " }", - " ,...], ", - " \"total_amount\" : x.xxx, (numeric) The total amount of all found unspent outputs in LBC", - "]", - "" - ], - "tags": [ - "Blockchain" - ], - "params": { - "type": "object", - "properties": {}, - "required": [] - } - }, "verifychain": { "summary": "Verifies blockchain database.", "description": [ @@ -2253,10 +1527,10 @@ "description": "How thorough the block verification is.", "default": 3 }, - "nblocks": { + "numblocks": { "type": "number", "description": "The number of blocks to check.", - "default": 24 + "default": 288 } }, "required": [] @@ -2285,12 +1559,12 @@ ] } }, - "getmemoryinfo": { - "summary": "Returns an object containing information about memory usage.", + "getinfo": { + "summary": "Returns an object containing various state info.", "description": [ "", - "> lbrycrd-cli getmemoryinfo ", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getmemoryinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> lbrycrd-cli getinfo ", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getinfo\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -2298,47 +1572,75 @@ ], "params": { "type": "object", - "properties": { - "null": { - "type": "object", - "description": "\"mode\" determines what kind of information is returned. This argument is optional, the default mode is \"stats\".\n - \"stats\" returns general statistics about memory usage in the daemon.\n - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+)." - } - }, - "required": [ - null - ] + "properties": {}, + "required": [] }, "result": { "type": "object", "properties": { - "locked": { - "type": "object", - "properties": { - "used": { - "type": "number", - "description": "Number of bytes used" - }, - "free": { - "type": "number", - "description": "Number of bytes available in current arenas" - }, - "total": { - "type": "number", - "description": "Total number of bytes managed" - }, - "locked": { - "type": "number", - "description": "Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk." - }, - "chunks_used": { - "type": "number", - "description": "Number allocated chunks" - }, - "chunks_free": { - "type": "number", - "description": "Number unused chunks" - } - } + "version": { + "type": "number", + "description": "the server version" + }, + "protocolversion": { + "type": "number", + "description": "the protocol version" + }, + "walletversion": { + "type": "number", + "description": "the wallet version" + }, + "balance": { + "type": "number", + "description": "the total lbrycrd balance of the wallet" + }, + "blocks": { + "type": "number", + "description": "the current number of blocks processed in the server" + }, + "timeoffset": { + "type": "number", + "description": "the time offset" + }, + "connections": { + "type": "number", + "description": "the number of connections" + }, + "proxy": { + "type": "string", + "description": "the proxy used by the server" + }, + "difficulty": { + "type": "number", + "description": "the current difficulty" + }, + "testnet": { + "type": "boolean", + "description": "if the server is using testnet or not" + }, + "keypoololdest": { + "type": "number", + "description": "the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool" + }, + "keypoolsize": { + "type": "number", + "description": "how many new keys are pre-generated" + }, + "unlocked_until": { + "type": "number", + "description": "the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked" + }, + "paytxfee": { + "type": "number", + "description": "the transaction fee set in LBC/kB" + }, + "relayfee": { + "type": "number", + "description": "minimum relay fee for non-free transactions in LBC/kB" + }, + "errors": { + "type": "string", + "description": "any error messages" } } } @@ -2364,43 +1666,8 @@ "description": "The help text" } }, - "logging": { - "summary": "Gets and sets the logging configuration. When called without an argument, returns the list of categories with status that are currently being debug logged or not. When called with arguments, adds or removes categories from debug logging and return the lists above. The arguments are evaluated in order \"include\", \"exclude\". If an item is both included and excluded, it will thus end up being excluded. The valid logging categories are: net, tor, mempool, http, bench, zmq, db, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb In addition, the following are available as category names with special meanings: - \"all\", \"1\" : represent all logging categories. - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.", - "description": [ - "", - "> lbrycrd-cli logging \"[\\\"all\\\"]\" \"[\\\"http\\\"]\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"logging\", \"params\": [[\"all\"], \"[libevent]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Control" - ], - "params": { - "type": "object", - "properties": { - "include": { - "type": "array", - "description": "A json array of categories to add debug logging\n [\n \"category\" (string) the valid logging category\n ,...\n ]" - }, - "exclude": { - "type": "array", - "description": "A json array of categories to remove debug logging\n [\n \"category\" (string) the valid logging category\n ,...\n ]" - } - }, - "required": [] - }, - "result": { - "type": "object", - "properties": { - "category": { - "type": "number", - "description": "if being debug logged or not. 0:inactive, 1:active" - } - } - } - }, "stop": { - "summary": "Stop lbrycrd server.", + "summary": "Stop LBRYcrd server.", "description": [], "tags": [ "Control" @@ -2411,29 +1678,8 @@ "required": [] } }, - "uptime": { - "summary": "Returns the total uptime of the server.", - "description": [ - "", - "> lbrycrd-cli uptime ", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"uptime\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Control" - ], - "params": { - "type": "object", - "properties": {}, - "required": [] - }, - "result": { - "type": "number", - "description": "The number of seconds that the server has been running" - } - }, "generate": { - "summary": "Mine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.", + "summary": "Mine up to numblocks blocks immediately (before the RPC call returns)", "description": [ "", "", @@ -2447,17 +1693,17 @@ "params": { "type": "object", "properties": { - "nblocks": { + "numblocks": { "type": "number", "description": "How many blocks are generated immediately." }, "maxtries": { "type": "number", - "description": "How many iterations to try (default = 1000000)." + "description": "How many iterations to try (default = 1000000). Result [ blockhashes ] (array) hashes of blocks generated" } }, "required": [ - "nblocks" + "numblocks" ] } }, @@ -2476,31 +1722,31 @@ "params": { "type": "object", "properties": { - "nblocks": { + "numblocks": { "type": "number", "description": "How many blocks are generated immediately." }, "address": { "type": "string", - "description": "The address to send the newly generated lbry to." + "description": "The address to send the newly generated bitcoin to." }, "maxtries": { "type": "number", - "description": "How many iterations to try (default = 1000000)." + "description": "How many iterations to try (default = 1000000). Result [ blockhashes ] (array) hashes of blocks generated" } }, "required": [ - "nblocks", + "numblocks", "address" ] } }, "getblocktemplate": { - "summary": "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. For full specification, see BIPs 22, 23, 9, and 145: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki", + "summary": "If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.", "description": [ "", - "> lbrycrd-cli getblocktemplate {\"rules\": [\"segwit\"]}", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblocktemplate\", \"params\": [{\"rules\": [\"segwit\"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> lbrycrd-cli getblocktemplate ", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getblocktemplate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -2509,38 +1755,9 @@ "params": { "type": "object", "properties": { - "template_request": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "description": "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted" - }, - "capabilities": { - "type": "array", - "items": { - "type": "array", - "properties": { - "support": { - "type": "string", - "description": "client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'" - } - } - } - }, - "rules": { - "type": "array", - "items": { - "type": "array", - "properties": { - "support": { - "type": "string", - "description": "client side supported softfork deployment" - } - } - } - } - } + "jsonrequestobject": { + "type": "string", + "description": "A json object in the following spec { \"mode\":\"template\" (string, optional) This must be set to \"template\" or omitted \"capabilities\":[ (array, optional) A list of strings \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid' ,... ] }" } }, "required": [] @@ -2550,20 +1767,7 @@ "properties": { "version": { "type": "number", - "description": "The preferred block version" - }, - "vbavailable": { - "type": "object", - "properties": { - "rulename": { - "type": "number", - "description": "identifies the bit number as indicating acceptance and readiness for the named softfork rule" - } - } - }, - "vbrequired": { - "type": "number", - "description": "bit mask of versionbits the server requires set in submissions" + "description": "The block version" }, "previousblockhash": { "type": "string", @@ -2578,13 +1782,9 @@ "type": "string", "description": "transaction data encoded in hexadecimal (byte-for-byte)" }, - "txid": { - "type": "string", - "description": "transaction id encoded in little-endian hexadecimal" - }, "hash": { "type": "string", - "description": "hash encoded in little-endian hexadecimal (including witness data)" + "description": "hash/id encoded in little-endian hexadecimal" }, "depends": { "type": "array", @@ -2600,15 +1800,15 @@ }, "fee": { "type": "number", - "description": "difference in value between transaction inputs and outputs (in satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one" + "description": "difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one" }, "sigops": { "type": "number", - "description": "total SigOps cost, as counted for purposes of block limits; if key is not present, sigop cost is unknown and clients MUST NOT assume it is zero" + "description": "total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any" }, - "weight": { - "type": "number", - "description": "total transaction weight, as counted for purposes of block limits" + "required": { + "type": "boolean", + "description": "if provided and true, this transaction must be in the final block" } } } @@ -2618,13 +1818,13 @@ "properties": { "flags": { "type": "string", - "description": "key name is to be ignored, and value included in scriptSig" + "description": "" } } }, "coinbasevalue": { "type": "number", - "description": "maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)" + "description": "maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis)" }, "target": { "type": "string", @@ -2658,10 +1858,6 @@ "type": "number", "description": "limit of block size" }, - "weightlimit": { - "type": "number", - "description": "limit of block weight" - }, "curtime": { "type": "number", "description": "current timestamp in seconds since epoch (Jan 1 1970 GMT)" @@ -2673,14 +1869,48 @@ "height": { "type": "number", "description": "The height of the next block" - }, - "claimtrie": { - "type": "string", - "description": "The root hash of the claim trie in hex" } } } }, + "getgenerate": { + "summary": "Return if the server is set to generate coins or not. The default is false. It is set with the command line argument -gen (or lbrycrd.conf setting gen) It can also be set with the setgenerate call. Result true|false (boolean) If the server is set to generate coins or not", + "description": [ + "", + "> lbrycrd-cli getgenerate ", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getgenerate\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "" + ], + "tags": [ + "Mining" + ], + "params": { + "type": "object", + "properties": {}, + "required": [] + } + }, + "gethashespersec": { + "summary": "Returns a recent hashes per second performance measurement while generating. See the getgenerate and setgenerate calls to turn generation on and off.", + "description": [ + "", + "> lbrycrd-cli gethashespersec ", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"gethashespersec\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "" + ], + "tags": [ + "Mining" + ], + "params": { + "type": "object", + "properties": {}, + "required": [] + }, + "result": { + "type": "number", + "description": "The recent hashes per second when generation is on (will return 0 if generation is off)" + } + }, "getmininginfo": { "summary": "Returns a json object containing mining-related information.", "description": [ @@ -2704,9 +1934,9 @@ "type": "number", "description": "The current block" }, - "currentblockweight": { + "currentblocksize": { "type": "number", - "description": "The last block weight" + "description": "The last block size" }, "currentblocktx": { "type": "number", @@ -2716,21 +1946,33 @@ "type": "number", "description": "The current difficulty" }, - "networkhashps": { + "errors": { + "type": "string", + "description": "Current errors" + }, + "generate": { + "type": "boolean", + "description": "If the generation is on or off (see getgenerate or setgenerate calls)" + }, + "genproclimit": { "type": "number", - "description": "The network hashes per second" + "description": "The processor limit for generation. -1 if no generation. (see getgenerate or setgenerate calls)" + }, + "hashespersec": { + "type": "number", + "description": "The hashes per second of the generation, or 0 if no generation." }, "pooledtx": { "type": "number", - "description": "The size of the mempool" + "description": "The size of the mem pool" + }, + "testnet": { + "type": "boolean", + "description": "If using testnet or not" }, "chain": { "type": "string", "description": "current network name as defined in BIP70 (main, test, regtest)" - }, - "warnings": { - "type": "string", - "description": "any network and blockchain warnings" } } } @@ -2749,7 +1991,7 @@ "params": { "type": "object", "properties": { - "nblocks": { + "blocks": { "type": "number", "description": "The number of blocks, or -1 for blocks since last difficulty change.", "default": 120 @@ -2785,27 +2027,62 @@ "type": "string", "description": "The transaction id." }, - "dummy": { + "priority delta": { "type": "number", - "description": "API-Compatibility for previous API. Must be zero or null. DEPRECATED. For forward compatibility use named arguments and omit this parameter." + "description": "The priority to add or subtract. The transaction selection algorithm considers the tx as it would have a higher priority. (priority of a transaction is calculated: coinage * value_in_satoshis / txsize)" }, - "fee_delta": { + "fee delta": { "type": "number", - "description": "The fee value (in satoshis) to add (or subtract, if negative). Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX. The fee is not actually paid, only the algorithm for selecting transactions into a block considers the transaction as it would have paid a higher (or lower) fee." + "description": "The fee value (in satoshis) to add (or subtract, if negative). The fee is not actually paid, only the algorithm for selecting transactions into a block considers the transaction as it would have paid a higher (or lower) fee. Result true (boolean) Returns true" } }, "required": [ "txid", - "fee_delta" + "priority delta", + "fee delta" + ] + } + }, + "setgenerate": { + "summary": "Set 'generate' true or false to turn generation on or off. Generation is limited to 'genproclimit' processors, -1 is unlimited. See the getgenerate call for the current setting.", + "description": [ + "", + "", + "Set the generation on with a limit of one processor", + "> lbrycrd-cli setgenerate true 1", + "", + "Check the setting", + "> lbrycrd-cli getgenerate ", + "", + "Turn off generation", + "> lbrycrd-cli setgenerate false", + "", + "Using json rpc", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setgenerate\", \"params\": [true, 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "" + ], + "tags": [ + "Mining" + ], + "params": { + "type": "object", + "properties": { + "generate": { + "type": "boolean", + "description": "Set to true to turn on generation, off to turn off." + }, + "genproclimit": { + "type": "number", + "description": "Set the processor limit for when generation is on. Can be -1 for unlimited." + } + }, + "required": [ + "generate" ] - }, - "result": { - "type": "boolean", - "description": "Returns true" } }, "submitblock": { - "summary": "Attempts to submit new block to network. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.", + "summary": "Attempts to submit new block to network. The 'jsonparametersobject' parameter is currently ignored. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.", "description": [ "", "> lbrycrd-cli submitblock \"mydata\"", @@ -2822,23 +2099,18 @@ "type": "string", "description": "the hex-encoded block data to submit" }, - "dummy": { - "type": "optional", - "description": "dummy value, for compatibility with BIP" - }, - "null": { - "type": "object", - "description": "This value is ignored." + "jsonparametersobject": { + "type": "string", + "description": "object of optional parameters { \"workid\" : \"id\" (string, optional) if the server provided a workid, it MUST be included with submissions }" } }, "required": [ - "hexdata", - null + "hexdata" ] } }, "addnode": { - "summary": "Attempts to add or remove a node from the addnode list. Or try a connection to a node once. Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).", + "summary": "Attempts add or remove a node from the addnode list. Or try a connection to a node once.", "description": [ "", "> lbrycrd-cli addnode \"192.168.0.6:8333\" \"onetry\"", @@ -2884,39 +2156,11 @@ } }, "disconnectnode": { - "summary": "Immediately disconnects from the specified peer node. Strictly one out of 'address' and 'nodeid' can be provided to identify the node. To disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.", + "summary": "Immediately disconnects from the specified node.", "description": [ "", "> lbrycrd-cli disconnectnode \"192.168.0.6:8333\"", - "> lbrycrd-cli disconnectnode \"\" 1", "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"disconnectnode\", \"params\": [\"192.168.0.6:8333\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"disconnectnode\", \"params\": [\"\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Network" - ], - "params": { - "type": "object", - "properties": { - "address": { - "type": "string", - "description": "The IP address/port of the node" - }, - "nodeid": { - "type": "number", - "description": "The node ID (see getpeerinfo for node IDs)" - } - }, - "required": [] - } - }, - "getaddednodeinfo": { - "summary": "Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here)", - "description": [ - "", - "> lbrycrd-cli getaddednodeinfo \"192.168.0.201\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddednodeinfo\", \"params\": [\"192.168.0.201\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -2925,12 +2169,43 @@ "params": { "type": "object", "properties": { + "node": { + "type": "string", + "description": "The node (see getpeerinfo for nodes)" + } + }, + "required": [ + "node" + ] + } + }, + "getaddednodeinfo": { + "summary": "Returns information about the given added node, or all added nodes (note that onetry addnodes are not listed here) If dns is false, only a list of added nodes will be provided, otherwise connected information will also be available.", + "description": [ + "", + "> lbrycrd-cli getaddednodeinfo true", + "> lbrycrd-cli getaddednodeinfo true \"192.168.0.201\"", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddednodeinfo\", \"params\": [true, \"192.168.0.201\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "" + ], + "tags": [ + "Network" + ], + "params": { + "type": "object", + "properties": { + "dns": { + "type": "boolean", + "description": "If false, only a list of added nodes will be provided, otherwise connected information will also be available." + }, "node": { "type": "string", "description": "If provided, return information about this specific node, otherwise all nodes are returned." } }, - "required": [] + "required": [ + "dns" + ] }, "result": { "type": "array", @@ -2939,7 +2214,7 @@ "properties": { "addednode": { "type": "string", - "description": "The node IP address or name (as provided to addnode)" + "description": "The node ip address" }, "connected": { "type": "boolean", @@ -2952,7 +2227,7 @@ "properties": { "address": { "type": "string", - "description": "The lbrycrd server IP and port we're connected to" + "description": "The lbrycrd server host and port" }, "connected": { "type": "string", @@ -3015,7 +2290,7 @@ }, "timemillis": { "type": "number", - "description": "Current UNIX time in milliseconds" + "description": "Total cpu time" }, "uploadtarget": { "type": "object", @@ -3084,10 +2359,6 @@ "type": "string", "description": "the services we offer to the network" }, - "localrelay": { - "type": "boolean", - "description": "true if transaction relay is requested from peers" - }, "timeoffset": { "type": "number", "description": "the time offset" @@ -3096,10 +2367,6 @@ "type": "number", "description": "the number of connections" }, - "networkactive": { - "type": "boolean", - "description": "whether p2p networking is enabled" - }, "networks": { "type": "array", "items": { @@ -3120,21 +2387,13 @@ "proxy": { "type": "string", "description": "the proxy that is used for this network, or empty if none" - }, - "proxy_randomize_credentials": { - "type": "string", - "description": "Whether randomized credentials are used" } } } }, "relayfee": { "type": "number", - "description": "minimum relay fee for transactions in LBC/kB" - }, - "incrementalfee": { - "type": "number", - "description": "minimum fee increment for mempool limiting or BIP 125 replacement in LBC/kB" + "description": "minimum relay fee for non-free transactions in LBC/kB" }, "localaddresses": { "type": "array", @@ -3158,7 +2417,7 @@ }, "warnings": { "type": "string", - "description": "any network and blockchain warnings" + "description": "any network warnings (such as alert messages)" } } } @@ -3190,15 +2449,11 @@ }, "addr": { "type": "string", - "description": "The IP address and port of the peer" - }, - "addrbind": { - "type": "string", - "description": "Bind address of the connection to the peer" + "description": "The ip address and port of the peer" }, "addrlocal": { "type": "string", - "description": "Local address as reported by the peer" + "description": "local address" }, "services": { "type": "string", @@ -3246,7 +2501,7 @@ }, "version": { "type": "number", - "description": "The peer version, such as 70001" + "description": "The peer version, such as 7001" }, "subver": { "type": "string", @@ -3256,10 +2511,6 @@ "type": "boolean", "description": "Inbound (true) or Outbound (false)" }, - "addnode": { - "type": "boolean", - "description": "Whether connection was due to addnode/-connect or if it was an automatic/inbound connection" - }, "startingheight": { "type": "number", "description": "The starting height (block) of the peer" @@ -3288,10 +2539,6 @@ } } }, - "whitelisted": { - "type": "boolean", - "description": "Whether the peer is whitelisted" - }, "bytessent_per_msg": { "type": "object", "properties": { @@ -3349,12 +2596,12 @@ } }, "setban": { - "summary": "Attempts to add or remove an IP/Subnet from the banned list.", + "summary": "Attempts add or remove a IP/Subnet from the banned list.", "description": [ "", "> lbrycrd-cli setban \"192.168.0.6\" \"add\" 86400", "> lbrycrd-cli setban \"192.168.0.0/24\" \"add\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setban\", \"params\": [\"192.168.0.6\", \"add\", 86400] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"setban\", \"params\": [\"192.168.0.6\", \"add\" 86400] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -3363,193 +2610,37 @@ "params": { "type": "object", "properties": { - "subnet": { + "ip(/netmask)": { "type": "string", - "description": "The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)" + "description": "The IP/Subnet (see getpeerinfo for nodes ip) with a optional netmask (default is /32 = single ip)" }, "command": { "type": "string", - "description": "'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list" + "description": "'add' to add a IP/Subnet to the list, 'remove' to remove a IP/Subnet from the list" }, "bantime": { "type": "number", - "description": "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)" + "description": "time in seconds how long (or until when if [absolute] is set) the ip is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)" }, "absolute": { "type": "boolean", - "description": "If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)" + "description": "If set, the bantime must be a absolute timestamp in seconds since epoch (Jan 1 1970 GMT)" } }, "required": [ - "subnet", + "ip(/netmask)", "command" ] } }, - "setnetworkactive": { - "summary": "Disable/enable all p2p network activity.", - "description": [], - "tags": [ - "Network" - ], - "params": { - "type": "object", - "properties": { - "state": { - "type": "boolean", - "description": "true to enable networking, false to disable" - } - }, - "required": [ - "state" - ] - } - }, - "combinepsbt": { - "summary": "Combine multiple partially signed LBRY transactions into one transaction. Implements the Combiner role.", - "description": [ - "", - "> lbrycrd-cli combinepsbt [\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "txs": { - "type": "string", - "description": "A json array of base64 strings of partially signed transactions [ \"psbt\" (string) A base64 string of a PSBT ,... ]" - } - }, - "required": [ - "txs" - ] - }, - "result": { - "type": "string", - "description": "The base64-encoded partially signed transaction" - } - }, - "combinerawtransaction": { - "summary": "Combine multiple partially signed transactions into one transaction. The combined transaction may be another partially signed transaction or a fully signed transaction.", - "description": [ - "", - "> lbrycrd-cli combinerawtransaction [\"myhex1\", \"myhex2\", \"myhex3\"]", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "txs": { - "type": "string", - "description": "A json array of hex strings of partially signed transactions [ \"hexstring\" (string) A transaction hash ,... ]" - } - }, - "required": [ - "txs" - ] - }, - "result": { - "type": "string", - "description": "The hex-encoded raw transaction with signature(s)" - } - }, - "converttopsbt": { - "summary": "Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction createpsbt and walletcreatefundedpsbt should be used for new applications.", - "description": [ - "", - "", - "Create a transaction", - "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"", - "", - "Convert the transaction to a PSBT", - "> lbrycrd-cli converttopsbt \"rawtransaction\"", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "hexstring": { - "type": "string", - "description": "The hex string of a raw transaction" - }, - "permitsigdata": { - "type": "boolean", - "description": "If true, any signatures in the input will be discarded and conversion. will continue. If false, RPC will fail if any signatures are present.", - "default": false - }, - "iswitness": { - "type": "boolean", - "description": "Whether the transaction hex is a serialized witness transaction. If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion will be tried. If false, only non-witness deserialization wil be tried. Only has an effect if permitsigdata is true." - } - }, - "required": [ - "hexstring" - ] - }, - "result": { - "type": "string", - "description": "The resulting raw transaction (base64-encoded string)" - } - }, - "createpsbt": { - "summary": "Creates a transaction in the Partially Signed Transaction format. Implements the Creator role.", - "description": [ - "", - "> lbrycrd-cli createpsbt \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "inputs": { - "type": "array", - "description": "A json array of json objects\n [\n {\n \"txid\":\"id\", (string, required) The transaction id\n \"vout\":n, (numeric, required) The output number\n \"sequence\":n (numeric, optional) The sequence number\n } \n ,...\n ]" - }, - "outputs": { - "type": "array", - "description": "a json array with outputs (key-value pairs), where none of the keys are duplicated.\nThat is, each address can only appear once and there can only be one 'data' object.\n [\n {\n \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the lbry address, the value (float or string) is the amount in LBC\n },\n {\n \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex encoded data\n }\n ,... More key-value pairs of the above form. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n accepted as second parameter.\n ]" - }, - "locktime": { - "type": "number", - "description": "Raw locktime. Non-0 value also locktime-activates inputs", - "default": 0 - }, - "replaceable": { - "type": "boolean", - "description": "Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.", - "default": false - } - }, - "required": [ - "inputs", - "outputs" - ] - }, - "result": { - "type": "string", - "description": "The resulting raw transaction (base64-encoded string)" - } - }, "createrawtransaction": { "summary": "Create a transaction spending the given inputs and creating new outputs. Outputs can be addresses or data. Returns hex-encoded raw transaction. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.", "description": [ "", - "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"address\\\":0.01}]\"", - "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"address\\\":0.01}]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"", + "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -3558,27 +2649,22 @@ "params": { "type": "object", "properties": { - "inputs": { - "type": "array", - "description": "A json array of json objects\n [\n {\n \"txid\":\"id\", (string, required) The transaction id\n \"vout\":n, (numeric, required) The output number\n \"sequence\":n (numeric, optional) The sequence number\n } \n ,...\n ]" + "transactions": { + "type": "string", + "description": "A json array of json objects [ { \"txid\":\"id\", (string, required) The transaction id \"vout\":n (numeric, required) The output number } ,... ]" }, "outputs": { - "type": "array", - "description": "a json array with outputs (key-value pairs), where none of the keys are duplicated.\nThat is, each address can only appear once and there can only be one 'data' object.\n [\n {\n \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the lbry address, the value (float or string) is the amount in LBC\n },\n {\n \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex encoded data\n }\n ,... More key-value pairs of the above form. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n accepted as second parameter.\n ]" + "type": "string", + "description": "a json object with outputs { \"address\": x.xxx (numeric or string, required) The key is the lbrycrd address, the numeric value (can be string) is the LBC amount \"data\": \"hex\", (string, required) The key is \"data\", the value is hex encoded data ... }" }, "locktime": { "type": "number", "description": "Raw locktime. Non-0 value also locktime-activates inputs", "default": 0 - }, - "replaceable": { - "type": "boolean", - "description": "Marks this transaction as BIP125 replaceable. Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.", - "default": false } }, "required": [ - "inputs", + "transactions", "outputs" ] }, @@ -3587,186 +2673,6 @@ "description": "hex string of the transaction" } }, - "decodepsbt": { - "summary": "Return a JSON object representing the serialized, base64-encoded partially signed LBRY transaction.", - "description": [ - "", - "> lbrycrd-cli decodepsbt \"psbt\"", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "psbt": { - "type": "string", - "description": "The PSBT base64 string" - } - }, - "required": [ - "psbt" - ] - }, - "result": { - "type": "object", - "properties": { - "tx": { - "type": "object" - }, - "unknown": { - "type": "object", - "properties": { - "key": { - "type": null, - "description": "An unknown key-value pair" - } - } - }, - "inputs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "non_witness_utxo": { - "type": "object" - }, - "witness_utxo": { - "type": "object", - "properties": { - "amount": { - "type": "number", - "description": "The value in LBC" - }, - "scriptPubKey": { - "type": "object", - "properties": { - "asm": { - "type": "string", - "description": "The asm" - }, - "hex": { - "type": "string", - "description": "The hex" - }, - "type": { - "type": "string", - "description": "The type, eg 'pubkeyhash'" - }, - "address": { - "type": "string", - "description": "LBRY address if there is one" - } - } - } - } - }, - "partial_signatures": { - "type": "object", - "properties": { - "pubkey": { - "type": "string", - "description": "The public key and signature that corresponds to it." - } - } - }, - "sighash": { - "type": "string", - "description": "The sighash type to be used" - }, - "redeem_script": { - "type": "object", - "properties": { - "asm": { - "type": "string", - "description": "The asm" - }, - "hex": { - "type": "string", - "description": "The hex" - }, - "type": { - "type": "string", - "description": "The type, eg 'pubkeyhash'" - } - } - }, - "witness_script": { - "type": "object", - "properties": { - "asm": { - "type": "string", - "description": "The asm" - }, - "hex": { - "type": "string", - "description": "The hex" - }, - "type": { - "type": "string", - "description": "The type, eg 'pubkeyhash'" - } - } - }, - "bip32_derivs": { - "type": "object", - "properties": { - "pubkey": { - "type": "object", - "properties": { - "master_fingerprint": { - "type": "string", - "description": "The fingerprint of the master key" - }, - "path": { - "type": "string", - "description": "The path" - } - } - } - } - }, - "final_scriptsig": { - "type": "object", - "properties": { - "asm": { - "type": "string", - "description": "The asm" - }, - "hex": { - "type": "string", - "description": "The hex" - } - } - }, - "unknown": { - "type": "object", - "properties": { - "key": { - "type": null, - "description": "An unknown key-value pair" - } - } - } - } - } - }, - "outputs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "key": { - "type": null, - "description": "An unknown key-value pair" - } - } - } - } - } - } - }, "decoderawtransaction": { "summary": "Return a JSON object representing the serialized, hex-encoded transaction.", "description": [ @@ -3781,17 +2687,13 @@ "params": { "type": "object", "properties": { - "hexstring": { + "hex": { "type": "string", "description": "The transaction hex string" - }, - "iswitness": { - "type": "boolean", - "description": "Whether the transaction hex is a serialized witness transaction If iswitness is not present, heuristic tests will be used in decoding" } }, "required": [ - "hexstring" + "hex" ] }, "result": { @@ -3801,22 +2703,10 @@ "type": "string", "description": "The transaction id" }, - "hash": { - "type": "string", - "description": "The transaction hash (differs from txid for witness transactions)" - }, "size": { "type": "number", "description": "The transaction size" }, - "vsize": { - "type": "number", - "description": "The virtual transaction size (differs from size for witness transactions)" - }, - "weight": { - "type": "number", - "description": "The transaction's weight (between vsize*4 - 3 and vsize*4)" - }, "version": { "type": "number", "description": "The version" @@ -3897,7 +2787,7 @@ "properties": { "12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc": { "type": "string", - "description": "lbry address" + "description": "lbrycrd address" } } } @@ -3924,13 +2814,13 @@ "params": { "type": "object", "properties": { - "hexstring": { + "hex": { "type": "string", "description": "the hex encoded script" } }, "required": [ - "hexstring" + "hex" ] }, "result": { @@ -3959,65 +2849,20 @@ "properties": { "address": { "type": "string", - "description": "lbry address" + "description": "lbrycrd address" } } } }, "p2sh\",\"address": { "type": "string", - "description": "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)." - } - } - } - }, - "finalizepsbt": { - "summary": "Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete. Implements the Finalizer and Extractor roles.", - "description": [ - "", - "> lbrycrd-cli finalizepsbt \"psbt\"", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "psbt": { - "type": "string", - "description": "A base64 string of a PSBT" - }, - "extract": { - "type": "boolean", - "description": "If true and the transaction is complete, extract and return the complete transaction in normal network serialization instead of the PSBT.", - "default": true - } - }, - "required": [ - "psbt" - ] - }, - "result": { - "type": "object", - "properties": { - "psbt": { - "type": "string", - "description": "The base64-encoded partially signed transaction if not extracted" - }, - "hex": { - "type": "string", - "description": "The hex-encoded network transaction if extracted" - }, - "complete": { - "type": "boolean", - "description": "If the transaction has a complete set of signatures" + "description": "script address" } } } }, "fundrawtransaction": { - "summary": "Add inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add at most one change output to the outputs. No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransaction for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees). You can see whether this is the case by checking the \"solvable\" field in the listunspent output. Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only", + "summary": "Add inputs to a transaction until it has enough in value to meet its out value. This will not modify existing inputs, and will add one change output to the outputs. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransaction for that. Note that all existing inputs must have their previous output transaction be in the wallet. Note that all inputs selected must be of standard form and P2SH scripts must be in the wallet using importaddress or addmultisigaddress (to calculate fees). Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only", "description": [ "", "", @@ -4055,10 +2900,6 @@ "type": "number", "description": "The index of the change output" }, - "change_type": { - "type": "string", - "description": "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -changetype." - }, "includeWatching": { "type": "boolean", "description": "Also select inputs which are watch only" @@ -4066,28 +2907,8 @@ "lockUnspents": { "type": "boolean", "description": "Lock selected unspent outputs" - }, - "feeRate": { - "type": "number", - "description": "Set a specific fee rate in LBC/kB" - }, - "replaceable": { - "type": "boolean", - "description": "Marks this transaction as BIP125 replaceable." - }, - "conf_target": { - "type": "number", - "description": "Confirmation target (in blocks)" - }, - "estimate_mode": { - "type": "string", - "description": "The fee estimate mode, must be one of:" } } - }, - "iswitness": { - "type": "boolean", - "description": "Whether the transaction hex is a serialized witness transaction If iswitness is not present, heuristic tests will be used in decoding" } }, "required": [ @@ -4103,7 +2924,7 @@ }, "fee": { "type": "number", - "description": "Fee in LBC the resulting transaction pays" + "description": "Fee the resulting transaction pays" }, "changepos": { "type": "number", @@ -4113,14 +2934,12 @@ } }, "getrawtransaction": { - "summary": "NOTE: By default this function only works for mempool transactions. If the -txindex option is enabled, it also works for blockchain transactions. If the block which contains the transaction is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is provided, only that block will be searched and if the transaction is in the mempool or other blocks, or if this node does not have the given block available, the transaction will not be found. DEPRECATED: for now, it also works for transactions with unspent outputs. Return the raw transaction data. If verbose is 'true', returns an Object with information about 'txid'. If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.", + "summary": "NOTE: By default this function only works sometimes. This is when the tx is in the mempool or there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option. Return the raw transaction data. If verbose=0, returns a string that is serialized, hex-encoded data for 'txid'. If verbose is non-zero, returns an Object with information about 'txid'.", "description": [ "", "> lbrycrd-cli getrawtransaction \"mytxid\"", - "> lbrycrd-cli getrawtransaction \"mytxid\" true", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawtransaction\", \"params\": [\"mytxid\", true] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "> lbrycrd-cli getrawtransaction \"mytxid\" false \"myblockhash\"", - "> lbrycrd-cli getrawtransaction \"mytxid\" true \"myblockhash\"", + "> lbrycrd-cli getrawtransaction \"mytxid\" 1", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getrawtransaction\", \"params\": [\"mytxid\", 1] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -4134,13 +2953,9 @@ "description": "The transaction id" }, "verbose": { - "type": "boolean", - "description": "If false, return a string, otherwise return a json object", - "default": false - }, - "blockhash": { - "type": "string", - "description": "The block in which to look for the transaction" + "type": "number", + "description": "If 0, return a string, other return a json object", + "default": 0 } }, "required": [ @@ -4149,7 +2964,7 @@ }, "result": { "type": "string", - "description": "The serialized, hex-encoded data for 'txid' Result (if verbose is set to true): { \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument) \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid' \"txid\" : \"id\", (string) The transaction id (same as provided) \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions) \"size\" : n, (numeric) The serialized transaction size \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions) \"weight\" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4) \"version\" : n, (numeric) The version \"locktime\" : ttt, (numeric) The lock time \"vin\" : [ (array of json objects) { \"txid\": \"id\", (string) The transaction id \"vout\": n, (numeric) \"scriptSig\": { (json object) The script \"asm\": \"asm\", (string) asm \"hex\": \"hex\" (string) hex }, \"sequence\": n (numeric) The script sequence number \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any) } ,... ], \"vout\" : [ (array of json objects) { \"value\" : x.xxx, (numeric) The value in LBC \"n\" : n, (numeric) index \"scriptPubKey\" : { (json object) \"asm\" : \"asm\", (string) the asm \"hex\" : \"hex\", (string) the hex \"reqSigs\" : n, (numeric) The required sigs \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash' \"addresses\" : [ (json array of string) \"address\" (string) lbry address ,... ] } } ,... ], \"blockhash\" : \"hash\", (string) the block hash \"confirmations\" : n, (numeric) The confirmations \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT) \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) }" + "description": "The serialized, hex-encoded data for 'txid' Result (if verbose > 0): { \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid' \"txid\" : \"id\", (string) The transaction id (same as provided) \"size\" : n, (numeric) The transaction size \"version\" : n, (numeric) The version \"locktime\" : ttt, (numeric) The lock time \"vin\" : [ (array of json objects) { \"txid\": \"id\", (string) The transaction id \"vout\": n, (numeric) \"scriptSig\": { (json object) The script \"asm\": \"asm\", (string) asm \"hex\": \"hex\" (string) hex }, \"sequence\": n (numeric) The script sequence number } ,... ], \"vout\" : [ (array of json objects) { \"value\" : x.xxx, (numeric) The value in LBC \"n\" : n, (numeric) index \"scriptPubKey\" : { (json object) \"asm\" : \"asm\", (string) the asm \"hex\" : \"hex\", (string) the hex \"reqSigs\" : n, (numeric) The required sigs \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash' \"addresses\" : [ (json array of string) \"lbrycrdaddress\" (string) lbrycrd address ,... ] } } ,... ], \"blockhash\" : \"hash\", (string) the block hash \"confirmations\" : n, (numeric) The confirmations \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT) \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT) }" } }, "sendrawtransaction": { @@ -4195,7 +3010,7 @@ } }, "signrawtransaction": { - "summary": "DEPRECATED. Sign inputs for raw transaction (serialized, hex-encoded). The second optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain. The third optional argument (may be null) is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction.", + "summary": "Sign inputs for raw transaction (serialized, hex-encoded). The second optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain. The third optional argument (may be null) is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction.", "description": [ "", "> lbrycrd-cli signrawtransaction \"myhex\"", @@ -4214,9 +3029,9 @@ }, "prevtxs": { "type": "string", - "description": "An json array of previous dependent transaction outputs [ (json array of json objects, or 'null' if none provided) { \"txid\":\"id\", (string, required) The transaction id \"vout\":n, (numeric, required) The output number \"scriptPubKey\": \"hex\", (string, required) script key \"redeemScript\": \"hex\", (string, required for P2SH or P2WSH) redeem script \"amount\": value (numeric, required) The amount spent } ,... ]" + "description": "An json array of previous dependent transaction outputs [ (json array of json objects, or 'null' if none provided) { \"txid\":\"id\", (string, required) The transaction id \"vout\":n, (numeric, required) The output number \"scriptPubKey\": \"hex\", (string, required) script key \"redeemScript\": \"hex\" (string, required for P2SH) redeem script } ,... ]" }, - "privkeys": { + "privatekeys": { "type": "string", "description": "A json array of base58-encoded private keys for signing [ (json array of strings, or 'null' if none provided) \"privatekey\" (string) private key in base58-encoding ,... ]" }, @@ -4272,147 +3087,16 @@ } } }, - "signrawtransactionwithkey": { - "summary": "Sign inputs for raw transaction (serialized, hex-encoded). The second argument is an array of base58-encoded private keys that will be the only keys used to sign the transaction. The third optional argument (may be null) is an array of previous transaction outputs that this transaction depends on but may not yet be in the block chain.", - "description": [ - "", - "> lbrycrd-cli signrawtransactionwithkey \"myhex\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signrawtransactionwithkey\", \"params\": [\"myhex\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "hexstring": { - "type": "string", - "description": "The transaction hex string" - }, - "privkeys": { - "type": "string", - "description": "A json array of base58-encoded private keys for signing [ (json array of strings) \"privatekey\" (string) private key in base58-encoding ,... ]" - }, - "prevtxs": { - "type": "string", - "description": "An json array of previous dependent transaction outputs [ (json array of json objects, or 'null' if none provided) { \"txid\":\"id\", (string, required) The transaction id \"vout\":n, (numeric, required) The output number \"scriptPubKey\": \"hex\", (string, required) script key \"redeemScript\": \"hex\", (string, required for P2SH or P2WSH) redeem script \"amount\": value (numeric, required) The amount spent } ,... ]" - }, - "sighashtype": { - "type": "string", - "description": "The signature hash type. Must be one of \"ALL\" \"NONE\" \"SINGLE\" \"ALL|ANYONECANPAY\" \"NONE|ANYONECANPAY\" \"SINGLE|ANYONECANPAY\"", - "default": "ALL" - } - }, - "required": [ - "hexstring", - "privkeys" - ] - }, - "result": { - "type": "object", - "properties": { - "hex": { - "type": "string", - "description": "The hex-encoded raw transaction with signature(s)" - }, - "complete": { - "type": "boolean", - "description": "If the transaction has a complete set of signatures" - }, - "errors": { - "type": "array", - "items": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The hash of the referenced, previous transaction" - }, - "vout": { - "type": "number", - "description": "The index of the output to spent and used as input" - }, - "scriptSig": { - "type": "string", - "description": "The hex-encoded signature script" - }, - "sequence": { - "type": "number", - "description": "Script sequence number" - }, - "error": { - "type": "string", - "description": "Verification or signing error related to the input" - } - } - } - } - } - } - }, - "testmempoolaccept": { - "summary": "Returns if raw transaction (serialized, hex-encoded) would be accepted by mempool. This checks if the transaction violates the consensus or policy rules. See sendrawtransaction call.", - "description": [ - "", - "", - "Create a transaction", - "> lbrycrd-cli createrawtransaction \"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"", - "Sign the transaction, and get back the hex", - "> lbrycrd-cli signrawtransaction \"myhex\"", - "", - "Test acceptance of the transaction (signed hex)", - "> lbrycrd-cli testmempoolaccept [\"signedhex\"]", - "", - "As a json rpc call", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"testmempoolaccept\", \"params\": [[\"signedhex\"]] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Rawtransactions" - ], - "params": { - "type": "object", - "properties": { - "allowhighfees": { - "type": "boolean", - "description": "Allow high fees", - "default": false - } - }, - "required": [] - }, - "result": { - "type": "array", - "items": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The transaction hash in hex" - }, - "allowed": { - "type": "boolean", - "description": "If the mempool allows this tx to be inserted" - }, - "reject-reason": { - "type": "string", - "description": "Rejection string (only present when 'allowed' is false)" - } - } - } - } - }, "createmultisig": { "summary": "Creates a multi-signature address with n signature of m keys required. It returns a json object with the address and redeemScript.", "description": [ "", "", - "Create a multisig address from 2 public keys", - "> lbrycrd-cli createmultisig 2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"", + "Create a multisig address from 2 addresses", + "> lbrycrd-cli createmultisig 2 \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"", "", "As a json rpc call", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createmultisig\", \"params\": [2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createmultisig\", \"params\": [2, \"[\\\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\\\",\\\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\\\"]\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -4423,15 +3107,11 @@ "properties": { "nrequired": { "type": "number", - "description": "The number of required signatures out of the n keys." + "description": "The number of required signatures out of the n keys or addresses." }, "keys": { "type": "string", - "description": "A json array of hex-encoded public keys [ \"key\" (string) The hex-encoded public key ,... ]" - }, - "address_type": { - "type": "string", - "description": "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is legacy." + "description": "A json array of keys which are lbrycrd addresses or hex-encoded public keys [ \"key\" (string) lbrycrd address or hex-encoded public key ,... ]" } }, "required": [ @@ -4453,8 +3133,62 @@ } } }, + "estimatefee": { + "summary": "Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks.", + "description": [ + "", + "> lbrycrd-cli estimatefee 6", + "" + ], + "tags": [ + "Util" + ], + "params": { + "type": "object", + "properties": { + "nblocks": { + "type": "number", + "description": "" + } + }, + "required": [ + "nblocks" + ] + }, + "result": { + "type": "number", + "description": "estimated fee-per-kilobyte A negative value is returned if not enough transactions and blocks have been observed to make an estimate." + } + }, + "estimatepriority": { + "summary": "Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks.", + "description": [ + "", + "> lbrycrd-cli estimatepriority 6", + "" + ], + "tags": [ + "Util" + ], + "params": { + "type": "object", + "properties": { + "nblocks": { + "type": "number", + "description": "" + } + }, + "required": [ + "nblocks" + ] + }, + "result": { + "type": "number", + "description": "estimated priority A negative value is returned if not enough transactions and blocks have been observed to make an estimate." + } + }, "estimatesmartfee": { - "summary": "Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible and return the number of blocks for which the estimate is valid. Uses virtual transaction size as defined in BIP 141 (witness data is discounted).", + "summary": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.", "description": [ "", "> lbrycrd-cli estimatesmartfee 6", @@ -4466,18 +3200,13 @@ "params": { "type": "object", "properties": { - "conf_target": { + "nblocks": { "type": "number", - "description": "Confirmation target in blocks (1 - 1008)" - }, - "estimate_mode": { - "type": "string", - "description": "The fee estimate mode. Whether to return a more conservative estimate which also satisfies a longer history. A conservative estimate potentially returns a higher feerate and is more likely to be sufficient for the desired target, but is not as responsive to short term drops in the prevailing fee market. Must be one of: \"UNSET\" (defaults to CONSERVATIVE) \"ECONOMICAL\" \"CONSERVATIVE\"", - "default": "CONSERVATIVE" + "description": "" } }, "required": [ - "conf_target" + "nblocks" ] }, "result": { @@ -4485,7 +3214,7 @@ "properties": { "feerate": { "type": "number", - "description": "estimate fee rate in LBC/kB" + "description": "estimate fee-per-kilobyte (in BTC)" }, "blocks": { "type": "number", @@ -4494,19 +3223,11 @@ } } }, - "signmessagewithprivkey": { - "summary": "Sign a message with the private key of an address", + "estimatesmartpriority": { + "summary": "WARNING: This interface is unstable and may disappear or change! Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks if possible and return the number of blocks for which the estimate is valid.", "description": [ "", - "", - "Create the signature", - "> lbrycrd-cli signmessagewithprivkey \"privkey\" \"my message\"", - "", - "Verify the signature", - "> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"", - "", - "As json rpc", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"signmessagewithprivkey\", \"params\": [\"privkey\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> lbrycrd-cli estimatesmartpriority 6", "" ], "tags": [ @@ -4515,27 +3236,31 @@ "params": { "type": "object", "properties": { - "privkey": { - "type": "string", - "description": "The private key to sign the message with." - }, - "message": { - "type": "string", - "description": "The message to create a signature of." + "nblocks": { + "type": "number", + "description": "" } }, "required": [ - "privkey", - "message" + "nblocks" ] }, "result": { - "type": "string", - "description": "The signature of the message encoded in base 64" + "type": "object", + "properties": { + "priority": { + "type": "number", + "description": "estimated priority" + }, + "blocks": { + "type": "number", + "description": "block number where estimate was found" + } + } } }, "validateaddress": { - "summary": "Return information about the given lbry address. DEPRECATION WARNING: Parts of this command have been deprecated and moved to getaddressinfo. Clients must transition to using getaddressinfo to access this information before upgrading to v0.18. The following deprecated fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly, script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.", + "summary": "Return information about the given lbrycrd address.", "description": [ "", "> lbrycrd-cli validateaddress \"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"", @@ -4548,13 +3273,13 @@ "params": { "type": "object", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", - "description": "The lbry address to validate" + "description": "The lbrycrd address to validate" } }, "required": [ - "address" + "lbrycrdaddress" ] }, "result": { @@ -4566,27 +3291,35 @@ }, "address": { "type": "string", - "description": "The lbry address validated" + "description": "The lbrycrd address validated" }, "scriptPubKey": { "type": "string", "description": "The hex encoded scriptPubKey generated by the address" }, + "ismine": { + "type": "boolean", + "description": "If the address is yours or not" + }, + "iswatchonly": { + "type": "boolean", + "description": "If the address is watchonly" + }, "isscript": { "type": "boolean", "description": "If the key is a script" }, - "iswitness": { - "type": "boolean", - "description": "If the address is a witness address" - }, - "witness_version": { - "type": "number", - "description": "The version number of the witness program" - }, - "witness_program": { + "pubkey": { "type": "string", - "description": "The hex value of the witness program" + "description": "The hex value of the raw public key" + }, + "iscompressed": { + "type": "boolean", + "description": "If the address is compressed" + }, + "account": { + "type": "string", + "description": "DEPRECATED. The account associated with the address, \"\" is the default account" } } } @@ -4600,13 +3333,13 @@ "> lbrycrd-cli walletpassphrase \"mypassphrase\" 30", "", "Create the signature", - "> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"my message\"", + "> lbrycrd-cli signmessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"my message\"", "", "Verify the signature", - "> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"", + "> lbrycrd-cli verifymessage \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" \"signature\" \"my message\"", "", "As json rpc", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifymessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"verifymessage\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", \"signature\", \"my message\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -4615,9 +3348,9 @@ "params": { "type": "object", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", - "description": "The lbry address to use for the signature." + "description": "The lbrycrd address to use for the signature." }, "signature": { "type": "string", @@ -4629,7 +3362,7 @@ } }, "required": [ - "address", + "lbrycrdaddress", "signature", "message" ] @@ -4640,7 +3373,7 @@ } }, "abandontransaction": { - "summary": "Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already abandoned.", + "summary": "Mark in-wallet transaction as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.", "description": [ "", "> lbrycrd-cli abandontransaction \"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"", @@ -4663,32 +3396,8 @@ ] } }, - "abortrescan": { - "summary": "Stops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.", - "description": [ - "", - "", - "Import a private key", - "> lbrycrd-cli importprivkey \"mykey\"", - "", - "Abort the running wallet rescan", - "> lbrycrd-cli abortrescan ", - "", - "As a JSON-RPC call", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"abortrescan\", \"params\": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Wallet" - ], - "params": { - "type": "object", - "properties": {}, - "required": [] - } - }, "addmultisigaddress": { - "summary": "Add a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup. Each key is a Bitcoin address or hex-encoded public key. This functionality is only intended for use with non-watchonly addresses. See `importaddress` for watchonly p2sh address support. If 'label' is specified, assign address to that label.", + "summary": "Add a nrequired-to-sign multisignature address to the wallet. Each key is a Bitcoin address or hex-encoded public key. If 'account' is specified (DEPRECATED), assign address to that account.", "description": [ "", "", @@ -4709,36 +3418,23 @@ "type": "number", "description": "The number of required signatures out of the n keys or addresses." }, - "keys": { + "keysobject": { "type": "string", - "description": "A json array of bitcoin addresses or hex-encoded public keys [ \"address\" (string) bitcoin address or hex-encoded public key ..., ]" + "description": "A json array of lbrycrd addresses or hex-encoded public keys [ \"address\" (string) lbrycrd address or hex-encoded public key ..., ]" }, - "label": { + "account": { "type": "string", - "description": "A label to assign the addresses to." - }, - "address_type": { - "type": "string", - "description": "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype." + "description": "DEPRECATED. An account to assign the addresses to." } }, "required": [ "nrequired", - "keys" + "keysobject" ] }, "result": { - "type": "object", - "properties": { - "address": { - "type": "string", - "description": "The value of the new multisig address." - }, - "redeemScript": { - "type": "string", - "description": "The string value of the hex-encoded redemption script." - } - } + "type": "string", + "description": "A lbrycrd address associated with the keys." } }, "backupwallet": { @@ -4765,112 +3461,8 @@ ] } }, - "bumpfee": { - "summary": "Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B. An opt-in RBF transaction with the given txid must be in the wallet. The command will pay the additional fee by decreasing (or perhaps removing) its change output. If the change output is not big enough to cover the increased fee, the command will currently fail instead of adding new inputs to compensate. (A future implementation could improve this.) The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs. By default, the new fee will be calculated automatically using estimatesmartfee. The user can specify a confirmation target for estimatesmartfee. Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate. At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee returned by getnetworkinfo) to enter the node's mempool.", - "description": [ - "", - "", - "Bump the fee, get the new transaction's txid", - "> lbrycrd-cli bumpfee ", - "" - ], - "tags": [ - "Wallet" - ], - "params": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The txid to be bumped" - }, - "options": { - "type": "object", - "properties": { - "confTarget": { - "type": "number", - "description": "Confirmation target (in blocks)" - }, - "totalFee": { - "type": "number", - "description": "Total fee (NOT feerate) to pay, in satoshis." - }, - "replaceable": { - "type": "boolean", - "description": "Whether the new transaction should still be" - }, - "estimate_mode": { - "type": "string", - "description": "The fee estimate mode, must be one of:" - } - } - } - }, - "required": [ - "txid" - ] - }, - "result": { - "type": "object", - "properties": { - "txid": { - "type": "string", - "description": "The id of the new transaction" - }, - "origfee": { - "type": "number", - "description": "Fee of the replaced transaction" - }, - "fee": { - "type": "number", - "description": "Fee of the new transaction" - } - } - } - }, - "createwallet": { - "summary": "Creates and loads a new wallet.", - "description": [ - "", - "> lbrycrd-cli createwallet \"testwallet\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createwallet\", \"params\": [\"testwallet\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Wallet" - ], - "params": { - "type": "object", - "properties": { - "wallet_name": { - "type": "string", - "description": "The name for the new wallet. If this is a path, the wallet will be created at the path location." - }, - "disable_private_keys": { - "type": "boolean", - "description": "Disable the possibility of private keys (only watchonlys are possible in this mode)." - } - }, - "required": [ - "wallet_name" - ] - }, - "result": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path." - }, - "warning": { - "type": "string", - "description": "Warning message if wallet was not loaded cleanly." - } - } - } - }, "dumpprivkey": { - "summary": "Reveals the private key corresponding to 'address'. Then the importprivkey can be used with this output", + "summary": "Reveals the private key corresponding to 'lbrycrdaddress'. Then the importprivkey can be used with this output", "description": [ "", "> lbrycrd-cli dumpprivkey \"myaddress\"", @@ -4884,13 +3476,13 @@ "params": { "type": "object", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", - "description": "The bitcoin address for the private key" + "description": "The lbrycrd address for the private key" } }, "required": [ - "address" + "lbrycrdaddress" ] }, "result": { @@ -4899,7 +3491,7 @@ } }, "dumpwallet": { - "summary": "Dumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files. Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet. Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).", + "summary": "Dumps all wallet keys in a human-readable format.", "description": [ "", "> lbrycrd-cli dumpwallet \"test\"", @@ -4914,7 +3506,7 @@ "properties": { "filename": { "type": "string", - "description": "The filename with path (either absolute or relative to bitcoind)" + "description": "The filename" } }, "required": [ @@ -4923,18 +3515,18 @@ } }, "encryptwallet": { - "summary": "Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call.", + "summary": "Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.", "description": [ "", "", - "Encrypt your wallet", + "Encrypt you wallet", "> lbrycrd-cli encryptwallet \"my pass phrase\"", "", - "Now set the passphrase to use the wallet, such as for signing or sending bitcoin", + "Now set the passphrase to use the wallet, such as for signing or sending LBC", "> lbrycrd-cli walletpassphrase \"my pass phrase\"", "", - "Now we can do something like sign", - "> lbrycrd-cli signmessage \"address\" \"test message\"", + "Now we can so something like sign", + "> lbrycrd-cli signmessage \"lbrycrdaddress\" \"test message\"", "", "Now lock the wallet again by removing the passphrase", "> lbrycrd-cli walletlock ", @@ -4963,8 +3555,8 @@ "summary": "DEPRECATED. Returns the account associated with the given address.", "description": [ "", - "> lbrycrd-cli getaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> lbrycrd-cli getaccount \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaccount\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -4973,13 +3565,13 @@ "params": { "type": "object", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", - "description": "The bitcoin address for account lookup." + "description": "The lbrycrd address for account lookup." } }, "required": [ - "address" + "lbrycrdaddress" ] }, "result": { @@ -5005,7 +3597,7 @@ "properties": { "account": { "type": "string", - "description": "The account for the address. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created and a new address created if there is no account by the given name." + "description": "The account name for the address. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created and a new address created if there is no account by the given name." } }, "required": [ @@ -5014,7 +3606,7 @@ }, "result": { "type": "string", - "description": "The account bitcoin address" + "description": "The account lbrycrd address" } }, "getaddressesbyaccount": { @@ -5045,85 +3637,23 @@ "items": { "type": "object", "properties": { - "address": { + "lbrycrdaddress": { "type": "string", - "description": "a bitcoin address associated with the given account" + "description": "a lbrycrd address associated with the given account" } } } } }, - "getaddressesbylabel": { - "summary": "Returns the list of addresses assigned the specified label.", - "description": [ - "", - "> lbrycrd-cli getaddressesbylabel \"tabby\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddressesbylabel\", \"params\": [\"tabby\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Wallet" - ], - "params": { - "type": "object", - "properties": { - "label": { - "type": "string", - "description": "The label." - } - }, - "required": [ - "label" - ] - }, - "result": { - "type": "object", - "properties": { - "address": { - "type": "object", - "properties": { - "purpose": { - "type": "string", - "description": "Purpose of address (\"send\" for sending address, \"receive\" for receiving address)" - } - } - } - } - } - }, - "getaddressinfo": { - "summary": "Return information about the given bitcoin address. Some information requires the address to be in the wallet.", - "description": [ - "", - "> lbrycrd-cli getaddressinfo \"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getaddressinfo\", \"params\": [\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", - "" - ], - "tags": [ - "Wallet" - ], - "params": { - "type": "object", - "properties": { - "address": { - "type": "string", - "description": "The bitcoin address to get the information of." - } - }, - "required": [ - "address" - ] - } - }, "getbalance": { - "summary": "If account is not specified, returns the server's total available balance. The available balance is what the wallet considers currently spendable, and is thus affected by options which limit spendability such as -spendzeroconfchange. If account is specified (DEPRECATED), returns the balance in the account. Note that the account \"\" is not the same as leaving the parameter out. The server total may be different to the balance in the default \"\" account.", + "summary": "If account is not specified, returns the server's total available balance. If account is specified (DEPRECATED), returns the balance in the account. Note that the account \"\" is not the same as leaving the parameter out. The server total may be different to the balance in the default \"\" account.", "description": [ "", "", - "The total amount in the wallet with 1 or more confirmations", + "The total amount in the wallet", "> lbrycrd-cli getbalance ", "", - "The total amount in the wallet at least 6 blocks confirmed", + "The total amount in the wallet at least 5 blocks confirmed", "> lbrycrd-cli getbalance \"*\" 6", "", "As a json rpc call", @@ -5138,19 +3668,16 @@ "properties": { "account": { "type": "string", - "description": "DEPRECATED. This argument will be removed in V0." - }, - "To use this deprecated argument, start bitcoind with -deprecatedrpc=accounts. The account string may be given as a\n specific account name to find the balance associated with wallet keys in\n a named account, or as the empty string": { - "type": null, - "description": "to find the balance associated with wallet keys not in any named account, or as \"*\" to find the balance associated with all wallet keys regardless of account. When this option is specified, it calculates the balance in a different way than when it is not specified, and which can count spends twice when there are conflicting pending transactions (such as those created by the bumpfee command), temporarily resulting in low or even negative balances. In general, account balance calculation is not considered reliable and has resulted in confusing outcomes, so it is recommended to avoid passing this argument." + "description": "DEPRECATED. The selected account, or \"*\" for entire wallet. It may be the default account using \"\"." }, "minconf": { "type": "number", - "description": "Only include transactions confirmed at least this many times. The default is 1 if an account is provided or 0 if no account is provided" + "description": "Only include transactions confirmed at least this many times.", + "default": 1 }, - "include_watchonly": { + "includeWatchonly": { "type": "boolean", - "description": "Also include balance in watch-only addresses (see 'importaddress')", + "description": "Also include balance in watchonly addresses (see 'importaddress')", "default": false } }, @@ -5162,7 +3689,7 @@ } }, "getnewaddress": { - "summary": "Returns a new Bitcoin address for receiving payments. If 'label' is specified, it is added to the address book so payments received with the address will be associated with 'label'.", + "summary": "Returns a new Bitcoin address for receiving payments. If 'account' is specified (DEPRECATED), it is added to the address book so payments received with the address will be credited to 'account'.", "description": [ "", "> lbrycrd-cli getnewaddress ", @@ -5175,20 +3702,16 @@ "params": { "type": "object", "properties": { - "label": { + "account": { "type": "string", - "description": "The label name for the address to be linked to. If not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name." - }, - "address_type": { - "type": "string", - "description": "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype." + "description": "DEPRECATED. The account name for the address to be linked to. If not provided, the default account \"\" is used. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name." } }, "required": [] }, "result": { "type": "string", - "description": "The new bitcoin address" + "description": "The new lbrycrd address" } }, "getrawchangeaddress": { @@ -5204,12 +3727,7 @@ ], "params": { "type": "object", - "properties": { - "address_type": { - "type": "string", - "description": "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -changetype." - } - }, + "properties": {}, "required": [] }, "result": { @@ -5217,22 +3735,22 @@ "description": "The address" } }, - "getreceivedbyaddress": { - "summary": "Returns the total amount received by the given address in transactions with at least minconf confirmations.", + "getreceivedbyaccount": { + "summary": "DEPRECATED. Returns the total amount received by addresses with in transactions with at least [minconf] confirmations.", "description": [ "", "", - "The amount from transactions with at least 1 confirmation", - "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\"", + "Amount received by the default account with at least 1 confirmation", + "> lbrycrd-cli getreceivedbyaccount \"\"", "", - "The amount including unconfirmed transactions, zero confirmations", - "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 0", + "Amount received at the tabby account including unconfirmed amounts with zero confirmations", + "> lbrycrd-cli getreceivedbyaccount \"tabby\" 0", "", - "The amount with at least 6 confirmations", - "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 6", + "The amount with at least 6 confirmation, very safe", + "> lbrycrd-cli getreceivedbyaccount \"tabby\" 6", "", "As a json rpc call", - "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaddress\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaccount\", \"params\": [\"tabby\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", "" ], "tags": [ @@ -5241,9 +3759,9 @@ "params": { "type": "object", "properties": { - "address": { + "account": { "type": "string", - "description": "The bitcoin address for transactions." + "description": "The selected account, may be the default account using \"\"." }, "minconf": { "type": "number", @@ -5252,7 +3770,50 @@ } }, "required": [ - "address" + "account" + ] + }, + "result": { + "type": "number", + "description": "The total amount in LBC received for this account." + } + }, + "getreceivedbyaddress": { + "summary": "Returns the total amount received by the given lbrycrdaddress in transactions with at least minconf confirmations.", + "description": [ + "", + "", + "The amount from transactions with at least 1 confirmation", + "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\"", + "", + "The amount including unconfirmed transactions, zero confirmations", + "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 0", + "", + "The amount with at least 6 confirmation, very safe", + "> lbrycrd-cli getreceivedbyaddress \"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\" 6", + "", + "As a json rpc call", + "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getreceivedbyaddress\", \"params\": [\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\", 6] }' -H 'content-type: text/plain;' http://127.0.0.1:9245/", + "" + ], + "tags": [ + "Wallet" + ], + "params": { + "type": "object", + "properties": { + "lbrycrdaddress": { + "type": "string", + "description": "The lbrycrd address for transactions." + }, + "minconf": { + "type": "number", + "description": "Only include transactions confirmed at least this many times.", + "default": 1 + } + }, + "required": [ + "lbrycrdaddress" ] }, "result": { @@ -5260,49 +3821,6 @@ "description": "The total amount in LBC received at this address." } }, - "getreceivedbylabel": { - "summary": "Returns the total amount received by addresses with