Place the mangoes into a large pot. 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, red pepper flakes, cumin seed, cardamom pods and seeds, cinnamon stick, and cloves. Stir to blend, and then cover the pot. Leave the pot sitting out at room temperature overnight.
The next day, place the pot over medium heat. Cook, stirring occasionally, until mixture begins to thicken, about 30 minutes. Stir in the vinegar and peppercorns; cook for 1 more minute. Cool before using.