For upstream

OK, here's a big pile of changes, mostly for updating licensing info as I've investigated in preparation for debian packaging.  Please review closely to see if my understanding of licensing matches yours.