Skip to content

Commit efcb6be

Browse files
committed
Prepare Rizin 0.10 alpha release
1 parent addf0d6 commit efcb6be

16 files changed

Lines changed: 179 additions & 179 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[workspace]
22
resolver = "3"
3-
members = [ "rizin-rs","rizin-sys"]
3+
members = [ "rizin-rs", "rizin-sys" ]
4+
5+
[workspace.package]
6+
version = "0.10.0-alpha.1"
7+
edition = "2024"
8+
repository = "https://github.com/b1llow/rizin-rs"
9+
readme = "README.md"

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ rizin-rs is a Rust library that provides bindings to the [Rizin](https://github.
1919

2020
## Installation
2121

22+
This alpha targets the Rizin 0.10 development line and requires Rizin
23+
`>=0.10.0, <0.11.0`.
24+
2225
```bash
23-
cargo add rizin-rs
26+
cargo add rizin-rs@0.10.0-alpha.1
2427
```
2528

2629
```nix
@@ -48,7 +51,8 @@ nix build .#rizin
4851
```
4952

5053
Rizin is pinned to a specific commit from its `dev` branch. Update it to the
51-
latest `dev` revision, including the source and Meson dependency hashes, with:
54+
latest `dev` revision, including the upstream version and source/Meson hashes,
55+
with:
5256

5357
```bash
5458
./nix/rizin/update.sh
@@ -62,11 +66,37 @@ Pass a full 40-character commit SHA to pin a specific revision instead:
6266

6367
## Usage
6468

65-
TODO
69+
```rust
70+
use rizin_rs::RzCore;
71+
72+
fn main() {
73+
let core = RzCore::new();
74+
core.config_set("analysis.arch", "x86").unwrap();
75+
core.config_set("analysis.bits", "64").unwrap();
76+
let arch = core.config_get("analysis.arch").unwrap();
77+
let bits = core.config_get("analysis.bits").unwrap();
78+
println!("Rizin analysis target: {arch}-{bits}");
79+
}
80+
```
81+
82+
Run the checked-in copy from the Nix development environment:
83+
84+
```bash
85+
nix develop . --command cargo run -p rizin-rs --example basic
86+
```
87+
88+
## Versioning
89+
90+
The crate's major/minor version tracks the compatible Rizin line. Alpha
91+
releases use `0.10.0-alpha.N`; once `0.10.0` is published, Rust-only fixes use
92+
the crate patch version while the exact Rizin source remains recorded by the
93+
Nix pin. See [RELEASING.md](RELEASING.md) for the release order.
6694

6795
## License
6896

69-
[LICENSE]
97+
The safe `rizin-rs` wrapper is released under
98+
[CC0-1.0](https://github.com/b1llow/rizin-rs/blob/main/LICENSE).
99+
The raw `rizin-sys` bindings and upstream Rizin are LGPL-3.0-only.
70100

71101
## Contributing
72102

RELEASING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Releasing
2+
3+
`rizin-rs` and `rizin-sys` release in lockstep. The `0.10` line targets Rizin
4+
`>=0.10.0, <0.11.0`; prereleases increment `alpha.N`, and the final `0.10.0`
5+
version is reserved until the bindings are ready to leave alpha.
6+
7+
For every release, update both the workspace package version and the exact
8+
`rizin-sys` requirement in `rizin-rs/Cargo.toml`, then refresh `Cargo.lock`.
9+
10+
## Verify the packages
11+
12+
Run the repository checks, then verify the raw bindings package first:
13+
14+
```bash
15+
nix develop . --command cargo publish --dry-run --locked -p rizin-sys
16+
nix develop . --command cargo package --list -p rizin-rs
17+
```
18+
19+
Cargo cannot fully package or dry-run `rizin-rs` until the exact `rizin-sys`
20+
version is available from the registry. Before that point, inspect its package
21+
list and rely on the workspace tests and Nix build to verify both crates
22+
together.
23+
24+
## Publish
25+
26+
Authenticate Cargo using a scoped crates.io token outside the repository, then
27+
publish in dependency order:
28+
29+
```bash
30+
nix develop . --command cargo publish --locked -p rizin-sys
31+
# Wait until 0.10.0-alpha.1 is visible in the crates.io index.
32+
nix develop . --command cargo publish --dry-run --locked -p rizin-rs
33+
nix develop . --command cargo publish --locked -p rizin-rs
34+
```
35+
36+
Create the matching `v0.10.0-alpha.1` source tag only after both uploads
37+
succeed. Published versions are immutable; yank a broken release and publish
38+
the next `alpha.N` instead of attempting to reuse its version.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
description = "Rust rizin bindings";
2+
description = "Safe Rust bindings for the Rizin reverse-engineering framework.";
33

44
inputs = {
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

nix/rizin-rs/default.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
2+
lib,
23
llvmPackages_18,
34
pkg-config,
45
rizin,
56
rustPlatform,
67
}:
78

9+
let
10+
workspaceManifest = lib.importTOML ../../Cargo.toml;
11+
in
812
rustPlatform.buildRustPackage {
913
pname = "rizin-rs";
10-
inherit (rizin) version;
14+
version = workspaceManifest.workspace.package.version;
1115

1216
src = ../..;
1317
cargoLock.lockFile = ../../Cargo.lock;

nix/rizin/checksum.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version": "0.10.0",
23
"rev": "26362e8c1888d4fec5d87068c08f313251cc64e1",
34
"srcHash": "sha256-CFDvgM4Ct5ZNsi/CnWxq9aOaAhklvkwZd8aupTLay2E=",
45
"mesonDepsHash": "sha256-MYRYrrhWbQRkHaYfSAxPMnhqxFFSb5xAHirqP8Zy2AY="

nix/rizin/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let
5959
} ./meson-deps-config-hook.sh;
6060
in
6161
rizin.overrideAttrs (prevAttrs: {
62-
version = "unstable-${builtins.substring 0 12 checksums.rev}";
62+
version = "${checksums.version}-unstable-${builtins.substring 0 12 checksums.rev}";
6363
inherit src mesonDeps;
6464
patches = builtins.filter (
6565
patch: builtins.baseNameOf patch != "0001-fix-compilation-with-clang.patch"

nix/rizin/update.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,22 @@ source_url="https://github.com/rizinorg/rizin/archive/$rev.tar.gz"
3939
echo "Prefetching Rizin source at $rev"
4040
prefetch_json=$(nix store prefetch-file --json --unpack "$source_url")
4141
src_hash=$(printf '%s\n' "$prefetch_json" | sed -n 's/.*"hash"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
42+
source_path=$(printf '%s\n' "$prefetch_json" | sed -n 's/.*"storePath"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
4243

4344
if [[ $src_hash != sha256-* ]]; then
4445
echo "Could not extract the Rizin source hash from: $prefetch_json" >&2
4546
exit 1
4647
fi
48+
if [[ ! -d $source_path ]]; then
49+
echo "Could not extract the unpacked Rizin source path from: $prefetch_json" >&2
50+
exit 1
51+
fi
52+
53+
upstream_version=$(sed -n "s/^[[:space:]]*version: 'v\([^']*\)',/\1/p" "$source_path/meson.build" | head -n 1)
54+
if [[ ! $upstream_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
55+
echo "Could not extract a three-part Rizin version from $source_path/meson.build" >&2
56+
exit 1
57+
fi
4758

4859
backup=$(mktemp)
4960
cp -- "$checksum_file" "$backup"
@@ -59,17 +70,18 @@ restore_on_error() {
5970
trap restore_on_error EXIT
6071

6172
write_checksums() {
62-
target_rev=$1
63-
target_src_hash=$2
64-
target_deps_hash=$3
73+
target_version=$1
74+
target_rev=$2
75+
target_src_hash=$3
76+
target_deps_hash=$4
6577
tmp=$(mktemp "${checksum_file}.tmp.XXXXXX")
66-
printf '{\n "rev": "%s",\n "srcHash": "%s",\n "mesonDepsHash": "%s"\n}\n' \
67-
"$target_rev" "$target_src_hash" "$target_deps_hash" >"$tmp"
78+
printf '{\n "version": "%s",\n "rev": "%s",\n "srcHash": "%s",\n "mesonDepsHash": "%s"\n}\n' \
79+
"$target_version" "$target_rev" "$target_src_hash" "$target_deps_hash" >"$tmp"
6880
mv -- "$tmp" "$checksum_file"
6981
}
7082

7183
fake_hash="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
72-
write_checksums "$rev" "$src_hash" "$fake_hash"
84+
write_checksums "$upstream_version" "$rev" "$src_hash" "$fake_hash"
7385

7486
echo "Calculating the Meson dependency hash"
7587
set +e
@@ -89,12 +101,13 @@ if [[ $meson_deps_hash != sha256-* ]]; then
89101
exit 1
90102
fi
91103

92-
write_checksums "$rev" "$src_hash" "$meson_deps_hash"
104+
write_checksums "$upstream_version" "$rev" "$src_hash" "$meson_deps_hash"
93105
echo "Validating Rizin and rizin-rs"
94106
nix build .#rizin --no-link --print-build-logs
95107
nix build .#rizin-rs --no-link --print-build-logs
96108

97109
echo "Updated nix/rizin/checksum.json"
110+
echo " version: $upstream_version"
98111
echo " rev: $rev"
99112
echo " srcHash: $src_hash"
100113
echo " mesonDepsHash: $meson_deps_hash"

rizin-rs/Cargo.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
[package]
22
name = "rizin-rs"
3-
version = "0.1.0"
4-
edition = "2024"
3+
version.workspace = true
4+
edition.workspace = true
5+
license = "CC0-1.0"
6+
description = "Safe Rust bindings for the Rizin reverse-engineering framework."
7+
repository.workspace = true
8+
readme.workspace = true
9+
keywords = ["rizin", "reverse-engineering", "binary-analysis", "bindings"]
10+
categories = ["development-tools"]
511

612
[[bench]]
713
name = "my_benchmark"
814
harness = false
915

1016
[dependencies]
1117
anyhow = "1.0.86"
12-
rizin-sys = { version = "0.9.1", path = "../rizin-sys" }
18+
rizin-sys = { version = "=0.10.0-alpha.1", path = "../rizin-sys" }
1319

1420
[dev-dependencies]
1521
criterion = { version = "0.7.0", features = ["html_reports"] }

0 commit comments

Comments
 (0)