pipeline {
  agent none
  stages {
    stage('Build') {
      parallel {
        stage('Interop') {
          agent { label 'interop' }
          stages {
            stage('autoreconf') {
              steps {
                sh 'autoreconf --force --install'
              }
            }
            stage('configure') {
              steps {
                sh 'CFLAGS="-O0 -g -Wall" DESTDIR="${WORKSPACE}/target" ./configure'
              }
            }
            stage('make install') {
              steps {
                sh 'DESTDIR="${WORKSPACE}/target" make install'
              }
            }
            stage('restart httpd') {
              steps {
                sh 'sudo /usr/sbin/restart-httpd'
              }
            }
          }
        }
        stage('RHEL9') {
          agent { label 'rhel-9-x86_64' }
          stages {
            stage('autoreconf') {
              steps {
                sh 'autoreconf --force --install'
              }
            }
            stage('configure') {
              steps {
                sh 'CFLAGS="-O0 -g -Wall" DESTDIR="${WORKSPACE}/target" ./configure'
              }
            }
            stage('make install') {
              steps {
                sh 'DESTDIR="${WORKSPACE}/target" make install'
              }
            }
            stage('make dist') {
              steps {
                sh 'make dist'
              }
            }
          }
        }
        stage('FedoraRawhide') {
          agent { label 'fedora-rawhide-x86_64' }
          stages {
            stage('autoreconf') {
              steps {
                sh 'autoreconf --force --install'
              }
            }
            stage('configure') {
              steps {
                sh 'CFLAGS="-O0 -g -Wall" DESTDIR="${WORKSPACE}/target" ./configure'
              }
            }
            stage('make install') {
              steps {
                sh 'DESTDIR="${WORKSPACE}/target" make install'
              }
            }
            stage('make dist') {
              steps {
                sh 'make dist'
              }
            }
          }
        }
      }
    }
  }
}