-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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,64 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
default_base_version="$(git describe --match "v*.*.*" --abbrev=0)" | ||
default_new_version="master" | ||
|
||
display_help_and_exit() { | ||
echo "Usage: $0 <base_ver> <new_ver>" | ||
echo "" | ||
echo "Description: This script uses the ABI Compliance Checker tool to determine if the ABI" | ||
echo " of a new version of libsecp256k1 has changed in a backward-incompatible way." | ||
echo "" | ||
echo "Options:" | ||
echo " base_ver Specify the base version (default: $default_base_version)" | ||
echo " new_ver Specify the new version (default: $default_new_version)" | ||
echo " -h, --help Display this help message" | ||
exit 0 | ||
} | ||
|
||
if [ "$#" -eq 0 ]; then | ||
base_version="$default_base_version" | ||
new_version="$default_new_version" | ||
elif [ "$#" -eq 1 ] && { [ "$1" = "-h" ] || [ "$1" = "--help" ]; }; then | ||
display_help_and_exit | ||
elif [ "$#" -eq 2 ]; then | ||
base_version="$1" | ||
new_version="$2" | ||
else | ||
echo "Invalid usage. See help:" | ||
echo "" | ||
display_help_and_exit | ||
fi | ||
|
||
checkout_and_build() { | ||
git worktree add -d "$1" "$2" | ||
cd "$1" | ||
mkdir build && cd build | ||
cmake -S .. --preset dev-mode \ | ||
-DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=None -DCMAKE_C_FLAGS="-g -Og -gdwarf-4" \ | ||
-DSECP256K1_BUILD_BENCHMARK=OFF \ | ||
-DSECP256K1_BUILD_TESTS=OFF \ | ||
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \ | ||
-DSECP256K1_BUILD_CTIME_TESTS=OFF \ | ||
-DSECP256K1_BUILD_EXAMPLES=OFF | ||
cmake --build . -j "$(nproc)" | ||
abi-dumper src/libsecp256k1.so -o ABI.dump -lver "$2" | ||
} | ||
|
||
echo "Comparing $base_version (base version) to $new_version (new version)" | ||
echo | ||
|
||
original_dir="$(pwd)" | ||
|
||
base_source_dir=$(mktemp -d) | ||
checkout_and_build "$base_source_dir" "$base_version" | ||
|
||
new_source_dir=$(mktemp -d) | ||
checkout_and_build "$new_source_dir" "$new_version" | ||
|
||
cd "$original_dir" | ||
abi-compliance-checker -lib libsecp256k1 -old "${base_source_dir}/build/ABI.dump" -new "${new_source_dir}/build/ABI.dump" | ||
git worktree remove "$base_source_dir" | ||
git worktree remove "$new_source_dir" |