Use ls -l / awk instead of stat during building.

I think this is posix compliant, and it works on os x.