"long-term profit" is the long-term financial returns to shareholders -- and corporate philanthropy is generally held to be justified in B-school circles only in so far as it builds up marketable goodwill (again, adding shareholder value), not for its own sake.
This is why some companies and interests are better off staying private. SpaceX is a perfect example. Musk doesn't want to be accountable to shareholders for return on investment and annual results.
At that point though, just about any reasonable actions can be justified even if they're not in the interests of immediate quarter earnings per share. And that's not what most people arguing that the board is legally required to maximize profits are talking about.