Ab initio study of the X2Π and A2Σ+ states of OH. I. Potential curves and properties