There is a need to have libsecp256k1 on its own for 3rd parties to use. This script can extract libsecp256k1 from a clone of the Bitcoin ABC repository.
Details
- Reviewers
jasonbcox - Group Reviewers
Restricted Project - Commits
- rSTAGING6de391d11463: Add a facility to extract libsecp256k1 from the repository
rABC6de391d11463: Add a facility to extract libsecp256k1 from the repository
Run the script and ensure the generated repository looks good.
Running the script takes a long time, so plan accordingly.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- extractlib
- Lint
Lint Passed Severity Location Code Message Advice contrib/extract-secp256k1.sh:24 SC1004 ShellCheck found an issue: Advice contrib/extract-secp256k1.sh:25 SC1004 ShellCheck found an issue: Advice contrib/extract-secp256k1.sh:27 SC1004 ShellCheck found an issue: Advice contrib/extract-secp256k1.sh:28 SC1004 ShellCheck found an issue: - Unit
No Test Coverage - Build Status
Buildable 8733 Build 15450: Default Diff Build & Tests Build 15449: arc lint + arc unit
Event Timeline
contrib/extract-secp256k1.sh | ||
---|---|---|
4 ↗ | (On Diff #15133) | Rather than follow the linter's advice regarding pushd ... || exit, use something like set -euo pipefail instead. The set -eu is also good practice either way. |
9 ↗ | (On Diff #15133) | use mktemp -d rather than a hardcoded workdir. |
26 ↗ | (On Diff #15133) | Call this in an exit trap that is set right after the creation of the directory so that it cleans up if the script fails at any point. |
contrib/extract-secp256k1.sh | ||
---|---|---|
8 ↗ | (On Diff #15150) | wokdir -> workdir |
contrib/extract-secp256k1.sh | ||
---|---|---|
36 ↗ | (On Diff #15168) | This will fail if secp256k1 already exists. Since the script takes a long time to run, the beginning of the script should bail early if this output dir already exists. |
Note that some cmake modules (from cmake/modules) are required to build secp256k1 with cmake.
This can be easily solved by copying the necessary files to new repo and setting the module path accordingly.
I can do it in a follow-up if desired.
Nit: I would prefer quoted echo statements, but this is probably best left to a linter.
This produces some lint advice (the only output right now if you run arc lint --everything)
>>> Lint for contrib/extract-secp256k1.sh: Advice (SC1004) ShellCheck found an issue: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. 26 27 pushd "${WORKDIR}" 28 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch \ >>> 29 --index-filter 'git ls-files \ ^ 30 | grep -v "^cmake\|^src/secp256k1" \ 31 | xargs git rm -q --cached; 32 git ls-files -s \ Advice (SC1004) ShellCheck found an issue: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. 27 pushd "${WORKDIR}" 28 FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch \ 29 --index-filter 'git ls-files \ >>> 30 | grep -v "^cmake\|^src/secp256k1" \ ^ 31 | xargs git rm -q --cached; 32 git ls-files -s \ 33 | sed "s%src/secp256k1/%%" \ Advice (SC1004) ShellCheck found an issue: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. 29 --index-filter 'git ls-files \ 30 | grep -v "^cmake\|^src/secp256k1" \ 31 | xargs git rm -q --cached; >>> 32 git ls-files -s \ ^ 33 | sed "s%src/secp256k1/%%" \ 34 | git update-index --index-info; 35 git rm -rq --cached --ignore-unmatch src/secp256k1' \ Advice (SC1004) ShellCheck found an issue: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. 30 | grep -v "^cmake\|^src/secp256k1" \ 31 | xargs git rm -q --cached; 32 git ls-files -s \ >>> 33 | sed "s%src/secp256k1/%%" \ ^ 34 | git update-index --index-info; 35 git rm -rq --cached --ignore-unmatch src/secp256k1' \ 36 --prune-empty -- --all