Combine tomatoes, sugar, lemon juice, ginger, basil, red pepper flakes, salt, cinnamon, and cumin in a large, heavy-bottomed pot and bring to a boil over medium-high heat, stirring frequently. Reduce heat and simmer until the mixture reaches a thick, jam like consistency, about 2 ½ hours. Stir in the pectin (if using) and simmer for one minute more.
If you are going to preserve the jam, prepare the jars and lids when the jam is nearly ready: place three half-pint jars on a rack in a large pot. Add enough water to cover the jars, and bring to boil over high heat. Boil for 10 minutes, then turn off heat and allow the jars to rest in the hot water. Meanwhile, put bands and lids in a small saucepan and cover with water. Heat over medium heat until the water is simmering, then remove the pan from heat and allow the bands and lids to rest in hot water until ready to use.
Ladle the hot jam into hot sterilized jars, leaving 1/4-inch headspace.
Wipe rims of the jars, cover with lids, and screw bands on until just barely tight. Place jars on a rack in the pot and cover completely with water. Cover pot and bring to a boil over high heat. Boil for 15 minutes. Turn off heat, uncover pot, and allow jars to rest in water for five minutes. Remove jars from the pot and allow them to rest undisturbed on the countertop for six hours or overnight.