Moved database functions to lib/database.c

Function get_local_brightness() was moved to src/nextwall.c.
check-nextwall: Make sure the ann test doesn't fail when doing 'make distcheck'