Fluxes in M-theory on 7-manifolds: G-structures and Superpotential