Phase shaping of single-photon wave packets