Fix some issues with generated pc files

 - Use #opt_prefix instead of #prefix or HOMEBREW_PREFIX
 - Use #version rather than hardcoded strings or @version
 - Unify pc file method naming
 - Use String#undent

Closes #18695.
iphotoexport: don't use ivars directly