The phonon spectra of LiH and LiD from density-functional perturbation theory