build: work around missing readlink -f on Mac