Status: Tests succeed, looks complete.
This is based on top of #2243 (LevelDB build bugfixes).
This is necessary for proper downstream distro packaging, and useful for people who have LevelDB installed for other reasons anyway. Undocumented to infer an unsupported status, but I could add a brief blurb if that's desirable. Only implemented for Linux (ie, not makefile.<not-unix>) for now - I assume OSX and Windows won't be packaging LevelDB/Bitcoin themselves anytime soon. Note that this does NOT remove the copied leveldb from the code, and will still build with that by default.
To test with system LevelDB:
- Optional: Delete or move src/leveldb so any attempt to use it errors explicitly
- Install LevelDB on your system as a shared library
- qmake bitcoin-qt.pro USE_SYSTEM_LEVELDB=1 && make
- cd src
- make -f makefile.unix USE_SYSTEM_LEVELDB=1 bitcoind
- make -f makefile.unix USE_SYSTEM_LEVELDB=1 test_bitcoin
Step 6 (test_bitcoin) will fail if your system LevelDB does not support memenv. This is expected behaviour.
To test included LevelDB still works:
- Restore src/leveldb
- Remove system LevelDB library/package
- qmake bitcoin-qt.pro && make
- cd src
- make -f makefile.unix bitcoind
- make -f makefile.unix test_bitcoin
SIDE EFFECT: Bitcoin-Qt and bitcoind no longer include the LevelDB memenv module (only test_bitcoin uses it) - saves 423 KB