I've done this a couple of ways off the truck alternator. One way is what blybrook describes. I had to put a relay and fuse into the power dist. box under the hood of the truck and then tie into that line with the "trailer tow battery" line on the 7-pin connector.
The other way, which will give a faster charge, is to get something like a Shure Power multi battery isolator, which is just a pair of big honkin' power diodes with cooling fins. Hang the isolator off the alternator, through a fuse, then back directly to the trailer battery with as be a wire as you can use. I use welding cable.
I honestly don't know whether the alternator does the charge controlling or if you need a separate one. It seems to me the alternator would cook the starting battery if it did not do charge control somehow. I should learn more about that. Anybody more knowledgeable have advice on that?
The solar panel may need an isolator if it does not come with one. Many of them do come with one. The solar panel may or may not need a charge controller depending on the power the panel is capable of. I'm in no way advocating you buy from We$t Marine, too spendy for me, but they have a good explanation on when you need a charge controller for solar panel charging:
google this phrase:
The West Advisor: Charging with Solar Panels - West Marine
PS If anyone wants to try an isolator, I have a spare one, a Shure Power model 1202 they can have for price of shipping...