Refactor more code in libretro-build-common.sh