Fracture, plastic slip and damage: a common variational approach