Its been a couple of years since I used phonegap, but I believe it does all that for you. If not that, then there's definitely something that does because I remember using it.
Edit before posting: here's a quote from the PhoneGap Website:
Package mobile apps in the cloudPhoneGap Build takes the pain out of compiling PhoneGap apps. Get app-store ready apps without the headache of maintaining native SDKs. Our PhoneGap Build service does the work for you by compiling in the cloud.