use `$RANLIB` instead of `ranlib` in scripts

This allows users to set RANLIB environment variable which is useful for
cross building.