Skip to content

Commit e336dd0

Browse files
committed
Harden build_secp256k1.sh and copy to Flutter CMake install path
1 parent fc75073 commit e336dd0

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

scripts/linux/build_secp256k1.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
14
mkdir -p build
25
cd build
6+
37
if [ ! -d "secp256k1" ]; then
48
git clone https://github.com/bitcoin-core/secp256k1
59
fi
10+
611
cd secp256k1
712
git checkout 68b55209f1ba3e6c0417789598f5f75649e9c14c
813
git reset --hard
14+
915
rm -rf build
10-
mkdir -p build && cd build
16+
mkdir -p build
17+
cd build
1118
cmake .. -DSECP256K1_ENABLE_MODULE_RECOVERY=ON
1219
cmake --build .
20+
21+
SECP_SO="$(find lib -maxdepth 1 -type f -name 'libsecp256k1.so*' | sort | head -n1)"
22+
if [ -z "$SECP_SO" ]; then
23+
echo "[ERROR] libsecp256k1 shared library not found after build."
24+
exit 1
25+
fi
26+
27+
# Legacy location used by parts of the build pipeline.
1328
mkdir -p ../../../../../build
14-
cp lib/libsecp256k1.so.2.*.* "../../../../../build/libsecp256k1.so"
15-
cd ../../../
29+
cp "$SECP_SO" ../../../../../build/libsecp256k1.so
30+
31+
# Location expected by Flutter/CMake install step.
32+
mkdir -p ../../../../../build/linux/x64/release/secp256k1/lib
33+
cp "$SECP_SO" ../../../../../build/linux/x64/release/secp256k1/lib/libsecp256k1.so

0 commit comments

Comments
 (0)