name: cross compile with mingw-w64 on mac

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  cross-compile:
    strategy:
      fail-fast: false
      matrix:
        build-machine-os: [macos-14, macos-13, macos-12, macos-11]
        target: [i686-w64-mingw32,x86_64-w64-mingw32]

    runs-on: ${{ matrix.build-machine-os }}

    steps:
      - uses: actions/checkout@v4

      - run: brew install mingw-w64 gcc make automake autoconf file

      - run: ./autogen.sh

      - name: Run ./configure ...
        run: |
          ./configure \
              --host=${{ matrix.target }} \
              --disable-iconv \
              --disable-xml \
              --disable-json \
              --disable-yaml \
              --disable-pcre2 \
              CC=${{ matrix.target }}-gcc \
              CFLAGS='-v' \
              AR=${{ matrix.target }}-ar \
              RANLIB=${{ matrix.target }}-ranlib \
              WINDRES=${{ matrix.target }}-windres

      - run: make V=1

      - run: file ctags.exe | grep PE32
