Brazilian meat giant JBS has struck a deal to buy Australian ham and bacon producer Primo Smallgoods for A$1.45bn (US$1.26bn).