cffi: Support using `--system-zstd`
- Refactor
make_cffi.pyto avoid performing the compilation in global scope, and allow passing parameters - Support
--system-zstdwith the CFFI backend. This uses the C preprocessor to find the system headers for, well, further preprocessing.
With these changes, I can successfully build the CFFI extension using system zstd library, and have it pass tests. I've also confirmed that it builds fine after removing the zstd directory entirely.
Sure, will do that now.
Rebased and updated.
Hmm, I wonder what's different about zstd on macOS that it fails. Unfortunately, I don't have a macOS system to test.
Wow - that was a quick rebase!
The macOS failure looks legit. We'll need to figure out a path forward there. And I'm pressed for time today. I was planning to cut a release this weekend to help with 3.14 support. So we'll have to defer this to the next release.
Yeah, no problem with that. As a last resort, I suppose we could limit system zstd + CFFI to Linux, I guess, and force CFFI with vendored libs elsewhere.
I went for the next best thing, I think: I've added a separate --system-zstd-cffi switch, so that both variants can switch between system and vendored library separately.