build: fix unoptimized libraries in depends
Summary:
We need to append-to rather than set CXXFLAGS, otherwise we loose -O2 &
-pipe. Currently this results in zeromq being built without optimizations
at all (or whatever the compiler would default too, essentially always -O0).Bdb is the same, for the CXX portion of its code. C code has been built
with -O2.Boost has actually been uneffected because it receives -O3 from it's own
build flags.
Also use c++17 for protobuf
This is a backport of core#22840
Test Plan: gitian builds, guix build
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13983