On the origin of the grain-size spectrum of interstellar dust