name: Build libmysqlclient
inputs:
  configurationParameters:
    default: ''
    required: false
  libmysql:
    required: true
runs:
  using: composite
  steps:
    - shell: bash
      run: |
        set -x
        LIBMYSQL=${{ inputs.libmysql }}
        MYSQL_BASE=${LIBMYSQL%%-linux-*}
        MYSQL_DIR=$HOME/$MYSQL_BASE
        mkdir -p $MYSQL_DIR
        URL=https://downloads.mysql.com/archives/get/p/23/file/$LIBMYSQL
        wget -nv $URL
        tar -xf $LIBMYSQL --strip-components=1 -C $MYSQL_DIR
        PDO_MYSQL=${MYSQL_DIR}
        ./buildconf --force
        ./configure ${{ inputs.configurationParameters }} \
          --enable-option-checking=fatal \
          --disable-all \
          --enable-pdo \
          --with-pdo-mysql=${PDO_MYSQL}
        make clean
        make -j$(/usr/bin/nproc) >/dev/null
