I have noticed that it is not wether or not the planet has a starport that determins wether or not it can build spaceships. When selecting a planet from the starmap, the starport-button is either available for all planets that turn, or unavailable for all planets that turn. I have tried to find out under what conditions the button is available/unavailable, but have been unable to do so. The starport details button on the planet screen works fine though.