Merge pull request #367 from euanh/build-improvements

Use %dist correctly.