Use pkg-config instead of absolute paths, optimise binary when installing, and other miscellaneous changes.