South African gold producers have reached a settlement with lawyers representing thousands of miners who contracted fatal lung disease, in the country's largest-ever class action suit.