canonicalize libraries: script to convert from Apache format to Nginx

Merge of Vid's #533 with some fixes.