A day after losing out on Zack Greinke, the Giants agreed to a five-year, $90 million deal with right-hander Jeff Samardzija.