A groupoid generalisation of Leavitt path algebras