Akorn posts 2Q profit, buys stake in eye drugmaker