From 4b4530619d5d8f25c2b9bb581a5cc098a96c62a6 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 26 Jun 2022 21:06:11 +0100 Subject: [PATCH 1/3] Fix casing of "BaseTsd.h" include Microsoft isn't consistent about the casing of header filenames in the Windows SDK and documentation (e.g. "Windows.h" vs. "windows.h"), but this doesn't matter on a case-insensitive filesystem. If you are cross-compiling for Windows (e.g. using gcc), then the case matters, and is practically controlled by the w32api headers provided by MinGW64 project. --- win32/regex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/regex.h b/win32/regex.h index 06a10906b..534bde742 100644 --- a/win32/regex.h +++ b/win32/regex.h @@ -12,7 +12,7 @@ extern "C" { #define CHARCLASS_NAME_MAX 14 #define RE_DUP_MAX 255 -#include +#include typedef SSIZE_T regoff_t; // #include From fb69d751344b37a8082737f93232d38b4813a037 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 26 Jun 2022 23:22:27 +0100 Subject: [PATCH 2/3] Fix Windows build with both ENABLED_SHARED and ENABLE_STATIC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define SOLV_STATIC_LIB for libsolv_static to avoid an error when building it for Windows: /work/libsolv/win32/getopt.c:11:14: error: variable ‘optind’ definition is marked dllimport /work/libsolv/win32/getopt.c:11:24: error: variable ‘opterr’ definition is marked dllimport /work/libsolv/win32/getopt.c:11:52: error: variable ‘__optreset’ definition is marked dllimport --- src/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbf30bac1..b07cd4e73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,6 +69,9 @@ INSTALL (TARGETS libsolv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DES IF (ENABLE_STATIC AND NOT DISABLE_SHARED) ADD_LIBRARY (libsolv_static STATIC ${libsolv_SRCS}) +IF (WIN32) + TARGET_COMPILE_DEFINITIONS(libsolv_static PUBLIC SOLV_STATIC_LIB) +ENDIF (WIN32) SET_TARGET_PROPERTIES(libsolv_static PROPERTIES OUTPUT_NAME "solv") SET_TARGET_PROPERTIES(libsolv_static PROPERTIES SOVERSION ${LIBSOLV_SOVERSION}) INSTALL (TARGETS libsolv_static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) From d5649cad1647a3cfe465e5ad2d2318c35917e230 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 27 Jun 2022 11:42:52 +0100 Subject: [PATCH 3/3] CI: Add build on Windows using gcc toolchain v2: Also run tests on Windows --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 750612728..c47e02620 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,31 @@ jobs: run: | cd build make test + + win32: + runs-on: windows-latest + steps: + - run: git config --global core.autocrlf input + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + pacboy: >- + toolchain:p + cmake:p + - name: Build + shell: msys2 {0} + run: | + mkdir build + cd build + export CFLAGS="-D__USE_MINGW_ANSI_STDIO=1" + # CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS doesn't work correctly in the + # presence of explicit dllexports for the gcc/binutils toolchain + export LDFLAGS="-Wl,--export-all-symbols" + cmake -DENABLE_STATIC=ON -DWITHOUT_COOKIEOPEN=ON .. + ninja + - name: Test + shell: msys2 {0} + run: | + cd build + export PATH="$(pwd)/src:$(pwd)/ext:${PATH}" + ninja test