A mean-field calculation of the equation of state of supernova matter