We derive a linear program for minimization, subject to a linear constraint, of an arbitrary positively homogeneous convex functional, whose dual set is given by linear inequalities, possibly involving auxiliary variables. This allows to reduce to linear programming individual and cooperative portfolio optimization problems with arbitrary deviation measures whose risk envelopes are given by a finite number of linear constraints. Earlier, such linear programs were known only for individual porfolio optimization problems with special examples of deviation measures, such as mean absolute deviation or CVaR deviation.