Skip to content

Commit 1a81df8

Browse files
committed
Merge #1380: Add ABI checking tool for release process
74a4d97 doc: Add ABI checking with `check-abi.sh` to the Release Process (Hennadii Stepanov) e7f830e Add `tools/check-abi.sh` (Hennadii Stepanov) Pull request description: ACKs for top commit: real-or-random: ACK 74a4d97 it compares the right commits now jonasnick: re-Concept ACK 74a4d97 Tree-SHA512: bcca5246837f899d43ced3b0099a8e123f4fd2db7d15684bda22657649521db0c87f76696bfbd93b4dfdec6c4851e99c26c7e37cc5a1a78e9b1a296850a067fe
2 parents 77af1da + 74a4d97 commit 1a81df8

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

doc/release-process.md

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ build=$(mktemp -d)
3434
cmake -B $build -DCMAKE_INSTALL_PREFIX=$dir && cmake --build $build --target install && ls -RlAh $dir
3535
gcc -o ecdsa examples/ecdsa.c -I $dir/include -L $dir/lib*/ -l secp256k1 -Wl,-rpath,"$dir/lib",-rpath,"$dir/lib64" && ./ecdsa
3636
```
37+
4. Use the [`check-abi.sh`](/tools/check-abi.sh) tool to ensure there are no unexpected ABI incompatibilities and that the version number and release notes accurately reflect all potential ABI changes. To run this tool, the `abi-dumper` and `abi-compliance-checker` packages are required.
38+
39+
```shell
40+
tools/check-abi.sh
41+
```
3742

3843
## Regular release
3944

tools/check-abi.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
default_base_version="$(git describe --match "v*.*.*" --abbrev=0)"
6+
default_new_version="master"
7+
8+
display_help_and_exit() {
9+
echo "Usage: $0 <base_ver> <new_ver>"
10+
echo ""
11+
echo "Description: This script uses the ABI Compliance Checker tool to determine if the ABI"
12+
echo " of a new version of libsecp256k1 has changed in a backward-incompatible way."
13+
echo ""
14+
echo "Options:"
15+
echo " base_ver Specify the base version (default: $default_base_version)"
16+
echo " new_ver Specify the new version (default: $default_new_version)"
17+
echo " -h, --help Display this help message"
18+
exit 0
19+
}
20+
21+
if [ "$#" -eq 0 ]; then
22+
base_version="$default_base_version"
23+
new_version="$default_new_version"
24+
elif [ "$#" -eq 1 ] && { [ "$1" = "-h" ] || [ "$1" = "--help" ]; }; then
25+
display_help_and_exit
26+
elif [ "$#" -eq 2 ]; then
27+
base_version="$1"
28+
new_version="$2"
29+
else
30+
echo "Invalid usage. See help:"
31+
echo ""
32+
display_help_and_exit
33+
fi
34+
35+
checkout_and_build() {
36+
git worktree add -d "$1" "$2"
37+
cd "$1"
38+
mkdir build && cd build
39+
cmake -S .. --preset dev-mode \
40+
-DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=None -DCMAKE_C_FLAGS="-g -Og -gdwarf-4" \
41+
-DSECP256K1_BUILD_BENCHMARK=OFF \
42+
-DSECP256K1_BUILD_TESTS=OFF \
43+
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \
44+
-DSECP256K1_BUILD_CTIME_TESTS=OFF \
45+
-DSECP256K1_BUILD_EXAMPLES=OFF
46+
cmake --build . -j "$(nproc)"
47+
abi-dumper src/libsecp256k1.so -o ABI.dump -lver "$2"
48+
}
49+
50+
echo "Comparing $base_version (base version) to $new_version (new version)"
51+
echo
52+
53+
original_dir="$(pwd)"
54+
55+
base_source_dir=$(mktemp -d)
56+
checkout_and_build "$base_source_dir" "$base_version"
57+
58+
new_source_dir=$(mktemp -d)
59+
checkout_and_build "$new_source_dir" "$new_version"
60+
61+
cd "$original_dir"
62+
abi-compliance-checker -lib libsecp256k1 -old "${base_source_dir}/build/ABI.dump" -new "${new_source_dir}/build/ABI.dump"
63+
git worktree remove "$base_source_dir"
64+
git worktree remove "$new_source_dir"

0 commit comments

Comments
 (0)