What did early civilizations due to adapt to a lack of rainfall?