Rangers agree permanent deal with Defoe