How the energy in waves originally came from the Sun?

The energy from waves is usually caused by the wind; the wind is caused by temperature differences among different parts of Earth; and these temperature differences are caused by the sunlight.