Hydrodynamic collimation of gamma-ray-burst fireballs