Development of magnetic shear in a flare-producing active region (Magara 2009)