From 2fb9b8438e02a460d7c4e88b9da889f81fd1b3ea Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Sat, 9 Aug 2025 01:24:17 -0400 Subject: [PATCH 1/2] Add Windows fixes so abc compiles natively with GCC. --- Makefile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eeff20d24d..dbf7198c4d 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,11 @@ $(call abc_info,$(MSG_PREFIX)Using AR=$(AR)) $(call abc_info,$(MSG_PREFIX)Using LD=$(LD)) PROG := abc + OS := $(shell uname -s) +ifneq ($(filter MINGW%,$(OS)),) +OS := MINGW +endif MODULES := \ $(wildcard src/ext*) \ @@ -151,10 +155,15 @@ ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD)) LIBS += -ldl endif -ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin)) +ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin MINGW)) LIBS += -lrt endif +# For PathMatchSpecA. +ifeq ($(OS), MINGW) + LIBS += -lshlwapi +endif + ifdef ABC_USE_LIBSTDCXX LIBS += -lstdc++ $(call abc_info,$(MSG_PREFIX)Using explicit -lstdc++) @@ -164,7 +173,7 @@ $(call abc_info,$(MSG_PREFIX)Using CFLAGS=$(CFLAGS)) CXXFLAGS += $(CFLAGS) -std=c++17 -fno-exceptions SRC := -GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags +GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags $(PROG).in .PHONY: all default tags clean docs cmake_info @@ -231,9 +240,17 @@ clean: tags: etags `find . -type f -regex '.*\.\(c\|h\)'` +ifeq ($(OS), MINGW) +$(PROG): $(OBJ) + @echo "$(MSG_PREFIX)\`\` Constructing Response File:" $(notdir @$@.in) + $(file >$@.in,$^ $(LDFLAGS) $(LIBS)) + @echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@) + $(VERBOSE)$(LD) -o $@ @$@.in +else $(PROG): $(OBJ) @echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@) $(VERBOSE)$(LD) -o $@ $^ $(LDFLAGS) $(LIBS) +endif lib$(PROG).a: $(LIBOBJ) @echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@) From 59d061744b07fe3881a6906bc417f5b9f7ca744b Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 3 Apr 2026 00:03:19 +0100 Subject: [PATCH 2/2] CI: add MinGW/MSYS2 build workflow Add a new build-mingw.yml workflow that builds ABC using MinGW64/MSYS2 on windows-latest. This provides CI coverage for the MinGW build path added in the previous commit, using ABC_USE_STDINT_H=1 and -DWIN32 -DWIN32_NO_DLL to handle MinGW platform quirks. Co-developed-by: Claude Code v2.1.90 (claude-sonnet-4-6) --- .github/workflows/build-mingw.yml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build-mingw.yml diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml new file mode 100644 index 0000000000..f450380644 --- /dev/null +++ b/.github/workflows/build-mingw.yml @@ -0,0 +1,50 @@ +name: Build MinGW + +on: + push: + pull_request: + +jobs: + + build-mingw: + + runs-on: windows-latest + + defaults: + run: + shell: msys2 {0} + + steps: + + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + mingw-w64-x86_64-gcc + make + + - name: Git Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build + run: | + ABC_USE_STDINT_H=1 make -j$(nproc) CFLAGS="-DWIN32 -DWIN32_NO_DLL" abc + + - name: Test Executable + run: | + ./abc.exe -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec" + + - name: Stage Executable + run: | + mkdir -p staging + cp abc.exe staging/ + + - name: Upload package artifact + uses: actions/upload-artifact@v4 + with: + name: package-mingw + path: staging/