Former Peruvian President Alan García has died after shooting himself as police arrived at his home to arrest him over bribery allegations.