{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/spack-compilers-yaml/latest.json",
  "title": "Spack compiler configuration file schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/spack/schemas/refs/heads/main/schemas/compilers.json",
    "sourceSha256": "a035f48c88cc7fc4f669e248efc3c66460dc30eaaf210d0d615916ba38e279f6",
    "fileMatch": [
      "**/*spack/**/compilers.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "compilers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "compiler": {
            "type": "object",
            "properties": {
              "paths": {
                "type": "object",
                "required": [
                  "cc",
                  "cxx",
                  "f77",
                  "fc"
                ],
                "properties": {
                  "cc": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cxx": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "f77": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fc": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "flags": {
                "type": "object",
                "properties": {
                  "cflags": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags for C compiler, e.g. -std=c11"
                  },
                  "cxxflags": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags for C++ compiler, e.g. -std=c++14"
                  },
                  "fflags": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags for Fortran 77 compiler, e.g. -ffixed-line-length-none"
                  },
                  "cppflags": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags for C preprocessor, e.g. -DFOO=1"
                  },
                  "ldflags": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags passed to the compiler driver during linking, e.g. -Wl,--gc-sections"
                  },
                  "ldlibs": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Flags for linker libraries, e.g. -lpthread"
                  }
                },
                "description": "Flags to pass to the compiler during compilation and linking",
                "additionalProperties": false
              },
              "spec": {
                "type": "string"
              },
              "operating_system": {
                "type": "string"
              },
              "target": {
                "type": "string"
              },
              "alias": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "modules": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "implicit_rpaths": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "boolean"
                  }
                ],
                "description": "List of non-default link directories to register at runtime as rpaths"
              },
              "environment": {
                "type": "object",
                "description": "Environment variable modifications to apply at runtime",
                "default": {},
                "properties": {
                  "set": {
                    "description": "Environment variables to set to specific values",
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "unset": {
                    "description": "Environment variables to remove/unset",
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "prepend_path": {
                    "description": "Environment variables to prepend values to (typically PATH-like variables)",
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "append_path": {
                    "description": "Environment variables to append values to (typically PATH-like variables)",
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "remove_path": {
                    "description": "Values to remove from PATH-like environment variables",
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  }
                },
                "additionalProperties": false
              },
              "extra_rpaths": {
                "type": "array",
                "default": [],
                "items": {
                  "type": "string"
                },
                "description": "List of extra rpaths to inject by Spack's compiler wrappers"
              }
            },
            "required": [
              "paths",
              "spec",
              "modules",
              "operating_system"
            ],
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
