-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build the secp256k1
C files separately
#23
Conversation
Simplify the `main` function a little by moving out some code.
Move some more code out from the `main` function to keep it easier to read. Also renamed the function so that it better conveys that it's a check returning a `bool`.
Make setting them more consistent.
A helper function to configure the build's language standard and to automatically enable or disable C++ support. This allows moving some more code out of `main`, but it is also preparing for running more than one build, for splitting the `secp256k1` library.
This just moves the code that configures the build for `secp256k1p`, but the plan is to have this function perform an independent build.
Remove the current Clang warning about compiling C code using C++ mode, and also avoid errors in the future when the `zcash` dependency is updated.
bb3eb45
to
357a889
Compare
.include("depend/zcash/src/secp256k1") | ||
// Some ecmult stuff is defined but not used upstream | ||
.flag_if_supported("-Wno-unused-function") | ||
.flag_if_supported("-Wno-unused-parameter"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need /wd4100
here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. At least there wasn't anything from CI 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but I'd like @oxarbitrage to do the final check.
Make it easy to understand what it is without having the reader to look it up. Co-authored-by: teor <teor@riseup.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me too.
Clang currently warns that building C files using C++ mode is deprecated. This happens because the
secp256k1
C files are built together with the C++ files. This will get worse in the future because when updating thezcash
dependency, the C files will lead to compiler errors due to subtle language version differences.This PR solves both issues by building the
secp245k1
C files separately from the other Zcash C++ files. The resultinglibsecp256k1.a
andlibzcash_script.a
binaries are then available to be linked into the final Rust binary.The PR also includes a few refactors to make the
main
function more concise and easier to read and update.