From 8b4670db3e2e0da48d332a14e8eac0a45cbcb75c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 17 Jul 2021 19:50:35 -0700 Subject: [PATCH] ci: First phase of adding MingW support --- .appveyor.yml | 3 ++- ci/build.bat | 1 + ci/build.sh | 15 +++++++++++++++ configure.ac | 5 +++++ lib/Makefile.am | 4 ++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ci/build.bat diff --git a/.appveyor.yml b/.appveyor.yml index 976157d..a9636f0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,4 +12,5 @@ install: - sh: 'ci/install.sh' build_script: - - sh: 'ci/build.sh' + - sh: 'ci/build.sh' + - cmd: 'ci\build.bat' diff --git a/ci/build.bat b/ci/build.bat new file mode 100644 index 0000000..d69eb1b --- /dev/null +++ b/ci/build.bat @@ -0,0 +1 @@ +C:\msys64\usr\bin\bash --login -c 'set -x; cd "${APPVEYOR_BUILD_FOLDER}"; ci/build.sh' diff --git a/ci/build.sh b/ci/build.sh index f13bc02..0828c7d 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -1,5 +1,20 @@ #!/bin/sh +case "$(uname)" in + MSYS*|MINGW*) + pacman --noconfirm --remove mingw-w64-x86_64-gcc-ada + pacman --noconfirm --remove mingw-w64-x86_64-gcc-fortran + pacman --noconfirm --remove mingw-w64-x86_64-gcc-libgfortran + pacman --noconfirm --remove mingw-w64-x86_64-gcc-objc + pacman --noconfirm --sync --refresh + pacman --noconfirm --sync --needed diffutils + pacman --noconfirm --sync --needed make + pacman --noconfirm --sync --needed mingw-w64-x86_64-gcc + pacman --noconfirm --sync --needed mingw-w64-x86_64-cunit + export PATH="/mingw64/bin:$PATH" + ;; +esac + ./autogen.sh && ./configure --enable-manpages --enable-test-tool --enable-tests \ --enable-examples && diff --git a/configure.ac b/configure.ac index 9710b64..09d3170 100644 --- a/configure.ac +++ b/configure.ac @@ -19,10 +19,15 @@ case $host in AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])]) AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])]) ;; + *mingw*) + target_os_is_win32=true + ;; *) ;; esac +AM_CONDITIONAL([TARGET_OS_IS_WIN32], [test x$target_os_is_win32 = xtrue]) + AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], [Disables building with -Werror by default])]) diff --git a/lib/Makefile.am b/lib/Makefile.am index de05776..ed7ede4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,6 +8,10 @@ libiscsipriv_la_SOURCES = \ scsi-lowlevel.c socket.c sync.c task_mgmt.c \ logging.c +if TARGET_OS_IS_WIN32 +libiscsipriv_la_SOURCES += ../win32/win32_compat.c +endif + if !HAVE_LIBGCRYPT libiscsipriv_la_SOURCES += md5.c endif