To make the rub, put the rub ingredients in a pestle and mortar and crush together. Reserve ½ tsp of the rub and set aside. Cut some slashes into the underside of the pork using a sharp knife, then pat the rub all over the flesh, avoiding the skin. Put on a plate, skin-side up, and leave to cure in the fridge for at least 3 hours.
Remove the pork from the fridge at least 30 minutes before cooking so it comes to room temperature. Heat the oven to 180°C/160°C fan/gas 4. Pat the reserved rub over the pork skin, and rub a little oil all over. Put the carrot, celery, onion, star anise, and bay leaves in a large flameproof roasting tin. Pour over a small glass of water, then place the pork on top, skin-side up. Roast for 1 hour 30 minutes.
Arrange the pears in the tin around the pork, coating them in the juices, and pour the cider into the tin, avoiding the pork skin (if the skin gets wet, you won’t end up with crisp crackling). Turn the oven up to 220°C/200°C fan/gas 7 and roast for a further 15–20 minutes. The pork skin should be crisp, and the pears glazed in the juices.
Remove the pork from the tin and leave to rest for 45 minutes. Transfer the pork to a serving platter. Gently lift the pears out of the tin and arrange next to the pork. Discard the carrot, celery, onion, and bay leaves, then skim some of the fat from the surface of the juices (you can transfer this fat to a jar and use it for cooking roast potatoes, making rillettes, etc.).
Put the roasting tin with the skimmed juices on the hob over a medium heat. Sprinkle in the flour and whisk it into the juices until smooth and thickened. Add a splash of hot water if it becomes too thick. Pour the gravy into a warm jug. Cut the pork into portions with a sharp knife, then serve with the roasted pear quarters, the gravy, and roast potatoes and steamed greens, if desired.