build: Extract shapeless c+p dependency logic.