From 2ae7ca9cf2a8e5b94b6081360c0a776c91c96e42 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Thu, 30 Mar 2023 12:37:28 +0000 Subject: [PATCH] secp-sys: update README for new vendoring script Also a couple minor tweaks to the vendoring script itself. --- secp256k1-sys/README.md | 7 ++++--- secp256k1-sys/depend/secp256k1-HEAD-revision.txt | 2 +- secp256k1-sys/vendor-libsecp.sh | 8 ++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/secp256k1-sys/README.md b/secp256k1-sys/README.md index 2684d4c..cd50e56 100644 --- a/secp256k1-sys/README.md +++ b/secp256k1-sys/README.md @@ -20,11 +20,12 @@ This prefix ensures that no symbol collision can happen: To update the vendored sources, use the `vendor-libsecp.sh` script: ``` -$ ./vendor-libsecp.sh depend +$ ./vendor-libsecp.sh ``` -- Where `` is the secp256k1-sys version number underscored: `0_1_2`. -- Where `` is the git revision of libsecp256k1 to checkout. +Where `` is the git revision of libsecp256k1 to checkout. If you do not +specify a revision, the script will simply clone the repo and use whatever +revision the default branch is pointing to. ## Linking to external symbols diff --git a/secp256k1-sys/depend/secp256k1-HEAD-revision.txt b/secp256k1-sys/depend/secp256k1-HEAD-revision.txt index e105753..cd5bb0c 100644 --- a/secp256k1-sys/depend/secp256k1-HEAD-revision.txt +++ b/secp256k1-sys/depend/secp256k1-HEAD-revision.txt @@ -1,2 +1,2 @@ -# This file was automatically created by ./vendor-libsecp.sh +# This file was automatically created by vendor-libsecp.sh 21ffe4b22a9683cf24ae0763359e401d1284cc7a diff --git a/secp256k1-sys/vendor-libsecp.sh b/secp256k1-sys/vendor-libsecp.sh index c50fa27..1c84c8c 100755 --- a/secp256k1-sys/vendor-libsecp.sh +++ b/secp256k1-sys/vendor-libsecp.sh @@ -2,7 +2,11 @@ set -e # Set default variables -: "${SECP_VENDOR_GIT_ROOT:=$(git rev-parse --show-toplevel)}" +if [ -z "$SECP_VENDOR_GIT_ROOT" ]; then + SECP_VENDOR_GIT_ROOT="$(git rev-parse --show-toplevel)" +else + SECP_VENDOR_GIT_ROOT="$(realpath "$SECP_VENDOR_GIT_ROOT")" +fi SECP_SYS="$SECP_VENDOR_GIT_ROOT"/secp256k1-sys DEFAULT_VERSION_CODE=$(grep version "$SECP_SYS/Cargo.toml" | sed 's/\./_/g' | sed 's/.*"\(.*\)".*/\1/') DEFAULT_DEPEND_DIR="$SECP_SYS/depend" @@ -83,7 +87,7 @@ rm -rf .git/ || true popd # Record revision -echo "# This file was automatically created by $0" > ./secp256k1-HEAD-revision.txt +echo "# This file was automatically created by $(basename "$0")" > ./secp256k1-HEAD-revision.txt echo "$SOURCE_REV" >> ./secp256k1-HEAD-revision.txt # Patch source files