Crush the ginger and garlic using a mortar and pestle until they become a smooth paste.
Stir the paste into the mangoes.
Stir in the sugar, and season with salt, chili flakes, cumin seed, cardamom pods, cardamom seeds, cinnamon stick and cloves. Mix well and cover the pot. Leave the pot sitting out at room temperature overnight.
Place the pot over medium heat and cook, stirring occasionally, until mixture begins to thicken, about 30 minutes.
Stir in the vinegar and peppercorns and cook for another minute.