Debian stable Clang:
  extends: .srb2ci

  stage: build

  when: on_success

  allow_failure: false

  artifacts:
    paths:
      - "build.clang/bin/"
      - "build.clang/src/config.h"
    expose_as: "clang"
    name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"

  variables:
    CC: clang
    CXX: clang
    WFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
    CFLAGS: -Wno-cast-align -Wno-implicit-const-int-float-conversion -Werror
    LDFLAGS: -Wl,-fuse-ld=gold

  script:
    - - |
          # apt_toolchain
          echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
      - apt-get install clang
      - |
          # apt_toolchain
          echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"

    - - |
          # apt_development
          echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
      - apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev libminiupnpc-dev
      - |
          # apt_development
          echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"

    - - |
          # cmake
          echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles"
      - cmake -B build.clang -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles"
      - |
          # cmake
          echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K"

    - - |
          # make
          echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
      - make --directory=build.clang --keep-going || make --directory=build.clang --keep-going
      - |
          # make
          echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"