Are you using/working with open source libaries/platform? Surely if you are active in a big community (say django), finding some gig to cover the salaries and buy you some time shouldn't be too difficult.
Btw, there is nothing to be ashamed of to work on others' ideas and projects, and 'mercenary coding' sounds a bit like you feel you are prostituting yourself, probably neither good for the ones in your team that will end up selling their services to keep the company afloat, nor for your customers.
What about your market ? if you think it's really dying, don't die with it. You should consider open source your product. Might bring more visibility, new customers and new "mercenary coding" ;)
If your market isn't dying and is small only if you focus on a national context, selling your team/product to someone having more connections to your market abroad could be an option, but will likely have an impact on your team, and on your product. Is this worthwhile ?
Bonne chance.