mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-22 16:14:50 +01:00
Compare commits
221 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cea169813 | ||
|
|
4e1134bdf1 | ||
|
|
12a0c0b3aa | ||
|
|
61646394b7 | ||
|
|
6bf4884d7b | ||
|
|
dc9ae4c26e | ||
|
|
b0c97ce31a | ||
|
|
c2e7baf2bd | ||
|
|
3b89bf6438 | ||
|
|
8b3311fb8d | ||
|
|
97546fc44c | ||
|
|
38671bff4e | ||
|
|
256321ebd2 | ||
|
|
eae0350b9c | ||
|
|
90897ab343 | ||
|
|
a2f2fb6acf | ||
|
|
cf67d8b49b | ||
|
|
b3964e3b7a | ||
|
|
43c2789fe3 | ||
|
|
dfe0d4da7e | ||
|
|
612efe89e3 | ||
|
|
3ad96bdf73 | ||
|
|
9c810058d8 | ||
|
|
cbc4e3bd37 | ||
|
|
94b67e58d1 | ||
|
|
5216f3c5d4 | ||
|
|
72a0adfb3c | ||
|
|
4b80b09f73 | ||
|
|
5297194bbd | ||
|
|
7e9a9874f3 | ||
|
|
0b3fd07fd2 | ||
|
|
fb818b6be4 | ||
|
|
8d598c26e3 | ||
|
|
842c48dba3 | ||
|
|
91ef4d93d4 | ||
|
|
f2778e0ce6 | ||
|
|
cf5bf5542a | ||
|
|
44d6bc8528 | ||
|
|
1bf6ac62ab | ||
|
|
093d7b5895 | ||
|
|
5dc72f8bb0 | ||
|
|
6a1343b470 | ||
|
|
41372485ce | ||
|
|
0e01d0f89d | ||
|
|
6d0132520c | ||
|
|
750d54f951 | ||
|
|
689746841a | ||
|
|
1cea6b0dee | ||
|
|
9bd0b4a633 | ||
|
|
743cc9e08b | ||
|
|
f696ea12e1 | ||
|
|
5e6d893650 | ||
|
|
ceba0f8c7e | ||
|
|
2ede6b7142 | ||
|
|
0dfcdd41eb | ||
|
|
c9ad65e5fa | ||
|
|
0194bddde4 | ||
|
|
bdf2542787 | ||
|
|
65426acb4d | ||
|
|
28d76d2aea | ||
|
|
843469ee15 | ||
|
|
4e5ea71bd5 | ||
|
|
3861f0fa21 | ||
|
|
04507de3b7 | ||
|
|
8b59079b8d | ||
|
|
ae52a7ffd1 | ||
|
|
0739e6e57a | ||
|
|
255eced936 | ||
|
|
7e66e9c97b | ||
|
|
3f5563877a | ||
|
|
be6420407b | ||
|
|
0fd8464458 | ||
|
|
09334e04a9 | ||
|
|
181771b712 | ||
|
|
ecc96f5ba9 | ||
|
|
ebd7d8d78c | ||
|
|
ae3d8f371a | ||
|
|
e4a7d51537 | ||
|
|
16f45600c8 | ||
|
|
ff32503267 | ||
|
|
da656068ec | ||
|
|
49e4d14f75 | ||
|
|
d7e7727658 | ||
|
|
424ae6629b | ||
|
|
9a5b88cc0c | ||
|
|
824c011d16 | ||
|
|
ebc0e41ede | ||
|
|
d8ac901842 | ||
|
|
bf8ad0dc6b | ||
|
|
139cd8177b | ||
|
|
bac6fca3c9 | ||
|
|
3a70613398 | ||
|
|
323de27f4b | ||
|
|
7494e0915b | ||
|
|
df45564cf0 | ||
|
|
57d1f46952 | ||
|
|
eae305f4c4 | ||
|
|
34127c77cb | ||
|
|
1c62e84099 | ||
|
|
149c1d890d | ||
|
|
24e48991d3 | ||
|
|
bf1cc80372 | ||
|
|
9e1cc16296 | ||
|
|
fe3122580e | ||
|
|
2b7636c3d6 | ||
|
|
ae1479a114 | ||
|
|
aa587d4cae | ||
|
|
0c6f334c32 | ||
|
|
214154e6fc | ||
|
|
2218d4bbe0 | ||
|
|
cf0218f8b2 | ||
|
|
b788994256 | ||
|
|
90bef6638f | ||
|
|
a1f425b48b | ||
|
|
4635a4c4e7 | ||
|
|
0eccf0ae30 | ||
|
|
78f64ef0b2 | ||
|
|
a316622fd0 | ||
|
|
1d2cdd2ef9 | ||
|
|
c9e022b7ee | ||
|
|
10c09f98b2 | ||
|
|
8752b5c882 | ||
|
|
601327be8c | ||
|
|
ca301bf98c | ||
|
|
2c0840631d | ||
|
|
81145a6ccd | ||
|
|
11173786ce | ||
|
|
c91c660e49 | ||
|
|
002c8a2411 | ||
|
|
200f29363b | ||
|
|
d5d8998028 | ||
|
|
786cf72c7f | ||
|
|
aeb9279228 | ||
|
|
23126a0a09 | ||
|
|
d148f62e00 | ||
|
|
7f502be259 | ||
|
|
047a898317 | ||
|
|
327d3e8824 | ||
|
|
7b6c847f67 | ||
|
|
e43f25c5b1 | ||
|
|
275400bfcc | ||
|
|
63efb36672 | ||
|
|
1eb14af28f | ||
|
|
336f9fbd30 | ||
|
|
b6347bf813 | ||
|
|
2448d34298 | ||
|
|
1bbad80bf4 | ||
|
|
b788c5561a | ||
|
|
fd7350d22e | ||
|
|
3916a81a27 | ||
|
|
6da2028b55 | ||
|
|
773c30d756 | ||
|
|
18695f08ef | ||
|
|
abfbeafe84 | ||
|
|
6a02ef8bdb | ||
|
|
b61940b3a1 | ||
|
|
c5044bc169 | ||
|
|
b24ff47c64 | ||
|
|
ed4206acb1 | ||
|
|
58259ad1ed | ||
|
|
186a517692 | ||
|
|
aaf55d25c6 | ||
|
|
249bf0e049 | ||
|
|
c3200bcd1e | ||
|
|
af35bdc6b0 | ||
|
|
4e7c219122 | ||
|
|
a3a73170a9 | ||
|
|
12b7c444f0 | ||
|
|
76ce5c8de3 | ||
|
|
2d375fe97b | ||
|
|
ace39db764 | ||
|
|
263b65ebf0 | ||
|
|
e2677d7ae8 | ||
|
|
7fdbedcaf8 | ||
|
|
867c600c29 | ||
|
|
008138c04a | ||
|
|
3022e7df2a | ||
|
|
06fdf326d3 | ||
|
|
58fda4d689 | ||
|
|
68c0580dfb | ||
|
|
4a3d3e20c0 | ||
|
|
94b362dbd6 | ||
|
|
221a38024a | ||
|
|
c2029018cc | ||
|
|
50891ad080 | ||
|
|
9241f7a7c1 | ||
|
|
4f57a3b20c | ||
|
|
8061d67aeb | ||
|
|
d1bcef4391 | ||
|
|
1eadfd9753 | ||
|
|
18021d08f7 | ||
|
|
b790d139c9 | ||
|
|
8543b0dfd9 | ||
|
|
968f13cae3 | ||
|
|
87d43a3c8e | ||
|
|
ed934bdb4d | ||
|
|
591c5692f8 | ||
|
|
52e57055cc | ||
|
|
b3d67e1c34 | ||
|
|
06ca0651b6 | ||
|
|
4e0bfa5814 | ||
|
|
2bb0ca9b55 | ||
|
|
a2300499b7 | ||
|
|
343492795a | ||
|
|
13e129ed9a | ||
|
|
3aa3c710ac | ||
|
|
f4dcc1e009 | ||
|
|
63b5a1dc80 | ||
|
|
c888111a3f | ||
|
|
3a88ba0794 | ||
|
|
d10a9015ad | ||
|
|
15ad0b54fa | ||
|
|
11855c1f99 | ||
|
|
8446262597 | ||
|
|
ad3d208fb9 | ||
|
|
0cb8763cbb | ||
|
|
b03632a671 | ||
|
|
c3c635b316 | ||
|
|
a572ff7139 | ||
|
|
44b4c0d8a9 | ||
|
|
0133e4fb48 |
@@ -1,26 +0,0 @@
|
||||
# This is the top-most EditorConfig file.
|
||||
root = true
|
||||
|
||||
# For all files.
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Source code files
|
||||
[*.{h,cpp,rs,py,sh}]
|
||||
indent_size = 4
|
||||
|
||||
# .cirrus.yml, etc.
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
|
||||
# Makefiles (only relevant for depends build)
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
# CMake files
|
||||
[{CMakeLists.txt,*.cmake,*.cmake.in}]
|
||||
indent_size = 2
|
||||
93
.github/ISSUE_TEMPLATE/bug.yml
vendored
93
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -1,93 +0,0 @@
|
||||
name: Bug report
|
||||
description: Submit a new bug report.
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## This issue tracker is only for technical issues related to Bitcoin Core.
|
||||
|
||||
* General bitcoin questions and/or support requests should use Bitcoin StackExchange at https://bitcoin.stackexchange.com.
|
||||
* For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/.
|
||||
* If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running `memtest` and observe CPU temperature with a load-test tool such as `linpack` before creating an issue.
|
||||
|
||||
----
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
- type: textarea
|
||||
id: current-behaviour
|
||||
attributes:
|
||||
label: Current behaviour
|
||||
description: Tell us what went wrong
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: Tell us what you expected to happen
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction-steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
Tell us how to reproduce your bug. Please attach related screenshots if necessary.
|
||||
* Run-time or compile-time configuration options
|
||||
* Actions taken
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: |
|
||||
Please copy and paste any relevant log output or attach a debug log file.
|
||||
|
||||
You can find the debug.log in your [data dir.](https://github.com/bitcoin/bitcoin/blob/master/doc/files.md#data-directory-location)
|
||||
|
||||
Please be aware that the debug log might contain personally identifying information.
|
||||
validations:
|
||||
required: false
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: How did you obtain Bitcoin Core
|
||||
multiple: false
|
||||
options:
|
||||
- Compiled from source
|
||||
- Pre-built binaries
|
||||
- Package manager
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: core-version
|
||||
attributes:
|
||||
label: What version of Bitcoin Core are you using?
|
||||
description: Run `bitcoind --version` or in Bitcoin-QT use `Help > About Bitcoin Core`
|
||||
placeholder: e.g. v24.0.1 or master@e1bf547
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: os
|
||||
attributes:
|
||||
label: Operating system and version
|
||||
placeholder: e.g. "MacOS Ventura 13.2" or "Ubuntu 22.04 LTS"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: machine-specs
|
||||
attributes:
|
||||
label: Machine specifications
|
||||
description: |
|
||||
What are the specifications of the host machine?
|
||||
e.g. OS/CPU and disk type, network connectivity
|
||||
validations:
|
||||
required: false
|
||||
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Bitcoin Core Security Policy
|
||||
url: https://github.com/bitcoin/bitcoin/blob/master/SECURITY.md
|
||||
about: View security policy
|
||||
- name: Bitcoin Core Developers
|
||||
url: https://bitcoincore.org
|
||||
about: Bitcoin Core homepage
|
||||
36
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
36
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -1,36 +0,0 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for this project.
|
||||
labels: [Feature]
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature
|
||||
attributes:
|
||||
label: Please describe the feature you'd like to see added.
|
||||
description: Attach screenshots or logs if applicable.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: related-problem
|
||||
attributes:
|
||||
label: Is your feature related to a problem, if so please describe it.
|
||||
description: Attach screenshots or logs if applicable.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Describe the solution you'd like
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Describe any alternatives you've considered
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Please leave any additional context
|
||||
validations:
|
||||
required: false
|
||||
44
.github/ISSUE_TEMPLATE/good_first_issue.yml
vendored
44
.github/ISSUE_TEMPLATE/good_first_issue.yml
vendored
@@ -1,44 +0,0 @@
|
||||
name: Good First Issue
|
||||
description: (Regular devs only) Suggest a new good first issue
|
||||
labels: [good first issue]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please add the label "good first issue" manually before or after opening
|
||||
|
||||
A good first issue is an uncontroversial issue, that has a relatively unique and obvious solution
|
||||
|
||||
Motivate the issue and explain the solution briefly
|
||||
- type: textarea
|
||||
id: motivation
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: Motivate the issue
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Possible solution
|
||||
description: Describe a possible solution
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: useful-skills
|
||||
attributes:
|
||||
label: Useful Skills
|
||||
description: For example, “`std::thread`”, “Qt6 GUI and async GUI design” or “basic understanding of Bitcoin mining and the Bitcoin Core RPC interface”.
|
||||
value: |
|
||||
* Compiling Bitcoin Core from source
|
||||
* Running the C++ unit tests and the Python functional tests
|
||||
* ...
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Guidance for new contributors
|
||||
description: Please leave this to automatically add the footer for new contributors
|
||||
value: |
|
||||
Want to work on this issue?
|
||||
|
||||
For guidance on contributing, please read [CONTRIBUTING.md](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md) before opening your pull request.
|
||||
|
||||
18
.github/ISSUE_TEMPLATE/gui_issue.yml
vendored
18
.github/ISSUE_TEMPLATE/gui_issue.yml
vendored
@@ -1,18 +0,0 @@
|
||||
name: Issue or feature request related to the GUI
|
||||
description: Any report, issue or feature request related to the GUI
|
||||
labels: [GUI]
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: acknowledgement
|
||||
attributes:
|
||||
label: Issues, reports or feature requests related to the GUI should be opened directly on the GUI repo
|
||||
description: https://github.com/bitcoin-core/gui/issues/
|
||||
options:
|
||||
- label: I still think this issue should be opened here
|
||||
required: true
|
||||
- type: textarea
|
||||
id: gui-request
|
||||
attributes:
|
||||
label: Report
|
||||
validations:
|
||||
required: true
|
||||
43
.github/PULL_REQUEST_TEMPLATE.md
vendored
43
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,43 +0,0 @@
|
||||
<!--
|
||||
*** Please remove the following help text before submitting: ***
|
||||
|
||||
Pull requests without a rationale and clear improvement may be closed
|
||||
immediately.
|
||||
|
||||
GUI-related pull requests should be opened against
|
||||
https://github.com/bitcoin-core/gui
|
||||
first. See CONTRIBUTING.md
|
||||
-->
|
||||
|
||||
<!--
|
||||
Please provide clear motivation for your patch and explain how it improves
|
||||
Bitcoin Core user experience or Bitcoin Core developer experience
|
||||
significantly:
|
||||
|
||||
* Any test improvements or new tests that improve coverage are always welcome.
|
||||
* All other changes should have accompanying unit tests (see `src/test/`) or
|
||||
functional tests (see `test/`). Contributors should note which tests cover
|
||||
modified code. If no tests exist for a region of modified code, new tests
|
||||
should accompany the change.
|
||||
* Bug fixes are most welcome when they come with steps to reproduce or an
|
||||
explanation of the potential issue as well as reasoning for the way the bug
|
||||
was fixed.
|
||||
* Features are welcome, but might be rejected due to design or scope issues.
|
||||
If a feature is based on a lot of dependencies, contributors should first
|
||||
consider building the system outside of Bitcoin Core, if possible.
|
||||
* Refactoring changes are only accepted if they are required for a feature or
|
||||
bug fix or otherwise improve developer experience significantly. For example,
|
||||
most "code style" refactoring changes require a thorough explanation why they
|
||||
are useful, what downsides they have and why they *significantly* improve
|
||||
developer experience or avoid serious programming bugs. Note that code style
|
||||
is often a subjective matter. Unless they are explicitly mentioned to be
|
||||
preferred in the [developer notes](/doc/developer-notes.md), stylistic code
|
||||
changes are usually rejected.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Bitcoin Core has a thorough review process and even the most trivial change
|
||||
needs to pass a lot of eyes and requires non-zero or even substantial time
|
||||
effort to review. There is a huge lack of active reviewers on the project, so
|
||||
patches often sit for a long time.
|
||||
-->
|
||||
55
.github/actions/configure-docker/action.yml
vendored
55
.github/actions/configure-docker/action.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: 'Configure Docker'
|
||||
description: 'Set up Docker build driver and configure build cache args'
|
||||
inputs:
|
||||
cache-provider:
|
||||
description: 'gha or cirrus cache provider'
|
||||
required: true
|
||||
options:
|
||||
- gh
|
||||
- cirrus
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# Use host network to allow access to cirrus gha cache running on the host
|
||||
driver-opts: |
|
||||
network=host
|
||||
|
||||
# This is required to allow buildkit to access the actions cache
|
||||
- name: Expose actions cache variables
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
|
||||
|
||||
- name: Construct docker build cache args
|
||||
shell: bash
|
||||
run: |
|
||||
# Configure docker build cache backend
|
||||
#
|
||||
# On forks the gha cache will work but will use Github's cache backend.
|
||||
# Docker will check for variables $ACTIONS_CACHE_URL, $ACTIONS_RESULTS_URL and $ACTIONS_RUNTIME_TOKEN
|
||||
# which are set automatically when running on GitHub infra: https://docs.docker.com/build/cache/backends/gha/#synopsis
|
||||
|
||||
# Use cirrus cache host
|
||||
if [[ ${{ inputs.cache-provider }} == 'cirrus' ]]; then
|
||||
url_args="url=${CIRRUS_CACHE_HOST},url_v2=${CIRRUS_CACHE_HOST}"
|
||||
else
|
||||
url_args=""
|
||||
fi
|
||||
|
||||
# Always optimistically --cache‑from in case a cache blob exists
|
||||
args=(--cache-from "type=gha${url_args:+,${url_args}},scope=${CONTAINER_NAME}")
|
||||
|
||||
# If this is a push to the default branch, also add --cache‑to to save the cache
|
||||
if [[ ${{ github.event_name }} == "push" && ${{ github.ref_name }} == ${{ github.event.repository.default_branch }} ]]; then
|
||||
args+=(--cache-to "type=gha${url_args:+,${url_args}},mode=max,ignore-error=true,scope=${CONTAINER_NAME}")
|
||||
fi
|
||||
|
||||
# Always `--load` into docker images (needed when using the `docker-container` build driver).
|
||||
args+=(--load)
|
||||
|
||||
echo "DOCKER_BUILD_CACHE_ARG=${args[*]}" >> $GITHUB_ENV
|
||||
27
.github/actions/configure-environment/action.yml
vendored
27
.github/actions/configure-environment/action.yml
vendored
@@ -1,27 +0,0 @@
|
||||
name: 'Configure environment'
|
||||
description: 'Configure CI, cache and container name environment variables'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Set CI and cache directories
|
||||
shell: bash
|
||||
run: |
|
||||
echo "BASE_ROOT_DIR=${{ runner.temp }}" >> "$GITHUB_ENV"
|
||||
echo "BASE_BUILD_DIR=${{ runner.temp }}/build" >> "$GITHUB_ENV"
|
||||
echo "CCACHE_DIR=${{ runner.temp }}/ccache_dir" >> $GITHUB_ENV
|
||||
echo "DEPENDS_DIR=${{ runner.temp }}/depends" >> "$GITHUB_ENV"
|
||||
echo "BASE_CACHE=${{ runner.temp }}/depends/built" >> $GITHUB_ENV
|
||||
echo "SOURCES_PATH=${{ runner.temp }}/depends/sources" >> $GITHUB_ENV
|
||||
echo "PREVIOUS_RELEASES_DIR=${{ runner.temp }}/previous_releases" >> $GITHUB_ENV
|
||||
|
||||
- name: Set cache hashes
|
||||
shell: bash
|
||||
run: |
|
||||
echo "DEPENDS_HASH=$(git ls-tree HEAD depends "ci/test/$FILE_ENV" | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
echo "PREVIOUS_RELEASES_HASH=$(git ls-tree HEAD test/get_previous_releases.py | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Get container name
|
||||
shell: bash
|
||||
run: |
|
||||
source $FILE_ENV
|
||||
echo "CONTAINER_NAME=$CONTAINER_NAME" >> "$GITHUB_ENV"
|
||||
47
.github/actions/restore-caches/action.yml
vendored
47
.github/actions/restore-caches/action.yml
vendored
@@ -1,47 +0,0 @@
|
||||
name: 'Restore Caches'
|
||||
description: 'Restore ccache, depends sources, and built depends caches'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Restore Ccache cache
|
||||
id: ccache-cache
|
||||
uses: cirruslabs/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
ccache-${{ env.CONTAINER_NAME }}-
|
||||
|
||||
- name: Restore depends sources cache
|
||||
id: depends-sources
|
||||
uses: cirruslabs/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.SOURCES_PATH }}
|
||||
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
||||
restore-keys: |
|
||||
depends-sources-${{ env.CONTAINER_NAME }}-
|
||||
|
||||
- name: Restore built depends cache
|
||||
id: depends-built
|
||||
uses: cirruslabs/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.BASE_CACHE }}
|
||||
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
||||
restore-keys: |
|
||||
depends-built-${{ env.CONTAINER_NAME }}-
|
||||
|
||||
- name: Restore previous releases cache
|
||||
id: previous-releases
|
||||
uses: cirruslabs/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.PREVIOUS_RELEASES_DIR }}
|
||||
key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }}
|
||||
restore-keys: |
|
||||
previous-releases-${{ env.CONTAINER_NAME }}-
|
||||
|
||||
- name: export cache hits
|
||||
shell: bash
|
||||
run: |
|
||||
echo "depends-sources-cache-hit=${{ steps.depends-sources.outputs.cache-hit }}" >> $GITHUB_ENV
|
||||
echo "depends-built-cache-hit=${{ steps.depends-built.outputs.cache-hit }}" >> $GITHUB_ENV
|
||||
echo "previous-releases-cache-hit=${{ steps.previous-releases.outputs.cache-hit }}" >> $GITHUB_ENV
|
||||
39
.github/actions/save-caches/action.yml
vendored
39
.github/actions/save-caches/action.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: 'Save Caches'
|
||||
description: 'Save ccache, depends sources, and built depends caches'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: debug cache hit inputs
|
||||
shell: bash
|
||||
run: |
|
||||
echo "depends sources direct cache hit to primary key: ${{ env.depends-sources-cache-hit }}"
|
||||
echo "depends built direct cache hit to primary key: ${{ env.depends-built-cache-hit }}"
|
||||
echo "previous releases direct cache hit to primary key: ${{ env.previous-releases-cache-hit }}"
|
||||
|
||||
- name: Save Ccache cache
|
||||
uses: cirruslabs/cache/save@v4
|
||||
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) }}
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
|
||||
|
||||
- name: Save depends sources cache
|
||||
uses: cirruslabs/cache/save@v4
|
||||
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-sources-cache-hit != 'true') }}
|
||||
with:
|
||||
path: ${{ env.SOURCES_PATH }}
|
||||
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
||||
|
||||
- name: Save built depends cache
|
||||
uses: cirruslabs/cache/save@v4
|
||||
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-built-cache-hit != 'true' )}}
|
||||
with:
|
||||
path: ${{ env.BASE_CACHE }}
|
||||
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
||||
|
||||
- name: Save previous releases cache
|
||||
uses: cirruslabs/cache/save@v4
|
||||
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.previous-releases-cache-hit != 'true' )}}
|
||||
with:
|
||||
path: ${{ env.PREVIOUS_RELEASES_DIR }}
|
||||
key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }}
|
||||
67
.github/ci-test-each-commit-exec.py
vendored
67
.github/ci-test-each-commit-exec.py
vendored
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import shlex
|
||||
|
||||
|
||||
def run(cmd, **kwargs):
|
||||
print("+ " + shlex.join(cmd), flush=True)
|
||||
try:
|
||||
return subprocess.run(cmd, check=True, **kwargs)
|
||||
except Exception as e:
|
||||
sys.exit(e)
|
||||
|
||||
|
||||
def main():
|
||||
print("Running tests on commit ...")
|
||||
run(["git", "log", "-1"])
|
||||
|
||||
num_procs = int(run(["nproc"], stdout=subprocess.PIPE).stdout)
|
||||
|
||||
run([
|
||||
"cmake",
|
||||
"-B",
|
||||
"build",
|
||||
"-Werror=dev",
|
||||
# Use clang++, because it is a bit faster and uses less memory than g++
|
||||
"-DCMAKE_C_COMPILER=clang",
|
||||
"-DCMAKE_CXX_COMPILER=clang++",
|
||||
# Use mold, because it is faster than the default linker
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=mold",
|
||||
# Use Debug build type for more debug checks, but enable optimizations
|
||||
"-DAPPEND_CXXFLAGS='-O3 -g2'",
|
||||
"-DAPPEND_CFLAGS='-O3 -g2'",
|
||||
"-DCMAKE_BUILD_TYPE=Debug",
|
||||
"-DWERROR=ON",
|
||||
"-DWITH_ZMQ=ON",
|
||||
"-DBUILD_GUI=ON",
|
||||
"-DBUILD_BENCH=ON",
|
||||
"-DBUILD_FUZZ_BINARY=ON",
|
||||
"-DWITH_USDT=ON",
|
||||
"-DCMAKE_CXX_FLAGS=-Wno-error=unused-member-function",
|
||||
])
|
||||
run(["cmake", "--build", "build", "-j", str(num_procs)])
|
||||
run([
|
||||
"ctest",
|
||||
"--output-on-failure",
|
||||
"--stop-on-failure",
|
||||
"--test-dir",
|
||||
"build",
|
||||
"-j",
|
||||
str(num_procs),
|
||||
])
|
||||
run([
|
||||
sys.executable,
|
||||
"./build/test/functional/test_runner.py",
|
||||
"-j",
|
||||
str(num_procs * 2),
|
||||
"--combinedlogslen=99999999",
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
564
.github/workflows/ci.yml
vendored
564
.github/workflows/ci.yml
vendored
@@ -1,564 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit.
|
||||
|
||||
name: CI
|
||||
on:
|
||||
# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request.
|
||||
pull_request:
|
||||
# See: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#push.
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error
|
||||
CIRRUS_CACHE_HOST: http://127.0.0.1:12321/ # When using Cirrus Runners this host can be used by the docker `gha` build cache type.
|
||||
REPO_USE_CIRRUS_RUNNERS: 'bitcoin/bitcoin' # Use cirrus runners and cache for this repo, instead of falling back to the slow GHA runners
|
||||
|
||||
defaults:
|
||||
run:
|
||||
# Enforce fail-fast behavior for all platforms.
|
||||
# See: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
runners:
|
||||
name: 'determine runners'
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
provider: ${{ steps.runners.outputs.provider }}
|
||||
steps:
|
||||
- id: runners
|
||||
run: |
|
||||
if [[ "${REPO_USE_CIRRUS_RUNNERS}" == "${{ github.repository }}" ]]; then
|
||||
echo "provider=cirrus" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice title=Runner Selection::Using Cirrus Runners"
|
||||
else
|
||||
echo "provider=gha" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice title=Runner Selection::Using GitHub-hosted runners"
|
||||
fi
|
||||
|
||||
test-each-commit:
|
||||
name: 'test each commit'
|
||||
runs-on: ubuntu-24.04
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
|
||||
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes. Assuming a worst case time of 1 hour per commit, this leads to a --max-count=6 below.
|
||||
env:
|
||||
MAX_COUNT: 6
|
||||
steps:
|
||||
- name: Determine fetch depth
|
||||
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: ${{ env.FETCH_DEPTH }}
|
||||
- name: Determine commit range
|
||||
run: |
|
||||
# Checkout HEAD~ and find the test base commit
|
||||
# Checkout HEAD~ because it would be wasteful to rerun tests on the PR
|
||||
# head commit that are already run by other jobs.
|
||||
git checkout HEAD~
|
||||
# Figure out test base commit by listing ancestors of HEAD, excluding
|
||||
# ancestors of the most recent merge commit, limiting the list to the
|
||||
# newest MAX_COUNT ancestors, ordering it from oldest to newest, and
|
||||
# taking the first one.
|
||||
#
|
||||
# If the branch contains up to MAX_COUNT ancestor commits after the
|
||||
# most recent merge commit, all of those commits will be tested. If it
|
||||
# contains more, only the most recent MAX_COUNT commits will be
|
||||
# tested.
|
||||
#
|
||||
# In the command below, the ^@ suffix is used to refer to all parents
|
||||
# of the merge commit as described in:
|
||||
# https://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations
|
||||
# and the ^ prefix is used to exclude these parents and all their
|
||||
# ancestors from the rev-list output as described in:
|
||||
# https://git-scm.com/docs/git-rev-list
|
||||
MERGE_BASE=$(git rev-list -n1 --merges HEAD)
|
||||
EXCLUDE_MERGE_BASE_ANCESTORS=
|
||||
# MERGE_BASE can be empty due to limited fetch-depth
|
||||
if test -n "$MERGE_BASE"; then
|
||||
EXCLUDE_MERGE_BASE_ANCESTORS=^${MERGE_BASE}^@
|
||||
fi
|
||||
echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD $EXCLUDE_MERGE_BASE_ANCESTORS | head -1)" >> "$GITHUB_ENV"
|
||||
- run: |
|
||||
git fetch origin "${GITHUB_BASE_REF}"
|
||||
git config user.email "ci@example.com"
|
||||
git config user.name "CI"
|
||||
- run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y
|
||||
sudo pip3 install --break-system-packages pycapnp
|
||||
- name: Compile and run tests
|
||||
run: |
|
||||
# Run tests on commits after the last merge commit and before the PR head commit
|
||||
git rebase --exec "git merge --no-commit origin/${GITHUB_BASE_REF} && python3 ./.github/ci-test-each-commit-exec.py && git reset --hard" ${{ env.TEST_BASE }}
|
||||
|
||||
macos-native-arm64:
|
||||
name: ${{ matrix.job-name }}
|
||||
# Use any image to support the xcode-select below, but hardcode version to avoid silent upgrades (and breaks).
|
||||
# See: https://github.com/actions/runner-images#available-images.
|
||||
runs-on: macos-14
|
||||
|
||||
# When a contributor maintains a fork of the repo, any pull request they make
|
||||
# to their own fork, or to the main repository, will trigger two CI runs:
|
||||
# one for the branch push and one for the pull request.
|
||||
# This can be avoided by setting SKIP_BRANCH_PUSH=true as a custom env variable
|
||||
# in Github repository settings.
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
|
||||
timeout-minutes: 120
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job-type: [standard, fuzz]
|
||||
include:
|
||||
- job-type: standard
|
||||
file-env: './ci/test/00_setup_env_mac_native.sh'
|
||||
job-name: 'macOS 14 native, arm64, no depends, sqlite only, gui'
|
||||
- job-type: fuzz
|
||||
file-env: './ci/test/00_setup_env_mac_native_fuzz.sh'
|
||||
job-name: 'macOS 14 native, arm64, fuzz'
|
||||
|
||||
env:
|
||||
DANGER_RUN_CI_ON_HOST: 1
|
||||
BASE_ROOT_DIR: ${{ github.workspace }}
|
||||
|
||||
steps:
|
||||
- &CHECKOUT
|
||||
name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
# Ensure the latest merged pull request state is used, even on re-runs.
|
||||
ref: &CHECKOUT_REF_TMPL ${{ github.event_name == 'pull_request' && github.ref || '' }}
|
||||
|
||||
- name: Clang version
|
||||
run: |
|
||||
# Use the earliest Xcode supported by the version of macOS denoted in
|
||||
# doc/release-notes-empty-template.md and providing at least the
|
||||
# minimum clang version denoted in doc/dependencies.md.
|
||||
# See: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes
|
||||
sudo xcode-select --switch /Applications/Xcode_15.0.app
|
||||
clang --version
|
||||
|
||||
- name: Install Homebrew packages
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
run: |
|
||||
# A workaround for "The `brew link` step did not complete successfully" error.
|
||||
brew install --quiet python@3 || brew link --overwrite python@3
|
||||
brew install --quiet coreutils ninja pkgconf gnu-getopt ccache boost libevent zeromq qt@6 qrencode capnp
|
||||
|
||||
- name: Install Python packages
|
||||
run: |
|
||||
git clone -b v2.1.0 https://github.com/capnproto/pycapnp
|
||||
pip3 install ./pycapnp -C force-bundled-libcapnp=True --break-system-packages
|
||||
|
||||
- name: Set Ccache directory
|
||||
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Restore Ccache cache
|
||||
id: ccache-cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
|
||||
restore-keys: ${{ github.job }}-${{ matrix.job-type }}-ccache-
|
||||
|
||||
- name: CI script
|
||||
run: ./ci/test_run_all.sh
|
||||
env:
|
||||
FILE_ENV: ${{ matrix.file-env }}
|
||||
|
||||
- name: Save Ccache cache
|
||||
uses: actions/cache/save@v4
|
||||
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
|
||||
key: ${{ github.job }}-${{ matrix.job-type }}-ccache-${{ github.run_id }}
|
||||
|
||||
windows-native-dll:
|
||||
name: ${{ matrix.job-name }}
|
||||
runs-on: windows-2022
|
||||
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
TEST_RUNNER_TIMEOUT_FACTOR: 40
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job-type: [standard, fuzz]
|
||||
include:
|
||||
- job-type: standard
|
||||
generate-options: '-DBUILD_GUI=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON'
|
||||
job-name: 'Windows native, VS 2022'
|
||||
- job-type: fuzz
|
||||
generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="wallet" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON'
|
||||
job-name: 'Windows native, fuzz, VS 2022'
|
||||
|
||||
steps:
|
||||
- *CHECKOUT
|
||||
|
||||
- name: Configure Developer Command Prompt for Microsoft Visual C++
|
||||
# Using microsoft/setup-msbuild is not enough.
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Get tool information
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake -version | Tee-Object -FilePath "cmake_version"
|
||||
Write-Output "---"
|
||||
msbuild -version | Tee-Object -FilePath "msbuild_version"
|
||||
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
|
||||
py -3 --version
|
||||
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
|
||||
bash --version
|
||||
|
||||
- name: Using vcpkg with MSBuild
|
||||
run: |
|
||||
echo "set(VCPKG_BUILD_TYPE release)" >> "${VCPKG_INSTALLATION_ROOT}/triplets/x64-windows.cmake"
|
||||
# Workaround for libevent, which requires CMake 3.1 but is incompatible with CMake >= 4.0.
|
||||
sed -i '1s/^/set(ENV{CMAKE_POLICY_VERSION_MINIMUM} 3.5)\n/' "${VCPKG_INSTALLATION_ROOT}/scripts/ports.cmake"
|
||||
|
||||
- name: vcpkg tools cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: C:/vcpkg/downloads/tools
|
||||
key: ${{ github.job }}-vcpkg-tools
|
||||
|
||||
- name: Restore vcpkg binary cache
|
||||
uses: actions/cache/restore@v4
|
||||
id: vcpkg-binary-cache
|
||||
with:
|
||||
path: ~/AppData/Local/vcpkg/archives
|
||||
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
|
||||
|
||||
- name: Generate build system
|
||||
run: |
|
||||
cmake -B build -Werror=dev --preset vs2022 -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ${{ matrix.generate-options }}
|
||||
|
||||
- name: Save vcpkg binary cache
|
||||
uses: actions/cache/save@v4
|
||||
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
|
||||
with:
|
||||
path: ~/AppData/Local/vcpkg/archives
|
||||
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
|
||||
|
||||
- name: Build
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake --build . -j $NUMBER_OF_PROCESSORS --config Release
|
||||
|
||||
- name: Get bitcoind manifest
|
||||
if: matrix.job-type == 'standard'
|
||||
working-directory: build
|
||||
run: |
|
||||
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -out:bitcoind.manifest
|
||||
cat bitcoind.manifest
|
||||
echo
|
||||
mt.exe -nologo -inputresource:bin/Release/bitcoind.exe -validate_manifest
|
||||
|
||||
- name: Run test suite
|
||||
if: matrix.job-type == 'standard'
|
||||
working-directory: build
|
||||
env:
|
||||
QT_PLUGIN_PATH: '${{ github.workspace }}\build\vcpkg_installed\x64-windows\Qt6\plugins'
|
||||
run: |
|
||||
ctest --output-on-failure --stop-on-failure -j $NUMBER_OF_PROCESSORS -C Release
|
||||
|
||||
- name: Run functional tests
|
||||
if: matrix.job-type == 'standard'
|
||||
working-directory: build
|
||||
env:
|
||||
BITCOIN_BIN: '${{ github.workspace }}\build\bin\Release\bitcoin.exe'
|
||||
BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe'
|
||||
BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe'
|
||||
BITCOINTX: '${{ github.workspace }}\build\bin\Release\bitcoin-tx.exe'
|
||||
BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe'
|
||||
BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe'
|
||||
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
|
||||
run: py -3 test/functional/test_runner.py --jobs $NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix="${RUNNER_TEMP}" --combinedlogslen=99999999 --timeout-factor=${TEST_RUNNER_TIMEOUT_FACTOR} ${TEST_RUNNER_EXTRA}
|
||||
|
||||
- name: Clone corpora
|
||||
if: matrix.job-type == 'fuzz'
|
||||
run: |
|
||||
git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${RUNNER_TEMP}/qa-assets"
|
||||
cd "${RUNNER_TEMP}/qa-assets"
|
||||
echo "Using qa-assets repo from commit ..."
|
||||
git log -1
|
||||
|
||||
- name: Run fuzz tests
|
||||
if: matrix.job-type == 'fuzz'
|
||||
working-directory: build
|
||||
env:
|
||||
BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe'
|
||||
run: |
|
||||
py -3 test/fuzz/test_runner.py --par $NUMBER_OF_PROCESSORS --loglevel DEBUG "${RUNNER_TEMP}/qa-assets/fuzz_corpora"
|
||||
|
||||
windows-cross:
|
||||
name: 'Linux->Windows cross, no tests'
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
FILE_ENV: './ci/test/00_setup_env_win64.sh'
|
||||
DANGER_CI_ON_HOST_FOLDERS: 1
|
||||
|
||||
steps:
|
||||
- *CHECKOUT
|
||||
|
||||
- name: Configure environment
|
||||
uses: ./.github/actions/configure-environment
|
||||
|
||||
- name: Restore caches
|
||||
id: restore-cache
|
||||
uses: ./.github/actions/restore-caches
|
||||
|
||||
- name: Configure Docker
|
||||
uses: ./.github/actions/configure-docker
|
||||
with:
|
||||
cache-provider: ${{ needs.runners.outputs.provider }}
|
||||
|
||||
- name: CI script
|
||||
run: ./ci/test_run_all.sh
|
||||
|
||||
- name: Save caches
|
||||
uses: ./.github/actions/save-caches
|
||||
|
||||
- name: Upload built executables
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
|
||||
path: |
|
||||
${{ env.BASE_BUILD_DIR }}/bin/*.exe
|
||||
${{ env.BASE_BUILD_DIR }}/src/secp256k1/bin/*.exe
|
||||
${{ env.BASE_BUILD_DIR }}/src/univalue/*.exe
|
||||
${{ env.BASE_BUILD_DIR }}/test/config.ini
|
||||
|
||||
windows-native-test:
|
||||
name: 'Windows, test cross-built'
|
||||
runs-on: windows-2022
|
||||
needs: windows-cross
|
||||
|
||||
env:
|
||||
PYTHONUTF8: 1
|
||||
TEST_RUNNER_TIMEOUT_FACTOR: 40
|
||||
|
||||
steps:
|
||||
- *CHECKOUT
|
||||
|
||||
- name: Download built executables
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: x86_64-w64-mingw32-executables-${{ github.run_id }}
|
||||
|
||||
- name: Run bitcoind.exe
|
||||
run: ./bin/bitcoind.exe -version
|
||||
|
||||
- name: Find mt.exe tool
|
||||
shell: pwsh
|
||||
run: |
|
||||
$sdk_dir = (Get-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' -Name KitsRoot10).KitsRoot10
|
||||
$sdk_latest = (Get-ChildItem "$sdk_dir\bin" -Directory | Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
"MT_EXE=${sdk_dir}bin\${sdk_latest}\x64\mt.exe" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Get bitcoind manifest
|
||||
shell: pwsh
|
||||
run: |
|
||||
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -out:bitcoind.manifest
|
||||
Get-Content bitcoind.manifest
|
||||
& $env:MT_EXE -nologo -inputresource:bin\bitcoind.exe -validate_manifest
|
||||
|
||||
- name: Run unit tests
|
||||
# Can't use ctest here like other jobs as we don't have a CMake build tree.
|
||||
run: |
|
||||
./bin/test_bitcoin.exe -l test_suite # Intentionally run sequentially here, to catch test case failures caused by dirty global state from prior test cases.
|
||||
./src/secp256k1/bin/exhaustive_tests.exe
|
||||
./src/secp256k1/bin/noverify_tests.exe
|
||||
./src/secp256k1/bin/tests.exe
|
||||
./src/univalue/object.exe
|
||||
./src/univalue/unitester.exe
|
||||
|
||||
- name: Run benchmarks
|
||||
run: ./bin/bench_bitcoin.exe -sanity-check
|
||||
|
||||
- name: Adjust paths in test/config.ini
|
||||
shell: pwsh
|
||||
run: |
|
||||
(Get-Content "test/config.ini") -replace '(?<=^SRCDIR=).*', '${{ github.workspace }}' -replace '(?<=^BUILDDIR=).*', '${{ github.workspace }}' -replace '(?<=^RPCAUTH=).*', '${{ github.workspace }}/share/rpcauth/rpcauth.py' | Set-Content "test/config.ini"
|
||||
Get-Content "test/config.ini"
|
||||
|
||||
- name: Set previous release directory
|
||||
run: |
|
||||
echo "PREVIOUS_RELEASES_DIR=${{ runner.temp }}/previous_releases" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Get previous releases
|
||||
working-directory: test
|
||||
run: ./get_previous_releases.py --target-dir $PREVIOUS_RELEASES_DIR
|
||||
|
||||
- name: Run functional tests
|
||||
env:
|
||||
# TODO: Fix the excluded test and re-enable it.
|
||||
# feature_unsupported_utxo_db.py fails on windows because of emojis in the test data directory
|
||||
EXCLUDE: '--exclude wallet_multiwallet.py,feature_unsupported_utxo_db.py'
|
||||
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
|
||||
run: py -3 test/functional/test_runner.py --jobs $NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix="$RUNNER_TEMP" --combinedlogslen=99999999 --timeout-factor=$TEST_RUNNER_TIMEOUT_FACTOR $EXCLUDE $TEST_RUNNER_EXTRA
|
||||
|
||||
ci-matrix:
|
||||
name: ${{ matrix.name }}
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && matrix.cirrus-runner || matrix.fallback-runner }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
timeout-minutes: ${{ matrix.timeout-minutes }}
|
||||
|
||||
env:
|
||||
DANGER_CI_ON_HOST_FOLDERS: 1
|
||||
FILE_ENV: ${{ matrix.file-env }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: '32 bit ARM, unit tests, no functional tests'
|
||||
cirrus-runner: 'ubuntu-24.04-arm' # Cirrus' Arm runners are Apple (with virtual Linux aarch64), which doesn't support 32-bit mode
|
||||
fallback-runner: 'ubuntu-24.04-arm'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_arm.sh'
|
||||
provider: 'gha'
|
||||
|
||||
- name: 'ASan + LSan + UBSan + integer, no depends, USDT'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md' # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_asan.sh'
|
||||
|
||||
- name: 'macOS-cross, gui, no tests'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_mac_cross.sh'
|
||||
|
||||
- name: 'No wallet, libbitcoinkernel'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh'
|
||||
|
||||
- name: 'no IPC, i686, DEBUG'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_i686_no_ipc.sh'
|
||||
|
||||
- name: 'fuzzer,address,undefined,integer, no depends'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 240
|
||||
file-env: './ci/test/00_setup_env_native_fuzz.sh'
|
||||
|
||||
- name: 'previous releases, depends DEBUG'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_previous_releases.sh'
|
||||
|
||||
- name: 'CentOS, depends, gui'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_centos.sh'
|
||||
|
||||
- name: 'tidy'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_tidy.sh'
|
||||
|
||||
- name: 'TSan, depends, no gui'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_tsan.sh'
|
||||
|
||||
- name: 'MSan, depends'
|
||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg'
|
||||
fallback-runner: 'ubuntu-24.04'
|
||||
timeout-minutes: 120
|
||||
file-env: './ci/test/00_setup_env_native_msan.sh'
|
||||
|
||||
steps:
|
||||
- *CHECKOUT
|
||||
|
||||
- name: Configure environment
|
||||
uses: ./.github/actions/configure-environment
|
||||
|
||||
- name: Restore caches
|
||||
id: restore-cache
|
||||
uses: ./.github/actions/restore-caches
|
||||
|
||||
- name: Configure Docker
|
||||
uses: ./.github/actions/configure-docker
|
||||
with:
|
||||
cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
||||
|
||||
- name: Enable bpfcc script
|
||||
if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }}
|
||||
# In the image build step, no external environment variables are available,
|
||||
# so any settings will need to be written to the settings env file:
|
||||
run: sed -i "s|\${INSTALL_BCC_TRACING_TOOLS}|true|g" ./ci/test/00_setup_env_native_asan.sh
|
||||
|
||||
- name: Set mmap_rnd_bits
|
||||
if: ${{ env.CONTAINER_NAME == 'ci_native_tsan' || env.CONTAINER_NAME == 'ci_native_msan' }}
|
||||
# Prevents crashes due to high ASLR entropy
|
||||
run: sudo sysctl -w vm.mmap_rnd_bits=28
|
||||
|
||||
- name: CI script
|
||||
run: ./ci/test_run_all.sh
|
||||
|
||||
- name: Save caches
|
||||
uses: ./.github/actions/save-caches
|
||||
|
||||
lint:
|
||||
name: 'lint'
|
||||
needs: runners
|
||||
runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-xs' || 'ubuntu-24.04' }}
|
||||
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
CONTAINER_NAME: "bitcoin-linter"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: *CHECKOUT_REF_TMPL
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Docker
|
||||
uses: ./.github/actions/configure-docker
|
||||
with:
|
||||
cache-provider: ${{ needs.runners.outputs.provider }}
|
||||
|
||||
- name: CI script
|
||||
run: |
|
||||
set -o xtrace
|
||||
docker buildx build -t "$CONTAINER_NAME" $DOCKER_BUILD_CACHE_ARG --file "./ci/lint_imagefile" .
|
||||
CIRRUS_PR_FLAG=""
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
CIRRUS_PR_FLAG="-e CIRRUS_PR=1"
|
||||
fi
|
||||
docker run --rm $CIRRUS_PR_FLAG -v "$(pwd)":/bitcoin "$CONTAINER_NAME"
|
||||
123
.gitignore
vendored
123
.gitignore
vendored
@@ -1,28 +1,113 @@
|
||||
# Patterns that are specific to a text editor, IDE, operating system, or user
|
||||
# environment are not added here. They should be added to your local gitignore
|
||||
# file instead:
|
||||
# https://docs.github.com/en/get-started/git-basics/ignoring-files#configuring-ignored-files-for-all-repositories-on-your-computer
|
||||
*.tar.gz
|
||||
|
||||
# Build subdirectories.
|
||||
/*build*
|
||||
!/build-aux
|
||||
!/build_msvc
|
||||
*.exe
|
||||
src/bitcoin
|
||||
src/bitcoind
|
||||
src/bitcoin-cli
|
||||
src/bitcoin-tx
|
||||
src/test/test_bitcoin
|
||||
src/qt/test/test_bitcoin-qt
|
||||
|
||||
# autoreconf
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
build-aux/depcomp
|
||||
build-aux/install-sh
|
||||
build-aux/ltmain.sh
|
||||
build-aux/m4/libtool.m4
|
||||
build-aux/m4/lt~obsolete.m4
|
||||
build-aux/m4/ltoptions.m4
|
||||
build-aux/m4/ltsugar.m4
|
||||
build-aux/m4/ltversion.m4
|
||||
build-aux/missing
|
||||
build-aux/compile
|
||||
build-aux/test-driver
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
libtool
|
||||
src/config/bitcoin-config.h
|
||||
src/config/bitcoin-config.h.in
|
||||
src/config/stamp-h1
|
||||
share/setup.nsi
|
||||
share/qt/Info.plist
|
||||
|
||||
src/univalue/gen
|
||||
|
||||
src/qt/*.moc
|
||||
src/qt/moc_*.cpp
|
||||
src/qt/forms/ui_*.h
|
||||
|
||||
src/qt/test/moc*.cpp
|
||||
|
||||
.deps
|
||||
.dirstamp
|
||||
.libs
|
||||
.*.swp
|
||||
*.*~*
|
||||
*.bak
|
||||
*.rej
|
||||
*.orig
|
||||
*.pyc
|
||||
|
||||
# Only ignore unexpected patches
|
||||
*.o
|
||||
*.o-*
|
||||
*.patch
|
||||
!contrib/guix/patches/*.patch
|
||||
!depends/patches/**/*.patch
|
||||
.bitcoin
|
||||
*.a
|
||||
*.pb.cc
|
||||
*.pb.h
|
||||
|
||||
/CMakeUserPresets.json
|
||||
*.log
|
||||
*.trs
|
||||
*.dmg
|
||||
|
||||
# Previous releases
|
||||
/releases
|
||||
*.json.h
|
||||
*.raw.h
|
||||
|
||||
# cargo default target dir
|
||||
target/
|
||||
#libtool object files
|
||||
*.lo
|
||||
*.la
|
||||
|
||||
/guix-build-*
|
||||
# Compilation and Qt preprocessor part
|
||||
*.qm
|
||||
Makefile
|
||||
bitcoin-qt
|
||||
Bitcoin-Qt.app
|
||||
|
||||
/ci/scratch/
|
||||
# Unit-tests
|
||||
Makefile.test
|
||||
bitcoin-qt_test
|
||||
src/test/buildenv.py
|
||||
|
||||
# Resources cpp
|
||||
qrc_*.cpp
|
||||
|
||||
# Qt creator
|
||||
*.pro.user
|
||||
|
||||
# Mac specific
|
||||
.DS_Store
|
||||
build
|
||||
|
||||
#lcov
|
||||
*.gcno
|
||||
/*.info
|
||||
test_bitcoin.coverage/
|
||||
total.coverage/
|
||||
coverage_percent.txt
|
||||
|
||||
#build tests
|
||||
linux-coverage-build
|
||||
linux-build
|
||||
win32-build
|
||||
qa/pull-tester/run-bitcoind-for-test.sh
|
||||
qa/pull-tester/tests-config.sh
|
||||
qa/pull-tester/cache/*
|
||||
qa/pull-tester/test.*/*
|
||||
|
||||
!src/leveldb*/Makefile
|
||||
|
||||
/doc/doxygen/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
3.10.14
|
||||
261
.style.yapf
261
.style.yapf
@@ -1,261 +0,0 @@
|
||||
[style]
|
||||
# Align closing bracket with visual indentation.
|
||||
align_closing_bracket_with_visual_indent=True
|
||||
|
||||
# Allow dictionary keys to exist on multiple lines. For example:
|
||||
#
|
||||
# x = {
|
||||
# ('this is the first element of a tuple',
|
||||
# 'this is the second element of a tuple'):
|
||||
# value,
|
||||
# }
|
||||
allow_multiline_dictionary_keys=False
|
||||
|
||||
# Allow lambdas to be formatted on more than one line.
|
||||
allow_multiline_lambdas=False
|
||||
|
||||
# Allow splits before the dictionary value.
|
||||
allow_split_before_dict_value=True
|
||||
|
||||
# Number of blank lines surrounding top-level function and class
|
||||
# definitions.
|
||||
blank_lines_around_top_level_definition=2
|
||||
|
||||
# Insert a blank line before a class-level docstring.
|
||||
blank_line_before_class_docstring=False
|
||||
|
||||
# Insert a blank line before a module docstring.
|
||||
blank_line_before_module_docstring=False
|
||||
|
||||
# Insert a blank line before a 'def' or 'class' immediately nested
|
||||
# within another 'def' or 'class'. For example:
|
||||
#
|
||||
# class Foo:
|
||||
# # <------ this blank line
|
||||
# def method():
|
||||
# ...
|
||||
blank_line_before_nested_class_or_def=False
|
||||
|
||||
# Do not split consecutive brackets. Only relevant when
|
||||
# dedent_closing_brackets is set. For example:
|
||||
#
|
||||
# call_func_that_takes_a_dict(
|
||||
# {
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# }
|
||||
# )
|
||||
#
|
||||
# would reformat to:
|
||||
#
|
||||
# call_func_that_takes_a_dict({
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# })
|
||||
coalesce_brackets=False
|
||||
|
||||
# The column limit.
|
||||
column_limit=160
|
||||
|
||||
# The style for continuation alignment. Possible values are:
|
||||
#
|
||||
# - SPACE: Use spaces for continuation alignment. This is default behavior.
|
||||
# - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns
|
||||
# (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs) for continuation
|
||||
# alignment.
|
||||
# - LESS: Slightly left if cannot vertically align continuation lines with
|
||||
# indent characters.
|
||||
# - VALIGN-RIGHT: Vertically align continuation lines with indent
|
||||
# characters. Slightly right (one more indent character) if cannot
|
||||
# vertically align continuation lines with indent characters.
|
||||
#
|
||||
# For options FIXED, and VALIGN-RIGHT are only available when USE_TABS is
|
||||
# enabled.
|
||||
continuation_align_style=SPACE
|
||||
|
||||
# Indent width used for line continuations.
|
||||
continuation_indent_width=4
|
||||
|
||||
# Put closing brackets on a separate line, dedented, if the bracketed
|
||||
# expression can't fit in a single line. Applies to all kinds of brackets,
|
||||
# including function definitions and calls. For example:
|
||||
#
|
||||
# config = {
|
||||
# 'key1': 'value1',
|
||||
# 'key2': 'value2',
|
||||
# } # <--- this bracket is dedented and on a separate line
|
||||
#
|
||||
# time_series = self.remote_client.query_entity_counters(
|
||||
# entity='dev3246.region1',
|
||||
# key='dns.query_latency_tcp',
|
||||
# transform=Transformation.AVERAGE(window=timedelta(seconds=60)),
|
||||
# start_ts=now()-timedelta(days=3),
|
||||
# end_ts=now(),
|
||||
# ) # <--- this bracket is dedented and on a separate line
|
||||
dedent_closing_brackets=False
|
||||
|
||||
# Disable the heuristic which places each list element on a separate line
|
||||
# if the list is comma-terminated.
|
||||
disable_ending_comma_heuristic=False
|
||||
|
||||
# Place each dictionary entry onto its own line.
|
||||
each_dict_entry_on_separate_line=True
|
||||
|
||||
# The regex for an i18n comment. The presence of this comment stops
|
||||
# reformatting of that line, because the comments are required to be
|
||||
# next to the string they translate.
|
||||
i18n_comment=
|
||||
|
||||
# The i18n function call names. The presence of this function stops
|
||||
# reformatting on that line, because the string it has cannot be moved
|
||||
# away from the i18n comment.
|
||||
i18n_function_call=
|
||||
|
||||
# Indent the dictionary value if it cannot fit on the same line as the
|
||||
# dictionary key. For example:
|
||||
#
|
||||
# config = {
|
||||
# 'key1':
|
||||
# 'value1',
|
||||
# 'key2': value1 +
|
||||
# value2,
|
||||
# }
|
||||
indent_dictionary_value=False
|
||||
|
||||
# The number of columns to use for indentation.
|
||||
indent_width=4
|
||||
|
||||
# Join short lines into one line. E.g., single line 'if' statements.
|
||||
join_multiple_lines=True
|
||||
|
||||
# Do not include spaces around selected binary operators. For example:
|
||||
#
|
||||
# 1 + 2 * 3 - 4 / 5
|
||||
#
|
||||
# will be formatted as follows when configured with "*,/":
|
||||
#
|
||||
# 1 + 2*3 - 4/5
|
||||
#
|
||||
no_spaces_around_selected_binary_operators=
|
||||
|
||||
# Use spaces around default or named assigns.
|
||||
spaces_around_default_or_named_assign=False
|
||||
|
||||
# Use spaces around the power operator.
|
||||
spaces_around_power_operator=False
|
||||
|
||||
# The number of spaces required before a trailing comment.
|
||||
spaces_before_comment=2
|
||||
|
||||
# Insert a space between the ending comma and closing bracket of a list,
|
||||
# etc.
|
||||
space_between_ending_comma_and_closing_bracket=True
|
||||
|
||||
# Split before arguments
|
||||
split_all_comma_separated_values=False
|
||||
|
||||
# Split before arguments if the argument list is terminated by a
|
||||
# comma.
|
||||
split_arguments_when_comma_terminated=False
|
||||
|
||||
# Set to True to prefer splitting before '&', '|' or '^' rather than
|
||||
# after.
|
||||
split_before_bitwise_operator=True
|
||||
|
||||
# Split before the closing bracket if a list or dict literal doesn't fit on
|
||||
# a single line.
|
||||
split_before_closing_bracket=True
|
||||
|
||||
# Split before a dictionary or set generator (comp_for). For example, note
|
||||
# the split before the 'for':
|
||||
#
|
||||
# foo = {
|
||||
# variable: 'Hello world, have a nice day!'
|
||||
# for variable in bar if variable != 42
|
||||
# }
|
||||
split_before_dict_set_generator=True
|
||||
|
||||
# Split before the '.' if we need to split a longer expression:
|
||||
#
|
||||
# foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d))
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# foo = ('This is a really long string: {}, {}, {}, {}'
|
||||
# .format(a, b, c, d))
|
||||
split_before_dot=False
|
||||
|
||||
# Split after the opening paren which surrounds an expression if it doesn't
|
||||
# fit on a single line.
|
||||
split_before_expression_after_opening_paren=False
|
||||
|
||||
# If an argument / parameter list is going to be split, then split before
|
||||
# the first argument.
|
||||
split_before_first_argument=False
|
||||
|
||||
# Set to True to prefer splitting before 'and' or 'or' rather than
|
||||
# after.
|
||||
split_before_logical_operator=True
|
||||
|
||||
# Split named assignments onto individual lines.
|
||||
split_before_named_assigns=True
|
||||
|
||||
# Set to True to split list comprehensions and generators that have
|
||||
# non-trivial expressions and multiple clauses before each of these
|
||||
# clauses. For example:
|
||||
#
|
||||
# result = [
|
||||
# a_long_var + 100 for a_long_var in xrange(1000)
|
||||
# if a_long_var % 10]
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# result = [
|
||||
# a_long_var + 100
|
||||
# for a_long_var in xrange(1000)
|
||||
# if a_long_var % 10]
|
||||
split_complex_comprehension=False
|
||||
|
||||
# The penalty for splitting right after the opening bracket.
|
||||
split_penalty_after_opening_bracket=30
|
||||
|
||||
# The penalty for splitting the line after a unary operator.
|
||||
split_penalty_after_unary_operator=10000
|
||||
|
||||
# The penalty for splitting right before an if expression.
|
||||
split_penalty_before_if_expr=0
|
||||
|
||||
# The penalty of splitting the line around the '&', '|', and '^'
|
||||
# operators.
|
||||
split_penalty_bitwise_operator=300
|
||||
|
||||
# The penalty for splitting a list comprehension or generator
|
||||
# expression.
|
||||
split_penalty_comprehension=80
|
||||
|
||||
# The penalty for characters over the column limit.
|
||||
split_penalty_excess_character=7000
|
||||
|
||||
# The penalty incurred by adding a line split to the unwrapped line. The
|
||||
# more line splits added the higher the penalty.
|
||||
split_penalty_for_added_line_split=30
|
||||
|
||||
# The penalty of splitting a list of "import as" names. For example:
|
||||
#
|
||||
# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1,
|
||||
# long_argument_2,
|
||||
# long_argument_3)
|
||||
#
|
||||
# would reformat to something like:
|
||||
#
|
||||
# from a_very_long_or_indented_module_name_yada_yad import (
|
||||
# long_argument_1, long_argument_2, long_argument_3)
|
||||
split_penalty_import_names=0
|
||||
|
||||
# The penalty of splitting the line around the 'and' and 'or'
|
||||
# operators.
|
||||
split_penalty_logical_operator=300
|
||||
|
||||
# Use the Tab character for indentation.
|
||||
use_tabs=False
|
||||
|
||||
75
.travis.yml
Normal file
75
.travis.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
# errata:
|
||||
# - A travis bug causes caches to trample eachother when using the same
|
||||
# compiler key (which we don't use anyway). This is worked around for now by
|
||||
# replacing the "compilers" with a build name prefixed by the no-op ":"
|
||||
# command. See: https://github.com/travis-ci/travis-ci/issues/4393
|
||||
# - sudo/dist/group are set so as to get Blue Box VMs, necessary for [loopback]
|
||||
# IPv6 support
|
||||
|
||||
sudo: required
|
||||
dist: precise
|
||||
group: legacy
|
||||
|
||||
os: linux
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
env:
|
||||
global:
|
||||
- MAKEJOBS=-j3
|
||||
- RUN_TESTS=false
|
||||
- CCACHE_SIZE=100M
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- BASE_OUTDIR=$TRAVIS_BUILD_DIR/out
|
||||
- SDK_URL=https://bitcoincore.org/depends-sources/sdks
|
||||
cache:
|
||||
apt: true
|
||||
directories:
|
||||
- depends/built
|
||||
- depends/sdk-sources
|
||||
- $HOME/.ccache
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- compiler: ": ARM"
|
||||
env: HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat"
|
||||
- compiler: ": bitcoind"
|
||||
env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat CPPFLAGS=-DDEBUG_LOCKORDER"
|
||||
- compiler: ": No wallet"
|
||||
env: HOST=x86_64-unknown-linux-gnu DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat"
|
||||
- compiler: ": 32-bit + dash"
|
||||
env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat" USE_SHELL="/bin/dash"
|
||||
- compiler: ": Cross-Mac"
|
||||
env: HOST=x86_64-apple-darwin11 PACKAGES="gcc-multilib g++-multilib cmake libcap-dev libz-dev libbz2-dev" OSX_SDK=10.7 GOAL="deploy"
|
||||
- compiler: ": Win64"
|
||||
env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-gui" MAKEJOBS="-j2"
|
||||
- compiler: ": Win32"
|
||||
env: HOST=i686-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-gui" MAKEJOBS="-j2"
|
||||
exclude:
|
||||
- compiler: gcc
|
||||
install:
|
||||
- if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get update; fi
|
||||
- if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES; fi
|
||||
before_script:
|
||||
- unset CC; unset CXX
|
||||
- mkdir -p depends/SDKs depends/sdk-sources
|
||||
- if [ -n "$OSX_SDK" -a ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi
|
||||
- if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi
|
||||
- make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
|
||||
script:
|
||||
- if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi
|
||||
- OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST
|
||||
- BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib"
|
||||
- depends/$HOST/native/bin/ccache --max-size=$CCACHE_SIZE
|
||||
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export CCACHE_READONLY=1; fi
|
||||
- test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh
|
||||
- ./configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
|
||||
- make distdir PACKAGE=bitcoin VERSION=$HOST
|
||||
- cd bitcoin-$HOST
|
||||
- ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
|
||||
- make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false )
|
||||
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib
|
||||
- if [ "$RUN_TESTS" = "true" ]; then make check; fi
|
||||
- if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.sh; fi
|
||||
after_script:
|
||||
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then (echo "Upload goes here. Something like: scp -r $BASE_OUTDIR server" || echo "upload failed"); fi
|
||||
@@ -1,7 +1,7 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[o:bitcoin:p:bitcoin:r:qt-translation-030x]
|
||||
file_filter = src/qt/locale/bitcoin_<lang>.xlf
|
||||
source_file = src/qt/locale/bitcoin_en.xlf
|
||||
[bitcoin.qt-translation-010x]
|
||||
file_filter = src/qt/locale/bitcoin_<lang>.ts
|
||||
source_file = src/qt/locale/bitcoin_en.ts
|
||||
source_lang = en
|
||||
|
||||
715
CMakeLists.txt
715
CMakeLists.txt
@@ -1,715 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# Ubuntu 22.04 LTS Jammy Jellyfish, https://wiki.ubuntu.com/Releases, EOSS in June 2027:
|
||||
# - CMake 3.22.1, https://packages.ubuntu.com/jammy/cmake
|
||||
#
|
||||
# Centos Stream 9, https://www.centos.org/cl-vs-cs/#end-of-life, EOL in May 2027:
|
||||
# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-source builds are not allowed.")
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0171)
|
||||
# `codegen` is a reserved target name.
|
||||
# See: https://cmake.org/cmake/help/latest/policy/CMP0171.html
|
||||
cmake_policy(SET CMP0171 NEW)
|
||||
endif()
|
||||
|
||||
# When adjusting CMake flag variables, we must not override those explicitly
|
||||
# set by the user. These are a subset of the CACHE_VARIABLES property.
|
||||
get_directory_property(precious_variables CACHE_VARIABLES)
|
||||
|
||||
#=============================
|
||||
# Project / Package metadata
|
||||
#=============================
|
||||
set(CLIENT_NAME "Bitcoin Core")
|
||||
set(CLIENT_VERSION_MAJOR 30)
|
||||
set(CLIENT_VERSION_MINOR 0)
|
||||
set(CLIENT_VERSION_BUILD 0)
|
||||
set(CLIENT_VERSION_RC 0)
|
||||
set(CLIENT_VERSION_IS_RELEASE "true")
|
||||
set(COPYRIGHT_YEAR "2025")
|
||||
|
||||
# During the enabling of the CXX and CXXOBJ languages, we modify
|
||||
# CMake's compiler/linker invocation strings by appending the content
|
||||
# of the user-defined `APPEND_*` variables, which allows overriding
|
||||
# any flag. We also ensure that the APPEND_* flags are considered
|
||||
# during CMake's tests, which use the `try_compile()` command.
|
||||
#
|
||||
# CMake's docs state that the `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`
|
||||
# variable "is meant to be set by CMake's platform information modules
|
||||
# for the current toolchain, or by a toolchain file." We do our best
|
||||
# to set it before the `project()` command.
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
||||
CMAKE_CXX_COMPILE_OBJECT
|
||||
CMAKE_OBJCXX_COMPILE_OBJECT
|
||||
CMAKE_CXX_LINK_EXECUTABLE
|
||||
)
|
||||
|
||||
project(BitcoinCore
|
||||
VERSION ${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_BUILD}
|
||||
DESCRIPTION "Bitcoin client software"
|
||||
HOMEPAGE_URL "https://bitcoincore.org/"
|
||||
LANGUAGES NONE
|
||||
)
|
||||
|
||||
set(CLIENT_VERSION_STRING ${PROJECT_VERSION})
|
||||
if(CLIENT_VERSION_RC GREATER 0)
|
||||
string(APPEND CLIENT_VERSION_STRING "rc${CLIENT_VERSION_RC}")
|
||||
endif()
|
||||
|
||||
set(COPYRIGHT_HOLDERS "The %s developers")
|
||||
set(COPYRIGHT_HOLDERS_FINAL "The ${CLIENT_NAME} developers")
|
||||
set(CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues")
|
||||
|
||||
#=============================
|
||||
# Language setup
|
||||
#=============================
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
|
||||
# We do not use the install_name_tool when cross-compiling for macOS.
|
||||
# So disable this tool check in further enable_language() commands.
|
||||
set(CMAKE_PLATFORM_HAS_INSTALLNAME FALSE)
|
||||
endif()
|
||||
enable_language(CXX)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
|
||||
include(ProcessConfigurations)
|
||||
|
||||
# Flatten static lib dependencies.
|
||||
# Without this, if libfoo.a depends on libbar.a, libfoo's objects can't begin
|
||||
# to be compiled until libbar.a has been created.
|
||||
if (NOT DEFINED CMAKE_OPTIMIZE_DEPENDENCIES)
|
||||
set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE)
|
||||
endif()
|
||||
|
||||
#=============================
|
||||
# Configurable options
|
||||
#=============================
|
||||
include(CMakeDependentOption)
|
||||
# When adding a new option, end the <help_text> with a full stop for consistency.
|
||||
option(BUILD_BITCOIN_BIN "Build bitcoin executable." ON)
|
||||
option(BUILD_DAEMON "Build bitcoind executable." ON)
|
||||
option(BUILD_GUI "Build bitcoin-qt executable." OFF)
|
||||
option(BUILD_CLI "Build bitcoin-cli executable." ON)
|
||||
|
||||
option(BUILD_TESTS "Build test_bitcoin and other unit test executables." ON)
|
||||
option(BUILD_TX "Build bitcoin-tx executable." ${BUILD_TESTS})
|
||||
option(BUILD_UTIL "Build bitcoin-util executable." ${BUILD_TESTS})
|
||||
|
||||
option(BUILD_UTIL_CHAINSTATE "Build experimental bitcoin-chainstate executable." OFF)
|
||||
option(BUILD_KERNEL_LIB "Build experimental bitcoinkernel library." ${BUILD_UTIL_CHAINSTATE})
|
||||
|
||||
option(ENABLE_WALLET "Enable wallet." ON)
|
||||
if(ENABLE_WALLET)
|
||||
if(VCPKG_TARGET_TRIPLET)
|
||||
# Use of the `unofficial::` namespace is a vcpkg package manager convention.
|
||||
find_package(unofficial-sqlite3 CONFIG REQUIRED)
|
||||
else()
|
||||
find_package(SQLite3 3.7.17 REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
cmake_dependent_option(BUILD_WALLET_TOOL "Build bitcoin-wallet tool." ${BUILD_TESTS} "ENABLE_WALLET" OFF)
|
||||
|
||||
option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting executables." OFF)
|
||||
option(WERROR "Treat compiler warnings as errors." OFF)
|
||||
option(WITH_CCACHE "Attempt to use ccache for compiling." ON)
|
||||
|
||||
option(WITH_ZMQ "Enable ZMQ notifications." OFF)
|
||||
if(WITH_ZMQ)
|
||||
find_package(ZeroMQ 4.0.0 MODULE REQUIRED)
|
||||
endif()
|
||||
|
||||
option(WITH_USDT "Enable tracepoints for Userspace, Statically Defined Tracing." OFF)
|
||||
if(WITH_USDT)
|
||||
find_package(USDT MODULE REQUIRED)
|
||||
endif()
|
||||
|
||||
option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON)
|
||||
|
||||
cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF)
|
||||
if(WITH_QRENCODE)
|
||||
find_package(QRencode MODULE REQUIRED)
|
||||
set(USE_QRCODE TRUE)
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "NOT CMAKE_SYSTEM_NAME MATCHES \"(Windows|Darwin)\" AND BUILD_GUI" OFF)
|
||||
|
||||
cmake_dependent_option(ENABLE_IPC "Build multiprocess bitcoin-node and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables." ON "NOT WIN32" OFF)
|
||||
cmake_dependent_option(WITH_EXTERNAL_LIBMULTIPROCESS "Build with external libmultiprocess library instead of with local git subtree when ENABLE_IPC is enabled. This is not normally recommended, but can be useful for developing libmultiprocess itself." OFF "ENABLE_IPC" OFF)
|
||||
if(ENABLE_IPC AND WITH_EXTERNAL_LIBMULTIPROCESS)
|
||||
find_package(Libmultiprocess REQUIRED COMPONENTS Lib)
|
||||
find_package(LibmultiprocessNative REQUIRED COMPONENTS Bin
|
||||
NAMES Libmultiprocess
|
||||
)
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF)
|
||||
if(BUILD_GUI)
|
||||
set(qt_components Core Gui Widgets LinguistTools)
|
||||
if(ENABLE_WALLET)
|
||||
list(APPEND qt_components Network)
|
||||
endif()
|
||||
if(WITH_DBUS)
|
||||
list(APPEND qt_components DBus)
|
||||
set(USE_DBUS TRUE)
|
||||
endif()
|
||||
if(BUILD_GUI_TESTS)
|
||||
list(APPEND qt_components Test)
|
||||
endif()
|
||||
find_package(Qt 6.2 MODULE REQUIRED
|
||||
COMPONENTS ${qt_components}
|
||||
)
|
||||
unset(qt_components)
|
||||
endif()
|
||||
|
||||
option(BUILD_BENCH "Build bench_bitcoin executable." OFF)
|
||||
option(BUILD_FUZZ_BINARY "Build fuzz binary." OFF)
|
||||
option(BUILD_FOR_FUZZING "Build for fuzzing. Enabling this will disable all other targets and override BUILD_FUZZ_BINARY." OFF)
|
||||
|
||||
option(INSTALL_MAN "Install man pages." ON)
|
||||
|
||||
set(APPEND_CPPFLAGS "" CACHE STRING "Preprocessor flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
|
||||
set(APPEND_CFLAGS "" CACHE STRING "C compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
|
||||
set(APPEND_CXXFLAGS "" CACHE STRING "(Objective) C++ compiler flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
|
||||
set(APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
|
||||
# Appending to this low-level rule variables is the only way to
|
||||
# guarantee that the flags appear at the end of the command line.
|
||||
string(APPEND CMAKE_CXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}")
|
||||
string(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY " ${APPEND_LDFLAGS}")
|
||||
string(APPEND CMAKE_CXX_LINK_EXECUTABLE " ${APPEND_LDFLAGS}")
|
||||
|
||||
set(configure_warnings)
|
||||
|
||||
include(CheckLinkerSupportsPIE)
|
||||
check_linker_supports_pie(configure_warnings)
|
||||
|
||||
# The core_interface library aims to encapsulate common build flags.
|
||||
# It is a usage requirement for all targets except for secp256k1, which
|
||||
# gets its flags by other means.
|
||||
add_library(core_interface INTERFACE)
|
||||
add_library(core_interface_relwithdebinfo INTERFACE)
|
||||
add_library(core_interface_debug INTERFACE)
|
||||
target_link_libraries(core_interface INTERFACE
|
||||
$<$<CONFIG:RelWithDebInfo>:core_interface_relwithdebinfo>
|
||||
$<$<CONFIG:Debug>:core_interface_debug>
|
||||
)
|
||||
|
||||
if(BUILD_FOR_FUZZING)
|
||||
message(WARNING "BUILD_FOR_FUZZING=ON will disable all other targets and force BUILD_FUZZ_BINARY=ON.")
|
||||
set(BUILD_BITCOIN_BIN OFF)
|
||||
set(BUILD_DAEMON OFF)
|
||||
set(BUILD_CLI OFF)
|
||||
set(BUILD_TX OFF)
|
||||
set(BUILD_UTIL OFF)
|
||||
set(BUILD_UTIL_CHAINSTATE OFF)
|
||||
set(BUILD_KERNEL_LIB OFF)
|
||||
set(BUILD_WALLET_TOOL OFF)
|
||||
set(BUILD_GUI OFF)
|
||||
set(ENABLE_EXTERNAL_SIGNER OFF)
|
||||
set(WITH_ZMQ OFF)
|
||||
set(BUILD_TESTS OFF)
|
||||
set(BUILD_GUI_TESTS OFF)
|
||||
set(BUILD_BENCH OFF)
|
||||
set(ENABLE_IPC OFF)
|
||||
set(BUILD_FUZZ_BINARY ON)
|
||||
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
)
|
||||
endif()
|
||||
|
||||
include(TryAppendCXXFlags)
|
||||
include(TryAppendLinkerFlag)
|
||||
|
||||
# Redefine/adjust per-configuration flags.
|
||||
target_compile_definitions(core_interface_debug INTERFACE
|
||||
DEBUG
|
||||
DEBUG_LOCKORDER
|
||||
DEBUG_LOCKCONTENTION
|
||||
RPC_DOC_CHECK
|
||||
ABORT_ON_FAILED_ASSUME
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
#[=[
|
||||
This build system supports two ways to build binaries for Windows.
|
||||
|
||||
1. Building on Windows using MSVC.
|
||||
Implementation notes:
|
||||
- /DWIN32 and /D_WINDOWS definitions are included into the CMAKE_CXX_FLAGS_INIT
|
||||
and CMAKE_CXX_FLAGS_INIT variables by default.
|
||||
- A run-time library is selected using the CMAKE_MSVC_RUNTIME_LIBRARY variable.
|
||||
- MSVC-specific options, for example, /Zc:__cplusplus, are additionally required.
|
||||
|
||||
2. Cross-compiling using MinGW.
|
||||
Implementation notes:
|
||||
- WIN32 and _WINDOWS definitions must be provided explicitly.
|
||||
- A run-time library must be specified explicitly using _MT definition.
|
||||
]=]
|
||||
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
_WIN32_WINNT=0x0A00
|
||||
_WIN32_IE=0x0A00
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-static")
|
||||
set(msvc_library_linkage "")
|
||||
else()
|
||||
set(msvc_library_linkage "DLL")
|
||||
endif()
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>${msvc_library_linkage}")
|
||||
unset(msvc_library_linkage)
|
||||
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
_UNICODE;UNICODE
|
||||
)
|
||||
target_compile_options(core_interface INTERFACE
|
||||
/utf-8
|
||||
/Zc:preprocessor
|
||||
/Zc:__cplusplus
|
||||
/sdl
|
||||
)
|
||||
target_link_options(core_interface INTERFACE
|
||||
# We embed our own manifests.
|
||||
/MANIFEST:NO
|
||||
)
|
||||
# Improve parallelism in MSBuild.
|
||||
# See: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/.
|
||||
list(APPEND CMAKE_VS_GLOBALS "UseMultiToolTask=true")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
WIN32
|
||||
_WINDOWS
|
||||
_MT
|
||||
)
|
||||
# Avoid the use of aligned vector instructions when building for Windows.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412.
|
||||
try_append_cxx_flags("-Wa,-muse-unaligned-vector-move" TARGET core_interface SKIP_LINK)
|
||||
try_append_linker_flag("-static" TARGET core_interface)
|
||||
# We support Windows 10+, however it's not possible to set these values accordingly,
|
||||
# due to a bug in mingw-w64. See https://sourceforge.net/p/mingw-w64/bugs/968/.
|
||||
# As a best effort, target Windows 8.
|
||||
try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,--minor-subsystem-version,2" TARGET core_interface)
|
||||
endif()
|
||||
|
||||
# Workaround producing large object files, which cannot be handled by the assembler.
|
||||
# More likely to happen with no, or lower levels of optimisation.
|
||||
# See discussion in https://github.com/bitcoin/bitcoin/issues/28109.
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
try_append_cxx_flags("/bigobj" TARGET core_interface_debug SKIP_LINK)
|
||||
else()
|
||||
try_append_cxx_flags("-Wa,-mbig-obj" TARGET core_interface_debug SKIP_LINK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Use 64-bit off_t on 32-bit Linux.
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Ensure 64-bit offsets are used for filesystem accesses for 32-bit compilation.
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
_FILE_OFFSET_BITS=64
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
target_compile_definitions(core_interface INTERFACE OBJC_OLD_DISPATCH_PROTOTYPES=0)
|
||||
# These flags are specific to ld64, and may cause issues with other linkers.
|
||||
# For example: GNU ld will interpret -dead_strip as -de and then try and use
|
||||
# "ad_strip" as the symbol for the entry point.
|
||||
try_append_linker_flag("-Wl,-dead_strip" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,-dead_strip_dylibs" TARGET core_interface)
|
||||
if(CMAKE_HOST_APPLE)
|
||||
try_append_linker_flag("-Wl,-headerpad_max_install_names" TARGET core_interface)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(core_interface INTERFACE
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
# Define sanitize_interface with -fsanitize flags intended to apply to all
|
||||
# libraries and executables.
|
||||
add_library(sanitize_interface INTERFACE)
|
||||
target_link_libraries(core_interface INTERFACE sanitize_interface)
|
||||
if(SANITIZERS)
|
||||
# Transform list of sanitizers into -fsanitize flags, replacing "fuzzer" with
|
||||
# "fuzzer-no-link" in sanitize_interface flags, and moving "fuzzer" to
|
||||
# fuzzer_interface flags. If -DSANITIZERS=fuzzer is specified, the fuzz test
|
||||
# binary should be built with -fsanitize=fuzzer (so it can use libFuzzer's
|
||||
# main function), but libraries should be built with -fsanitize=fuzzer-no-link
|
||||
# (so they can be linked into other executables that have their own main
|
||||
# functions).
|
||||
string(REGEX REPLACE "(^|,)fuzzer($|,)" "\\1fuzzer-no-link\\2" sanitize_opts "${SANITIZERS}")
|
||||
set(fuzz_flag "")
|
||||
if(NOT sanitize_opts STREQUAL SANITIZERS)
|
||||
set(fuzz_flag "-fsanitize=fuzzer")
|
||||
endif()
|
||||
|
||||
# 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
|
||||
try_append_cxx_flags("-fsanitize=${sanitize_opts}" TARGET sanitize_interface
|
||||
RESULT_VAR cxx_supports_sanitizers
|
||||
SKIP_LINK
|
||||
)
|
||||
if(NOT cxx_supports_sanitizers)
|
||||
message(FATAL_ERROR "Compiler did not accept requested flags.")
|
||||
endif()
|
||||
|
||||
# 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.
|
||||
try_append_linker_flag("-fsanitize=${sanitize_opts}" VAR SANITIZER_LDFLAGS
|
||||
SOURCE "
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
|
||||
int main() { return 0; }
|
||||
"
|
||||
RESULT_VAR linker_supports_sanitizers
|
||||
NO_CACHE_IF_FAILED
|
||||
)
|
||||
if(NOT linker_supports_sanitizers)
|
||||
message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.")
|
||||
endif()
|
||||
endif()
|
||||
target_link_options(sanitize_interface INTERFACE ${SANITIZER_LDFLAGS})
|
||||
|
||||
# Define fuzzer_interface with flags intended to apply to the fuzz test binary,
|
||||
# and perform a test compilation to determine correct value of
|
||||
# FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION.
|
||||
if(BUILD_FUZZ_BINARY)
|
||||
include(CheckSourceCompilesWithFlags)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; }
|
||||
// No main() function.
|
||||
" FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION
|
||||
LDFLAGS ${SANITIZER_LDFLAGS} ${fuzz_flag}
|
||||
LINK_LIBRARIES ${FUZZ_LIBS}
|
||||
)
|
||||
add_library(fuzzer_interface INTERFACE)
|
||||
target_link_options(fuzzer_interface INTERFACE ${fuzz_flag})
|
||||
target_link_libraries(fuzzer_interface INTERFACE ${FUZZ_LIBS})
|
||||
endif()
|
||||
|
||||
include(AddBoostIfNeeded)
|
||||
add_boost_if_needed()
|
||||
|
||||
if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD_FUZZ_BINARY)
|
||||
find_package(Libevent 2.1.8 MODULE REQUIRED)
|
||||
endif()
|
||||
|
||||
include(cmake/introspection.cmake)
|
||||
|
||||
include(cmake/ccache.cmake)
|
||||
|
||||
add_library(warn_interface INTERFACE)
|
||||
target_link_libraries(core_interface INTERFACE warn_interface)
|
||||
if(MSVC)
|
||||
try_append_cxx_flags("/W3" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4018" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4146" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4244" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4267" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4715" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("/wd4805" TARGET warn_interface SKIP_LINK)
|
||||
target_compile_definitions(warn_interface INTERFACE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
||||
)
|
||||
else()
|
||||
try_append_cxx_flags("-Wall" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wextra" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wgnu" TARGET warn_interface SKIP_LINK)
|
||||
# Some compilers will ignore -Wformat-security without -Wformat, so just combine the two here.
|
||||
try_append_cxx_flags("-Wformat -Wformat-security" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wvla" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wshadow-field" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wthread-safety" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wthread-safety-pointer" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wloop-analysis" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wredundant-decls" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wunused-member-function" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wdate-time" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wconditional-uninitialized" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wduplicated-branches" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wduplicated-cond" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wlogical-op" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Woverloaded-virtual" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wsuggest-override" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wimplicit-fallthrough" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wunreachable-code" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wdocumentation" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wself-assign" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wbidi-chars=any" TARGET warn_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-Wundef" TARGET warn_interface SKIP_LINK)
|
||||
|
||||
# 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.
|
||||
try_append_cxx_flags("-Wunused-parameter" TARGET warn_interface SKIP_LINK
|
||||
IF_CHECK_PASSED "-Wno-unused-parameter"
|
||||
)
|
||||
endif()
|
||||
|
||||
configure_file(cmake/script/Coverage.cmake Coverage.cmake USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
configure_file(cmake/script/CoverageFuzz.cmake CoverageFuzz.cmake USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
configure_file(cmake/script/CoverageInclude.cmake.in CoverageInclude.cmake USE_SOURCE_PERMISSIONS @ONLY)
|
||||
configure_file(cmake/script/cov_tool_wrapper.sh.in cov_tool_wrapper.sh.in USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
configure_file(contrib/filter-lcov.py filter-lcov.py USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
|
||||
# Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
|
||||
try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK)
|
||||
|
||||
# Avoiding the `-ffile-prefix-map` compiler option because it implies
|
||||
# `-fcoverage-prefix-map` on Clang or `-fprofile-prefix-map` on GCC,
|
||||
# which can cause issues with coverage builds, particularly when using
|
||||
# Clang in the OSS-Fuzz environment due to its use of other options
|
||||
# and a third party script, or with GCC.
|
||||
try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK
|
||||
IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}/src=."
|
||||
)
|
||||
try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK
|
||||
IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}/src=."
|
||||
)
|
||||
|
||||
# Currently all versions of gcc are subject to a class of bugs, see the
|
||||
# gccbug_90348 test case (only reproduces on GCC 11 and earlier) and
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set
|
||||
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag).
|
||||
try_append_cxx_flags("-fstack-reuse=none" TARGET core_interface)
|
||||
|
||||
if(MSVC)
|
||||
try_append_linker_flag("/DYNAMICBASE" TARGET core_interface)
|
||||
try_append_linker_flag("/HIGHENTROPYVA" TARGET core_interface)
|
||||
try_append_linker_flag("/NXCOMPAT" TARGET core_interface)
|
||||
else()
|
||||
|
||||
# _FORTIFY_SOURCE requires that there is some level of optimization,
|
||||
# otherwise it does nothing and just creates a compiler warning.
|
||||
try_append_cxx_flags("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
|
||||
RESULT_VAR cxx_supports_fortify_source
|
||||
SOURCE "int main() {
|
||||
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
|
||||
#error
|
||||
#endif
|
||||
}"
|
||||
)
|
||||
if(cxx_supports_fortify_source)
|
||||
target_compile_options(core_interface INTERFACE
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_FORTIFY_SOURCE=3
|
||||
)
|
||||
endif()
|
||||
unset(cxx_supports_fortify_source)
|
||||
|
||||
try_append_cxx_flags("-Wstack-protector" TARGET core_interface SKIP_LINK)
|
||||
try_append_cxx_flags("-fstack-protector-all" TARGET core_interface)
|
||||
try_append_cxx_flags("-fcf-protection=full" TARGET core_interface)
|
||||
|
||||
if(MINGW)
|
||||
# stack-clash-protection is a no-op for Windows.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details.
|
||||
else()
|
||||
try_append_cxx_flags("-fstack-clash-protection" TARGET core_interface)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
try_append_cxx_flags("-mbranch-protection=bti" TARGET core_interface SKIP_LINK)
|
||||
else()
|
||||
try_append_cxx_flags("-mbranch-protection=standard" TARGET core_interface SKIP_LINK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
try_append_linker_flag("-Wl,--enable-reloc-section" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,--dynamicbase" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,--nxcompat" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,--high-entropy-va" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,-z,relro" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,-z,now" TARGET core_interface)
|
||||
# TODO: This can be dropped once Bitcoin Core no longer supports
|
||||
# NetBSD 10.0 or if upstream fix is backported.
|
||||
# NetBSD's dynamic linker ld.elf_so < 11.0 supports exactly 2
|
||||
# `PT_LOAD` segments and binaries linked with `-z separate-code`
|
||||
# have 4 `PT_LOAD` segments.
|
||||
# Relevant discussions:
|
||||
# - https://github.com/bitcoin/bitcoin/pull/28724#issuecomment-2589347934
|
||||
# - https://mail-index.netbsd.org/tech-userlevel/2023/01/05/msg013666.html
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD" AND CMAKE_SYSTEM_VERSION VERSION_LESS 11.0)
|
||||
try_append_linker_flag("-Wl,-z,noseparate-code" TARGET core_interface)
|
||||
else()
|
||||
try_append_linker_flag("-Wl,-z,separate-code" TARGET core_interface)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
try_append_linker_flag("-Wl,-fixup_chains" TARGET core_interface)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(REDUCE_EXPORTS)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
try_append_linker_flag("-Wl,--exclude-libs,ALL" TARGET core_interface)
|
||||
try_append_linker_flag("-Wl,-no_exported_symbols" VAR CMAKE_EXE_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
if(WERROR)
|
||||
if(MSVC)
|
||||
set(werror_flag "/WX")
|
||||
else()
|
||||
set(werror_flag "-Werror")
|
||||
endif()
|
||||
try_append_cxx_flags(${werror_flag} TARGET core_interface SKIP_LINK RESULT_VAR compiler_supports_werror)
|
||||
if(NOT compiler_supports_werror)
|
||||
message(FATAL_ERROR "WERROR set but ${werror_flag} is not usable.")
|
||||
endif()
|
||||
unset(werror_flag)
|
||||
endif()
|
||||
|
||||
# Prefer Unix-style package components over frameworks on macOS.
|
||||
# This improves compatibility with Python version managers.
|
||||
set(Python3_FIND_FRAMEWORK LAST CACHE STRING "")
|
||||
# Search for generic names before more specialized ones. This
|
||||
# improves compatibility with Python version managers that use shims.
|
||||
set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
|
||||
mark_as_advanced(Python3_FIND_FRAMEWORK Python3_FIND_UNVERSIONED_NAMES)
|
||||
find_package(Python3 3.10 COMPONENTS Interpreter)
|
||||
if(NOT TARGET Python3::Interpreter)
|
||||
list(APPEND configure_warnings
|
||||
"Minimum required Python not found."
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(core_interface INTERFACE ${DEPENDS_COMPILE_DEFINITIONS})
|
||||
target_compile_definitions(core_interface_relwithdebinfo INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_RELWITHDEBINFO})
|
||||
target_compile_definitions(core_interface_debug INTERFACE ${DEPENDS_COMPILE_DEFINITIONS_DEBUG})
|
||||
|
||||
# If the {CXX,LD}FLAGS environment variables are defined during building depends
|
||||
# and configuring this build system, their content might be duplicated.
|
||||
if(DEFINED ENV{CXXFLAGS})
|
||||
deduplicate_flags(CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
if(DEFINED ENV{LDFLAGS})
|
||||
deduplicate_flags(CMAKE_EXE_LINKER_FLAGS)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
|
||||
# have "make test" depend on "make all"
|
||||
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)
|
||||
endif()
|
||||
|
||||
# TODO: The `CMAKE_SKIP_BUILD_RPATH` variable setting can be deleted
|
||||
# in the future after reordering Guix script commands to
|
||||
# perform binary checks after the installation step.
|
||||
# Relevant discussions:
|
||||
# - https://github.com/hebasto/bitcoin/pull/236#issuecomment-2183120953
|
||||
# - https://github.com/bitcoin/bitcoin/pull/30312#issuecomment-2191235833
|
||||
# NetBSD always requires runtime paths to be set for executables.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
else()
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
|
||||
endif()
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(doc)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
include(Maintenance)
|
||||
setup_split_debug_script()
|
||||
add_maintenance_targets()
|
||||
add_windows_deploy_target()
|
||||
add_macos_deploy_target()
|
||||
|
||||
message("\n")
|
||||
message("Configure summary")
|
||||
message("=================")
|
||||
message("Executables:")
|
||||
message(" bitcoin ............................. ${BUILD_BITCOIN_BIN}")
|
||||
message(" bitcoind ............................ ${BUILD_DAEMON}")
|
||||
if(BUILD_DAEMON AND ENABLE_IPC)
|
||||
set(bitcoin_daemon_status ON)
|
||||
else()
|
||||
set(bitcoin_daemon_status OFF)
|
||||
endif()
|
||||
message(" bitcoin-node (multiprocess) ......... ${bitcoin_daemon_status}")
|
||||
message(" bitcoin-qt (GUI) .................... ${BUILD_GUI}")
|
||||
if(BUILD_GUI AND ENABLE_IPC)
|
||||
set(bitcoin_gui_status ON)
|
||||
else()
|
||||
set(bitcoin_gui_status OFF)
|
||||
endif()
|
||||
message(" bitcoin-gui (GUI, multiprocess) ..... ${bitcoin_gui_status}")
|
||||
message(" bitcoin-cli ......................... ${BUILD_CLI}")
|
||||
message(" bitcoin-tx .......................... ${BUILD_TX}")
|
||||
message(" bitcoin-util ........................ ${BUILD_UTIL}")
|
||||
message(" bitcoin-wallet ...................... ${BUILD_WALLET_TOOL}")
|
||||
message(" bitcoin-chainstate (experimental) ... ${BUILD_UTIL_CHAINSTATE}")
|
||||
message(" libbitcoinkernel (experimental) ..... ${BUILD_KERNEL_LIB}")
|
||||
message("Optional features:")
|
||||
message(" wallet support ...................... ${ENABLE_WALLET}")
|
||||
message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}")
|
||||
message(" ZeroMQ .............................. ${WITH_ZMQ}")
|
||||
if(ENABLE_IPC)
|
||||
if (WITH_EXTERNAL_LIBMULTIPROCESS)
|
||||
set(ipc_status "ON (with external libmultiprocess)")
|
||||
else()
|
||||
set(ipc_status ON)
|
||||
endif()
|
||||
else()
|
||||
set(ipc_status OFF)
|
||||
endif()
|
||||
message(" IPC ................................. ${ipc_status}")
|
||||
message(" USDT tracing ........................ ${WITH_USDT}")
|
||||
message(" QR code (GUI) ....................... ${WITH_QRENCODE}")
|
||||
message(" DBus (GUI) .......................... ${WITH_DBUS}")
|
||||
message("Tests:")
|
||||
message(" test_bitcoin ........................ ${BUILD_TESTS}")
|
||||
message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}")
|
||||
message(" bench_bitcoin ....................... ${BUILD_BENCH}")
|
||||
message(" fuzz binary ......................... ${BUILD_FUZZ_BINARY}")
|
||||
message("")
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(cross_status "TRUE, for ${CMAKE_SYSTEM_NAME}, ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
else()
|
||||
set(cross_status "FALSE")
|
||||
endif()
|
||||
message("Cross compiling ....................... ${cross_status}")
|
||||
message("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}, ${CMAKE_CXX_COMPILER}")
|
||||
include(FlagsSummary)
|
||||
flags_summary()
|
||||
message("Treat compiler warnings as errors ..... ${WERROR}")
|
||||
message("Use ccache for compiling .............. ${WITH_CCACHE}")
|
||||
message("\n")
|
||||
if(configure_warnings)
|
||||
message(" ******\n")
|
||||
foreach(warning IN LISTS configure_warnings)
|
||||
message(WARNING "${warning}")
|
||||
endforeach()
|
||||
message(" ******\n")
|
||||
endif()
|
||||
|
||||
# We want all build properties to be encapsulated properly.
|
||||
include(WarnAboutGlobalProperties)
|
||||
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "vs2022",
|
||||
"displayName": "Build using 'Visual Studio 17 2022' generator and 'x64-windows' triplet",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": "x64",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "x64-windows",
|
||||
"BUILD_GUI": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vs2022-static",
|
||||
"displayName": "Build using 'Visual Studio 17 2022' generator and 'x64-windows-static' triplet",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": "x64",
|
||||
"toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
|
||||
"BUILD_GUI": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "libfuzzer",
|
||||
"displayName": "Build for fuzzing with libfuzzer, and sanitizers enabled",
|
||||
"binaryDir": "${sourceDir}/build_fuzz",
|
||||
"cacheVariables": {
|
||||
"BUILD_FOR_FUZZING": "ON",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_C_FLAGS": "-ftrivial-auto-var-init=pattern",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"CMAKE_CXX_FLAGS": "-ftrivial-auto-var-init=pattern",
|
||||
"SANITIZERS": "undefined,address,fuzzer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "libfuzzer-nosan",
|
||||
"displayName": "Build for fuzzing with libfuzzer, and sanitizers disabled",
|
||||
"binaryDir": "${sourceDir}/build_fuzz_nosan",
|
||||
"cacheVariables": {
|
||||
"BUILD_FOR_FUZZING": "ON",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"SANITIZERS": "fuzzer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-mode",
|
||||
"displayName": "Developer mode, with all features/dependencies enabled",
|
||||
"binaryDir": "${sourceDir}/build_dev_mode",
|
||||
"errors": {"dev": true},
|
||||
"cacheVariables": {
|
||||
"BUILD_BENCH": "ON",
|
||||
"BUILD_CLI": "ON",
|
||||
"BUILD_DAEMON": "ON",
|
||||
"BUILD_FUZZ_BINARY": "ON",
|
||||
"BUILD_GUI": "ON",
|
||||
"BUILD_GUI_TESTS": "ON",
|
||||
"BUILD_KERNEL_LIB": "ON",
|
||||
"BUILD_SHARED_LIBS": "ON",
|
||||
"BUILD_TESTS": "ON",
|
||||
"BUILD_TX": "ON",
|
||||
"BUILD_UTIL": "ON",
|
||||
"BUILD_UTIL_CHAINSTATE": "ON",
|
||||
"BUILD_WALLET_TOOL": "ON",
|
||||
"ENABLE_EXTERNAL_SIGNER": "ON",
|
||||
"ENABLE_WALLET": "ON",
|
||||
"ENABLE_IPC": "ON",
|
||||
"WITH_QRENCODE": "ON",
|
||||
"WITH_USDT": "ON",
|
||||
"WITH_ZMQ": "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
444
CONTRIBUTING.md
444
CONTRIBUTING.md
@@ -1,444 +0,0 @@
|
||||
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.
|
||||
|
||||
First, in terms of structure, there is no particular concept of "Bitcoin Core
|
||||
developers" in the sense of privileged people. Open source often naturally
|
||||
revolves around a meritocracy where contributors earn trust from the developer
|
||||
community over time. Nevertheless, some hierarchy is necessary for practical
|
||||
purposes. As such, there are repository maintainers who are responsible for
|
||||
merging pull requests, the [release cycle](/doc/release-process.md), and
|
||||
moderation.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
New contributors are very welcome and needed.
|
||||
|
||||
Reviewing and testing is highly valued and the most effective way you can contribute
|
||||
as a new contributor. It also will teach you much more about the code and
|
||||
process than opening pull requests. Please refer to the [peer review](#peer-review)
|
||||
section below.
|
||||
|
||||
Before you start contributing, familiarize yourself with the Bitcoin Core build
|
||||
system and tests. Refer to the documentation in the repository on how to build
|
||||
Bitcoin Core and how to run the unit tests, functional tests, and fuzz tests.
|
||||
|
||||
There are many open issues of varying difficulty waiting to be fixed.
|
||||
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 or changes that are
|
||||
[up for grabs](https://github.com/bitcoin/bitcoin/issues?utf8=%E2%9C%93&q=label%3A%22Up+for+grabs%22).
|
||||
Some of them might no longer be applicable. So if you are interested, but
|
||||
unsure, you might want to leave a comment on the issue first.
|
||||
|
||||
You may also participate in the [Bitcoin Core PR Review Club](https://bitcoincore.reviews/).
|
||||
|
||||
### Good First Issue Label
|
||||
|
||||
The purpose of the `good first issue` label is to highlight which issues are
|
||||
suitable for a new contributor without a deep understanding of the codebase.
|
||||
|
||||
However, good first issues can be solved by anyone. If they remain unsolved
|
||||
for a longer time, a frequent contributor might address them.
|
||||
|
||||
You do not need to request permission to start working on an issue. However,
|
||||
you are encouraged to leave a comment if you are planning to work on it. This
|
||||
will help other contributors monitor which issues are actively being addressed
|
||||
and is also an effective way to request assistance if and when you need it.
|
||||
|
||||
Communication Channels
|
||||
----------------------
|
||||
|
||||
Most communication about Bitcoin Core development happens on IRC, in the
|
||||
`#bitcoin-core-dev` channel on Libera Chat. The easiest way to participate on IRC is
|
||||
with the web client, [web.libera.chat](https://web.libera.chat/#bitcoin-core-dev). Chat
|
||||
history logs can be found
|
||||
on [https://www.erisian.com.au/bitcoin-core-dev/](https://www.erisian.com.au/bitcoin-core-dev/)
|
||||
and [https://gnusha.org/bitcoin-core-dev/](https://gnusha.org/bitcoin-core-dev/).
|
||||
|
||||
Discussion about codebase improvements happens in GitHub issues and pull
|
||||
requests.
|
||||
|
||||
The developer
|
||||
[mailing list](https://groups.google.com/g/bitcoindev)
|
||||
should be used to discuss complicated or controversial consensus or P2P protocol changes before working on
|
||||
a patch set.
|
||||
Archives can be found on [https://gnusha.org/pi/bitcoindev/](https://gnusha.org/pi/bitcoindev/).
|
||||
|
||||
|
||||
Contributor Workflow
|
||||
--------------------
|
||||
|
||||
The codebase is maintained using the "contributor workflow" where everyone
|
||||
without exception contributes patch proposals using "pull requests" (PRs). This
|
||||
facilitates social contribution, easy testing and peer review.
|
||||
|
||||
To contribute a patch, the workflow is as follows:
|
||||
|
||||
1. Fork repository ([only for the first time](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo))
|
||||
1. Create topic branch
|
||||
1. Commit patches
|
||||
|
||||
For GUI-related issues or pull requests, the https://github.com/bitcoin-core/gui repository should be used.
|
||||
For all other issues and pull requests, the https://github.com/bitcoin/bitcoin node repository should be used.
|
||||
|
||||
The master branch for all monotree repositories is identical.
|
||||
|
||||
As a rule of thumb, everything that only modifies `src/qt` is a GUI-only pull
|
||||
request. However:
|
||||
|
||||
* For global refactoring or other transversal changes the node repository
|
||||
should be used.
|
||||
* For GUI-related build system changes, the node repository should be used
|
||||
because the change needs review by the build systems reviewers.
|
||||
* Changes in `src/interfaces` need to go to the node repository because they
|
||||
might affect other components like the wallet.
|
||||
|
||||
For large GUI changes that include build system and interface changes, it is
|
||||
recommended to first open a pull request against the GUI repository. When there
|
||||
is agreement to proceed with the changes, a pull request with the build system
|
||||
and interfaces changes can be submitted to the node repository.
|
||||
|
||||
The project coding conventions in the [developer notes](doc/developer-notes.md)
|
||||
must be followed.
|
||||
|
||||
### Committing Patches
|
||||
|
||||
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.
|
||||
|
||||
Make sure each individual commit is hygienic: that it builds successfully on its
|
||||
own without warnings, errors, regressions, or test failures.
|
||||
This means tests must be updated in the same commit that changes the behavior.
|
||||
|
||||
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 "Correct 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](https://cbea.ms/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.
|
||||
|
||||
Commit messages should never contain any `@` mentions (usernames prefixed with "@").
|
||||
|
||||
Please refer to the [Git manual](https://git-scm.com/doc) for more information
|
||||
about Git.
|
||||
|
||||
- Push changes to your fork
|
||||
- Create pull request
|
||||
|
||||
### Creating the 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
|
||||
- `doc` for changes to the documentation
|
||||
- `qt` or `gui` for changes to bitcoin-qt
|
||||
- `log` for changes to log messages
|
||||
- `mining` for changes to the mining code
|
||||
- `net` or `p2p` for changes to the peer-to-peer network code
|
||||
- `refactor` for structural changes that do not change behavior
|
||||
- `rpc`, `rest` or `zmq` for changes to the RPC, REST or ZMQ APIs
|
||||
- `contrib` or `cli` for changes to the scripts and tools
|
||||
- `test`, `qa` or `ci` for changes to the unit tests, QA tests or CI code
|
||||
- `util` or `lib` for changes to the utils or libraries
|
||||
- `wallet` for changes to the wallet code
|
||||
- `build` for changes to CMake
|
||||
- `guix` for changes to the GUIX reproducible builds
|
||||
|
||||
Examples:
|
||||
|
||||
consensus: Add new opcode for BIP-XXXX OP_CHECKAWESOMESIG
|
||||
net: Automatically create onion service, listen on Tor
|
||||
qt: Add feed bump button
|
||||
log: Fix typo in log message
|
||||
|
||||
The body of the pull request should contain sufficient description of *what* the
|
||||
patch does, and even more importantly, *why*, with justification and reasoning.
|
||||
You should include references to any discussions (for example, other issues or
|
||||
mailing list discussions).
|
||||
|
||||
The description for a new pull request should not contain any `@` mentions. The
|
||||
PR description will be included in the commit message when the PR is merged and
|
||||
any users mentioned in the description will be annoyingly notified each time a
|
||||
fork of Bitcoin Core copies the merge. Instead, make any username mentions in a
|
||||
subsequent comment to the PR.
|
||||
|
||||
### Translation changes
|
||||
|
||||
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.
|
||||
|
||||
### Work in Progress Changes and Requests for Comments
|
||||
|
||||
If a pull request is not to be considered for merging (yet), please
|
||||
prefix the title with [WIP] or use [Tasks Lists](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#task-lists)
|
||||
in the body of the pull request to indicate tasks are pending.
|
||||
|
||||
### Address Feedback
|
||||
|
||||
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.
|
||||
|
||||
You are expected to reply to any review comments before your pull request is
|
||||
merged. You may update the code or reject the feedback if you do not agree with
|
||||
it, but you should express so in a reply. If there is outstanding feedback and
|
||||
you are not actively working on it, your pull request may be closed.
|
||||
|
||||
Please refer to the [peer review](#peer-review) section below for more details.
|
||||
|
||||
### Squashing Commits
|
||||
|
||||
If your pull request contains fixup commits (commits that change the same line of code repeatedly) or too fine-grained
|
||||
commits, you may be asked to [squash](https://git-scm.com/docs/git-rebase#_interactive_mode) your commits
|
||||
before it will be reviewed. 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)
|
||||
|
||||
Please update the resulting commit message, if needed. It should read as a
|
||||
coherent message. In most cases, this means not just listing the interim
|
||||
commits.
|
||||
|
||||
If your change contains a merge commit, the above workflow may not work and you
|
||||
will need to remove the merge commit first. See the next section for details on
|
||||
how to rebase.
|
||||
|
||||
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.
|
||||
|
||||
### Rebasing Changes
|
||||
|
||||
When a pull request conflicts with the target branch, you may be asked to rebase it on top of the current target branch.
|
||||
|
||||
git fetch https://github.com/bitcoin/bitcoin # Fetch the latest upstream commit
|
||||
git rebase FETCH_HEAD # Rebuild commits on top of the new base
|
||||
|
||||
This project aims to have a clean git history, where code changes are only made in non-merge commits. This simplifies
|
||||
auditability because merge commits can be assumed to not contain arbitrary code changes. Merge commits should be signed,
|
||||
and the resulting git tree hash must be deterministic and reproducible. The script in
|
||||
[/contrib/verify-commits](/contrib/verify-commits) checks that.
|
||||
|
||||
After a rebase, reviewers are encouraged to sign off on the force push. This should be relatively straightforward with
|
||||
the `git range-diff` tool explained in the [productivity
|
||||
notes](/doc/productivity.md#diff-the-diffs-with-git-range-diff). To avoid needless review churn, maintainers will
|
||||
generally merge pull requests that received the most review attention first.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
### 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.
|
||||
|
||||
|
||||
### Refactoring
|
||||
|
||||
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, and
|
||||
code refactoring. In general, refactoring pull requests should not mix these
|
||||
three kinds of activities 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.
|
||||
|
||||
|
||||
"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.
|
||||
|
||||
Whether a pull request is merged into Bitcoin Core rests with the project merge
|
||||
maintainers.
|
||||
|
||||
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, functional tests, and fuzz 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.
|
||||
- Change relevant comments and documentation when behaviour of code changes.
|
||||
|
||||
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
|
||||
|
||||
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).
|
||||
|
||||
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 NACK'ing" the PR, the author may need to present arguments and/or do
|
||||
research backing their suggested changes.
|
||||
|
||||
#### Conceptual Review
|
||||
|
||||
A review can be a conceptual review, where the reviewer leaves a comment
|
||||
* `Concept (N)ACK`, meaning "I do (not) agree with the general goal of this pull
|
||||
request",
|
||||
* `Approach (N)ACK`, meaning `Concept ACK`, but "I do (not) agree with the
|
||||
approach of this change".
|
||||
|
||||
A `NACK` needs to include a rationale why the change is not worthwhile.
|
||||
NACKs without accompanying reasoning may be disregarded.
|
||||
|
||||
#### Code Review
|
||||
|
||||
After conceptual agreement on the change, code review can be provided. A review
|
||||
begins with `ACK BRANCH_COMMIT`, where `BRANCH_COMMIT` is the top of the PR
|
||||
branch, followed by a description of how the reviewer did the review. The
|
||||
following language is used within pull request comments:
|
||||
|
||||
- "I have tested the code", involving change-specific manual testing in
|
||||
addition to running the unit, functional, or fuzz tests, and in case it is
|
||||
not obvious how the manual testing was done, it should be described;
|
||||
- "I have not tested the code, but I have reviewed it and it looks
|
||||
OK, I agree it can be merged";
|
||||
- A "nit" refers to a trivial, often non-blocking issue.
|
||||
|
||||
Project maintainers reserve the right to weigh the opinions of peer reviewers
|
||||
using common sense judgement and may also weigh based on merit. Reviewers that
|
||||
have demonstrated a deeper commitment and understanding of the project over time
|
||||
or who 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 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 after the release. Wait for the 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://docs.github.com/en/repositories/working-with-files/using-files/viewing-and-understanding-files). Simply
|
||||
look up who last modified the code you are changing 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 for an unreasonably long time (say,
|
||||
more than a month) for no particular reason (a few lines changed, etc.),
|
||||
this is totally fine. Try to return the favor when someone else is asking
|
||||
for feedback on their code, and the universe balances out.
|
||||
- Remember that the best thing you can do while waiting is give review to others!
|
||||
|
||||
|
||||
Backporting
|
||||
-----------
|
||||
|
||||
Security and bug fixes can be backported from `master` to release
|
||||
branches.
|
||||
Maintainers will do backports in batches and
|
||||
use the proper `Needs backport (...)` labels
|
||||
when needed (the original author does not need to worry about it).
|
||||
|
||||
A backport should contain the following metadata in the commit body:
|
||||
|
||||
```
|
||||
Github-Pull: #<PR number>
|
||||
Rebased-From: <commit hash of the original commit>
|
||||
```
|
||||
|
||||
Have a look at [an example backport PR](
|
||||
https://github.com/bitcoin/bitcoin/pull/16189).
|
||||
|
||||
Also see the [backport.py script](
|
||||
https://github.com/bitcoin-core/bitcoin-maintainer-tools#backport).
|
||||
|
||||
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.
|
||||
5
COPYING
5
COPYING
@@ -1,7 +1,4 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2009-2025 The Bitcoin Core developers
|
||||
Copyright (c) 2009-2025 Bitcoin Developers
|
||||
Copyright (c) 2009-2015 Bitcoin 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
|
||||
|
||||
5
INSTALL
Normal file
5
INSTALL
Normal file
@@ -0,0 +1,5 @@
|
||||
Building Bitcoin
|
||||
|
||||
See doc/build-*.md for instructions on building bitcoind,
|
||||
the intended-for-services, no-graphical-interface, reference
|
||||
implementation of Bitcoin.
|
||||
@@ -1 +0,0 @@
|
||||
See [doc/build-\*.md](/doc)
|
||||
202
Makefile.am
Normal file
202
Makefile.am
Normal file
@@ -0,0 +1,202 @@
|
||||
ACLOCAL_AMFLAGS = -I build-aux/m4
|
||||
SUBDIRS = src
|
||||
.PHONY: deploy FORCE
|
||||
|
||||
GZIP_ENV="-9n"
|
||||
|
||||
BITCOIND_BIN=$(top_builddir)/src/bitcoind$(EXEEXT)
|
||||
BITCOIN_QT_BIN=$(top_builddir)/src/qt/bitcoin-qt$(EXEEXT)
|
||||
BITCOIN_CLI_BIN=$(top_builddir)/src/bitcoin-cli$(EXEEXT)
|
||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
OSX_APP=Bitcoin-Qt.app
|
||||
OSX_DMG=Bitcoin-Qt.dmg
|
||||
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_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)
|
||||
|
||||
WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
|
||||
$(top_srcdir)/share/pixmaps/nsis-header.bmp \
|
||||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
|
||||
$(top_srcdir)/doc/README_windows.txt
|
||||
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
|
||||
$(top_srcdir)/contrib/macdeploy/background.png \
|
||||
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
|
||||
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 \
|
||||
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
|
||||
@test -f $(MAKENSIS) && $(MAKENSIS) $(top_builddir)/share/setup.nsi || \
|
||||
echo error: could not build $@
|
||||
|
||||
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
||||
$(MAKE) -C src $(patsubst src/%,%,$@)
|
||||
|
||||
$(OSX_APP)/Contents/PkgInfo:
|
||||
$(MKDIR_P) $(@D)
|
||||
@echo "APPL????" > $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
$(MKDIR_P) $(@D)
|
||||
@touch $@
|
||||
|
||||
$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||
$(MKDIR_P) $(@D)
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
|
||||
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
|
||||
if BUILD_DARWIN
|
||||
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
|
||||
deploydir: $(OSX_DMG)
|
||||
else
|
||||
APP_DIST_DIR=$(top_builddir)/dist
|
||||
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/background.png $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||
|
||||
$(APP_DIST_DIR)/Applications:
|
||||
@rm -f $@
|
||||
@cd $(@D); $(LN_S) /Applications $(@F)
|
||||
|
||||
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
|
||||
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Qt" -no-pad -r -apple -o $@ dist
|
||||
|
||||
$(APP_DIST_DIR)/.background/background.png:
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL) $(top_srcdir)/contrib/macdeploy/background.png $@
|
||||
$(APP_DIST_DIR)/.DS_Store:
|
||||
$(INSTALL) $(top_srcdir)/contrib/macdeploy/DS_Store $@
|
||||
|
||||
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
|
||||
deploydir: $(APP_DIST_EXTRAS)
|
||||
endif
|
||||
|
||||
if TARGET_DARWIN
|
||||
appbundle: $(OSX_APP_BUILT)
|
||||
deploy: $(OSX_DMG)
|
||||
endif
|
||||
if TARGET_WINDOWS
|
||||
deploy: $(BITCOIN_WIN_INSTALLER)
|
||||
endif
|
||||
|
||||
$(BITCOIN_QT_BIN): FORCE
|
||||
$(MAKE) -C src qt/$(@F)
|
||||
|
||||
$(BITCOIND_BIN): FORCE
|
||||
$(MAKE) -C src $(@F)
|
||||
|
||||
$(BITCOIN_CLI_BIN): FORCE
|
||||
$(MAKE) -C src $(@F)
|
||||
|
||||
if USE_LCOV
|
||||
|
||||
baseline.info:
|
||||
$(LCOV) -c -i -d $(abs_builddir)/src -o $@
|
||||
|
||||
baseline_filtered.info: baseline.info
|
||||
$(LCOV) -r $< "/usr/include/*" -o $@
|
||||
|
||||
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 -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
|
||||
$(LCOV) -r $< "/usr/include/*" -o $@
|
||||
|
||||
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 0
|
||||
$(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@
|
||||
$(LCOV) -z -d $(abs_builddir)/src
|
||||
$(LCOV) -z -d $(abs_builddir)/src/leveldb
|
||||
|
||||
block_test_filtered.info: block_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
|
||||
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_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 $< -o $(@D)
|
||||
@touch $@
|
||||
|
||||
total.coverage/.dirstamp: total_coverage.info
|
||||
$(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 = $(top_srcdir)/share/genbuild.sh qa/pull-tester/rpc-tests.sh qa/pull-tester/run-bitcoin-cli qa/rpc-tests $(DIST_DOCS) $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
|
||||
|
||||
CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER)
|
||||
|
||||
.INTERMEDIATE: $(COVERAGE_INFO)
|
||||
|
||||
clean-local:
|
||||
rm -rf test_bitcoin.coverage/ total.coverage/ $(OSX_APP)
|
||||
115
README.md
115
README.md
@@ -1,40 +1,49 @@
|
||||
Bitcoin Core integration/staging tree
|
||||
=====================================
|
||||
|
||||
https://bitcoincore.org
|
||||
[](https://travis-ci.org/bitcoin/bitcoin)
|
||||
|
||||
For an immediately usable, binary version of the Bitcoin Core software, see
|
||||
https://bitcoincore.org/en/download/.
|
||||
https://www.bitcoin.org
|
||||
|
||||
What is Bitcoin Core?
|
||||
---------------------
|
||||
What is Bitcoin?
|
||||
----------------
|
||||
|
||||
Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully
|
||||
validate blocks and transactions. It also includes a wallet and graphical user
|
||||
interface, which can be optionally built.
|
||||
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.
|
||||
|
||||
Further information about Bitcoin Core is available in the [doc folder](/doc).
|
||||
For more information, as well as an immediately useable, binary version of
|
||||
the Bitcoin Core software, see https://www.bitcoin.org/en/download.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more
|
||||
information or see https://opensource.org/license/MIT.
|
||||
information or see http://opensource.org/licenses/MIT.
|
||||
|
||||
Development Process
|
||||
Development process
|
||||
-------------------
|
||||
|
||||
The `master` branch is regularly built (see `doc/build-*.md` for instructions) and tested, but it is not guaranteed to be
|
||||
Developers work in their own trees, then submit pull requests when they think
|
||||
their feature or bug fix is ready.
|
||||
|
||||
If it is a simple/trivial/non-controversial change, then one of the Bitcoin
|
||||
development team members simply pulls it.
|
||||
|
||||
If it is a *more complicated or potentially controversial* change, then the patch
|
||||
submitter will be asked to start a discussion (if they haven't already) on the
|
||||
[mailing list](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev)
|
||||
|
||||
The patch will be accepted if there is broad consensus that it is a good thing.
|
||||
Developers should expect to rework and resubmit patches if the code doesn't
|
||||
match the project's coding conventions (see [doc/coding.md](doc/coding.md)) or are
|
||||
controversial.
|
||||
|
||||
The `master` branch is regularly built and tested, but is not guaranteed to be
|
||||
completely stable. [Tags](https://github.com/bitcoin/bitcoin/tags) are created
|
||||
regularly from release branches to indicate new official, stable release versions of Bitcoin Core.
|
||||
|
||||
The https://github.com/bitcoin-core/gui repository is used exclusively for the
|
||||
development of the GUI. Its master branch is identical in all monotree
|
||||
repositories. Release branches and tags do not exist, so please do not fork
|
||||
that repository unless it is for development reasons.
|
||||
|
||||
The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||
and useful hints for developers can be found in [doc/developer-notes.md](doc/developer-notes.md).
|
||||
regularly to indicate new official, stable release versions of Bitcoin.
|
||||
|
||||
Testing
|
||||
-------
|
||||
@@ -46,34 +55,66 @@ lots of money.
|
||||
|
||||
### Automated Testing
|
||||
|
||||
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 can be compiled and run
|
||||
(assuming they weren't disabled during the generation of the build system) with: `ctest`. Further details on running
|
||||
and extending unit tests can be found in [/src/test/README.md](/src/test/README.md).
|
||||
Developers are strongly encouraged to write unit tests 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`
|
||||
|
||||
There are also [regression and integration tests](/test), written
|
||||
in Python.
|
||||
These tests can be run (if the [test dependencies](/test) are installed) with: `build/test/functional/test_runner.py`
|
||||
(assuming `build` is your build directory).
|
||||
|
||||
The CI (Continuous Integration) systems make sure that every pull request is tested on Windows, Linux, and macOS.
|
||||
The CI must pass on all commits before merge to avoid unrelated CI failures on new pull requests.
|
||||
Every pull request is built for both Windows and Linux on a dedicated server,
|
||||
and unit and sanity tests are automatically run. The binaries produced may be
|
||||
used for manual QA testing — a link to them will appear in a comment on the
|
||||
pull request posted by [BitcoinPullTester](https://github.com/BitcoinPullTester). See https://github.com/TheBlueMatt/test-scripts
|
||||
for the build/test scripts.
|
||||
|
||||
### Manual Quality Assurance (QA) Testing
|
||||
|
||||
Changes should be tested by somebody other than the developer who wrote the
|
||||
code. This is especially important for large or high-risk changes. It is useful
|
||||
to add a test plan to the pull request description if testing the changes is
|
||||
not straightforward.
|
||||
Large changes should have a test plan, and should be tested by somebody other
|
||||
than the developer who wrote the code.
|
||||
See https://github.com/bitcoin/QA/ for how to create a test plan.
|
||||
|
||||
Translations
|
||||
------------
|
||||
|
||||
Changes to translations as well as new translations can be submitted to
|
||||
[Bitcoin Core's Transifex page](https://explore.transifex.com/bitcoin/bitcoin/).
|
||||
[Bitcoin Core's Transifex page](https://www.transifex.com/projects/p/bitcoin/).
|
||||
|
||||
Translations are periodically pulled from Transifex and merged into the git repository. See the
|
||||
[translation process](doc/translation_process.md) for details on how this works.
|
||||
|
||||
**Important**: We do not accept translation changes as GitHub pull requests because the next
|
||||
pull from Transifex would automatically overwrite them again.
|
||||
|
||||
Translators should also subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bitcoin-translators).
|
||||
|
||||
Development tips and tricks
|
||||
---------------------------
|
||||
|
||||
**compiling for debugging**
|
||||
|
||||
Run configure with the --enable-debug option, then make. Or run configure with
|
||||
CXXFLAGS="-g -ggdb -O0" or whatever debug flags you need.
|
||||
|
||||
**debug.log**
|
||||
|
||||
If the code is behaving strangely, take a look in the debug.log file in the data directory;
|
||||
error and debugging messages are written there.
|
||||
|
||||
The -debug=... command-line option controls debugging; running with just -debug will turn
|
||||
on all categories (and give you a very large debug.log file).
|
||||
|
||||
The Qt code routes qDebug() output to debug.log under category "qt": run with -debug=qt
|
||||
to see it.
|
||||
|
||||
**testnet and regtest modes**
|
||||
|
||||
Run with the -testnet option to run with "play bitcoins" on the test network, if you
|
||||
are testing multi-machine code that needs to operate across the internet.
|
||||
|
||||
If you are testing something that can run on one machine, run with the -regtest option.
|
||||
In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests
|
||||
that run in -regtest mode.
|
||||
|
||||
**DEBUG_LOCKORDER**
|
||||
|
||||
Bitcoin Core is a multithreaded application, and deadlocks or other multithreading bugs
|
||||
can be very difficult to track down. Compiling with -DDEBUG_LOCKORDER (configure
|
||||
CXXFLAGS="-DDEBUG_LOCKORDER -g") inserts run-time checks to keep track of which locks
|
||||
are held, and adds warnings to the debug.log file if inconsistencies are detected.
|
||||
|
||||
20
SECURITY.md
20
SECURITY.md
@@ -1,20 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
See our website for versions of Bitcoin Core that are currently supported with
|
||||
security updates: https://bitcoincore.org/en/lifecycle/#schedule
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report security issues send an email to security@bitcoincore.org (not for support).
|
||||
|
||||
The following keys may be used to communicate sensitive information to developers:
|
||||
|
||||
| Name | Fingerprint |
|
||||
|------|-------------|
|
||||
| Pieter Wuille | 133E AC17 9436 F14A 5CF1 B794 860F EB80 4E66 9320 |
|
||||
| Michael Ford | E777 299F C265 DD04 7930 70EB 944D 35F9 AC3D B76A |
|
||||
| Ava Chow | 1528 1230 0785 C964 44D3 334D 1756 5732 E08E 5E41 |
|
||||
|
||||
You can import a key by running the following command with that individual’s fingerprint: `gpg --keyserver hkps://keys.openpgp.org --recv-keys "<fingerprint>"` Ensure that you put quotes around fingerprints containing spaces.
|
||||
9
autogen.sh
Executable file
9
autogen.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
srcdir="$(dirname $0)"
|
||||
cd "$srcdir"
|
||||
if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then
|
||||
LIBTOOLIZE="${GLIBTOOLIZE}"
|
||||
export LIBTOOLIZE
|
||||
fi
|
||||
autoreconf --install --force --warnings=all
|
||||
281
build-aux/m4/ax_boost_base.m4
Normal file
281
build-aux/m4/ax_boost_base.m4
Normal file
@@ -0,0 +1,281 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for the Boost C++ libraries of a particular version (or newer)
|
||||
#
|
||||
# If no path to the installed boost library is given the macro searchs
|
||||
# under /usr, /usr/local, /opt and /opt/local and evaluates the
|
||||
# $BOOST_ROOT environment variable. Further documentation is available at
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2009 Peter Adolphs
|
||||
#
|
||||
# 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 23
|
||||
|
||||
AC_DEFUN([AX_BOOST_BASE],
|
||||
[
|
||||
AC_ARG_WITH([boost],
|
||||
[AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
|
||||
[use Boost library from a standard location (ARG=yes),
|
||||
from the specified location (ARG=<path>),
|
||||
or disable it (ARG=no)
|
||||
@<:@ARG=yes@:>@ ])],
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ac_boost_path=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ac_boost_path="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"])
|
||||
|
||||
|
||||
AC_ARG_WITH([boost-libdir],
|
||||
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
||||
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
||||
[
|
||||
if test -d "$withval"
|
||||
then
|
||||
ac_boost_lib_path="$withval"
|
||||
else
|
||||
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
||||
fi
|
||||
],
|
||||
[ac_boost_lib_path=""]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
||||
boost_lib_version_req_sub_minor="0"
|
||||
fi
|
||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
||||
succeeded=no
|
||||
|
||||
dnl On 64-bit systems check for system libraries in both lib64 and lib.
|
||||
dnl The former is specified by FHS, but e.g. Debian does not adhere to
|
||||
dnl this (as it rises problems for generic multi-arch support).
|
||||
dnl The last entry in the list is chosen by default when no libraries
|
||||
dnl are found, e.g. when only header-only libraries are installed!
|
||||
libsubdirs="lib"
|
||||
ax_arch=`uname -m`
|
||||
case $ax_arch in
|
||||
x86_64)
|
||||
libsubdirs="lib64 libx32 lib lib64"
|
||||
;;
|
||||
ppc64|s390x|sparc64|aarch64)
|
||||
libsubdirs="lib64 lib lib64"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
|
||||
dnl them priority over the other paths since, if libs are found there, they
|
||||
dnl are almost assuredly the ones desired.
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
|
||||
|
||||
case ${host_cpu} in
|
||||
i?86)
|
||||
libsubdirs="lib/i386-${host_os} $libsubdirs"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl some arches may advertise a cpu type that doesn't line up with their
|
||||
dnl prefix's cpu type. For example, uname may report armv7l while libs are
|
||||
dnl installed to /usr/lib/arm-linux-gnueabihf. Try getting the compiler's
|
||||
dnl value for an extra chance of finding the correct path.
|
||||
libsubdirs="lib/`$CXX -dumpmachine 2>/dev/null` $libsubdirs"
|
||||
|
||||
dnl first we check the system location for boost libraries
|
||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||
dnl or if you install boost with RPM
|
||||
if test "$ac_boost_path" != ""; then
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
||||
for ac_boost_path_tmp in $libsubdirs; do
|
||||
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
|
||||
break
|
||||
fi
|
||||
done
|
||||
elif test "$cross_compiling" != yes; then
|
||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
dnl overwrite ld flags if we have required special directory with
|
||||
dnl --with-boost-libdir parameter
|
||||
if test "$ac_boost_lib_path" != ""; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
||||
fi
|
||||
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[:
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
|
||||
|
||||
dnl if we found no boost with system layout we search for boost libraries
|
||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||
if test "x$succeeded" != "xyes"; then
|
||||
_version=0
|
||||
if test "$ac_boost_path" != ""; then
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
fi
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||
done
|
||||
fi
|
||||
else
|
||||
if test "$cross_compiling" != yes; then
|
||||
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
best_path=$ac_boost_path
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
||||
if test "$ac_boost_lib_path" = ""; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
BOOST_LDFLAGS="-L$best_path/$libsubdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$BOOST_ROOT" != "x"; then
|
||||
for libsubdir in $libsubdirs ; do
|
||||
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
|
||||
done
|
||||
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
|
||||
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
||||
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[:
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
if test "$succeeded" != "yes" ; then
|
||||
if test "$_version" = "0" ; then
|
||||
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||
else
|
||||
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
|
||||
fi
|
||||
# execute ACTION-IF-NOT-FOUND (if present):
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
AC_SUBST(BOOST_LDFLAGS)
|
||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
||||
# execute ACTION-IF-FOUND (if present):
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
|
||||
])
|
||||
119
build-aux/m4/ax_boost_chrono.m4
Normal file
119
build-aux/m4/ax_boost_chrono.m4
Normal file
@@ -0,0 +1,119 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_chrono.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_CHRONO
|
||||
#
|
||||
# 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
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_CHRONO_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_CHRONO
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
|
||||
#
|
||||
# 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 1
|
||||
|
||||
AC_DEFUN([AX_BOOST_CHRONO],
|
||||
[
|
||||
AC_ARG_WITH([boost-chrono],
|
||||
AS_HELP_STRING([--with-boost-chrono@<:@=special-lib@:>@],
|
||||
[use the Chrono library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-chrono=boost_chrono-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_chrono_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_chrono_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::Chrono library is available,
|
||||
ax_cv_boost_chrono,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/chrono.hpp>]],
|
||||
[[boost::chrono::system_clock::time_point time;]])],
|
||||
ax_cv_boost_chrono=yes, ax_cv_boost_chrono=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_chrono" = "xyes"; then
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
|
||||
AC_DEFINE(HAVE_BOOST_CHRONO,,[define if the Boost::Chrono library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
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,
|
||||
[BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break],
|
||||
[link_chrono="no"])
|
||||
done
|
||||
if test "x$link_chrono" != "xyes"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/boost_chrono*.dll* $BOOSTLIBDIR/boost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_chrono.*\)\.dll.*$;\1;' -e 's;^\(boost_chrono.*\)\.a.*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break],
|
||||
[link_chrono="no"])
|
||||
done
|
||||
fi
|
||||
|
||||
else
|
||||
for ax_lib in $ax_boost_user_chrono_lib boost_chrono-$ax_boost_user_chrono_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break],
|
||||
[link_chrono="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
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 !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
119
build-aux/m4/ax_boost_filesystem.m4
Normal file
119
build-aux/m4/ax_boost_filesystem.m4
Normal file
@@ -0,0 +1,119 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_FILESYSTEM
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for Filesystem library from the Boost C++ libraries. The macro
|
||||
# requires a preceding call to AX_BOOST_BASE. Further documentation is
|
||||
# available at <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_FILESYSTEM_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_FILESYSTEM
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2009 Michael Tindal
|
||||
# Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
|
||||
#
|
||||
# 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 26
|
||||
|
||||
AC_DEFUN([AX_BOOST_FILESYSTEM],
|
||||
[
|
||||
AC_ARG_WITH([boost-filesystem],
|
||||
AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
|
||||
[use the Filesystem library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_filesystem_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_filesystem_lib="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
LIBS_SAVED=$LIBS
|
||||
LIBS="$LIBS $BOOST_SYSTEM_LIB"
|
||||
export LIBS
|
||||
|
||||
AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
|
||||
ax_cv_boost_filesystem,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
|
||||
[[using namespace boost::filesystem;
|
||||
path my_path( "foo/bar/data.txt" );
|
||||
return 0;]])],
|
||||
ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_filesystem" = "xyes"; then
|
||||
AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
ax_lib=
|
||||
if test "x$ax_boost_user_filesystem_lib" = "x"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
||||
[link_filesystem="no"])
|
||||
done
|
||||
if test "x$link_filesystem" != "xyes"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
||||
[link_filesystem="no"])
|
||||
done
|
||||
fi
|
||||
else
|
||||
for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
|
||||
[link_filesystem="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
AC_MSG_ERROR(Could not find a version of the boost_filesystem library!)
|
||||
fi
|
||||
if test "x$link_filesystem" != "xyes"; then
|
||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
LIBS="$LIBS_SAVED"
|
||||
fi
|
||||
])
|
||||
109
build-aux/m4/ax_boost_program_options.m4
Normal file
109
build-aux/m4/ax_boost_program_options.m4
Normal file
@@ -0,0 +1,109 @@
|
||||
# ============================================================================
|
||||
# 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 <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_PROGRAM_OPTIONS
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
|
||||
#
|
||||
# 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 22
|
||||
|
||||
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.hpp>
|
||||
]],
|
||||
[[boost::program_options::options_description generic("Generic options");
|
||||
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
|
||||
ax_lib=
|
||||
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
|
||||
])
|
||||
121
build-aux/m4/ax_boost_system.m4
Normal file
121
build-aux/m4/ax_boost_system.m4
Normal file
@@ -0,0 +1,121 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_SYSTEM
|
||||
#
|
||||
# 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
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_SYSTEM_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_SYSTEM
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2008 Michael Tindal
|
||||
# Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
|
||||
#
|
||||
# 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 17
|
||||
|
||||
AC_DEFUN([AX_BOOST_SYSTEM],
|
||||
[
|
||||
AC_ARG_WITH([boost-system],
|
||||
AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
|
||||
[use the System library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-system=boost_system-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_system_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_system_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::System library is available,
|
||||
ax_cv_boost_system,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
|
||||
[[boost::system::system_category]])],
|
||||
ax_cv_boost_system=yes, ax_cv_boost_system=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_system" = "xyes"; then
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
|
||||
AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
LDFLAGS_SAVE=$LDFLAGS
|
||||
if test "x$ax_boost_user_system_lib" = "x"; then
|
||||
ax_lib=
|
||||
for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
if test "x$link_system" != "xyes"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
fi
|
||||
|
||||
else
|
||||
for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
|
||||
[link_system="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
AC_MSG_ERROR(Could not find a version of the boost_system library!)
|
||||
fi
|
||||
if test "x$link_system" = "xno"; then
|
||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
150
build-aux/m4/ax_boost_thread.m4
Normal file
150
build-aux/m4/ax_boost_thread.m4
Normal file
@@ -0,0 +1,150 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_THREAD
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for Thread library from the Boost C++ libraries. The macro requires
|
||||
# a preceding call to AX_BOOST_BASE. Further documentation is available at
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_THREAD_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_THREAD
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
|
||||
# Copyright (c) 2009 Michael Tindal
|
||||
#
|
||||
# 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 27
|
||||
|
||||
AC_DEFUN([AX_BOOST_THREAD],
|
||||
[
|
||||
AC_ARG_WITH([boost-thread],
|
||||
AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@],
|
||||
[use the Thread library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-thread=boost_thread-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_thread_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_thread_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::Thread library is available,
|
||||
ax_cv_boost_thread,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
|
||||
if test "x$host_os" = "xsolaris" ; then
|
||||
CXXFLAGS="-pthreads $CXXFLAGS"
|
||||
elif test "x$host_os" = "xmingw32" ; then
|
||||
CXXFLAGS="-mthreads $CXXFLAGS"
|
||||
else
|
||||
CXXFLAGS="-pthread $CXXFLAGS"
|
||||
fi
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
|
||||
[[boost::thread_group thrds;
|
||||
return 0;]])],
|
||||
ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_thread" = "xyes"; then
|
||||
if test "x$host_os" = "xsolaris" ; then
|
||||
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
|
||||
elif test "x$host_os" = "xmingw32" ; then
|
||||
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
|
||||
else
|
||||
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
|
||||
AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
LDFLAGS_SAVE=$LDFLAGS
|
||||
case "x$host_os" in
|
||||
*bsd* )
|
||||
LDFLAGS="-pthread $LDFLAGS"
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
if test "x$ax_boost_user_thread_lib" = "x"; then
|
||||
ax_lib=
|
||||
for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
|
||||
[link_thread="no"])
|
||||
done
|
||||
if test "x$link_thread" != "xyes"; then
|
||||
for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
|
||||
[link_thread="no"])
|
||||
done
|
||||
fi
|
||||
|
||||
else
|
||||
for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
|
||||
[link_thread="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
AC_MSG_ERROR(Could not find a version of the boost_thread library!)
|
||||
fi
|
||||
if test "x$link_thread" = "xno"; then
|
||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
||||
else
|
||||
case "x$host_os" in
|
||||
*bsd* )
|
||||
BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
138
build-aux/m4/ax_boost_unit_test_framework.m4
Normal file
138
build-aux/m4/ax_boost_unit_test_framework.m4
Normal file
@@ -0,0 +1,138 @@
|
||||
# ================================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html
|
||||
# ================================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_UNIT_TEST_FRAMEWORK
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for Unit_Test_Framework library from the Boost C++ libraries. The
|
||||
# macro requires a preceding call to AX_BOOST_BASE. Further documentation
|
||||
# is available at <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_UNIT_TEST_FRAMEWORK
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||
#
|
||||
# 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 19
|
||||
|
||||
AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK],
|
||||
[
|
||||
AC_ARG_WITH([boost-unit-test-framework],
|
||||
AS_HELP_STRING([--with-boost-unit-test-framework@<:@=special-lib@:>@],
|
||||
[use the Unit_Test_Framework library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-unit-test-framework=boost_unit_test_framework-gcc ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_unit_test_framework_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_unit_test_framework_lib="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_CACHE_CHECK(whether the Boost::Unit_Test_Framework library is available,
|
||||
ax_cv_boost_unit_test_framework,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/test/unit_test.hpp>]],
|
||||
[[using boost::unit_test::test_suite;
|
||||
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++])
|
||||
])
|
||||
if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
|
||||
AC_DEFINE(HAVE_BOOST_UNIT_TEST_FRAMEWORK,,[define if the Boost::Unit_Test_Framework library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
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;'`
|
||||
ax_lib=${libextension}
|
||||
link_unit_test_framework="yes"
|
||||
else
|
||||
link_unit_test_framework="no"
|
||||
fi
|
||||
|
||||
if test "x$link_unit_test_framework" = "xyes"; then
|
||||
BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"
|
||||
AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB)
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "x$link_unit_test_framework" != "xyes"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/boost_unit_test_framework*.dll* $BOOSTLIBDIR/boost_unit_test_framework*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_unit_test_framework.*\)\.dll.*$;\1;' -e 's;^\(boost_unit_test_framework.*\)\.a.*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"; AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) link_unit_test_framework="yes"; break],
|
||||
[link_unit_test_framework="no"])
|
||||
done
|
||||
fi
|
||||
else
|
||||
link_unit_test_framework="no"
|
||||
saved_ldflags="${LDFLAGS}"
|
||||
for ax_lib in boost_unit_test_framework-$ax_boost_user_unit_test_framework_lib $ax_boost_user_unit_test_framework_lib ; do
|
||||
if test "x$link_unit_test_framework" = "xyes"; then
|
||||
break;
|
||||
fi
|
||||
for unittest_library in `ls $BOOSTLIBDIR/lib${ax_lib}.so* $BOOSTLIBDIR/lib${ax_lib}.a* 2>/dev/null` ; do
|
||||
if test -r $unittest_library ; then
|
||||
libextension=`echo $unittest_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a*$;\1;'`
|
||||
ax_lib=${libextension}
|
||||
link_unit_test_framework="yes"
|
||||
else
|
||||
link_unit_test_framework="no"
|
||||
fi
|
||||
|
||||
if test "x$link_unit_test_framework" = "xyes"; then
|
||||
BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"
|
||||
AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB)
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
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 !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
72
build-aux/m4/ax_check_compile_flag.m4
Normal file
72
build-aux/m4/ax_check_compile_flag.m4
Normal file
@@ -0,0 +1,72 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
71
build-aux/m4/ax_check_link_flag.m4
Normal file
71
build-aux/m4/ax_check_link_flag.m4
Normal file
@@ -0,0 +1,71 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the linker or gives an error.
|
||||
# (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||
# issue an error when a bad flag is given.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_CHECK_LINK_FLAG],
|
||||
[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS $4 $1"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
LDFLAGS=$ax_check_save_flags])
|
||||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_LINK_FLAGS
|
||||
72
build-aux/m4/ax_check_preproc_flag.m4
Normal file
72
build-aux/m4/ax_check_preproc_flag.m4
Normal file
@@ -0,0 +1,72 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's
|
||||
# preprocessor or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the preprocessor's default
|
||||
# flags when the check is done. The check is thus made with the flags:
|
||||
# "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the
|
||||
# preprocessor to issue an error when a bad flag is given.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# 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
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_CHECK_PREPROC_FLAG],
|
||||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $4 $1"
|
||||
AC_PREPROC_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
CPPFLAGS=$ax_check_save_flags])
|
||||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_PREPROC_FLAGS
|
||||
217
build-aux/m4/ax_gcc_func_attribute.m4
Normal file
217
build-aux/m4/ax_gcc_func_attribute.m4
Normal file
@@ -0,0 +1,217 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro checks if the compiler supports one of GCC's function
|
||||
# attributes; many other compilers also provide function attributes with
|
||||
# the same syntax. Compiler warnings are used to detect supported
|
||||
# attributes as unsupported ones are ignored by default so quieting
|
||||
# warnings when using this macro will yield false positives.
|
||||
#
|
||||
# The ATTRIBUTE parameter holds the name of the attribute to be checked.
|
||||
#
|
||||
# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
|
||||
#
|
||||
# The macro caches its result in the ax_cv_have_func_attribute_<attribute>
|
||||
# variable.
|
||||
#
|
||||
# The macro currently supports the following function attributes:
|
||||
#
|
||||
# alias
|
||||
# aligned
|
||||
# alloc_size
|
||||
# always_inline
|
||||
# artificial
|
||||
# cold
|
||||
# const
|
||||
# constructor
|
||||
# deprecated
|
||||
# destructor
|
||||
# dllexport
|
||||
# dllimport
|
||||
# error
|
||||
# externally_visible
|
||||
# flatten
|
||||
# format
|
||||
# format_arg
|
||||
# gnu_inline
|
||||
# hot
|
||||
# ifunc
|
||||
# leaf
|
||||
# malloc
|
||||
# noclone
|
||||
# noinline
|
||||
# nonnull
|
||||
# noreturn
|
||||
# nothrow
|
||||
# optimize
|
||||
# pure
|
||||
# unused
|
||||
# used
|
||||
# visibility
|
||||
# warning
|
||||
# warn_unused_result
|
||||
# weak
|
||||
# weakref
|
||||
#
|
||||
# Unsuppored function attributes will be tested with a prototype returning
|
||||
# an int and not accepting any arguments and the result of the check might
|
||||
# be wrong or meaningless so use with care.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
|
||||
#
|
||||
# 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_GCC_FUNC_ATTRIBUTE], [
|
||||
AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
|
||||
|
||||
AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||
m4_case([$1],
|
||||
[alias], [
|
||||
int foo( void ) { return 0; }
|
||||
int bar( void ) __attribute__(($1("foo")));
|
||||
],
|
||||
[aligned], [
|
||||
int foo( void ) __attribute__(($1(32)));
|
||||
],
|
||||
[alloc_size], [
|
||||
void *foo(int a) __attribute__(($1(1)));
|
||||
],
|
||||
[always_inline], [
|
||||
inline __attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[artificial], [
|
||||
inline __attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[cold], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[const], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[constructor], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[deprecated], [
|
||||
int foo( void ) __attribute__(($1("")));
|
||||
],
|
||||
[destructor], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[dllexport], [
|
||||
__attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[dllimport], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[error], [
|
||||
int foo( void ) __attribute__(($1("")));
|
||||
],
|
||||
[externally_visible], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[flatten], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[format], [
|
||||
int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
|
||||
],
|
||||
[format_arg], [
|
||||
char *foo(const char *p) __attribute__(($1(1)));
|
||||
],
|
||||
[gnu_inline], [
|
||||
inline __attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[hot], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[ifunc], [
|
||||
int my_foo( void ) { return 0; }
|
||||
static int (*resolve_foo(void))(void) { return my_foo; }
|
||||
int foo( void ) __attribute__(($1("resolve_foo")));
|
||||
],
|
||||
[leaf], [
|
||||
__attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[malloc], [
|
||||
void *foo( void ) __attribute__(($1));
|
||||
],
|
||||
[noclone], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[noinline], [
|
||||
__attribute__(($1)) int foo( void ) { return 0; }
|
||||
],
|
||||
[nonnull], [
|
||||
int foo(char *p) __attribute__(($1(1)));
|
||||
],
|
||||
[noreturn], [
|
||||
void foo( void ) __attribute__(($1));
|
||||
],
|
||||
[nothrow], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[optimize], [
|
||||
__attribute__(($1(3))) int foo( void ) { return 0; }
|
||||
],
|
||||
[pure], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[unused], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[used], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[visibility], [
|
||||
int foo_def( void ) __attribute__(($1("default")));
|
||||
int foo_hid( void ) __attribute__(($1("hidden")));
|
||||
],
|
||||
[warning], [
|
||||
int foo( void ) __attribute__(($1("")));
|
||||
],
|
||||
[warn_unused_result], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[weak], [
|
||||
int foo( void ) __attribute__(($1));
|
||||
],
|
||||
[weakref], [
|
||||
static int foo( void ) { return 0; }
|
||||
static int bar( void ) __attribute__(($1("foo")));
|
||||
],
|
||||
[
|
||||
m4_warn([syntax], [Unsupported attribute $1, the test may fail])
|
||||
int foo( void ) __attribute__(($1));
|
||||
]
|
||||
)], [])
|
||||
],
|
||||
dnl GCC doesn't exit with an error if an unknown attribute is
|
||||
dnl provided but only outputs a warning, so accept the attribute
|
||||
dnl only if no warning were issued.
|
||||
[AS_IF([test -s conftest.err],
|
||||
[AS_VAR_SET([ac_var], [no])],
|
||||
[AS_VAR_SET([ac_var], [yes])])],
|
||||
[AS_VAR_SET([ac_var], [no])])
|
||||
])
|
||||
|
||||
AS_IF([test yes = AS_VAR_GET([ac_var])],
|
||||
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
|
||||
[Define to 1 if the system has the `$1' function attribute])], [])
|
||||
|
||||
AS_VAR_POPDEF([ac_var])
|
||||
])
|
||||
332
build-aux/m4/ax_pthread.m4
Normal file
332
build-aux/m4/ax_pthread.m4
Normal file
@@ -0,0 +1,332 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro figures out how to build C programs using POSIX threads. It
|
||||
# sets the PTHREAD_LIBS output variable to the threads library and linker
|
||||
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
|
||||
# flags that are needed. (The user can also force certain compiler
|
||||
# flags/libs to be tested by setting these environment variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well. e.g. you should link with
|
||||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use these
|
||||
# variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||
# PTHREAD_CFLAGS.
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||
# will define HAVE_PTHREAD.
|
||||
#
|
||||
# Please let the authors know if this macro fails on any platform, or if
|
||||
# you have any other suggestions or comments. This macro was based on work
|
||||
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
|
||||
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
|
||||
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||
# grateful for the helpful feedback of numerous users.
|
||||
#
|
||||
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
#
|
||||
# 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
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 21
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_PUSH([C])
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC([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
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case ${host_os} in
|
||||
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. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (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 just look for -pthreads and -lpthread first:
|
||||
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clang doesn't consider unrecognized options an error unless we specify
|
||||
# -Werror. We throw in some extra Clang-specific options to ensure that
|
||||
# this doesn't happen for GCC, which also accepts -Werror.
|
||||
|
||||
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
|
||||
save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_extra_flags="-Werror"
|
||||
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ax_pthread_extra_flags=
|
||||
AC_MSG_RESULT([no])])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
|
||||
|
||||
# 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 <pthread.h>
|
||||
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],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT([$attr_name])
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
# TODO: What about Clang on Solaris?
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$flag])
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[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"],
|
||||
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# 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"
|
||||
|
||||
AC_SUBST([PTHREAD_LIBS])
|
||||
AC_SUBST([PTHREAD_CFLAGS])
|
||||
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])
|
||||
:
|
||||
else
|
||||
ax_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_POP
|
||||
])dnl AX_PTHREAD
|
||||
66
build-aux/m4/bitcoin_find_bdb48.m4
Normal file
66
build-aux/m4/bitcoin_find_bdb48.m4
Normal file
@@ -0,0 +1,66 @@
|
||||
AC_DEFUN([BITCOIN_FIND_BDB48],[
|
||||
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
|
||||
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)
|
||||
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
|
||||
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
|
||||
AC_MSG_ERROR([libdb_cxx missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
fi
|
||||
AC_SUBST(BDB_LIBS)
|
||||
])
|
||||
415
build-aux/m4/bitcoin_qt.m4
Normal file
415
build-aux/m4/bitcoin_qt.m4
Normal file
@@ -0,0 +1,415 @@
|
||||
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
|
||||
AC_MSG_WARN([$1; bitcoin-qt frontend will not be built])
|
||||
fi
|
||||
bitcoin_enable_qt=no
|
||||
else
|
||||
AC_MSG_ERROR([$1])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([BITCOIN_QT_CHECK],[
|
||||
if test "x$bitcoin_enable_qt" != "xno" && test x$bitcoin_qt_want_version != xno; then
|
||||
true
|
||||
$1
|
||||
else
|
||||
true
|
||||
$2
|
||||
fi
|
||||
])
|
||||
|
||||
dnl BITCOIN_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing])
|
||||
dnl Helper for finding the path of programs needed for Qt.
|
||||
dnl Inputs: $1: Variable to be set
|
||||
dnl Inputs: $2: List of programs to search for
|
||||
dnl Inputs: $3: Look for $2 here before $PATH
|
||||
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
|
||||
AC_PATH_PROGS($1,$2,,$3)
|
||||
else
|
||||
AC_PATH_PROGS($1,$2)
|
||||
fi
|
||||
if test "x$$1" = "x" && test "x$4" != "xyes"; then
|
||||
BITCOIN_QT_FAIL([$1 not found])
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl Initialize qt input.
|
||||
dnl This must be called before any other BITCOIN_QT* macros to ensure that
|
||||
dnl input variables are set correctly.
|
||||
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|qt4|qt5|auto@:>@],
|
||||
[build bitcoin-qt GUI (default=auto, qt4 tried first)])],
|
||||
[
|
||||
bitcoin_qt_want_version=$withval
|
||||
if test x$bitcoin_qt_want_version = xyes; then
|
||||
bitcoin_qt_force=yes
|
||||
bitcoin_qt_want_version=auto
|
||||
fi
|
||||
],
|
||||
[bitcoin_qt_want_version=auto])
|
||||
|
||||
AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], [])
|
||||
AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], [])
|
||||
AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], [])
|
||||
AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], [])
|
||||
AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], [])
|
||||
|
||||
AC_ARG_WITH([qtdbus],
|
||||
[AS_HELP_STRING([--with-qtdbus],
|
||||
[enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
|
||||
[use_dbus=$withval],
|
||||
[use_dbus=auto])
|
||||
|
||||
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
|
||||
])
|
||||
|
||||
dnl Find the appropriate version of Qt libraries and includes.
|
||||
dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes.
|
||||
dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be
|
||||
dnl tried first.
|
||||
dnl Outputs: See _BITCOIN_QT_FIND_LIBS_*
|
||||
dnl Outputs: Sets variables for all qt-related tools.
|
||||
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
|
||||
use_pkgconfig=yes
|
||||
fi
|
||||
|
||||
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 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([
|
||||
TEMP_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS=$QT_INCLUDES
|
||||
if test x$bitcoin_qt_got_major_vers = x5; then
|
||||
_BITCOIN_QT_IS_STATIC
|
||||
if test x$bitcoin_cv_static_qt = xyes; then
|
||||
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
|
||||
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/platforms"
|
||||
fi
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
|
||||
fi
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets])
|
||||
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
|
||||
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"])
|
||||
_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
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"])
|
||||
fi
|
||||
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
|
||||
else
|
||||
if test x$TARGET_OS = xwindows; then
|
||||
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
|
||||
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
|
||||
_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
|
||||
])
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
*darwin*)
|
||||
BITCOIN_QT_CHECK([
|
||||
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
|
||||
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
|
||||
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
|
||||
])
|
||||
;;
|
||||
*mingw*)
|
||||
BITCOIN_QT_CHECK([
|
||||
AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)])
|
||||
])
|
||||
esac
|
||||
|
||||
|
||||
dnl enable qt support
|
||||
AC_MSG_CHECKING(whether to build Bitcoin Core GUI)
|
||||
BITCOIN_QT_CHECK([
|
||||
bitcoin_enable_qt=yes
|
||||
bitcoin_enable_qt_test=yes
|
||||
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
|
||||
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.")
|
||||
fi
|
||||
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 (Qt${bitcoin_qt_got_major_vers})])
|
||||
|
||||
AC_SUBST(QT_INCLUDES)
|
||||
AC_SUBST(QT_LIBS)
|
||||
AC_SUBST(QT_LDFLAGS)
|
||||
AC_SUBST(QT_DBUS_INCLUDES)
|
||||
AC_SUBST(QT_DBUS_LIBS)
|
||||
AC_SUBST(QT_TEST_INCLUDES)
|
||||
AC_SUBST(QT_TEST_LIBS)
|
||||
AC_SUBST(QT_SELECT, qt${bitcoin_qt_got_major_vers})
|
||||
AC_SUBST(MOC_DEFS)
|
||||
])
|
||||
|
||||
dnl All macros below are internal and should _not_ be used from the main
|
||||
dnl configure.ac.
|
||||
dnl ----
|
||||
|
||||
dnl Internal. Check if the included version of Qt is Qt5.
|
||||
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 <QtCore>]],
|
||||
[[
|
||||
#if QT_VERSION < 0x050000
|
||||
choke me
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
]])],
|
||||
[bitcoin_cv_qt5=yes],
|
||||
[bitcoin_cv_qt5=no])
|
||||
])])
|
||||
|
||||
dnl Internal. Check if the linked version of Qt was built as static libs.
|
||||
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 <QtCore>]],
|
||||
[[
|
||||
#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
|
||||
])
|
||||
|
||||
dnl Internal. Check if the link-requirements for static plugins are met.
|
||||
dnl Requires: INCLUDES and LIBS must be populated as necessary.
|
||||
dnl Inputs: $1: A series of Q_IMPORT_PLUGIN().
|
||||
dnl Inputs: $2: The libraries that resolve $1.
|
||||
dnl Output: QT_LIBS is prepended or configure exits.
|
||||
AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[
|
||||
AC_MSG_CHECKING(for static Qt plugins: $2)
|
||||
CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS"
|
||||
LIBS="$2 $QT_LIBS $LIBS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#define QT_STATICPLUGIN
|
||||
#include <QtPlugin>
|
||||
$1]],
|
||||
[[return 0;]])],
|
||||
[AC_MSG_RESULT(yes); QT_LIBS="$2 $QT_LIBS"],
|
||||
[AC_MSG_RESULT(no); BITCOIN_QT_FAIL(Could not resolve: $2)])
|
||||
LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS"
|
||||
])
|
||||
|
||||
dnl Internal. Find Qt libraries using pkg-config.
|
||||
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to check
|
||||
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],[
|
||||
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([
|
||||
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
|
||||
|
||||
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 = x$qt5; 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
|
||||
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
|
||||
fi
|
||||
])
|
||||
])
|
||||
true; dnl
|
||||
])
|
||||
|
||||
dnl Internal. Find Qt libraries without using pkg-config. Version is deduced
|
||||
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"
|
||||
TEMP_LIBS="$LIBS"
|
||||
BITCOIN_QT_CHECK([
|
||||
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
|
||||
])
|
||||
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing))])
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing))])
|
||||
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
|
||||
_BITCOIN_QT_CHECK_QT5
|
||||
fi
|
||||
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
|
||||
LIBS="$LIBS -L$qt_lib_path"
|
||||
fi
|
||||
|
||||
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_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_CHECK_LIB([pcre16] ,[main],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in])))
|
||||
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
|
||||
QT_LIBS="$LIBS"
|
||||
LIBS="$TEMP_LIBS"
|
||||
|
||||
BITCOIN_QT_CHECK([
|
||||
LIBS=
|
||||
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
|
||||
LIBS=
|
||||
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)
|
||||
AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no)
|
||||
QT_DBUS_LIBS="$LIBS"
|
||||
fi
|
||||
])
|
||||
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||
LIBS="$TEMP_LIBS"
|
||||
])
|
||||
|
||||
14
build-aux/m4/bitcoin_subdir_to_include.m4
Normal file
14
build-aux/m4/bitcoin_subdir_to_include.m4
Normal file
@@ -0,0 +1,14 @@
|
||||
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],[
|
||||
if test "x$2" = "x"; then
|
||||
AC_MSG_RESULT([default])
|
||||
else
|
||||
echo "#include <$2$3.h>" >conftest.cpp
|
||||
newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`]
|
||||
AC_MSG_RESULT([${newinclpath}])
|
||||
if test "x${newinclpath}" != "x"; then
|
||||
eval "$1=\"\$$1\"' -I${newinclpath}'"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
80
ci/README.md
80
ci/README.md
@@ -1,80 +0,0 @@
|
||||
# CI Scripts
|
||||
|
||||
This directory contains scripts for each build step in each build stage.
|
||||
|
||||
## Running a Stage Locally
|
||||
|
||||
Be aware that the tests will be built and run in-place, so please run at your own risk.
|
||||
If the repository is not a fresh git clone, you might have to clean files from previous builds or test runs first.
|
||||
|
||||
The ci needs to perform various sysadmin tasks such as installing packages or writing to the user's home directory.
|
||||
While it should be fine to run
|
||||
the ci system locally on your development box, the ci scripts can generally be assumed to have received less review and
|
||||
testing compared to other parts of the codebase. If you want to keep the work tree clean, you might want to run the ci
|
||||
system in a virtual machine with a Linux operating system of your choice.
|
||||
|
||||
To allow for a wide range of tested environments, but also ensure reproducibility to some extent, the test stage
|
||||
requires `bash`, `docker`, and `python3` to be installed. To run on different architectures than the host `qemu` is also required. To install all requirements on Ubuntu, run
|
||||
|
||||
```
|
||||
sudo apt install bash docker.io python3 qemu-user-static
|
||||
```
|
||||
|
||||
It is recommended to run the ci system in a clean env. To run the test stage
|
||||
with a specific configuration,
|
||||
|
||||
```
|
||||
env -i HOME="$HOME" PATH="$PATH" USER="$USER" bash -c 'FILE_ENV="./ci/test/00_setup_env_arm.sh" ./ci/test_run_all.sh'
|
||||
```
|
||||
|
||||
## Configurations
|
||||
|
||||
The test files (`FILE_ENV`) are constructed to test a wide range of
|
||||
configurations, rather than a single pass/fail. This helps to catch build
|
||||
failures and logic errors that present on platforms other than the ones the
|
||||
author has tested.
|
||||
|
||||
Some builders use the dependency-generator in `./depends`, rather than using
|
||||
the system package manager to install build dependencies. This guarantees that
|
||||
the tester is using the same versions as the release builds, which also use
|
||||
`./depends`.
|
||||
|
||||
It is also possible to force a specific configuration without modifying the
|
||||
file. For example,
|
||||
|
||||
```
|
||||
env -i HOME="$HOME" PATH="$PATH" USER="$USER" bash -c 'MAKEJOBS="-j1" FILE_ENV="./ci/test/00_setup_env_arm.sh" ./ci/test_run_all.sh'
|
||||
```
|
||||
|
||||
The files starting with `0n` (`n` greater than 0) are the scripts that are run
|
||||
in order.
|
||||
|
||||
## Cache
|
||||
|
||||
In order to avoid rebuilding all dependencies for each build, the binaries are
|
||||
cached and reused when possible. Changes in the dependency-generator will
|
||||
trigger cache-invalidation and rebuilds as necessary.
|
||||
|
||||
## Configuring a repository for CI
|
||||
|
||||
### Primary repository
|
||||
|
||||
To configure the primary repository, follow these steps:
|
||||
|
||||
1. Register with [Cirrus Runners](https://cirrus-runners.app/) and purchase runners.
|
||||
2. Install the Cirrus Runners GitHub app against the GitHub organization.
|
||||
3. Enable organisation-level runners to be used in public repositories:
|
||||
1. `Org settings -> Actions -> Runner Groups -> Default -> Allow public repos`
|
||||
4. Permit the following actions to run:
|
||||
1. cirruslabs/cache/restore@\*
|
||||
1. cirruslabs/cache/save@\*
|
||||
1. docker/setup-buildx-action@\*
|
||||
1. actions/github-script@\*
|
||||
|
||||
### Forked repositories
|
||||
|
||||
When used in a fork the CI will run on GitHub's free hosted runners by default.
|
||||
In this case, due to GitHub's 10GB-per-repo cache size limitations caches will be frequently evicted and missed, but the workflows will run (slowly).
|
||||
|
||||
It is also possible to use your own Cirrus Runners in your own fork with an appropriate patch to the `REPO_USE_CIRRUS_RUNNERS` variable in ../.github/workflows/ci.yml
|
||||
NB that Cirrus Runners only work at an organisation level, therefore in order to use your own Cirrus Runners, *the fork must be within your own organisation*.
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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 -o errexit -o pipefail -o xtrace
|
||||
|
||||
export CI_RETRY_EXE="/ci_retry --"
|
||||
|
||||
pushd "/"
|
||||
|
||||
${CI_RETRY_EXE} apt-get update
|
||||
# Lint dependencies:
|
||||
# - cargo (used to run the lint tests)
|
||||
# - curl/xz-utils (to install shellcheck)
|
||||
# - git (used in many lint scripts)
|
||||
# - gpg (used by verify-commits)
|
||||
${CI_RETRY_EXE} apt-get install -y cargo curl xz-utils git gpg
|
||||
|
||||
PYTHON_PATH="/python_build"
|
||||
if [ ! -d "${PYTHON_PATH}/bin" ]; then
|
||||
(
|
||||
${CI_RETRY_EXE} git clone --depth=1 https://github.com/pyenv/pyenv.git
|
||||
cd pyenv/plugins/python-build || exit 1
|
||||
./install.sh
|
||||
)
|
||||
# For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
|
||||
${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
|
||||
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
|
||||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
|
||||
clang
|
||||
env CC=clang python-build "$(cat "/.python-version")" "${PYTHON_PATH}"
|
||||
fi
|
||||
export PATH="${PYTHON_PATH}/bin:${PATH}"
|
||||
command -v python3
|
||||
python3 --version
|
||||
|
||||
${CI_RETRY_EXE} pip3 install \
|
||||
codespell==2.4.1 \
|
||||
lief==0.16.6 \
|
||||
mypy==1.4.1 \
|
||||
pyzmq==25.1.0 \
|
||||
ruff==0.5.5 \
|
||||
vulture==2.6
|
||||
|
||||
SHELLCHECK_VERSION=v0.11.0
|
||||
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \
|
||||
tar --xz -xf - --directory /tmp/
|
||||
mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/
|
||||
|
||||
MLC_VERSION=v1
|
||||
MLC_BIN=mlc-x86_64-linux
|
||||
curl -sL "https://github.com/becheran/mlc/releases/download/${MLC_VERSION}/${MLC_BIN}" -o "/usr/bin/mlc"
|
||||
chmod +x /usr/bin/mlc
|
||||
|
||||
popd || exit
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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 -ex
|
||||
|
||||
if [ -n "$CIRRUS_PR" ]; then
|
||||
export COMMIT_RANGE="HEAD~..HEAD"
|
||||
if [ "$(git rev-list -1 HEAD)" != "$(git rev-list -1 --merges HEAD)" ]; then
|
||||
echo "Error: The top commit must be a merge commit, usually the remote 'pull/${PR_NUMBER}/merge' branch."
|
||||
false
|
||||
fi
|
||||
fi
|
||||
|
||||
RUST_BACKTRACE=1 cargo run --manifest-path "./test/lint/test_runner/Cargo.toml"
|
||||
|
||||
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then
|
||||
# Sanity check only the last few commits to get notified of missing sigs,
|
||||
# missing keys, or expired keys. Usually there is only one new merge commit
|
||||
# per push on the master branch and a few commits on release branches, so
|
||||
# sanity checking only a few (10) commits seems sufficient and cheap.
|
||||
git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
|
||||
git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-git-root
|
||||
mapfile -t KEYS < contrib/verify-commits/trusted-keys
|
||||
git config user.email "ci@ci.ci"
|
||||
git config user.name "ci"
|
||||
${CI_RETRY_EXE} gpg --keyserver hkps://keys.openpgp.org --recv-keys "${KEYS[@]}" &&
|
||||
./contrib/verify-commits/verify-commits.py;
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
# Fixes permission issues when there is a container UID/GID mismatch with the owner
|
||||
# of the mounted bitcoin src dir.
|
||||
git config --global --add safe.directory /bitcoin
|
||||
|
||||
export PATH="/python_build/bin:${PATH}"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
bash -ic "./ci/lint/06_script.sh"
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# See test/lint/README.md for usage.
|
||||
|
||||
FROM mirror.gcr.io/ubuntu:24.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
||||
COPY ./ci/retry/retry /ci_retry
|
||||
COPY ./.python-version /.python-version
|
||||
COPY ./ci/lint/container-entrypoint.sh /entrypoint.sh
|
||||
COPY ./ci/lint/01_install.sh /install.sh
|
||||
|
||||
RUN /install.sh && \
|
||||
echo 'alias lint="./ci/lint/06_script.sh"' >> ~/.bashrc && \
|
||||
chmod 755 /entrypoint.sh && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
WORKDIR /bitcoin
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -1,123 +0,0 @@
|
||||
retry - The command line retry tool
|
||||
------------------------------------------
|
||||
|
||||
Retry any shell command with exponential backoff or constant delay.
|
||||
|
||||
### Instructions
|
||||
|
||||
Install:
|
||||
|
||||
retry is a shell script, so drop it somewhere and make sure it's added to your $PATH. Or you can use the following one-liner:
|
||||
|
||||
```sh
|
||||
sudo sh -c "curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry"
|
||||
```
|
||||
|
||||
If you're on OS X, retry is also on Homebrew:
|
||||
|
||||
```
|
||||
brew pull 27283
|
||||
brew install retry
|
||||
```
|
||||
Not popular enough for homebrew-core. Please star this project to help.
|
||||
|
||||
### Usage
|
||||
|
||||
Help:
|
||||
|
||||
`retry -?`
|
||||
|
||||
Usage: retry [options] -- execute command
|
||||
-h, -?, --help
|
||||
-v, --verbose Verbose output
|
||||
-t, --tries=# Set max retries: Default 10
|
||||
-s, --sleep=secs Constant sleep amount (seconds)
|
||||
-m, --min=secs Exponential Backoff: minimum sleep amount (seconds): Default 0.3
|
||||
-x, --max=secs Exponential Backoff: maximum sleep amount (seconds): Default 60
|
||||
-f, --fail="script +cmds" Fail Script: run in case of final failure
|
||||
|
||||
### Examples
|
||||
|
||||
No problem:
|
||||
|
||||
`retry echo u work good`
|
||||
|
||||
u work good
|
||||
|
||||
Test functionality:
|
||||
|
||||
`retry 'echo "y u no work"; false'`
|
||||
|
||||
y u no work
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
y u no work
|
||||
Before retry #2: sleeping 0.6 seconds
|
||||
y u no work
|
||||
Before retry #3: sleeping 1.2 seconds
|
||||
y u no work
|
||||
Before retry #4: sleeping 2.4 seconds
|
||||
y u no work
|
||||
Before retry #5: sleeping 4.8 seconds
|
||||
y u no work
|
||||
Before retry #6: sleeping 9.6 seconds
|
||||
y u no work
|
||||
Before retry #7: sleeping 19.2 seconds
|
||||
y u no work
|
||||
Before retry #8: sleeping 38.4 seconds
|
||||
y u no work
|
||||
Before retry #9: sleeping 60.0 seconds
|
||||
y u no work
|
||||
Before retry #10: sleeping 60.0 seconds
|
||||
y u no work
|
||||
etc..
|
||||
|
||||
Limit retries:
|
||||
|
||||
`retry -t 4 'echo "y u no work"; false'`
|
||||
|
||||
y u no work
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
y u no work
|
||||
Before retry #2: sleeping 0.6 seconds
|
||||
y u no work
|
||||
Before retry #3: sleeping 1.2 seconds
|
||||
y u no work
|
||||
Before retry #4: sleeping 2.4 seconds
|
||||
y u no work
|
||||
Retries exhausted
|
||||
|
||||
Bad command:
|
||||
|
||||
`retry poop`
|
||||
|
||||
bash: poop: command not found
|
||||
|
||||
Fail command:
|
||||
|
||||
`retry -t 3 -f 'echo "oh poopsickles"' 'echo "y u no work"; false'`
|
||||
|
||||
y u no work
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
y u no work
|
||||
Before retry #2: sleeping 0.6 seconds
|
||||
y u no work
|
||||
Before retry #3: sleeping 1.2 seconds
|
||||
y u no work
|
||||
Retries exhausted, running fail script
|
||||
oh poopsickles
|
||||
|
||||
Last attempt passed:
|
||||
|
||||
`retry -t 3 -- 'if [ $RETRY_ATTEMPT -eq 3 ]; then echo Passed at attempt $RETRY_ATTEMPT; true; else echo Failed at attempt $RETRY_ATTEMPT; false; fi;'`
|
||||
|
||||
Failed at attempt 0
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
Failed at attempt 1
|
||||
Before retry #2: sleeping 0.6 seconds
|
||||
Failed at attempt 2
|
||||
Before retry #3: sleeping 1.2 seconds
|
||||
Passed at attempt 3
|
||||
|
||||
### License
|
||||
|
||||
Apache 2.0 - go nuts
|
||||
163
ci/retry/retry
163
ci/retry/retry
@@ -1,163 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GETOPT_BIN=$IN_GETOPT_BIN
|
||||
GETOPT_BIN=${GETOPT_BIN:-getopt}
|
||||
|
||||
__sleep_amount() {
|
||||
if [ -n "$constant_sleep" ]; then
|
||||
sleep_time=$constant_sleep
|
||||
else
|
||||
#TODO: check for awk
|
||||
#TODO: check if user would rather use one of the other possible dependencies: python, ruby, bc, dc
|
||||
sleep_time=`awk "BEGIN {t = $min_sleep * $(( (1<<($attempts -1)) )); print (t > $max_sleep ? $max_sleep : t)}"`
|
||||
fi
|
||||
}
|
||||
|
||||
__log_out() {
|
||||
echo "$1" 1>&2
|
||||
}
|
||||
|
||||
# Parameters: max_tries min_sleep max_sleep constant_sleep fail_script EXECUTION_COMMAND
|
||||
retry()
|
||||
{
|
||||
local max_tries="$1"; shift
|
||||
local min_sleep="$1"; shift
|
||||
local max_sleep="$1"; shift
|
||||
local constant_sleep="$1"; shift
|
||||
local fail_script="$1"; shift
|
||||
if [ -n "$VERBOSE" ]; then
|
||||
__log_out "Retry Parameters: max_tries=$max_tries min_sleep=$min_sleep max_sleep=$max_sleep constant_sleep=$constant_sleep"
|
||||
if [ -n "$fail_script" ]; then __log_out "Fail script: $fail_script"; fi
|
||||
__log_out ""
|
||||
__log_out "Execution Command: $*"
|
||||
__log_out ""
|
||||
fi
|
||||
|
||||
local attempts=0
|
||||
local return_code=1
|
||||
|
||||
|
||||
while [[ $return_code -ne 0 && $attempts -le $max_tries ]]; do
|
||||
if [ $attempts -gt 0 ]; then
|
||||
__sleep_amount
|
||||
__log_out "Before retry #$attempts: sleeping $sleep_time seconds"
|
||||
sleep $sleep_time
|
||||
fi
|
||||
|
||||
P="$1"
|
||||
for param in "${@:2}"; do P="$P '$param'"; done
|
||||
#TODO: replace single quotes in each arg with '"'"' ?
|
||||
export RETRY_ATTEMPT=$attempts
|
||||
bash -c "$P"
|
||||
return_code=$?
|
||||
#__log_out "Process returned $return_code on attempt $attempts"
|
||||
if [ $return_code -eq 127 ]; then
|
||||
# command not found
|
||||
exit $return_code
|
||||
elif [ $return_code -ne 0 ]; then
|
||||
attempts=$[$attempts +1]
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $attempts -gt $max_tries ]; then
|
||||
if [ -n "$fail_script" ]; then
|
||||
__log_out "Retries exhausted, running fail script"
|
||||
eval $fail_script
|
||||
else
|
||||
__log_out "Retries exhausted"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $return_code
|
||||
}
|
||||
|
||||
# If we're being sourced, don't worry about such things
|
||||
if [ "$BASH_SOURCE" == "$0" ]; then
|
||||
# Prints the help text
|
||||
help()
|
||||
{
|
||||
local retry=$(basename $0)
|
||||
cat <<EOF
|
||||
Usage: $retry [options] -- execute command
|
||||
-h, -?, --help
|
||||
-v, --verbose Verbose output
|
||||
-t, --tries=# Set max retries: Default 10
|
||||
-s, --sleep=secs Constant sleep amount (seconds)
|
||||
-m, --min=secs Exponential Backoff: minimum sleep amount (seconds): Default 0.3
|
||||
-x, --max=secs Exponential Backoff: maximum sleep amount (seconds): Default 60
|
||||
-f, --fail="script +cmds" Fail Script: run in case of final failure
|
||||
EOF
|
||||
}
|
||||
|
||||
# show help for no arguments if stdin is a terminal
|
||||
if { [ -z "$1" ] && [ -t 0 ] ; } || [ "$1" == '-h' ] || [ "$1" == '-?' ] || [ "$1" == '--help' ]
|
||||
then
|
||||
help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$GETOPT_BIN --test > /dev/null
|
||||
if [[ $? -ne 4 ]]; then
|
||||
echo "I’m sorry, 'getopt --test' failed in this environment. Please load GNU getopt."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTIONS=vt:s:m:x:f:
|
||||
LONGOPTIONS=verbose,tries:,sleep:,min:,max:,fail:
|
||||
|
||||
PARSED=$($GETOPT_BIN --options="$OPTIONS" --longoptions="$LONGOPTIONS" --name "$0" -- "$@")
|
||||
if [[ $? -ne 0 ]]; then
|
||||
# e.g. $? == 1
|
||||
# then getopt has complained about wrong arguments to stdout
|
||||
exit 2
|
||||
fi
|
||||
# read getopt’s output this way to handle the quoting right:
|
||||
eval set -- "$PARSED"
|
||||
|
||||
max_tries=10
|
||||
min_sleep=0.3
|
||||
max_sleep=60.0
|
||||
constant_sleep=
|
||||
fail_script=
|
||||
|
||||
# now enjoy the options in order and nicely split until we see --
|
||||
while true; do
|
||||
case "$1" in
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
-t|--tries)
|
||||
max_tries="$2"
|
||||
shift 2
|
||||
;;
|
||||
-s|--sleep)
|
||||
constant_sleep="$2"
|
||||
shift 2
|
||||
;;
|
||||
-m|--min)
|
||||
min_sleep="$2"
|
||||
shift 2
|
||||
;;
|
||||
-x|--max)
|
||||
max_sleep="$2"
|
||||
shift 2
|
||||
;;
|
||||
-f|--fail)
|
||||
fail_script="$2"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Programming error"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
retry "$max_tries" "$min_sleep" "$max_sleep" "$constant_sleep" "$fail_script" "$@"
|
||||
|
||||
fi
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
set -ex
|
||||
|
||||
# The source root dir, usually from git, usually read-only.
|
||||
# The ci system copies this folder.
|
||||
BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
|
||||
export BASE_READ_ONLY_DIR
|
||||
# The destination root dir inside the container.
|
||||
# This folder will also hold any SDKs.
|
||||
# This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR
|
||||
export BASE_ROOT_DIR="${BASE_ROOT_DIR:-/ci_container_base}"
|
||||
# The depends dir.
|
||||
# This folder exists only on the ci guest, and on the ci host as a volume.
|
||||
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
|
||||
# A folder for the ci system to put temporary files (build result, datadirs for tests, ...)
|
||||
# This folder only exists on the ci guest.
|
||||
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
|
||||
# A folder for the ci system to put executables.
|
||||
# This folder only exists on the ci guest.
|
||||
export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/"
|
||||
|
||||
echo "Setting specific values in env"
|
||||
if [ -n "${FILE_ENV}" ]; then
|
||||
set -o errexit;
|
||||
# shellcheck disable=SC1090
|
||||
source "${FILE_ENV}"
|
||||
fi
|
||||
|
||||
echo "Fallback to default values in env (if not yet set)"
|
||||
# The number of parallel jobs to pass down to make and test_runner.py
|
||||
export MAKEJOBS=${MAKEJOBS:--j$(if command -v nproc > /dev/null 2>&1; then nproc; else sysctl -n hw.logicalcpu; fi)}
|
||||
# Whether to prefer BusyBox over GNU utilities
|
||||
export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
|
||||
|
||||
export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
|
||||
export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
|
||||
export RUN_TIDY=${RUN_TIDY:-false}
|
||||
# By how much to scale the test_runner timeouts (option --timeout-factor).
|
||||
# This is needed because some ci machines have slow CPU or disk, so sanitizers
|
||||
# might be slow or a reindex might be waiting on disk IO.
|
||||
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40}
|
||||
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
|
||||
|
||||
# Randomize test order.
|
||||
# See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html
|
||||
export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1}
|
||||
# See man 7 debconf
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-500M}
|
||||
export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
|
||||
export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
|
||||
# The cache dir.
|
||||
# This folder exists only on the ci guest, and on the ci host as a volume.
|
||||
export CCACHE_DIR="${CCACHE_DIR:-$BASE_SCRATCH_DIR/ccache}"
|
||||
# Folder where the build result is put (bin and lib).
|
||||
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out}
|
||||
# The folder for previous release binaries.
|
||||
# This folder exists only on the ci guest, and on the ci host as a volume.
|
||||
export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/prev_releases}
|
||||
export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential pkgconf curl ca-certificates ccache python3 rsync git procps bison e2fsprogs cmake ninja-build}
|
||||
export GOAL=${GOAL:-install}
|
||||
export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
|
||||
export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"}
|
||||
|
||||
# The --platform argument used with `docker build` and `docker run`.
|
||||
export CI_IMAGE_PLATFORM=${CI_IMAGE_PLATFORM:-"linux"} # Force linux, but use native arch by default
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export HOST=arm-linux-gnueabihf
|
||||
export DPKG_ADD_ARCH="armhf"
|
||||
export PACKAGES="python3-zmq g++-arm-linux-gnueabihf busybox libc6:armhf libstdc++6:armhf libfontconfig1:armhf libxcb1:armhf"
|
||||
export CONTAINER_NAME=ci_arm_linux
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" # Check that https://packages.ubuntu.com/noble/g++-arm-linux-gnueabihf (version 13.x, similar to guix) can cross-compile
|
||||
export CI_IMAGE_PLATFORM="linux/arm64"
|
||||
export USE_BUSY_BOX=true
|
||||
export RUN_UNIT_TESTS=true
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
|
||||
# This could be removed once the ABI change warning does not show up by default
|
||||
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DCMAKE_CXX_FLAGS='-Wno-psabi -Wno-error=maybe-uninitialized'"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2020-present 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.UTF-8
|
||||
|
||||
export HOST=i686-pc-linux-gnu
|
||||
export CONTAINER_NAME=ci_i686_no_multiprocess
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CI_IMAGE_PLATFORM="linux/amd64"
|
||||
export PACKAGES="llvm clang g++-multilib"
|
||||
export DEP_OPTS="DEBUG=1 NO_IPC=1"
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
export TEST_RUNNER_EXTRA="--v2transport --usecli"
|
||||
export BITCOIN_CONFIG="\
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_COMPILER='clang;-m32' \
|
||||
-DCMAKE_CXX_COMPILER='clang++;-m32' \
|
||||
-DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' \
|
||||
"
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
|
||||
|
||||
export CONTAINER_NAME=ci_macos_cross
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export HOST=x86_64-apple-darwin
|
||||
export PACKAGES="clang lld llvm zip"
|
||||
export XCODE_VERSION=15.0
|
||||
export XCODE_BUILD_ID=15A240d
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export GOAL="deploy"
|
||||
export BITCOIN_CONFIG="-DBUILD_GUI=ON -DREDUCE_EXPORTS=ON"
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
# Homebrew's python@3.12 is marked as externally managed (PEP 668).
|
||||
# Therefore, `--break-system-packages` is needed.
|
||||
export CONTAINER_NAME="ci_mac_native" # macos does not use a container, but the env var is needed for logging
|
||||
export PIP_PACKAGES="--break-system-packages zmq"
|
||||
export GOAL="install deploy"
|
||||
export CMAKE_GENERATOR="Ninja"
|
||||
export BITCOIN_CONFIG="-DBUILD_GUI=ON -DWITH_ZMQ=ON -DREDUCE_EXPORTS=ON -DCMAKE_EXE_LINKER_FLAGS='-Wl,-stack_size -Wl,0x80000'"
|
||||
export CI_OS_NAME="macos"
|
||||
export NO_DEPENDS=1
|
||||
export OSX_SDK=""
|
||||
export BITCOIN_CMD="bitcoin -m" # Used in functional tests
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME="ci_mac_native_fuzz" # macos does not use a container, but the env var is needed for logging
|
||||
export CMAKE_GENERATOR="Ninja"
|
||||
export BITCOIN_CONFIG="-DBUILD_FOR_FUZZING=ON -DCMAKE_EXE_LINKER_FLAGS='-Wl,-stack_size -Wl,0x80000'"
|
||||
export CI_OS_NAME="macos"
|
||||
export NO_DEPENDS=1
|
||||
export OSX_SDK=""
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export RUN_FUZZ_TESTS=true
|
||||
export GOAL="all"
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
|
||||
# Only install BCC tracing packages in CI. Container has to match the host for BCC to work.
|
||||
if [[ "${INSTALL_BCC_TRACING_TOOLS}" == "true" ]]; then
|
||||
# Required for USDT functional tests to run
|
||||
BPFCC_PACKAGE="bpfcc-tools linux-headers-$(uname --kernel-release)"
|
||||
export CI_CONTAINER_CAP="--privileged -v /sys/kernel:/sys/kernel:rw"
|
||||
else
|
||||
BPFCC_PACKAGE=""
|
||||
export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764)
|
||||
fi
|
||||
|
||||
export CONTAINER_NAME=ci_native_asan
|
||||
export APT_LLVM_V="21"
|
||||
export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libevent-dev libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export NO_DEPENDS=1
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
export BITCOIN_CONFIG="\
|
||||
-DWITH_USDT=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON \
|
||||
-DSANITIZERS=address,float-divide-by-zero,integer,undefined \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_C_FLAGS='-ftrivial-auto-var-init=pattern' \
|
||||
-DCMAKE_CXX_FLAGS='-ftrivial-auto-var-init=pattern' \
|
||||
-DAPPEND_CXXFLAGS='-std=c++23' \
|
||||
-DAPPEND_CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \
|
||||
"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2020-present 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_native_centos
|
||||
export CI_IMAGE_NAME_TAG="quay.io/centos/centos:stream10"
|
||||
export CI_BASE_PACKAGES="gcc-c++ glibc-devel libstdc++-devel ccache make ninja-build git python3 python3-pip which patch xz procps-ng rsync coreutils bison e2fsprogs cmake dash"
|
||||
export PIP_PACKAGES="pyzmq pycapnp"
|
||||
export DEP_OPTS="DEBUG=1"
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="\
|
||||
-DWITH_ZMQ=ON \
|
||||
-DBUILD_GUI=ON \
|
||||
-DREDUCE_EXPORTS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
"
|
||||
export BITCOIN_CMD="bitcoin -m" # Used in functional tests
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CONTAINER_NAME=ci_native_fuzz
|
||||
export APT_LLVM_V="21"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libevent-dev libboost-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export RUN_FUZZ_TESTS=true
|
||||
export GOAL="all"
|
||||
export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764)
|
||||
export BITCOIN_CONFIG="\
|
||||
-DBUILD_FOR_FUZZING=ON \
|
||||
-DSANITIZERS=fuzzer,address,undefined,float-divide-by-zero,integer \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_C_FLAGS='-ftrivial-auto-var-init=pattern' \
|
||||
-DCMAKE_CXX_FLAGS='-ftrivial-auto-var-init=pattern' \
|
||||
"
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2020-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export APT_LLVM_V="21"
|
||||
LIBCXX_DIR="/cxx_build/"
|
||||
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
|
||||
# -lstdc++ to resolve link issues due to upstream packaging
|
||||
LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument -lstdc++"
|
||||
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
|
||||
|
||||
export CONTAINER_NAME="ci_native_fuzz_msan"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev"
|
||||
export DEP_OPTS="DEBUG=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
|
||||
export GOAL="all"
|
||||
# Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered.
|
||||
# _FORTIFY_SOURCE is not compatible with MSAN.
|
||||
export BITCOIN_CONFIG="\
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_FLAGS_DEBUG='' \
|
||||
-DCMAKE_CXX_FLAGS_DEBUG='' \
|
||||
-DBUILD_FOR_FUZZING=ON \
|
||||
-DSANITIZERS=fuzzer,memory \
|
||||
-DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE -U_FORTIFY_SOURCE' \
|
||||
"
|
||||
export USE_INSTRUMENTED_LIBCPP="MemoryWithOrigins"
|
||||
export RUN_UNIT_TESTS="false"
|
||||
export RUN_FUNCTIONAL_TESTS="false"
|
||||
export RUN_FUZZ_TESTS=true
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CONTAINER_NAME=ci_native_fuzz_valgrind
|
||||
export PACKAGES="libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export RUN_FUZZ_TESTS=true
|
||||
export FUZZ_TESTS_CONFIG="--valgrind"
|
||||
export GOAL="all"
|
||||
export BITCOIN_CONFIG="\
|
||||
-DBUILD_FOR_FUZZING=ON \
|
||||
-DCMAKE_CXX_FLAGS='-Wno-error=array-bounds' \
|
||||
"
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2020-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export APT_LLVM_V="21"
|
||||
LIBCXX_DIR="/cxx_build/"
|
||||
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
|
||||
LIBCXX_FLAGS="-nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
|
||||
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
|
||||
|
||||
export CONTAINER_NAME="ci_native_msan"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export DEP_OPTS="DEBUG=1 NO_QT=1 CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
# Setting CMAKE_{C,CXX}_FLAGS_DEBUG flags to an empty string ensures that the flags set in MSAN_FLAGS remain unaltered.
|
||||
# _FORTIFY_SOURCE is not compatible with MSAN.
|
||||
export BITCOIN_CONFIG="\
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_FLAGS_DEBUG='' \
|
||||
-DCMAKE_CXX_FLAGS_DEBUG='' \
|
||||
-DSANITIZERS=memory \
|
||||
-DAPPEND_CPPFLAGS='-U_FORTIFY_SOURCE' \
|
||||
"
|
||||
export USE_INSTRUMENTED_LIBCPP="MemoryWithOrigins"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/debian:bookworm"
|
||||
# Use minimum supported python3.10 (or best-effort 3.11) and clang-16, see doc/dependencies.md
|
||||
export PACKAGES="python3-zmq python3-pip clang-16 llvm-16 libc++abi-16-dev libc++-16-dev"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export DEP_OPTS="NO_WALLET=1 CC=clang-16 CXX='clang++-16 -stdlib=libc++'"
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_UTIL_CHAINSTATE=ON -DBUILD_KERNEL_LIB=ON -DBUILD_SHARED_LIBS=ON"
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_native_previous_releases
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:22.04"
|
||||
# Use minimum supported python3.10 and gcc-11, see doc/dependencies.md
|
||||
export PACKAGES="gcc-11 g++-11 python3-zmq"
|
||||
export DEP_OPTS="CC=gcc-11 CXX=g++-11"
|
||||
export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
export DOWNLOAD_PREVIOUS_RELEASES="true"
|
||||
export BITCOIN_CONFIG="\
|
||||
-DWITH_ZMQ=ON -DBUILD_GUI=ON -DREDUCE_EXPORTS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_FLAGS='-funsigned-char' \
|
||||
-DCMAKE_C_FLAGS_DEBUG='-g2 -O2' \
|
||||
-DCMAKE_CXX_FLAGS='-funsigned-char' \
|
||||
-DCMAKE_CXX_FLAGS_DEBUG='-g2 -O2' \
|
||||
-DAPPEND_CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' \
|
||||
"
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2023-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CONTAINER_NAME=ci_native_tidy
|
||||
export TIDY_LLVM_V="20"
|
||||
export APT_LLVM_V="${TIDY_LLVM_V}"
|
||||
export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto"
|
||||
export NO_DEPENDS=1
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export RUN_FUZZ_TESTS=false
|
||||
export RUN_CHECK_DEPS=true
|
||||
export RUN_TIDY=true
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="\
|
||||
-DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DWITH_USDT=ON \
|
||||
-DCMAKE_C_COMPILER=clang-${TIDY_LLVM_V} \
|
||||
-DCMAKE_CXX_COMPILER=clang++-${TIDY_LLVM_V} \
|
||||
-DCMAKE_C_FLAGS_RELWITHDEBINFO='-O0 -g0' \
|
||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO='-O0 -g0' \
|
||||
"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_native_tsan
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export APT_LLVM_V="21"
|
||||
LIBCXX_DIR="/cxx_build/"
|
||||
LIBCXX_FLAGS="-fsanitize=thread -nostdinc++ -nostdlib++ -isystem ${LIBCXX_DIR}include/c++/v1 -L${LIBCXX_DIR}lib -Wl,-rpath,${LIBCXX_DIR}lib -lc++ -lc++abi -lpthread -Wno-unused-command-line-argument"
|
||||
export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} llvm-${APT_LLVM_V}-dev libclang-${APT_LLVM_V}-dev libclang-rt-${APT_LLVM_V}-dev python3-zmq python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export DEP_OPTS="CC=clang CXX=clang++ CXXFLAGS='${LIBCXX_FLAGS}' NO_QT=1"
|
||||
export GOAL="install"
|
||||
export CI_LIMIT_STACK_SIZE=1
|
||||
export BITCOIN_CONFIG="-DWITH_ZMQ=ON -DSANITIZERS=thread \
|
||||
-DAPPEND_CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKCONTENTION -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES'"
|
||||
export USE_INSTRUMENTED_LIBCPP="Thread"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CONTAINER_NAME=ci_native_valgrind
|
||||
export PACKAGES="valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip"
|
||||
export PIP_PACKAGES="--break-system-packages pycapnp"
|
||||
export USE_VALGRIND=1
|
||||
export NO_DEPENDS=1
|
||||
# bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
|
||||
export TEST_RUNNER_EXTRA="--exclude rpc_bind,feature_bind_extra"
|
||||
export GOAL="install"
|
||||
# TODO enable GUI
|
||||
export BITCOIN_CONFIG="\
|
||||
-DWITH_ZMQ=ON -DBUILD_GUI=OFF \
|
||||
"
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export HOST=s390x-linux-gnu
|
||||
export PACKAGES="python3-zmq"
|
||||
export CONTAINER_NAME=ci_s390x
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
|
||||
export CI_IMAGE_PLATFORM="linux/s390x"
|
||||
export TEST_RUNNER_EXTRA="--exclude rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
|
||||
export RUN_FUNCTIONAL_TESTS=true
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON"
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_win64
|
||||
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04" # Check that https://packages.ubuntu.com/noble/g++-mingw-w64-x86-64-posix (version 13.x, similar to guix) can cross-compile
|
||||
export CI_IMAGE_PLATFORM="linux/amd64"
|
||||
export HOST=x86_64-w64-mingw32
|
||||
export PACKAGES="g++-mingw-w64-x86-64-posix nsis"
|
||||
export RUN_UNIT_TESTS=false
|
||||
export RUN_FUNCTIONAL_TESTS=false
|
||||
export GOAL="deploy"
|
||||
export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_GUI_TESTS=OFF \
|
||||
-DCMAKE_CXX_FLAGS='-Wno-error=maybe-uninitialized'"
|
||||
@@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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.UTF-8
|
||||
|
||||
set -o errexit -o pipefail -o xtrace
|
||||
|
||||
CFG_DONE="${BASE_ROOT_DIR}/ci.base-install-done" # Use a global setting to remember whether this script ran to avoid running it twice
|
||||
|
||||
if [ "$( cat "${CFG_DONE}" || true )" == "done" ]; then
|
||||
echo "Skip base install"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MAKEJOBS="-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds.
|
||||
|
||||
if [ -n "$DPKG_ADD_ARCH" ]; then
|
||||
dpkg --add-architecture "$DPKG_ADD_ARCH"
|
||||
fi
|
||||
|
||||
if [ -n "${APT_LLVM_V}" ]; then
|
||||
${CI_RETRY_EXE} apt-get update
|
||||
${CI_RETRY_EXE} apt-get install curl -y
|
||||
curl "https://apt.llvm.org/llvm-snapshot.gpg.key" | tee "/etc/apt/trusted.gpg.d/apt.llvm.org.asc"
|
||||
(
|
||||
# shellcheck disable=SC2034
|
||||
source /etc/os-release
|
||||
echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-${APT_LLVM_V} main" > "/etc/apt/sources.list.d/llvm-toolchain-${VERSION_CODENAME}-${APT_LLVM_V}.list"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then
|
||||
bash -c "dnf -y install epel-release"
|
||||
# The ninja-build package is available in the CRB repository.
|
||||
bash -c "dnf -y --allowerasing --enablerepo crb install $CI_BASE_PACKAGES $PACKAGES"
|
||||
elif [ "$CI_OS_NAME" != "macos" ]; then
|
||||
if [[ -n "${APPEND_APT_SOURCES_LIST}" ]]; then
|
||||
echo "${APPEND_APT_SOURCES_LIST}" >> /etc/apt/sources.list
|
||||
fi
|
||||
${CI_RETRY_EXE} apt-get update
|
||||
${CI_RETRY_EXE} bash -c "apt-get install --no-install-recommends --no-upgrade -y $PACKAGES $CI_BASE_PACKAGES"
|
||||
fi
|
||||
|
||||
if [ -n "${APT_LLVM_V}" ]; then
|
||||
update-alternatives --install /usr/bin/clang++ clang++ "/usr/bin/clang++-${APT_LLVM_V}" 100
|
||||
update-alternatives --install /usr/bin/clang clang "/usr/bin/clang-${APT_LLVM_V}" 100
|
||||
update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "/usr/bin/llvm-symbolizer-${APT_LLVM_V}" 100
|
||||
fi
|
||||
|
||||
if [ -n "$PIP_PACKAGES" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
${CI_RETRY_EXE} pip3 install --user $PIP_PACKAGES
|
||||
fi
|
||||
|
||||
if [[ -n "${USE_INSTRUMENTED_LIBCPP}" ]]; then
|
||||
${CI_RETRY_EXE} git clone --depth=1 https://github.com/llvm/llvm-project -b "llvmorg-21.1.1" /llvm-project
|
||||
|
||||
cmake -G Ninja -B /cxx_build/ \
|
||||
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_USE_SANITIZER="${USE_INSTRUMENTED_LIBCPP}" \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DLLVM_TARGETS_TO_BUILD=Native \
|
||||
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
|
||||
-DLIBCXX_ABI_DEFINES="_LIBCPP_ABI_BOUNDED_ITERATORS;_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STD_ARRAY;_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING;_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR;_LIBCPP_ABI_BOUNDED_UNIQUE_PTR" \
|
||||
-DLIBCXX_HARDENING_MODE=debug \
|
||||
-S /llvm-project/runtimes
|
||||
|
||||
ninja -C /cxx_build/ "$MAKEJOBS"
|
||||
|
||||
# Clear no longer needed source folder
|
||||
du -sh /llvm-project
|
||||
rm -rf /llvm-project
|
||||
fi
|
||||
|
||||
if [[ "${RUN_TIDY}" == "true" ]]; then
|
||||
${CI_RETRY_EXE} git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_"${TIDY_LLVM_V}" /include-what-you-use
|
||||
cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-"${TIDY_LLVM_V}" -S /include-what-you-use
|
||||
make -C /iwyu-build/ install "$MAKEJOBS"
|
||||
fi
|
||||
|
||||
mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
|
||||
|
||||
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers"
|
||||
|
||||
if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ]; then
|
||||
OSX_SDK_FILENAME="${OSX_SDK_BASENAME}.tar.gz"
|
||||
OSX_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${OSX_SDK_FILENAME}"
|
||||
if [ ! -f "$OSX_SDK_PATH" ]; then
|
||||
${CI_RETRY_EXE} curl --location --fail "${SDK_URL}/${OSX_SDK_FILENAME}" -o "$OSX_SDK_PATH"
|
||||
fi
|
||||
tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH"
|
||||
fi
|
||||
|
||||
echo -n "done" > "${CFG_DONE}"
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def run(cmd, **kwargs):
|
||||
print("+ " + shlex.join(cmd), flush=True)
|
||||
try:
|
||||
return subprocess.run(cmd, check=True, **kwargs)
|
||||
except Exception as e:
|
||||
sys.exit(e)
|
||||
|
||||
|
||||
def main():
|
||||
print("Export only allowed settings:")
|
||||
settings = run(
|
||||
["bash", "-c", "grep export ./ci/test/00_setup_env*.sh"],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
encoding="utf8",
|
||||
).stdout.splitlines()
|
||||
settings = set(l.split("=")[0].split("export ")[1] for l in settings)
|
||||
# Add "hidden" settings, which are never exported, manually. Otherwise,
|
||||
# they will not be passed on.
|
||||
settings.update([
|
||||
"BASE_BUILD_DIR",
|
||||
"CI_FAILFAST_TEST_LEAVE_DANGLING",
|
||||
])
|
||||
|
||||
# Append $USER to /tmp/env to support multi-user systems and $CONTAINER_NAME
|
||||
# to allow support starting multiple runs simultaneously by the same user.
|
||||
env_file = "/tmp/env-{u}-{c}".format(
|
||||
u=os.getenv("USER"),
|
||||
c=os.getenv("CONTAINER_NAME"),
|
||||
)
|
||||
with open(env_file, "w", encoding="utf8") as file:
|
||||
for k, v in os.environ.items():
|
||||
if k in settings:
|
||||
file.write(f"{k}={v}\n")
|
||||
run(["cat", env_file])
|
||||
|
||||
run(["./ci/test/02_run_container.sh"]) # run the remainder
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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.UTF-8
|
||||
export CI_IMAGE_LABEL="bitcoin-ci-test"
|
||||
|
||||
set -o errexit -o pipefail -o xtrace
|
||||
|
||||
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
|
||||
# Env vars during the build can not be changed. For example, a modified
|
||||
# $MAKEJOBS is ignored in the build process. Use --cpuset-cpus as an
|
||||
# approximation to respect $MAKEJOBS somewhat, if cpuset is available.
|
||||
MAYBE_CPUSET=""
|
||||
if [ "$HAVE_CGROUP_CPUSET" ]; then
|
||||
MAYBE_CPUSET="--cpuset-cpus=$( python3 -c "import random;P=$( nproc );M=min(P,int('$MAKEJOBS'.lstrip('-j')));print(','.join(map(str,sorted(random.sample(range(P),M)))))" )"
|
||||
fi
|
||||
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
|
||||
|
||||
# Use buildx unconditionally
|
||||
# Using buildx is required to properly load the correct driver, for use with registry caching. Neither build, nor BUILDKIT=1 currently do this properly
|
||||
# shellcheck disable=SC2086
|
||||
docker buildx build \
|
||||
--file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
|
||||
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
|
||||
--build-arg "FILE_ENV=${FILE_ENV}" \
|
||||
--build-arg "BASE_ROOT_DIR=${BASE_ROOT_DIR}" \
|
||||
$MAYBE_CPUSET \
|
||||
--platform="${CI_IMAGE_PLATFORM}" \
|
||||
--label="${CI_IMAGE_LABEL}" \
|
||||
--tag="${CONTAINER_NAME}" \
|
||||
$DOCKER_BUILD_CACHE_ARG \
|
||||
"${BASE_READ_ONLY_DIR}"
|
||||
|
||||
docker volume create "${CONTAINER_NAME}_ccache" || true
|
||||
docker volume create "${CONTAINER_NAME}_depends" || true
|
||||
docker volume create "${CONTAINER_NAME}_depends_sources" || true
|
||||
docker volume create "${CONTAINER_NAME}_previous_releases" || true
|
||||
|
||||
CI_CCACHE_MOUNT="type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR"
|
||||
CI_DEPENDS_MOUNT="type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR/built"
|
||||
CI_DEPENDS_SOURCES_MOUNT="type=volume,src=${CONTAINER_NAME}_depends_sources,dst=$DEPENDS_DIR/sources"
|
||||
CI_PREVIOUS_RELEASES_MOUNT="type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR"
|
||||
CI_BUILD_MOUNT=""
|
||||
|
||||
if [ "$DANGER_CI_ON_HOST_FOLDERS" ]; then
|
||||
# ensure the directories exist
|
||||
mkdir -p "${CCACHE_DIR}"
|
||||
mkdir -p "${DEPENDS_DIR}/built"
|
||||
mkdir -p "${DEPENDS_DIR}/sources"
|
||||
mkdir -p "${PREVIOUS_RELEASES_DIR}"
|
||||
mkdir -p "${BASE_BUILD_DIR}" # Unset by default, must be defined externally
|
||||
|
||||
CI_CCACHE_MOUNT="type=bind,src=${CCACHE_DIR},dst=$CCACHE_DIR"
|
||||
CI_DEPENDS_MOUNT="type=bind,src=${DEPENDS_DIR}/built,dst=$DEPENDS_DIR/built"
|
||||
CI_DEPENDS_SOURCES_MOUNT="type=bind,src=${DEPENDS_DIR}/sources,dst=$DEPENDS_DIR/sources"
|
||||
CI_PREVIOUS_RELEASES_MOUNT="type=bind,src=${PREVIOUS_RELEASES_DIR},dst=$PREVIOUS_RELEASES_DIR"
|
||||
CI_BUILD_MOUNT="--mount type=bind,src=${BASE_BUILD_DIR},dst=${BASE_BUILD_DIR}"
|
||||
fi
|
||||
|
||||
if [ "$DANGER_CI_ON_HOST_CCACHE_FOLDER" ]; then
|
||||
if [ ! -d "${CCACHE_DIR}" ]; then
|
||||
echo "Error: Directory '${CCACHE_DIR}' must be created in advance."
|
||||
exit 1
|
||||
fi
|
||||
CI_CCACHE_MOUNT="type=bind,src=${CCACHE_DIR},dst=${CCACHE_DIR}"
|
||||
fi
|
||||
|
||||
docker network create --ipv6 --subnet 1111:1111::/112 ci-ip6net || true
|
||||
|
||||
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
|
||||
echo "Restart docker before run to stop and clear all containers started with --rm"
|
||||
podman container rm --force --all # Similar to "systemctl restart docker"
|
||||
|
||||
# Still prune everything in case the filtered pruning doesn't work, or if labels were not set
|
||||
# on a previous run. Belt and suspenders approach, should be fine to remove in the future.
|
||||
# Prune images used by --external containers (e.g. build containers) when
|
||||
# using podman.
|
||||
echo "Prune all dangling images"
|
||||
podman image prune --force --external
|
||||
fi
|
||||
echo "Prune all dangling $CI_IMAGE_LABEL images"
|
||||
# When detecting podman-docker, `--external` should be added.
|
||||
docker image prune --force --filter "label=$CI_IMAGE_LABEL"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
CI_CONTAINER_ID=$(docker run --cap-add LINUX_IMMUTABLE $CI_CONTAINER_CAP --rm --interactive --detach --tty \
|
||||
--mount "type=bind,src=$BASE_READ_ONLY_DIR,dst=$BASE_READ_ONLY_DIR,readonly" \
|
||||
--mount "${CI_CCACHE_MOUNT}" \
|
||||
--mount "${CI_DEPENDS_MOUNT}" \
|
||||
--mount "${CI_DEPENDS_SOURCES_MOUNT}" \
|
||||
--mount "${CI_PREVIOUS_RELEASES_MOUNT}" \
|
||||
${CI_BUILD_MOUNT} \
|
||||
--env-file /tmp/env-$USER-$CONTAINER_NAME \
|
||||
--name "$CONTAINER_NAME" \
|
||||
--network ci-ip6net \
|
||||
--platform="${CI_IMAGE_PLATFORM}" \
|
||||
"$CONTAINER_NAME")
|
||||
export CI_CONTAINER_ID
|
||||
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
|
||||
else
|
||||
echo "Running on host system without docker wrapper"
|
||||
echo "Create missing folders"
|
||||
mkdir -p "${CCACHE_DIR}"
|
||||
mkdir -p "${PREVIOUS_RELEASES_DIR}"
|
||||
fi
|
||||
|
||||
if [ "$CI_OS_NAME" == "macos" ]; then
|
||||
IN_GETOPT_BIN="$(brew --prefix gnu-getopt)/bin/getopt"
|
||||
export IN_GETOPT_BIN
|
||||
fi
|
||||
|
||||
CI_EXEC () {
|
||||
$CI_EXEC_CMD_PREFIX bash -c "export PATH=\"/path_with space:${BINS_SCRATCH_DIR}:${BASE_ROOT_DIR}/ci/retry:\$PATH\" && cd \"${BASE_ROOT_DIR}\" && $*"
|
||||
}
|
||||
export -f CI_EXEC
|
||||
|
||||
# Normalize all folders to BASE_ROOT_DIR
|
||||
CI_EXEC rsync --recursive --perms --stats --human-readable "${BASE_READ_ONLY_DIR}/" "${BASE_ROOT_DIR}" || echo "Nothing to copy from ${BASE_READ_ONLY_DIR}/"
|
||||
CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
|
||||
|
||||
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
|
||||
|
||||
CI_EXEC "${BASE_ROOT_DIR}/ci/test/03_test_script.sh"
|
||||
|
||||
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
|
||||
echo "Stop and remove CI container by ID"
|
||||
docker container kill "${CI_CONTAINER_ID}"
|
||||
fi
|
||||
@@ -1,233 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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.UTF-8
|
||||
|
||||
set -ex
|
||||
|
||||
export ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
|
||||
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
|
||||
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:second_deadlock_stack=1"
|
||||
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
|
||||
|
||||
echo "Number of available processing units: $(nproc)"
|
||||
if [ "$CI_OS_NAME" == "macos" ]; then
|
||||
top -l 1 -s 0 | awk ' /PhysMem/ {print}'
|
||||
else
|
||||
free -m -h
|
||||
echo "System info: $(uname --kernel-name --kernel-release)"
|
||||
lscpu
|
||||
fi
|
||||
echo "Free disk space:"
|
||||
df -h
|
||||
|
||||
# We force an install of linux-headers again here via $PACKAGES to fix any
|
||||
# kernel mismatch between a cached docker image and the underlying host.
|
||||
# This can happen occasionally on hosted runners if the runner image is updated.
|
||||
if [[ "$CONTAINER_NAME" == "ci_native_asan" ]]; then
|
||||
$CI_RETRY_EXE apt-get update
|
||||
${CI_RETRY_EXE} bash -c "apt-get install --no-install-recommends --no-upgrade -y $PACKAGES"
|
||||
fi
|
||||
|
||||
# What host to compile for. See also ./depends/README.md
|
||||
# Tests that need cross-compilation export the appropriate HOST.
|
||||
# Tests that run natively guess the host
|
||||
export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")}
|
||||
|
||||
echo "=== BEGIN env ==="
|
||||
env
|
||||
echo "=== END env ==="
|
||||
|
||||
(
|
||||
# compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
|
||||
# The statistic bytes_written is only used for logging, which is disabled in
|
||||
# CI, so as a temporary minimal fix to work around UB and CI failures, leave
|
||||
# bytes_written unmodified.
|
||||
# See https://github.com/bitcoin/bitcoin/pull/28359#issuecomment-1698694748
|
||||
# Tee patch to stdout to make it clear CI is testing modified code.
|
||||
tee >(patch -p1) <<'EOF'
|
||||
--- a/src/leveldb/db/db_impl.cc
|
||||
+++ b/src/leveldb/db/db_impl.cc
|
||||
@@ -1028,9 +1028,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
|
||||
stats.bytes_read += compact->compaction->input(which, i)->file_size;
|
||||
}
|
||||
}
|
||||
- for (size_t i = 0; i < compact->outputs.size(); i++) {
|
||||
- stats.bytes_written += compact->outputs[i].file_size;
|
||||
- }
|
||||
|
||||
mutex_.Lock();
|
||||
stats_[compact->compaction->level() + 1].Add(stats);
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
||||
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_corpora/
|
||||
if [ ! -d "$DIR_FUZZ_IN" ]; then
|
||||
${CI_RETRY_EXE} git clone --depth=1 https://github.com/bitcoin-core/qa-assets "${DIR_QA_ASSETS}"
|
||||
fi
|
||||
(
|
||||
cd "${DIR_QA_ASSETS}"
|
||||
echo "Using qa-assets repo from commit ..."
|
||||
git log -1
|
||||
)
|
||||
elif [ "$RUN_UNIT_TESTS" = "true" ]; then
|
||||
export DIR_UNIT_TEST_DATA=${DIR_QA_ASSETS}/unit_test_data/
|
||||
if [ ! -d "$DIR_UNIT_TEST_DATA" ]; then
|
||||
mkdir -p "$DIR_UNIT_TEST_DATA"
|
||||
${CI_RETRY_EXE} curl --location --fail https://github.com/bitcoin-core/qa-assets/raw/main/unit_test_data/script_assets_test.json -o "${DIR_UNIT_TEST_DATA}/script_assets_test.json"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$USE_BUSY_BOX" = "true" ]; then
|
||||
echo "Setup to use BusyBox utils"
|
||||
# tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version)
|
||||
# ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed)
|
||||
for util in $(busybox --list | grep -v "^ar$" | grep -v "^tar$" ); do ln -s "$(command -v busybox)" "${BINS_SCRATCH_DIR}/$util"; done
|
||||
# Print BusyBox version
|
||||
patch --help
|
||||
fi
|
||||
|
||||
# Make sure default datadir does not exist and is never read by creating a dummy file
|
||||
if [ "$CI_OS_NAME" == "macos" ]; then
|
||||
echo > "${HOME}/Library/Application Support/Bitcoin"
|
||||
else
|
||||
echo > "${HOME}/.bitcoin"
|
||||
fi
|
||||
|
||||
if [ -z "$NO_DEPENDS" ]; then
|
||||
if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then
|
||||
SHELL_OPTS="CONFIG_SHELL=/bin/dash"
|
||||
else
|
||||
SHELL_OPTS="CONFIG_SHELL="
|
||||
fi
|
||||
bash -c "$SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS LOG=1"
|
||||
fi
|
||||
if [ "$DOWNLOAD_PREVIOUS_RELEASES" = "true" ]; then
|
||||
test/get_previous_releases.py --target-dir "$PREVIOUS_RELEASES_DIR"
|
||||
fi
|
||||
|
||||
BITCOIN_CONFIG_ALL="-DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON"
|
||||
if [ -z "$NO_DEPENDS" ]; then
|
||||
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DCMAKE_TOOLCHAIN_FILE=$DEPENDS_DIR/$HOST/toolchain.cmake"
|
||||
fi
|
||||
if [ -z "$NO_WERROR" ]; then
|
||||
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} -DWERROR=ON"
|
||||
fi
|
||||
|
||||
ccache --zero-stats
|
||||
PRINT_CCACHE_STATISTICS="ccache --version | head -n 1 && ccache --show-stats"
|
||||
|
||||
# Folder where the build is done.
|
||||
BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST}
|
||||
|
||||
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR -Werror=dev"
|
||||
|
||||
if [[ "${RUN_TIDY}" == "true" ]]; then
|
||||
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
fi
|
||||
|
||||
bash -c "cmake -S $BASE_ROOT_DIR -B ${BASE_BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || (
|
||||
cd "${BASE_BUILD_DIR}"
|
||||
# shellcheck disable=SC2046
|
||||
cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake")
|
||||
false
|
||||
)
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target all $GOAL || (
|
||||
echo "Build failure. Verbose build follows."
|
||||
# shellcheck disable=SC2086
|
||||
cmake --build "${BASE_BUILD_DIR}" -j1 --target all $GOAL --verbose
|
||||
false
|
||||
)
|
||||
|
||||
bash -c "${PRINT_CCACHE_STATISTICS}"
|
||||
if [ "$CI" = "true" ]; then
|
||||
hit_rate=$(ccache -s | grep "Hits:" | head -1 | sed 's/.*(\(.*\)%).*/\1/')
|
||||
if [ "${hit_rate%.*}" -lt 75 ]; then
|
||||
echo "::notice title=low ccache hitrate::Ccache hit-rate in $CONTAINER_NAME was $hit_rate%"
|
||||
fi
|
||||
fi
|
||||
du -sh "${DEPENDS_DIR}"/*/
|
||||
du -sh "${PREVIOUS_RELEASES_DIR}"
|
||||
|
||||
if [ -n "${CI_LIMIT_STACK_SIZE}" ]; then
|
||||
ulimit -s 512
|
||||
fi
|
||||
|
||||
if [ -n "$USE_VALGRIND" ]; then
|
||||
"${BASE_ROOT_DIR}/ci/test/wrap-valgrind.sh"
|
||||
fi
|
||||
|
||||
if [ "$RUN_CHECK_DEPS" = "true" ]; then
|
||||
"${BASE_ROOT_DIR}/contrib/devtools/check-deps.sh" "${BASE_BUILD_DIR}"
|
||||
fi
|
||||
|
||||
if [ "$RUN_UNIT_TESTS" = "true" ]; then
|
||||
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" \
|
||||
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
|
||||
CTEST_OUTPUT_ON_FAILURE=ON \
|
||||
ctest --test-dir "${BASE_BUILD_DIR}" \
|
||||
--stop-on-failure \
|
||||
"${MAKEJOBS}" \
|
||||
--timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
|
||||
fi
|
||||
|
||||
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
|
||||
# parses TEST_RUNNER_EXTRA as an array which allows for multiple arguments such as TEST_RUNNER_EXTRA='--exclude "rpc_bind.py --ipv6"'
|
||||
eval "TEST_RUNNER_EXTRA=($TEST_RUNNER_EXTRA)"
|
||||
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
|
||||
"${BASE_BUILD_DIR}/test/functional/test_runner.py" \
|
||||
--ci "${MAKEJOBS}" \
|
||||
--tmpdirprefix "${BASE_SCRATCH_DIR}/test_runner/" \
|
||||
--ansi \
|
||||
--combinedlogslen=99999999 \
|
||||
--timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" \
|
||||
"${TEST_RUNNER_EXTRA[@]}" \
|
||||
--quiet \
|
||||
--failfast
|
||||
fi
|
||||
|
||||
if [ "${RUN_TIDY}" = "true" ]; then
|
||||
cmake -B /tidy-build -DLLVM_DIR=/usr/lib/llvm-"${TIDY_LLVM_V}"/cmake -DCMAKE_BUILD_TYPE=Release -S "${BASE_ROOT_DIR}"/contrib/devtools/bitcoin-tidy
|
||||
cmake --build /tidy-build "$MAKEJOBS"
|
||||
cmake --build /tidy-build --target bitcoin-tidy-tests "$MAKEJOBS"
|
||||
|
||||
set -eo pipefail
|
||||
# Filter out:
|
||||
# * qt qrc and moc generated files
|
||||
jq 'map(select(.file | test("src/qt/.*_autogen/.*\\.cpp$") | not))' "${BASE_BUILD_DIR}/compile_commands.json" > tmp.json
|
||||
mv tmp.json "${BASE_BUILD_DIR}/compile_commands.json"
|
||||
|
||||
cd "${BASE_BUILD_DIR}/src/"
|
||||
if ! ( run-clang-tidy-"${TIDY_LLVM_V}" -quiet -load="/tidy-build/libbitcoin-tidy.so" "${MAKEJOBS}" | tee tmp.tidy-out.txt ); then
|
||||
grep -C5 "error: " tmp.tidy-out.txt
|
||||
echo "^^^ ⚠️ Failure generated from clang-tidy"
|
||||
false
|
||||
fi
|
||||
|
||||
cd "${BASE_ROOT_DIR}"
|
||||
python3 "/include-what-you-use/iwyu_tool.py" \
|
||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||
-Xiwyu --max_line_length=160 \
|
||||
2>&1 | tee /tmp/iwyu_ci.out
|
||||
cd "${BASE_ROOT_DIR}/src"
|
||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
||||
git --no-pager diff
|
||||
fi
|
||||
|
||||
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
|
||||
"${BASE_BUILD_DIR}/test/fuzz/test_runner.py" \
|
||||
${FUZZ_TESTS_CONFIG} \
|
||||
"${MAKEJOBS}" \
|
||||
-l DEBUG \
|
||||
"${DIR_FUZZ_IN}" \
|
||||
--empty_min_time=60
|
||||
fi
|
||||
@@ -1,11 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.26)
|
||||
set(log_files "CMakeFiles/CMakeConfigureLog.yaml")
|
||||
else()
|
||||
set(log_files "CMakeFiles/CMakeOutput.log CMakeFiles/CMakeError.log")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${log_files})
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018-present 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.UTF-8
|
||||
|
||||
for b_name in "${BASE_OUTDIR}/bin"/*; do
|
||||
# shellcheck disable=SC2044
|
||||
for b in $(find "${BASE_ROOT_DIR}" -executable -type f -name "$(basename "$b_name")"); do
|
||||
echo "Wrap $b ..."
|
||||
mv "$b" "${b}_orig"
|
||||
echo '#!/usr/bin/env bash' > "$b"
|
||||
echo "exec valgrind --gen-suppressions=all --quiet --error-exitcode=1 --suppressions=${BASE_ROOT_DIR}/contrib/valgrind.supp \"${b}_orig\" \"\$@\"" >> "$b"
|
||||
chmod +x "$b"
|
||||
done
|
||||
done
|
||||
@@ -1,20 +0,0 @@
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# See ci/README.md for usage.
|
||||
|
||||
# We never want scratch, but default arg silences a Warning
|
||||
ARG CI_IMAGE_NAME_TAG=scratch
|
||||
FROM ${CI_IMAGE_NAME_TAG}
|
||||
|
||||
ARG FILE_ENV
|
||||
ENV FILE_ENV=${FILE_ENV}
|
||||
|
||||
ARG BASE_ROOT_DIR
|
||||
ENV BASE_ROOT_DIR=${BASE_ROOT_DIR}
|
||||
|
||||
COPY ./ci/retry/retry /usr/bin/retry
|
||||
COPY ./ci/test/00_setup_env.sh ./${FILE_ENV} ./ci/test/01_base_install.sh /ci_container_base/ci/test/
|
||||
|
||||
RUN ["bash", "-c", "cd /ci_container_base/ && set -o errexit && source ./ci/test/00_setup_env.sh && ./ci/test/01_base_install.sh"]
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019-present 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.UTF-8
|
||||
|
||||
set -o errexit; source ./ci/test/00_setup_env.sh
|
||||
set -o errexit
|
||||
"./ci/test/02_run_container.py"
|
||||
@@ -1,115 +0,0 @@
|
||||
// Copyright (c) 2023-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#ifndef BITCOIN_CONFIG_H
|
||||
#define BITCOIN_CONFIG_H
|
||||
|
||||
/* Version Build */
|
||||
#define CLIENT_VERSION_BUILD @CLIENT_VERSION_BUILD@
|
||||
|
||||
/* Version is release */
|
||||
#define CLIENT_VERSION_IS_RELEASE @CLIENT_VERSION_IS_RELEASE@
|
||||
|
||||
/* Major version */
|
||||
#define CLIENT_VERSION_MAJOR @CLIENT_VERSION_MAJOR@
|
||||
|
||||
/* Minor version */
|
||||
#define CLIENT_VERSION_MINOR @CLIENT_VERSION_MINOR@
|
||||
|
||||
/* Copyright holder(s) before %s replacement */
|
||||
#define COPYRIGHT_HOLDERS "@COPYRIGHT_HOLDERS@"
|
||||
|
||||
/* Copyright holder(s) */
|
||||
#define COPYRIGHT_HOLDERS_FINAL "@COPYRIGHT_HOLDERS_FINAL@"
|
||||
|
||||
/* Replacement for %s in copyright holders string */
|
||||
#define COPYRIGHT_HOLDERS_SUBSTITUTION "@CLIENT_NAME@"
|
||||
|
||||
/* Copyright year */
|
||||
#define COPYRIGHT_YEAR @COPYRIGHT_YEAR@
|
||||
|
||||
/* Define if external signer support is enabled */
|
||||
#cmakedefine ENABLE_EXTERNAL_SIGNER 1
|
||||
|
||||
/* Define to 1 to enable tracepoints for Userspace, Statically Defined Tracing
|
||||
*/
|
||||
#cmakedefine ENABLE_TRACING 1
|
||||
|
||||
/* Define to 1 to enable wallet functions. */
|
||||
#cmakedefine ENABLE_WALLET 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `fork', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_FORK
|
||||
|
||||
/* Define to 1 if '*ifaddrs' are available. */
|
||||
#cmakedefine HAVE_IFADDRS 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `pipe2', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_PIPE2
|
||||
|
||||
/* Define to 1 if you have the declaration of `setsid', and to 0 if you don't.
|
||||
*/
|
||||
#cmakedefine01 HAVE_DECL_SETSID
|
||||
|
||||
/* Define to 1 if fdatasync is available. */
|
||||
#cmakedefine HAVE_FDATASYNC 1
|
||||
|
||||
/* Define this symbol if the BSD getentropy system call is available with
|
||||
sys/random.h */
|
||||
#cmakedefine HAVE_GETENTROPY_RAND 1
|
||||
|
||||
/* Define this symbol if the Linux getrandom function call is available */
|
||||
#cmakedefine HAVE_GETRANDOM 1
|
||||
|
||||
/* Define this symbol if you have malloc_info */
|
||||
#cmakedefine HAVE_MALLOC_INFO 1
|
||||
|
||||
/* Define this symbol if you have mallopt with M_ARENA_MAX */
|
||||
#cmakedefine HAVE_MALLOPT_ARENA_MAX 1
|
||||
|
||||
/* Define to 1 if O_CLOEXEC flag is available. */
|
||||
#cmakedefine01 HAVE_O_CLOEXEC
|
||||
|
||||
/* Define this symbol if you have posix_fallocate */
|
||||
#cmakedefine HAVE_POSIX_FALLOCATE 1
|
||||
|
||||
/* Define this symbol if platform supports unix domain sockets */
|
||||
#cmakedefine HAVE_SOCKADDR_UN 1
|
||||
|
||||
/* Define this symbol to build code that uses getauxval */
|
||||
#cmakedefine HAVE_STRONG_GETAUXVAL 1
|
||||
|
||||
/* Define this symbol if the BSD sysctl() is available */
|
||||
#cmakedefine HAVE_SYSCTL 1
|
||||
|
||||
/* Define this symbol if the BSD sysctl(KERN_ARND) is available */
|
||||
#cmakedefine HAVE_SYSCTL_ARND 1
|
||||
|
||||
/* Define to 1 if std::system or ::wsystem is available. */
|
||||
#cmakedefine HAVE_SYSTEM 1
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define CLIENT_BUGREPORT "@CLIENT_BUGREPORT@"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define CLIENT_NAME "@CLIENT_NAME@"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define CLIENT_URL "@PROJECT_HOMEPAGE_URL@"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define CLIENT_VERSION_STRING "@CLIENT_VERSION_STRING@"
|
||||
|
||||
/* Define to 1 if strerror_r returns char *. */
|
||||
#cmakedefine STRERROR_R_CHAR_P 1
|
||||
|
||||
/* Define if dbus support should be compiled in */
|
||||
#cmakedefine USE_DBUS 1
|
||||
|
||||
/* Define if QR support should be compiled in */
|
||||
#cmakedefine USE_QRCODE 1
|
||||
|
||||
#endif //BITCOIN_CONFIG_H
|
||||
@@ -1,30 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
if(NOT MSVC)
|
||||
find_program(CCACHE_EXECUTABLE ccache)
|
||||
if(CCACHE_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND readlink -f ${CMAKE_CXX_COMPILER}
|
||||
OUTPUT_VARIABLE compiler_resolved_link
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(CCACHE_EXECUTABLE STREQUAL compiler_resolved_link AND NOT WITH_CCACHE)
|
||||
list(APPEND configure_warnings
|
||||
"Disabling ccache was attempted using -DWITH_CCACHE=${WITH_CCACHE}, but ccache masquerades as the compiler."
|
||||
)
|
||||
set(WITH_CCACHE ON)
|
||||
elseif(WITH_CCACHE)
|
||||
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
|
||||
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
|
||||
endif()
|
||||
else()
|
||||
set(WITH_CCACHE OFF)
|
||||
endif()
|
||||
else()
|
||||
set(WITH_CCACHE OFF)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CCACHE_EXECUTABLE)
|
||||
@@ -1,115 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# This file is part of the transition from Autotools to CMake. Once CMake
|
||||
# support has been merged we should switch to using the upstream CMake
|
||||
# buildsystem.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckSourceCompilesWithFlags)
|
||||
|
||||
# Check for __builtin_prefetch support in the compiler.
|
||||
check_cxx_source_compiles("
|
||||
int main() {
|
||||
char data = 0;
|
||||
const char* address = &data;
|
||||
__builtin_prefetch(address, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_BUILTIN_PREFETCH
|
||||
)
|
||||
|
||||
# Check for _mm_prefetch support in the compiler.
|
||||
check_cxx_source_compiles("
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
char data = 0;
|
||||
const char* address = &data;
|
||||
_mm_prefetch(address, _MM_HINT_NTA);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_MM_PREFETCH
|
||||
)
|
||||
|
||||
# Check for SSE4.2 support in the compiler.
|
||||
if(MSVC)
|
||||
set(SSE42_CXXFLAGS /arch:AVX)
|
||||
else()
|
||||
set(SSE42_CXXFLAGS -msse4.2)
|
||||
endif()
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <cstdint>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#elif defined(__GNUC__) && defined(__SSE4_2__)
|
||||
#include <nmmintrin.h>
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
uint64_t l = 0;
|
||||
l = _mm_crc32_u8(l, 0);
|
||||
l = _mm_crc32_u32(l, 0);
|
||||
l = _mm_crc32_u64(l, 0);
|
||||
return l;
|
||||
}
|
||||
" HAVE_SSE42
|
||||
CXXFLAGS ${SSE42_CXXFLAGS}
|
||||
)
|
||||
|
||||
# Check for ARMv8 w/ CRC and CRYPTO extensions support in the compiler.
|
||||
set(ARM64_CRC_CXXFLAGS -march=armv8-a+crc+crypto)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <arm_acle.h>
|
||||
#include <arm_neon.h>
|
||||
|
||||
int main() {
|
||||
#ifdef __aarch64__
|
||||
__crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0);
|
||||
vmull_p64(0, 0);
|
||||
#else
|
||||
#error crc32c library does not support hardware acceleration on 32-bit ARM
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
" HAVE_ARM64_CRC32C
|
||||
CXXFLAGS ${ARM64_CRC_CXXFLAGS}
|
||||
)
|
||||
|
||||
add_library(crc32c STATIC EXCLUDE_FROM_ALL
|
||||
${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c.cc
|
||||
${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_portable.cc
|
||||
)
|
||||
target_compile_definitions(crc32c PRIVATE
|
||||
HAVE_BUILTIN_PREFETCH=$<BOOL:${HAVE_BUILTIN_PREFETCH}>
|
||||
HAVE_MM_PREFETCH=$<BOOL:${HAVE_MM_PREFETCH}>
|
||||
HAVE_STRONG_GETAUXVAL=$<BOOL:${HAVE_STRONG_GETAUXVAL}>
|
||||
BYTE_ORDER_BIG_ENDIAN=$<STREQUAL:${CMAKE_CXX_BYTE_ORDER},BIG_ENDIAN>
|
||||
HAVE_SSE42=$<BOOL:${HAVE_SSE42}>
|
||||
HAVE_ARM64_CRC32C=$<BOOL:${HAVE_ARM64_CRC32C}>
|
||||
)
|
||||
target_include_directories(crc32c
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/crc32c/include>
|
||||
)
|
||||
target_link_libraries(crc32c PRIVATE core_interface)
|
||||
set_target_properties(crc32c PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
|
||||
|
||||
if(HAVE_SSE42)
|
||||
set(_crc32_src ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_sse42.cc)
|
||||
target_sources(crc32c PRIVATE ${_crc32_src})
|
||||
set_property(SOURCE ${_crc32_src} PROPERTY COMPILE_OPTIONS ${SSE42_CXXFLAGS})
|
||||
endif()
|
||||
|
||||
if(HAVE_ARM64_CRC32C)
|
||||
set(_crc32_src ${PROJECT_SOURCE_DIR}/src/crc32c/src/crc32c_arm64.cc)
|
||||
target_sources(crc32c PRIVATE ${_crc32_src})
|
||||
set_property(SOURCE ${_crc32_src} PROPERTY COMPILE_OPTIONS ${ARM64_CRC_CXXFLAGS})
|
||||
endif()
|
||||
|
||||
unset(_crc32_src)
|
||||
@@ -1,213 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCXXSymbolExists)
|
||||
|
||||
check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
|
||||
check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
|
||||
check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK)
|
||||
check_cxx_symbol_exists(pipe2 "unistd.h" HAVE_DECL_PIPE2)
|
||||
check_cxx_symbol_exists(setsid "unistd.h" HAVE_DECL_SETSID)
|
||||
|
||||
if(NOT WIN32)
|
||||
include(TestAppendRequiredLibraries)
|
||||
test_append_socket_library(core_interface)
|
||||
endif()
|
||||
|
||||
include(TestAppendRequiredLibraries)
|
||||
test_append_atomic_library(core_interface)
|
||||
|
||||
# Even though ::system is part of the standard library, we still check
|
||||
# for it, to support building targets that don't have it, such as iOS.
|
||||
check_cxx_symbol_exists(std::system "cstdlib" HAVE_STD_SYSTEM)
|
||||
check_cxx_symbol_exists(::_wsystem "stdlib.h" HAVE__WSYSTEM)
|
||||
if(HAVE_STD_SYSTEM OR HAVE__WSYSTEM)
|
||||
set(HAVE_SYSTEM 1)
|
||||
endif()
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char buf[100];
|
||||
char* p{strerror_r(0, buf, sizeof buf)};
|
||||
(void)p;
|
||||
}
|
||||
" STRERROR_R_CHAR_P
|
||||
)
|
||||
|
||||
# Check for malloc_info (for memory statistics information in getmemoryinfo).
|
||||
check_cxx_symbol_exists(malloc_info "malloc.h" HAVE_MALLOC_INFO)
|
||||
|
||||
# Check for mallopt(M_ARENA_MAX) (to set glibc arenas).
|
||||
check_cxx_source_compiles("
|
||||
#include <malloc.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
mallopt(M_ARENA_MAX, 1);
|
||||
}
|
||||
" HAVE_MALLOPT_ARENA_MAX
|
||||
)
|
||||
|
||||
# Check for posix_fallocate().
|
||||
check_cxx_source_compiles("
|
||||
#include <fcntl.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
return posix_fallocate(0, 0, 0);
|
||||
}
|
||||
" HAVE_POSIX_FALLOCATE
|
||||
)
|
||||
|
||||
# Check for strong getauxval() support in the system headers.
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/auxv.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
getauxval(AT_HWCAP);
|
||||
}
|
||||
" HAVE_STRONG_GETAUXVAL
|
||||
)
|
||||
|
||||
# Check for UNIX sockets.
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
addr.sun_family = AF_UNIX;
|
||||
}
|
||||
" HAVE_SOCKADDR_UN
|
||||
)
|
||||
|
||||
# Check for different ways of gathering OS randomness:
|
||||
# - Linux getrandom()
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/random.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
getrandom(nullptr, 32, 0);
|
||||
}
|
||||
" HAVE_GETRANDOM
|
||||
)
|
||||
|
||||
# - BSD getentropy()
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/random.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
getentropy(nullptr, 32);
|
||||
}
|
||||
" HAVE_GETENTROPY_RAND
|
||||
)
|
||||
|
||||
|
||||
# - BSD sysctl()
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#error Don't use sysctl on Linux, it's deprecated even when it works
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
sysctl(nullptr, 2, nullptr, nullptr, nullptr, 0);
|
||||
}
|
||||
" HAVE_SYSCTL
|
||||
)
|
||||
|
||||
# - BSD sysctl(KERN_ARND)
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#error Don't use sysctl on Linux, it's deprecated even when it works
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
static int name[2] = {CTL_KERN, KERN_ARND};
|
||||
sysctl(name, 2, nullptr, nullptr, nullptr, 0);
|
||||
}
|
||||
" HAVE_SYSCTL_ARND
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
include(CheckSourceCompilesWithFlags)
|
||||
|
||||
# Check for SSE4.1 intrinsics.
|
||||
set(SSE41_CXXFLAGS -msse4.1)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <immintrin.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__m128i a = _mm_set1_epi32(0);
|
||||
__m128i b = _mm_set1_epi32(1);
|
||||
__m128i r = _mm_blend_epi16(a, b, 0xFF);
|
||||
return _mm_extract_epi32(r, 3);
|
||||
}
|
||||
" HAVE_SSE41
|
||||
CXXFLAGS ${SSE41_CXXFLAGS}
|
||||
)
|
||||
|
||||
# Check for AVX2 intrinsics.
|
||||
set(AVX2_CXXFLAGS -mavx -mavx2)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <immintrin.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__m256i l = _mm256_set1_epi32(0);
|
||||
return _mm256_extract_epi32(l, 7);
|
||||
}
|
||||
" HAVE_AVX2
|
||||
CXXFLAGS ${AVX2_CXXFLAGS}
|
||||
)
|
||||
|
||||
# Check for x86 SHA-NI intrinsics.
|
||||
set(X86_SHANI_CXXFLAGS -msse4 -msha)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <immintrin.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__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, j, k), 0);
|
||||
}
|
||||
" HAVE_X86_SHANI
|
||||
CXXFLAGS ${X86_SHANI_CXXFLAGS}
|
||||
)
|
||||
|
||||
# Check for ARMv8 SHA-NI intrinsics.
|
||||
set(ARM_SHANI_CXXFLAGS -march=armv8-a+crypto)
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <arm_neon.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
uint32x4_t a, b, c;
|
||||
vsha256h2q_u32(a, b, c);
|
||||
vsha256hq_u32(a, b, c);
|
||||
vsha256su0q_u32(a, b);
|
||||
vsha256su1q_u32(a, b, c);
|
||||
}
|
||||
" HAVE_ARM_SHANI
|
||||
CXXFLAGS ${ARM_SHANI_CXXFLAGS}
|
||||
)
|
||||
endif()
|
||||
@@ -1,103 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# This file is part of the transition from Autotools to CMake. Once CMake
|
||||
# support has been merged we should switch to using the upstream CMake
|
||||
# buildsystem.
|
||||
|
||||
include(CheckCXXSymbolExists)
|
||||
check_cxx_symbol_exists(F_FULLFSYNC "fcntl.h" HAVE_FULLFSYNC)
|
||||
|
||||
add_library(leveldb STATIC EXCLUDE_FROM_ALL
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/builder.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/c.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/db_impl.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/db_iter.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/dbformat.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/dumpfile.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/filename.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/log_reader.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/log_writer.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/memtable.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/repair.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/table_cache.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/version_edit.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/version_set.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/db/write_batch.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/block.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/block_builder.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/filter_block.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/format.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/iterator.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/merger.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/table.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/table_builder.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/table/two_level_iterator.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/arena.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/bloom.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/cache.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/coding.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/comparator.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/crc32c.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/env.cc
|
||||
$<$<NOT:$<BOOL:${WIN32}>>:${PROJECT_SOURCE_DIR}/src/leveldb/util/env_posix.cc>
|
||||
$<$<BOOL:${WIN32}>:${PROJECT_SOURCE_DIR}/src/leveldb/util/env_windows.cc>
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/filter_policy.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/hash.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/histogram.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/logging.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/options.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/util/status.cc
|
||||
${PROJECT_SOURCE_DIR}/src/leveldb/helpers/memenv/memenv.cc
|
||||
)
|
||||
|
||||
target_compile_definitions(leveldb
|
||||
PRIVATE
|
||||
HAVE_SNAPPY=0
|
||||
HAVE_CRC32C=1
|
||||
HAVE_FDATASYNC=$<BOOL:${HAVE_FDATASYNC}>
|
||||
HAVE_FULLFSYNC=$<BOOL:${HAVE_FULLFSYNC}>
|
||||
HAVE_O_CLOEXEC=$<BOOL:${HAVE_O_CLOEXEC}>
|
||||
FALLTHROUGH_INTENDED=[[fallthrough]]
|
||||
$<$<NOT:$<BOOL:${WIN32}>>:LEVELDB_PLATFORM_POSIX>
|
||||
$<$<BOOL:${WIN32}>:LEVELDB_PLATFORM_WINDOWS>
|
||||
$<$<BOOL:${WIN32}>:_UNICODE;UNICODE>
|
||||
)
|
||||
if(MINGW)
|
||||
target_compile_definitions(leveldb
|
||||
PRIVATE
|
||||
__USE_MINGW_ANSI_STDIO=1
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(leveldb
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/leveldb>
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/leveldb/include>
|
||||
)
|
||||
|
||||
add_library(nowarn_leveldb_interface INTERFACE)
|
||||
if(MSVC)
|
||||
target_compile_options(nowarn_leveldb_interface INTERFACE
|
||||
/wd4722
|
||||
)
|
||||
target_compile_definitions(nowarn_leveldb_interface INTERFACE
|
||||
_CRT_NONSTDC_NO_WARNINGS
|
||||
)
|
||||
else()
|
||||
try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK
|
||||
IF_CHECK_PASSED "-Wno-conditional-uninitialized"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(leveldb PRIVATE
|
||||
core_interface
|
||||
nowarn_leveldb_interface
|
||||
crc32c
|
||||
)
|
||||
|
||||
set_target_properties(leveldb PROPERTIES
|
||||
EXPORT_COMPILE_COMMANDS OFF
|
||||
)
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2025 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
function(add_libmultiprocess subdir)
|
||||
# Set BUILD_TESTING to match BUILD_TESTS. BUILD_TESTING is a standard cmake
|
||||
# option that controls whether enable_testing() is called, but in the bitcoin
|
||||
# build a BUILD_TESTS option is used instead.
|
||||
set(BUILD_TESTING "${BUILD_TESTS}")
|
||||
add_subdirectory(${subdir} EXCLUDE_FROM_ALL)
|
||||
# Apply core_interface compile options to libmultiprocess runtime library.
|
||||
target_link_libraries(multiprocess PUBLIC $<BUILD_INTERFACE:core_interface>)
|
||||
target_link_libraries(mputil PUBLIC $<BUILD_INTERFACE:core_interface>)
|
||||
target_link_libraries(mpgen PUBLIC $<BUILD_INTERFACE:core_interface>)
|
||||
# Mark capproto options as advanced to hide by default from cmake UI
|
||||
mark_as_advanced(CapnProto_DIR)
|
||||
mark_as_advanced(CapnProto_capnpc_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_capnp_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_capnp-json_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_capnp-rpc_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_capnp-websocket_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj-async_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj-gzip_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj-http_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj-test_IMPORTED_LOCATION)
|
||||
mark_as_advanced(CapnProto_kj-tls_IMPORTED_LOCATION)
|
||||
if(BUILD_TESTS)
|
||||
# Add tests to "all" target so ctest can run them
|
||||
set_target_properties(mptests PROPERTIES EXCLUDE_FROM_ALL OFF)
|
||||
endif()
|
||||
# Exclude examples from compilation database, because the examples are not
|
||||
# built by default, and they contain generated c++ code. Without this
|
||||
# exclusion, tools like clang-tidy and IWYU that make use of compilation
|
||||
# database would complain that the generated c++ source files do not exist. An
|
||||
# alternate fix could build "mpexamples" by default like "mptests" above.
|
||||
set_target_properties(mpcalculator mpprinter mpexample PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
|
||||
endfunction()
|
||||
@@ -1,89 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include(CheckSourceCompilesWithFlags)
|
||||
|
||||
# Check for clmul instructions support.
|
||||
if(MSVC)
|
||||
set(CLMUL_CXXFLAGS "")
|
||||
else()
|
||||
set(CLMUL_CXXFLAGS -mpclmul)
|
||||
endif()
|
||||
check_cxx_source_compiles_with_flags("
|
||||
#include <immintrin.h>
|
||||
#include <cstdint>
|
||||
|
||||
int main()
|
||||
{
|
||||
__m128i a = _mm_cvtsi64_si128((uint64_t)7);
|
||||
__m128i b = _mm_clmulepi64_si128(a, a, 37);
|
||||
__m128i c = _mm_srli_epi64(b, 41);
|
||||
__m128i d = _mm_xor_si128(b, c);
|
||||
uint64_t e = _mm_cvtsi128_si64(d);
|
||||
return e == 0;
|
||||
}
|
||||
" HAVE_CLMUL
|
||||
CXXFLAGS ${CLMUL_CXXFLAGS}
|
||||
)
|
||||
|
||||
add_library(minisketch_common INTERFACE)
|
||||
if(MSVC)
|
||||
target_compile_options(minisketch_common INTERFACE
|
||||
/wd4060
|
||||
/wd4065
|
||||
/wd4146
|
||||
/wd4244
|
||||
/wd4267
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(minisketch STATIC EXCLUDE_FROM_ALL
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/minisketch.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_1byte.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_2bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_3bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_4bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_5bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_6bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_7bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/generic_8bytes.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(minisketch
|
||||
PRIVATE
|
||||
DISABLE_DEFAULT_FIELDS
|
||||
ENABLE_FIELD_32
|
||||
)
|
||||
|
||||
target_include_directories(minisketch
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/minisketch/include>
|
||||
)
|
||||
|
||||
target_link_libraries(minisketch
|
||||
PRIVATE
|
||||
core_interface
|
||||
minisketch_common
|
||||
)
|
||||
|
||||
set_target_properties(minisketch PROPERTIES
|
||||
EXPORT_COMPILE_COMMANDS OFF
|
||||
)
|
||||
|
||||
if(HAVE_CLMUL)
|
||||
set(_minisketch_clmul_src
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_1byte.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_2bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_3bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_4bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_5bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_6bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_7bytes.cpp
|
||||
${PROJECT_SOURCE_DIR}/src/minisketch/src/fields/clmul_8bytes.cpp
|
||||
)
|
||||
target_sources(minisketch PRIVATE ${_minisketch_clmul_src})
|
||||
set_property(SOURCE ${_minisketch_clmul_src} PROPERTY COMPILE_OPTIONS ${CLMUL_CXXFLAGS})
|
||||
target_compile_definitions(minisketch PRIVATE HAVE_CLMUL)
|
||||
unset(_minisketch_clmul_src)
|
||||
endif()
|
||||
@@ -1,80 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
function(add_boost_if_needed)
|
||||
#[=[
|
||||
TODO: Not all targets, which will be added in the future, require
|
||||
Boost. Therefore, a proper check will be appropriate here.
|
||||
|
||||
Implementation notes:
|
||||
Although only Boost headers are used to build Bitcoin Core,
|
||||
we still leverage a standard CMake's approach to handle
|
||||
dependencies, i.e., the Boost::headers "library".
|
||||
A command target_link_libraries(target PRIVATE Boost::headers)
|
||||
will propagate Boost::headers usage requirements to the target.
|
||||
For Boost::headers such usage requirements is an include
|
||||
directory and other added INTERFACE properties.
|
||||
]=]
|
||||
|
||||
if(CMAKE_HOST_APPLE)
|
||||
find_program(HOMEBREW_EXECUTABLE brew)
|
||||
if(HOMEBREW_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${HOMEBREW_EXECUTABLE} --prefix boost
|
||||
OUTPUT_VARIABLE Boost_ROOT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.73.0 REQUIRED CONFIG)
|
||||
mark_as_advanced(Boost_INCLUDE_DIR boost_headers_DIR)
|
||||
# Workaround for a bug in NetBSD pkgsrc.
|
||||
# See: https://github.com/NetBSD/pkgsrc/issues/167.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||
get_filename_component(_boost_include_dir "${boost_headers_DIR}/../../../include/" ABSOLUTE)
|
||||
set_target_properties(Boost::headers PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${_boost_include_dir}
|
||||
)
|
||||
unset(_boost_include_dir)
|
||||
endif()
|
||||
set_target_properties(Boost::headers PROPERTIES IMPORTED_GLOBAL TRUE)
|
||||
target_compile_definitions(Boost::headers INTERFACE
|
||||
# We don't use multi_index serialization.
|
||||
BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
|
||||
)
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET)
|
||||
# Workaround for https://github.com/microsoft/vcpkg/issues/36955.
|
||||
target_compile_definitions(Boost::headers INTERFACE
|
||||
BOOST_NO_USER_CONFIG
|
||||
)
|
||||
endif()
|
||||
|
||||
# Prevent use of std::unary_function, which was removed in C++17,
|
||||
# and will generate warnings with newer compilers for Boost
|
||||
# older than 1.80.
|
||||
# See: https://github.com/boostorg/config/pull/430.
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -DBOOST_NO_CXX98_FUNCTION_BASE)
|
||||
get_target_property(CMAKE_REQUIRED_INCLUDES Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(CMAKE_REQUIRED_FLAGS ${working_compiler_werror_flag})
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/config.hpp>
|
||||
" NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE
|
||||
)
|
||||
if(NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE)
|
||||
target_compile_definitions(Boost::headers INTERFACE
|
||||
BOOST_NO_CXX98_FUNCTION_BASE
|
||||
)
|
||||
endif()
|
||||
|
||||
# Some package managers, such as vcpkg, vendor Boost.Test separately
|
||||
# from the rest of the headers, so we have to check for it individually.
|
||||
if(BUILD_TESTS AND DEFINED VCPKG_TARGET_TRIPLET)
|
||||
find_package(boost_included_unit_test_framework ${Boost_VERSION} EXACT REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(add_windows_resources target rc_file)
|
||||
if(WIN32)
|
||||
target_sources(${target} PRIVATE ${rc_file})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Add a fusion manifest to Windows executables.
|
||||
# See: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
|
||||
function(add_windows_application_manifest target)
|
||||
if(WIN32)
|
||||
configure_file(${PROJECT_SOURCE_DIR}/cmake/windows-app.manifest.in ${target}.manifest USE_SOURCE_PERMISSIONS)
|
||||
file(CONFIGURE
|
||||
OUTPUT ${target}-manifest.rc
|
||||
CONTENT "1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ \"${target}.manifest\""
|
||||
)
|
||||
add_windows_resources(${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}-manifest.rc)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(check_linker_supports_pie warnings)
|
||||
# Workaround for a bug in the check_pie_supported() function.
|
||||
# See:
|
||||
# - https://gitlab.kitware.com/cmake/cmake/-/issues/26463
|
||||
# - https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10034
|
||||
if(CMAKE_VERSION VERSION_LESS 3.32)
|
||||
# CMAKE_CXX_COMPILE_OPTIONS_PIE is a list, whereas CMAKE_REQUIRED_FLAGS
|
||||
# must be a string. Therefore, a proper conversion is required.
|
||||
list(JOIN CMAKE_CXX_COMPILE_OPTIONS_PIE " " CMAKE_REQUIRED_FLAGS)
|
||||
endif()
|
||||
|
||||
include(CheckPIESupported)
|
||||
check_pie_supported(OUTPUT_VARIABLE output LANGUAGES CXX)
|
||||
if(CMAKE_CXX_LINK_PIE_SUPPORTED)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON PARENT_SCOPE)
|
||||
elseif(NOT WIN32)
|
||||
# The warning is superfluous for Windows.
|
||||
message(WARNING "PIE is not supported at link time. See the configure log for details.")
|
||||
set(${warnings} ${${warnings}} "Position independent code disabled." PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
#[=[
|
||||
Check once if C++ source code can be compiled.
|
||||
|
||||
Options:
|
||||
|
||||
CXXFLAGS - A list of additional flags to pass to the compiler.
|
||||
|
||||
LDFLAGS - A list of additional flags to pass to the linker.
|
||||
|
||||
LINK_LIBRARIES - A list of libraries to add to the link command.
|
||||
|
||||
For historical reasons, among the CMake `CMAKE_REQUIRED_*` variables that influence
|
||||
`check_cxx_source_compiles()`, only `CMAKE_REQUIRED_FLAGS` is a string rather than
|
||||
a list. Additionally, `target_compile_options()` also expects a list of options.
|
||||
|
||||
The `check_cxx_source_compiles_with_flags()` function handles this case and accepts
|
||||
`CXXFLAGS` as a list, simplifying the code at the caller site.
|
||||
|
||||
#]=]
|
||||
function(check_cxx_source_compiles_with_flags source result_var)
|
||||
cmake_parse_arguments(PARSE_ARGV 2 _ "" "" "CXXFLAGS;LDFLAGS;LINK_LIBRARIES")
|
||||
list(JOIN __CXXFLAGS " " CMAKE_REQUIRED_FLAGS)
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS ${__LDFLAGS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${__LINK_LIBRARIES})
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("${source}" ${result_var})
|
||||
set(${result_var} ${${result_var}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,86 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindLibevent
|
||||
------------
|
||||
|
||||
Finds the Libevent headers and libraries.
|
||||
|
||||
This is a wrapper around find_package()/pkg_check_modules() commands that:
|
||||
- facilitates searching in various build environments
|
||||
- prints a standard log message
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
# Check whether evhttp_connection_get_peer expects const char**.
|
||||
# See https://github.com/libevent/libevent/commit/a18301a2bb160ff7c3ffaf5b7653c39ffe27b385
|
||||
function(check_evhttp_connection_get_peer target)
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${target})
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("
|
||||
#include <cstdint>
|
||||
#include <event2/http.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
evhttp_connection* conn = (evhttp_connection*)1;
|
||||
const char* host;
|
||||
uint16_t port;
|
||||
evhttp_connection_get_peer(conn, &host, &port);
|
||||
}
|
||||
" HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
target_compile_definitions(${target} INTERFACE
|
||||
$<$<BOOL:${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR}>:HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR>
|
||||
)
|
||||
endfunction()
|
||||
|
||||
set(_libevent_components core extra)
|
||||
if(NOT WIN32)
|
||||
list(APPEND _libevent_components pthreads)
|
||||
endif()
|
||||
|
||||
find_package(Libevent ${Libevent_FIND_VERSION} QUIET
|
||||
NO_MODULE
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(Libevent_FOUND)
|
||||
find_package(Libevent ${Libevent_FIND_VERSION} QUIET
|
||||
REQUIRED COMPONENTS ${_libevent_components}
|
||||
NO_MODULE
|
||||
)
|
||||
find_package_handle_standard_args(Libevent
|
||||
REQUIRED_VARS Libevent_DIR
|
||||
VERSION_VAR Libevent_VERSION
|
||||
)
|
||||
check_evhttp_connection_get_peer(libevent::extra)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
foreach(component IN LISTS _libevent_components)
|
||||
pkg_check_modules(libevent_${component}
|
||||
REQUIRED QUIET
|
||||
IMPORTED_TARGET GLOBAL
|
||||
libevent_${component}>=${Libevent_FIND_VERSION}
|
||||
)
|
||||
if(TARGET PkgConfig::libevent_${component} AND NOT TARGET libevent::${component})
|
||||
add_library(libevent::${component} ALIAS PkgConfig::libevent_${component})
|
||||
endif()
|
||||
endforeach()
|
||||
find_package_handle_standard_args(Libevent
|
||||
REQUIRED_VARS libevent_core_LIBRARY_DIRS
|
||||
VERSION_VAR libevent_core_VERSION
|
||||
)
|
||||
check_evhttp_connection_get_peer(PkgConfig::libevent_extra)
|
||||
endif()
|
||||
|
||||
unset(_libevent_components)
|
||||
|
||||
mark_as_advanced(Libevent_DIR)
|
||||
mark_as_advanced(_event_h)
|
||||
mark_as_advanced(_event_lib)
|
||||
@@ -1,71 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindQRencode
|
||||
------------
|
||||
|
||||
Finds the QRencode header and library.
|
||||
|
||||
This is a wrapper around find_package()/pkg_check_modules() commands that:
|
||||
- facilitates searching in various build environments
|
||||
- prints a standard log message
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_QRencode QUIET libqrencode)
|
||||
endif()
|
||||
|
||||
find_path(QRencode_INCLUDE_DIR
|
||||
NAMES qrencode.h
|
||||
HINTS ${PC_QRencode_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(QRencode_LIBRARY_RELEASE
|
||||
NAMES qrencode
|
||||
HINTS ${PC_QRencode_LIBRARY_DIRS}
|
||||
)
|
||||
find_library(QRencode_LIBRARY_DEBUG
|
||||
NAMES qrencoded qrencode
|
||||
HINTS ${PC_QRencode_LIBRARY_DIRS}
|
||||
)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(QRencode)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(QRencode
|
||||
REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR
|
||||
VERSION_VAR PC_QRencode_VERSION
|
||||
)
|
||||
|
||||
if(QRencode_FOUND)
|
||||
if(NOT TARGET QRencode::QRencode)
|
||||
add_library(QRencode::QRencode UNKNOWN IMPORTED)
|
||||
endif()
|
||||
if(QRencode_LIBRARY_RELEASE)
|
||||
set_property(TARGET QRencode::QRencode APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_target_properties(QRencode::QRencode PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
if(QRencode_LIBRARY_DEBUG)
|
||||
set_property(TARGET QRencode::QRencode APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_target_properties(QRencode::QRencode PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
set_target_properties(QRencode::QRencode PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
QRencode_INCLUDE_DIR
|
||||
)
|
||||
@@ -1,45 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindQt
|
||||
------
|
||||
|
||||
Finds the Qt headers and libraries.
|
||||
|
||||
This is a wrapper around find_package() command that:
|
||||
- facilitates searching in various build environments
|
||||
- prints a standard log message
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
set(_qt_homebrew_prefix)
|
||||
if(CMAKE_HOST_APPLE)
|
||||
find_program(HOMEBREW_EXECUTABLE brew)
|
||||
if(HOMEBREW_EXECUTABLE)
|
||||
execute_process(
|
||||
COMMAND ${HOMEBREW_EXECUTABLE} --prefix qt@${Qt_FIND_VERSION_MAJOR}
|
||||
OUTPUT_VARIABLE _qt_homebrew_prefix
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Qt${Qt_FIND_VERSION_MAJOR} ${Qt_FIND_VERSION}
|
||||
COMPONENTS ${Qt_FIND_COMPONENTS}
|
||||
HINTS ${_qt_homebrew_prefix}
|
||||
PATH_SUFFIXES Qt${Qt_FIND_VERSION_MAJOR} # Required on OpenBSD systems.
|
||||
)
|
||||
unset(_qt_homebrew_prefix)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Qt
|
||||
REQUIRED_VARS Qt${Qt_FIND_VERSION_MAJOR}_DIR
|
||||
VERSION_VAR Qt${Qt_FIND_VERSION_MAJOR}_VERSION
|
||||
)
|
||||
|
||||
foreach(component IN LISTS Qt_FIND_COMPONENTS ITEMS "")
|
||||
mark_as_advanced(Qt${Qt_FIND_VERSION_MAJOR}${component}_DIR)
|
||||
endforeach()
|
||||
@@ -1,71 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindUSDT
|
||||
--------
|
||||
|
||||
Finds the Userspace, Statically Defined Tracing header(s).
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides imported target ``USDT::headers``, if
|
||||
USDT has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
``USDT_FOUND``
|
||||
"True" if USDT found.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(USDT_INCLUDE_DIR
|
||||
NAMES sys/sdt.h
|
||||
)
|
||||
mark_as_advanced(USDT_INCLUDE_DIR)
|
||||
|
||||
if(USDT_INCLUDE_DIR)
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state(RESET)
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${USDT_INCLUDE_DIR})
|
||||
check_cxx_source_compiles("
|
||||
#if defined(__arm__)
|
||||
# define STAP_SDT_ARG_CONSTRAINT g
|
||||
#endif
|
||||
|
||||
// Setting SDT_USE_VARIADIC lets systemtap (sys/sdt.h) know that we want to use
|
||||
// the optional variadic macros to define tracepoints.
|
||||
#define SDT_USE_VARIADIC 1
|
||||
#include <sys/sdt.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
STAP_PROBEV(context, event);
|
||||
int a, b, c, d, e, f, g;
|
||||
STAP_PROBEV(context, event, a, b, c, d, e, f, g);
|
||||
}
|
||||
" HAVE_USDT_H
|
||||
)
|
||||
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(USDT
|
||||
REQUIRED_VARS USDT_INCLUDE_DIR HAVE_USDT_H
|
||||
)
|
||||
|
||||
if(USDT_FOUND AND NOT TARGET USDT::headers)
|
||||
add_library(USDT::headers INTERFACE IMPORTED)
|
||||
set_target_properties(USDT::headers PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${USDT_INCLUDE_DIR}"
|
||||
)
|
||||
set(ENABLE_TRACING TRUE)
|
||||
endif()
|
||||
@@ -1,41 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#[=======================================================================[
|
||||
FindZeroMQ
|
||||
----------
|
||||
|
||||
Finds the ZeroMQ headers and library.
|
||||
|
||||
This is a wrapper around find_package()/pkg_check_modules() commands that:
|
||||
- facilitates searching in various build environments
|
||||
- prints a standard log message
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package(ZeroMQ ${ZeroMQ_FIND_VERSION} NO_MODULE QUIET)
|
||||
if(ZeroMQ_FOUND)
|
||||
find_package_handle_standard_args(ZeroMQ
|
||||
REQUIRED_VARS ZeroMQ_DIR
|
||||
VERSION_VAR ZeroMQ_VERSION
|
||||
)
|
||||
if(TARGET libzmq)
|
||||
add_library(zeromq ALIAS libzmq)
|
||||
elseif(TARGET libzmq-static)
|
||||
add_library(zeromq ALIAS libzmq-static)
|
||||
endif()
|
||||
mark_as_advanced(ZeroMQ_DIR)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(libzmq QUIET
|
||||
IMPORTED_TARGET
|
||||
libzmq>=${ZeroMQ_FIND_VERSION}
|
||||
)
|
||||
find_package_handle_standard_args(ZeroMQ
|
||||
REQUIRED_VARS libzmq_LIBRARY_DIRS
|
||||
VERSION_VAR libzmq_VERSION
|
||||
)
|
||||
add_library(zeromq ALIAS PkgConfig::libzmq)
|
||||
endif()
|
||||
@@ -1,74 +0,0 @@
|
||||
# Copyright (c) 2024-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(indent_message header content indent_num)
|
||||
if(indent_num GREATER 0)
|
||||
string(REPEAT " " ${indent_num} indentation)
|
||||
string(REPEAT "." ${indent_num} tail)
|
||||
string(REGEX REPLACE "${tail}$" "" header "${header}")
|
||||
endif()
|
||||
message("${indentation}${header} ${content}")
|
||||
endfunction()
|
||||
|
||||
# Print tools' flags on best-effort. Include the abstracted
|
||||
# CMake flags that we touch ourselves.
|
||||
function(print_flags_per_config config indent_num)
|
||||
string(TOUPPER "${config}" config_uppercase)
|
||||
|
||||
include(GetTargetInterface)
|
||||
get_target_interface(definitions "${config}" core_interface COMPILE_DEFINITIONS)
|
||||
indent_message("Preprocessor defined macros ..........." "${definitions}" ${indent_num})
|
||||
|
||||
string(STRIP "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS}" combined_cxx_flags)
|
||||
string(STRIP "${combined_cxx_flags} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_cxx_flags)
|
||||
string(STRIP "${combined_cxx_flags} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}" combined_cxx_flags)
|
||||
if(CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
string(JOIN " " combined_cxx_flags ${combined_cxx_flags} ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
|
||||
endif()
|
||||
get_target_interface(core_cxx_flags "${config}" core_interface COMPILE_OPTIONS)
|
||||
string(STRIP "${combined_cxx_flags} ${core_cxx_flags}" combined_cxx_flags)
|
||||
string(STRIP "${combined_cxx_flags} ${APPEND_CPPFLAGS}" combined_cxx_flags)
|
||||
string(STRIP "${combined_cxx_flags} ${APPEND_CXXFLAGS}" combined_cxx_flags)
|
||||
indent_message("C++ compiler flags ...................." "${combined_cxx_flags}" ${indent_num})
|
||||
|
||||
string(STRIP "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${config_uppercase}}" combined_linker_flags)
|
||||
string(STRIP "${combined_linker_flags} ${CMAKE_EXE_LINKER_FLAGS}" combined_linker_flags)
|
||||
get_target_interface(common_link_options "${config}" core_interface LINK_OPTIONS)
|
||||
string(STRIP "${combined_linker_flags} ${common_link_options}" combined_linker_flags)
|
||||
if(CMAKE_CXX_LINK_PIE_SUPPORTED)
|
||||
string(JOIN " " combined_linker_flags ${combined_linker_flags} ${CMAKE_CXX_LINK_OPTIONS_PIE})
|
||||
endif()
|
||||
string(STRIP "${combined_linker_flags} ${APPEND_LDFLAGS}" combined_linker_flags)
|
||||
indent_message("Linker flags .........................." "${combined_linker_flags}" ${indent_num})
|
||||
endfunction()
|
||||
|
||||
function(flags_summary)
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
list(JOIN CMAKE_CONFIGURATION_TYPES ", " configs)
|
||||
message("Available build configurations ........ ${configs}")
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(default_config "Debug")
|
||||
else()
|
||||
list(GET CMAKE_CONFIGURATION_TYPES 0 default_config)
|
||||
endif()
|
||||
message("Default build configuration ........... ${default_config}")
|
||||
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
|
||||
message("")
|
||||
message("'${config}' build configuration:")
|
||||
print_flags_per_config("${config}" 2)
|
||||
endforeach()
|
||||
else()
|
||||
message("CMAKE_BUILD_TYPE ...................... ${CMAKE_BUILD_TYPE}")
|
||||
print_flags_per_config("${CMAKE_BUILD_TYPE}" 0)
|
||||
endif()
|
||||
message("")
|
||||
message([=[
|
||||
NOTE: The summary above may not exactly match the final applied build flags
|
||||
if any additional CMAKE_* or environment variables have been modified.
|
||||
To see the exact flags applied, build with the --verbose option.
|
||||
]=])
|
||||
endfunction()
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
function(generate_setup_nsi)
|
||||
set(abs_top_srcdir ${PROJECT_SOURCE_DIR})
|
||||
set(abs_top_builddir ${PROJECT_BINARY_DIR})
|
||||
set(CLIENT_URL ${PROJECT_HOMEPAGE_URL})
|
||||
set(CLIENT_TARNAME "bitcoin")
|
||||
set(BITCOIN_WRAPPER_NAME "bitcoin")
|
||||
set(BITCOIN_GUI_NAME "bitcoin-qt")
|
||||
set(BITCOIN_DAEMON_NAME "bitcoind")
|
||||
set(BITCOIN_CLI_NAME "bitcoin-cli")
|
||||
set(BITCOIN_TX_NAME "bitcoin-tx")
|
||||
set(BITCOIN_WALLET_TOOL_NAME "bitcoin-wallet")
|
||||
set(BITCOIN_TEST_NAME "test_bitcoin")
|
||||
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
|
||||
configure_file(${PROJECT_SOURCE_DIR}/share/setup.nsi.in ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi USE_SOURCE_PERMISSIONS @ONLY)
|
||||
endfunction()
|
||||
@@ -1,53 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Evaluates config-specific generator expressions in a list.
|
||||
# Recognizable patterns are:
|
||||
# - $<$<CONFIG:[config]>:[value]>
|
||||
# - $<$<NOT:$<CONFIG:[config]>>:[value]>
|
||||
function(evaluate_generator_expressions list config)
|
||||
set(input ${${list}})
|
||||
set(result)
|
||||
foreach(token IN LISTS input)
|
||||
if(token MATCHES "\\$<\\$<CONFIG:([^>]+)>:([^>]+)>")
|
||||
if(CMAKE_MATCH_1 STREQUAL config)
|
||||
list(APPEND result ${CMAKE_MATCH_2})
|
||||
endif()
|
||||
elseif(token MATCHES "\\$<\\$<NOT:\\$<CONFIG:([^>]+)>>:([^>]+)>")
|
||||
if(NOT CMAKE_MATCH_1 STREQUAL config)
|
||||
list(APPEND result ${CMAKE_MATCH_2})
|
||||
endif()
|
||||
else()
|
||||
list(APPEND result ${token})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${list} ${result} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Gets target's interface properties recursively.
|
||||
function(get_target_interface var config target property)
|
||||
get_target_property(result ${target} INTERFACE_${property})
|
||||
if(result)
|
||||
evaluate_generator_expressions(result "${config}")
|
||||
list(JOIN result " " result)
|
||||
else()
|
||||
set(result)
|
||||
endif()
|
||||
|
||||
get_target_property(dependencies ${target} INTERFACE_LINK_LIBRARIES)
|
||||
if(dependencies)
|
||||
evaluate_generator_expressions(dependencies "${config}")
|
||||
foreach(dependency IN LISTS dependencies)
|
||||
if(TARGET ${dependency})
|
||||
get_target_interface(dep_result "${config}" ${dependency} ${property})
|
||||
string(STRIP "${result} ${dep_result}" result)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(${var} "${result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright (c) 2025-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
function(install_binary_component component)
|
||||
cmake_parse_arguments(PARSE_ARGV 1
|
||||
IC # prefix
|
||||
"HAS_MANPAGE;INTERNAL" # options
|
||||
"" # one_value_keywords
|
||||
"" # multi_value_keywords
|
||||
)
|
||||
set(target_name ${component})
|
||||
if(IC_INTERNAL)
|
||||
set(runtime_dest ${CMAKE_INSTALL_LIBEXECDIR})
|
||||
else()
|
||||
set(runtime_dest ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
install(TARGETS ${target_name}
|
||||
RUNTIME DESTINATION ${runtime_dest}
|
||||
COMPONENT ${component}
|
||||
)
|
||||
if(INSTALL_MAN AND IC_HAS_MANPAGE)
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/doc/man/${target_name}.1
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||
COMPONENT ${component}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,144 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(setup_split_debug_script)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(OBJCOPY ${CMAKE_OBJCOPY})
|
||||
set(STRIP ${CMAKE_STRIP})
|
||||
configure_file(
|
||||
contrib/devtools/split-debug.sh.in split-debug.sh
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ
|
||||
@ONLY
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_maintenance_targets)
|
||||
if(NOT TARGET Python3::Interpreter)
|
||||
return()
|
||||
endif()
|
||||
|
||||
foreach(target IN ITEMS bitcoin bitcoind bitcoin-node bitcoin-qt bitcoin-gui bitcoin-cli bitcoin-tx bitcoin-util bitcoin-wallet test_bitcoin bench_bitcoin)
|
||||
if(TARGET ${target})
|
||||
list(APPEND executables $<TARGET_FILE:${target}>)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target(check-symbols
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Running symbol and dynamic library checks..."
|
||||
COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/contrib/guix/symbol-check.py ${executables}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(check-security
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Checking binary security..."
|
||||
COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/contrib/guix/security-check.py ${executables}
|
||||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(add_windows_deploy_target)
|
||||
if(MINGW AND TARGET bitcoin AND TARGET bitcoin-qt AND TARGET bitcoind AND TARGET bitcoin-cli AND TARGET bitcoin-tx AND TARGET bitcoin-wallet AND TARGET bitcoin-util AND TARGET test_bitcoin)
|
||||
find_program(MAKENSIS_EXECUTABLE makensis)
|
||||
if(NOT MAKENSIS_EXECUTABLE)
|
||||
add_custom_target(deploy
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Error: NSIS not found"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO: Consider replacing this code with the CPack NSIS Generator.
|
||||
# See https://cmake.org/cmake/help/latest/cpack_gen/nsis.html
|
||||
include(GenerateSetupNsi)
|
||||
generate_setup_nsi()
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/release
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-qt> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-qt>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoind> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoind>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-cli> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-cli>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-tx> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-tx>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-wallet> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-wallet>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:bitcoin-util> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:bitcoin-util>
|
||||
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:test_bitcoin> -o ${PROJECT_BINARY_DIR}/release/$<TARGET_FILE_NAME:test_bitcoin>
|
||||
COMMAND ${MAKENSIS_EXECUTABLE} -V2 ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.nsi
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploy DEPENDS ${PROJECT_BINARY_DIR}/bitcoin-win64-setup.exe)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_macos_deploy_target)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND TARGET bitcoin-qt)
|
||||
set(macos_app "Bitcoin-Qt.app")
|
||||
# Populate Contents subdirectory.
|
||||
configure_file(${PROJECT_SOURCE_DIR}/share/qt/Info.plist.in ${macos_app}/Contents/Info.plist NO_SOURCE_PERMISSIONS)
|
||||
file(CONFIGURE OUTPUT ${macos_app}/Contents/PkgInfo CONTENT "APPL????")
|
||||
# Populate Contents/Resources subdirectory.
|
||||
file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/empty.lproj CONTENT "")
|
||||
configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/bitcoin.icns ${macos_app}/Contents/Resources/bitcoin.icns NO_SOURCE_PERMISSIONS COPYONLY)
|
||||
file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
CONTENT "{ CFBundleDisplayName = \"@CLIENT_NAME@\"; CFBundleName = \"@CLIENT_NAME@\"; }"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
COMMAND ${CMAKE_COMMAND} --install ${PROJECT_BINARY_DIR} --config $<CONFIG> --component bitcoin-qt --prefix ${macos_app}/Contents/MacOS --strip
|
||||
COMMAND ${CMAKE_COMMAND} -E rename ${macos_app}/Contents/MacOS/bin/$<TARGET_FILE_NAME:bitcoin-qt> ${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf ${macos_app}/Contents/MacOS/bin
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf ${macos_app}/Contents/MacOS/share
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
string(REPLACE " " "-" osx_volname ${CLIENT_NAME})
|
||||
if(CMAKE_HOST_APPLE)
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip
|
||||
COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR} -zip
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploydir
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip
|
||||
)
|
||||
add_custom_target(deploy
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${osx_volname}.zip
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
COMMAND ${CMAKE_COMMAND} -E env OBJDUMP=${CMAKE_OBJDUMP} $<TARGET_FILE:Python3::Interpreter> ${PROJECT_SOURCE_DIR}/contrib/macdeploy/macdeployqtplus ${macos_app} ${osx_volname} -translations-dir=${QT_TRANSLATIONS_DIR}
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploydir
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/dist/${macos_app}/Contents/MacOS/Bitcoin-Qt
|
||||
)
|
||||
|
||||
find_program(ZIP_EXECUTABLE zip)
|
||||
if(NOT ZIP_EXECUTABLE)
|
||||
add_custom_target(deploy
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Error: ZIP not found"
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
WORKING_DIRECTORY dist
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/script/macos_zip.sh ${ZIP_EXECUTABLE} ${osx_volname}.zip
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(deploy
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/dist/${osx_volname}.zip
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
add_dependencies(deploydir bitcoin-qt)
|
||||
add_dependencies(deploy deploydir)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -1,166 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
macro(normalize_string string)
|
||||
string(REGEX REPLACE " +" " " ${string} "${${string}}")
|
||||
string(STRIP "${${string}}" ${string})
|
||||
endmacro()
|
||||
|
||||
function(are_flags_overridden flags_var result_var)
|
||||
normalize_string(${flags_var})
|
||||
normalize_string(${flags_var}_INIT)
|
||||
if(${flags_var} STREQUAL ${flags_var}_INIT)
|
||||
set(${result_var} FALSE PARENT_SCOPE)
|
||||
else()
|
||||
set(${result_var} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Removes duplicated flags. The relative order of flags is preserved.
|
||||
# If duplicates are encountered, only the last instance is preserved.
|
||||
function(deduplicate_flags flags)
|
||||
separate_arguments(${flags})
|
||||
list(REVERSE ${flags})
|
||||
list(REMOVE_DUPLICATES ${flags})
|
||||
list(REVERSE ${flags})
|
||||
list(JOIN ${flags} " " result)
|
||||
set(${flags} "${result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(get_all_configs output)
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
set(all_configs ${CMAKE_CONFIGURATION_TYPES})
|
||||
else()
|
||||
get_property(all_configs CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS)
|
||||
if(NOT all_configs)
|
||||
# See https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations
|
||||
set(all_configs Debug Release RelWithDebInfo MinSizeRel)
|
||||
endif()
|
||||
endif()
|
||||
set(${output} "${all_configs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
#[=[
|
||||
Set the default build configuration.
|
||||
|
||||
See: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations.
|
||||
|
||||
On single-configuration generators, this function sets the CMAKE_BUILD_TYPE variable to
|
||||
the default build configuration, which can be overridden by the user at configure time if needed.
|
||||
|
||||
On multi-configuration generators, this function rearranges the CMAKE_CONFIGURATION_TYPES list,
|
||||
ensuring that the default build configuration appears first while maintaining the order of the
|
||||
remaining configurations. The user can choose a build configuration at build time.
|
||||
]=]
|
||||
function(set_default_config config)
|
||||
get_all_configs(all_configs)
|
||||
if(NOT ${config} IN_LIST all_configs)
|
||||
message(FATAL_ERROR "The default config is \"${config}\", but must be one of ${all_configs}.")
|
||||
endif()
|
||||
|
||||
list(REMOVE_ITEM all_configs ${config})
|
||||
list(PREPEND all_configs ${config})
|
||||
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
get_property(help_string CACHE CMAKE_CONFIGURATION_TYPES PROPERTY HELPSTRING)
|
||||
set(CMAKE_CONFIGURATION_TYPES "${all_configs}" CACHE STRING "${help_string}" FORCE)
|
||||
# Also see https://gitlab.kitware.com/cmake/cmake/-/issues/19512.
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION "${config}" PARENT_SCOPE)
|
||||
else()
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||
STRINGS "${all_configs}"
|
||||
)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Setting build type to \"${config}\" as none was specified")
|
||||
get_property(help_string CACHE CMAKE_BUILD_TYPE PROPERTY HELPSTRING)
|
||||
set(CMAKE_BUILD_TYPE "${config}" CACHE STRING "${help_string}" FORCE)
|
||||
endif()
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(remove_cxx_flag_from_all_configs flag)
|
||||
get_all_configs(all_configs)
|
||||
foreach(config IN LISTS all_configs)
|
||||
string(TOUPPER "${config}" config_uppercase)
|
||||
set(flags "${CMAKE_CXX_FLAGS_${config_uppercase}}")
|
||||
separate_arguments(flags)
|
||||
list(FILTER flags EXCLUDE REGEX "${flag}")
|
||||
list(JOIN flags " " new_flags)
|
||||
set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}" PARENT_SCOPE)
|
||||
set(CMAKE_CXX_FLAGS_${config_uppercase} "${new_flags}"
|
||||
CACHE STRING
|
||||
"Flags used by the CXX compiler during ${config_uppercase} builds."
|
||||
FORCE
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(replace_cxx_flag_in_config config old_flag new_flag)
|
||||
string(TOUPPER "CMAKE_CXX_FLAGS_${config}" var_name)
|
||||
if("${var_name}" IN_LIST precious_variables)
|
||||
return()
|
||||
endif()
|
||||
string(REGEX REPLACE "(^| )${old_flag}( |$)" "\\1${new_flag}\\2" ${var_name} "${${var_name}}")
|
||||
set(${var_name} "${${var_name}}" PARENT_SCOPE)
|
||||
set_property(CACHE ${var_name} PROPERTY VALUE "${${var_name}}")
|
||||
endfunction()
|
||||
|
||||
set_default_config(RelWithDebInfo)
|
||||
|
||||
include(TryAppendCXXFlags)
|
||||
|
||||
# We leave assertions on.
|
||||
if(MSVC)
|
||||
remove_cxx_flag_from_all_configs(/DNDEBUG)
|
||||
else()
|
||||
remove_cxx_flag_from_all_configs(-DNDEBUG)
|
||||
|
||||
# Adjust flags used by the CXX compiler during RELEASE builds.
|
||||
# Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.)
|
||||
replace_cxx_flag_in_config(Release -O3 -O2)
|
||||
|
||||
are_flags_overridden(CMAKE_CXX_FLAGS_DEBUG cxx_flags_debug_overridden)
|
||||
if(NOT cxx_flags_debug_overridden)
|
||||
# Redefine flags used by the CXX compiler during DEBUG builds.
|
||||
try_append_cxx_flags("-g3" RESULT_VAR compiler_supports_g3)
|
||||
if(compiler_supports_g3)
|
||||
replace_cxx_flag_in_config(Debug -g -g3)
|
||||
endif()
|
||||
unset(compiler_supports_g3)
|
||||
|
||||
try_append_cxx_flags("-ftrapv" RESULT_VAR compiler_supports_ftrapv)
|
||||
if(compiler_supports_ftrapv)
|
||||
string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-ftrapv ")
|
||||
endif()
|
||||
unset(compiler_supports_ftrapv)
|
||||
|
||||
string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-O0 ")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}"
|
||||
CACHE STRING
|
||||
"Flags used by the CXX compiler during DEBUG builds."
|
||||
FORCE
|
||||
)
|
||||
endif()
|
||||
unset(cxx_flags_debug_overridden)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -Og --coverage")
|
||||
set(CMAKE_OBJCXX_FLAGS_COVERAGE "-g -Og --coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage")
|
||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(is_multi_config)
|
||||
if(NOT "Coverage" IN_LIST CMAKE_CONFIGURATION_TYPES)
|
||||
list(APPEND CMAKE_CONFIGURATION_TYPES Coverage)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,55 +0,0 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
macro(set_add_custom_command_options)
|
||||
set(DEPENDS_EXPLICIT_OPT "")
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
|
||||
set(DEPENDS_EXPLICIT_OPT DEPENDS_EXPLICIT_ONLY)
|
||||
endif()
|
||||
set(CODEGEN_OPT "")
|
||||
if(POLICY CMP0171)
|
||||
cmake_policy(GET CMP0171 _cmp0171_status)
|
||||
if(_cmp0171_status STREQUAL "NEW")
|
||||
set(CODEGEN_OPT CODEGEN)
|
||||
endif()
|
||||
unset(_cmp0171_status)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Specifies JSON data files to be processed into corresponding
|
||||
# header files for inclusion when building a target.
|
||||
function(target_json_data_sources target)
|
||||
set_add_custom_command_options()
|
||||
foreach(json_file IN LISTS ARGN)
|
||||
set(header ${CMAKE_CURRENT_BINARY_DIR}/${json_file}.h)
|
||||
add_custom_command(
|
||||
OUTPUT ${header}
|
||||
COMMAND ${CMAKE_COMMAND} -DJSON_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${json_file} -DHEADER_PATH=${header} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromJson.cmake
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${json_file} ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromJson.cmake
|
||||
VERBATIM
|
||||
${CODEGEN_OPT}
|
||||
${DEPENDS_EXPLICIT_OPT}
|
||||
)
|
||||
target_sources(${target} PRIVATE ${header})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Specifies raw binary data files to be processed into corresponding
|
||||
# header files for inclusion when building a target.
|
||||
function(target_raw_data_sources target)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 _ "" "NAMESPACE" "")
|
||||
set_add_custom_command_options()
|
||||
foreach(raw_file IN LISTS __UNPARSED_ARGUMENTS)
|
||||
set(header ${CMAKE_CURRENT_BINARY_DIR}/${raw_file}.h)
|
||||
add_custom_command(
|
||||
OUTPUT ${header}
|
||||
COMMAND ${CMAKE_COMMAND} -DRAW_SOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/${raw_file} -DHEADER_PATH=${header} -DRAW_NAMESPACE=${__NAMESPACE} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromRaw.cmake
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${raw_file} ${PROJECT_SOURCE_DIR}/cmake/script/GenerateHeaderFromRaw.cmake
|
||||
VERBATIM
|
||||
${CODEGEN_OPT}
|
||||
${DEPENDS_EXPLICIT_OPT}
|
||||
)
|
||||
target_sources(${target} PRIVATE ${header})
|
||||
endforeach()
|
||||
endfunction()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user