From d35b46023a32c61297a5f9e539dc1d35039a74c3 Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 17 Jul 2025 18:33:32 -0400 Subject: [PATCH 1/2] Build code on MINGW64 --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a672782752..6ee5bfcb13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,12 +23,18 @@ jobs: - os: macos-latest cc: clang cxx: clang++ + - os: windows-latest + cc: gcc + cxx: g++ name: "Test (${{ matrix.os }}, ${{ matrix.cc }})" runs-on: ${{ matrix.os }} env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} + defaults: + run: + shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }} steps: - uses: actions/checkout@v4 @@ -45,6 +51,15 @@ jobs: run: | brew update brew install autoconf automake libtool wget ffmpeg + - name: Setup msys2 + if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + install: >- + mingw-w64-x86_64-autotools + mingw-w64-x86_64-ffmpeg + mingw-w64-x86_64-toolchain - name: configure run: ./autogen.sh --enable-static --disable-shared - name: make From 5b506b3521a0b2724016839877a9f30748e9f027 Mon Sep 17 00:00:00 2001 From: moi15moi Date: Thu, 17 Jul 2025 18:40:05 -0400 Subject: [PATCH 2/2] Add -municode flag to fix compilation on msys2 On msys2, when compiling, I was getting the error: undefined reference to `WinMain' msys2 package patched have a similar fix: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-ffms2/0001-ffmsindex-add-municode-ldflag.patch --- Makefile.am | 3 +++ configure.ac | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Makefile.am b/Makefile.am index 05631fda9c..644f3e14ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,9 @@ include_HEADERS = $(top_srcdir)/include/ffms.h $(top_srcdir)/include/ffmscompat. bin_PROGRAMS = src/index/ffmsindex src_index_ffmsindex_SOURCES = src/index/ffmsindex.cpp +if WINDOWS +src_index_ffmsindex_LDFLAGS = -municode +endif src_index_ffmsindex_LDADD = -lavutil src/core/libffms2.la .PHONY: test test-build test-clean test-sync test-run diff --git a/configure.ac b/configure.ac index b875b30911..79cb85dcee 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,8 @@ AS_CASE([$host], AC_ENABLE_SHARED AC_DISABLE_STATIC]) +AM_CONDITIONAL([WINDOWS], [case "$host_os" in mingw* | cygwin*) true ;; *) false ;; esac]) + AC_PROG_LIBTOOL if echo "$host" | $GREP "cygwin" >/dev/null 2>&1 && test "$enable_shared" = "yes"; then