From polytropic to barotropic perfect fluids in general-relativistic hydrodynamics