Merge pull request #2946 from tkelman/appveyor-mingw RFC: add mingw to appveyor matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c63107b..1948fc8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -493,7 +493,11 @@ IF (BUILD_CLAR)
ENDIF ()
ENABLE_TESTING()
- ADD_TEST(libgit2_clar libgit2_clar -ionline)
+ IF (WINHTTP OR OPENSSL_FOUND)
+ ADD_TEST(libgit2_clar libgit2_clar -ionline)
+ ELSE ()
+ ADD_TEST(libgit2_clar libgit2_clar -v)
+ ENDIF ()
ENDIF ()
IF (TAGS)
diff --git a/appveyor.yml b/appveyor.yml
index d155485..c6a9f1d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -11,11 +11,32 @@ environment:
ARCH: 32
- GENERATOR: "Visual Studio 11 Win64"
ARCH: 64
+ - GENERATOR: "MSYS Makefiles"
+ ARCH: 32
+ - GENERATOR: "MSYS Makefiles"
+ ARCH: i686 # this is for 32-bit MinGW-w64
+ - GENERATOR: "MSYS Makefiles"
+ ARCH: 64
+matrix:
+ allow_failures:
+ - GENERATOR: "MSYS Makefiles"
+ ARCH: 32
+cache:
+- i686-4.9.2-release-win32-sjlj-rt_v3-rev1.7z
+- x86_64-4.9.2-release-win32-seh-rt_v3-rev1.7z
build_script:
- ps: |
+ if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
+ https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
+ Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
+ throw "There are newer queued builds for this pull request, failing early." }
mkdir build
cd build
- cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON .. -G"$env:GENERATOR"
- cmake --build . --config RelWithDebInfo
+ if ($env:GENERATOR -ne "MSYS Makefiles") {
+ cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON .. -G"$env:GENERATOR"
+ cmake --build . --config RelWithDebInfo
+ }
+- cmd: |
+ if "%GENERATOR%"=="MSYS Makefiles" (C:\MinGW\msys\1.0\bin\sh --login /c/projects/libgit2/script/appveyor-mingw.sh)
test_script:
- ps: ctest -V .
diff --git a/script/appveyor-mingw.sh b/script/appveyor-mingw.sh
new file mode 100755
index 0000000..48e0bad
--- /dev/null
+++ b/script/appveyor-mingw.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+cd `dirname "$0"`/..
+if [ "$ARCH" = "32" ]; then
+ echo 'C:\MinGW\ /MinGW' > /etc/fstab
+elif [ "$ARCH" = "i686" ]; then
+ f=i686-4.9.2-release-win32-sjlj-rt_v3-rev1.7z
+ if ! [ -e $f ]; then
+ curl -LsSO http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/$f
+ fi
+ 7z x $f > /dev/null
+ mv mingw32 /MinGW
+else
+ f=x86_64-4.9.2-release-win32-seh-rt_v3-rev1.7z
+ if ! [ -e $f ]; then
+ curl -LsSO http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/seh/$f
+ fi
+ 7z x $f > /dev/null
+ mv mingw64 /MinGW
+fi
+cd build
+cmake -D ENABLE_TRACE=ON -D BUILD_CLAR=ON .. -G"$GENERATOR"
+cmake --build . --config RelWithDebInfo
diff --git a/script/cibuild.sh b/script/cibuild.sh
index 8983dcc..82cf725 100755
--- a/script/cibuild.sh
+++ b/script/cibuild.sh
@@ -1,5 +1,15 @@
#!/bin/sh
+# Fail fast for superseded builds to PR's
+if ! [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
+ if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "Accept: application/vnd.travis-ci.2+json" \
+ https://api.travis-ci.org/repos/libgit2/libgit2/builds?event_type=pull_request | \
+ jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number") ]; then
+ echo "There are newer queued builds for this pull request, failing early."
+ exit 1
+ fi
+fi
+
if [ -n "$COVERITY" ];
then
./script/coverity.sh;
diff --git a/script/install-deps-linux.sh b/script/install-deps-linux.sh
index 347922b..3eb57ce 100755
--- a/script/install-deps-linux.sh
+++ b/script/install-deps-linux.sh
@@ -3,4 +3,4 @@
set -x
sudo apt-get -qq update &&
-sudo apt-get -qq install cmake libssh2-1-dev openssh-client openssh-server
+sudo apt-get -qq install cmake libssh2-1-dev openssh-client openssh-server jq
diff --git a/script/install-deps-osx.sh b/script/install-deps-osx.sh
index c2e0162..ad6a7b4 100755
--- a/script/install-deps-osx.sh
+++ b/script/install-deps-osx.sh
@@ -2,4 +2,4 @@
set -x
-brew install libssh2 cmake
+brew install libssh2 cmake jq
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h
index feedfec..a4a5a31 100644
--- a/src/win32/mingw-compat.h
+++ b/src/win32/mingw-compat.h
@@ -17,6 +17,13 @@
#define stat _stati64
#endif
+#if _WIN32_WINNT < 0x0600 && !defined(__MINGW64_VERSION_MAJOR)
+#undef MemoryBarrier
+void __mingworg_MemoryBarrier(void);
+#define MemoryBarrier __mingworg_MemoryBarrier
+#define VOLUME_NAME_DOS 0x0
+#endif
+
#endif
#endif /* INCLUDE_mingw_compat__ */
diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h
index 4789d63..8004bc1 100644
--- a/src/win32/msvc-compat.h
+++ b/src/win32/msvc-compat.h
@@ -15,6 +15,9 @@
typedef unsigned short mode_t;
typedef SSIZE_T ssize_t;
+#define strcasecmp(s1, s2) _stricmp(s1, s2)
+#define strncasecmp(s1, s2, c) _strnicmp(s1, s2, c)
+
#endif
#define GIT_STDLIB_CALL __cdecl
diff --git a/src/win32/posix.h b/src/win32/posix.h
index 9ac7843..4bc6bfe 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -32,8 +32,6 @@ extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
extern int p_inet_pton(int af, const char* src, void* dst);
-#define strcasecmp(s1, s2) _stricmp(s1, s2)
-#define strncasecmp(s1, s2, c) _strnicmp(s1, s2, c)
extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4);
extern int p_mkstemp(char *tmp_path);
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index b8b4f43..544b1eb 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -55,7 +55,7 @@ int p_ftruncate(int fd, git_off_t size)
return -1;
}
-#if !defined(__MINGW32__)
+#if !defined(__MINGW32__) || defined(MINGW_HAS_SECURE_API)
return ((_chsize_s(fd, size) == 0) ? 0 : -1);
#else
/* TODO MINGW32 Find a replacement for _chsize() that handles big files. */