forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
build: consume Dash Platform CXX bindings from depends #7623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PastaPastaPasta
wants to merge
3
commits into
dashpay:develop
Choose a base branch
from
PastaPastaPasta:feat/platform-cxx-depends
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
e42c902
build(depends): add pinned Rust toolchain packages and crate vendoring
PastaPastaPasta 97c428a
build(depends): build Dash Platform CXX bindings behind a PLATFORM_GU…
PastaPastaPasta efe07f5
ci: exercise the PLATFORM_GUI depends knob in a linux64_platform_gui …
PastaPastaPasta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Copyright (c) 2026 The Dash 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 | ||
|
|
||
| # Builds depends with PLATFORM_GUI=1 so mbedtls and the Platform-owned CXX | ||
| # binding archive (libdash_platform_cxx.a, built offline from vendored crates) | ||
| # are produced, hash-verified and installed into the depends prefix, then | ||
| # builds dash-qt against that prefix. The --enable-platform-gui configure flag | ||
| # and the platform_* unit-test suites arrive with the Platform client library | ||
| # and are added to BITCOIN_CONFIG there; until then this lane proves the | ||
| # depends knob end to end and that the enriched prefix stays link-compatible. | ||
| # Functional tests are skipped: there is no dashd-only surface to drive. | ||
| export CONTAINER_NAME=ci_native_platform_gui | ||
| export HOST=x86_64-pc-linux-gnu | ||
| export PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libdbus-1-dev libharfbuzz-dev" | ||
| export DEP_OPTS="PLATFORM_GUI=1" | ||
| export RUN_UNIT_TESTS="true" | ||
| export RUN_UNIT_TESTS_SEQUENTIAL="false" | ||
| export RUN_FUNCTIONAL_TESTS="false" | ||
| export GOAL="install" | ||
| export BITCOIN_CONFIG="--with-gui=qt5 --enable-zmq --with-libs=no --enable-reduce-exports LDFLAGS=-static-libstdc++" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| # Copyright (c) 2021-2022 The Zcash developers | ||
| # Copyright (c) 2026 The Dash Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| import hashlib | ||
| import re | ||
| import sys | ||
| import urllib.request | ||
| from pathlib import Path | ||
|
|
||
| # Rust standard libraries provisioned in rust_stdlib.mk. Confined to the | ||
| # hosts we validate (the Guix release set); see rust_stdlib.mk. | ||
| CROSS_TARGETS = [ | ||
| # Linux | ||
| "aarch64-unknown-linux-musl", | ||
| "riscv64gc-unknown-linux-musl", | ||
| "x86_64-unknown-linux-musl", | ||
| # Windows | ||
| "x86_64-pc-windows-gnu", | ||
| # macOS | ||
| "aarch64-apple-darwin", | ||
| "x86_64-apple-darwin", | ||
| ] | ||
|
|
||
| # Native compilers provisioned in native_rust.mk (build hosts for depends) | ||
| NATIVE_TARGETS = [ | ||
| # Linux | ||
| ("aarch64-unknown-linux-gnu", "aarch64_linux"), | ||
| ("x86_64-unknown-linux-gnu", "x86_64_linux"), | ||
| # macOS | ||
| ("aarch64-apple-darwin", "aarch64_darwin"), | ||
| ("x86_64-apple-darwin", "x86_64_darwin"), | ||
| ] | ||
|
|
||
|
|
||
| def get_rust_version(makefile_path: Path) -> str: | ||
| content = makefile_path.read_text() | ||
| match = re.search(r"\$\(package\)_version:=(.+)", content) | ||
| if not match: | ||
| raise RuntimeError("Could not find Rust version in makefile") | ||
| return match.group(1).strip() | ||
|
|
||
|
|
||
| def compute_sha256(url: str) -> str: | ||
| hasher = hashlib.sha256() | ||
| with urllib.request.urlopen(url) as response: | ||
| while chunk := response.read(8192): | ||
| hasher.update(chunk) | ||
| return hasher.hexdigest() | ||
|
|
||
|
|
||
| def update_hash_in_file(makefile_path: Path, pattern: str, new_hash: str) -> None: | ||
| content = makefile_path.read_text() | ||
| regex = re.compile(rf"^(\$\(package\)_{pattern}:=).*$", re.MULTILINE) | ||
| if not regex.search(content): | ||
| raise RuntimeError(f"Could not find pattern {pattern} in makefile") | ||
| new_content = regex.sub(rf"\g<1>{new_hash}", content) | ||
| makefile_path.write_text(new_content) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def update_version_in_file(path: Path, pattern: str, version: str) -> None: | ||
| content = path.read_text() | ||
| regex = re.compile(pattern, re.MULTILINE) | ||
| new_content, replacements = regex.subn( | ||
| lambda match: f"{match.group(1)}{version}{match.group(2) if match.lastindex == 2 else ''}", content | ||
| ) | ||
| if replacements != 1: | ||
| raise RuntimeError(f"Expected one version pin in {path}, found {replacements}") | ||
| path.write_text(new_content) | ||
|
|
||
|
|
||
| def compute_rust_hash(rust_version: str, rust_target: str) -> str: | ||
| url = f"https://static.rust-lang.org/dist/rust-{rust_version}-{rust_target}.tar.gz" | ||
| return compute_sha256(url) | ||
|
|
||
|
|
||
| def compute_stdlib_hash(rust_version: str, rust_target: str) -> str: | ||
| url = f"https://static.rust-lang.org/dist/rust-std-{rust_version}-{rust_target}.tar.gz" | ||
| return compute_sha256(url) | ||
|
|
||
|
|
||
| def main() -> int: | ||
| script_dir = Path(__file__).resolve().parent | ||
| native_rust_path = script_dir / "../../depends/packages/native_rust.mk" | ||
| native_rust_path = native_rust_path.resolve() | ||
| rust_stdlib_path = script_dir / "../../depends/packages/rust_stdlib.mk" | ||
| rust_stdlib_path = rust_stdlib_path.resolve() | ||
| for path in (native_rust_path, rust_stdlib_path): | ||
| if not path.exists(): | ||
| print(f"Error: {path} not found", file=sys.stderr) | ||
| return 1 | ||
|
|
||
| rust_version = get_rust_version(native_rust_path) | ||
|
|
||
| print(f"Rust version: {rust_version}\n") | ||
| print("Downloading native compiler hashes:") | ||
|
|
||
| native_hashes = {} | ||
| for rust_target, makefile_id in NATIVE_TARGETS: | ||
| native_hashes[makefile_id] = compute_rust_hash(rust_version, rust_target) | ||
| print(f" Downloaded sha256_hash_{makefile_id}") | ||
|
|
||
| print("\nDownloading stdlib hashes:") | ||
| stdlib_hashes = {} | ||
| for rust_target in CROSS_TARGETS: | ||
| stdlib_hashes[rust_target] = compute_stdlib_hash(rust_version, rust_target) | ||
| print(f" Downloaded sha256_hash_{rust_target}") | ||
|
|
||
| for makefile_id, hash_value in native_hashes.items(): | ||
| update_hash_in_file(native_rust_path, f"sha256_hash_{makefile_id}", hash_value) | ||
| for rust_target, hash_value in stdlib_hashes.items(): | ||
| update_hash_in_file(rust_stdlib_path, f"sha256_hash_{rust_target}", hash_value) | ||
|
|
||
| update_version_in_file(rust_stdlib_path, r"^(\$\(package\)_version:=).*$", rust_version) | ||
| print("\nSynchronized rust_stdlib.mk to the native_rust.mk version") | ||
|
|
||
| print("\nDone!") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.