1::
2:: Licensed under the Apache License, Version 2.0 (the "License");
3:: you may not use this file except in compliance with the License.
4:: You may obtain a copy of the License at
5::
6::     http://www.apache.org/licenses/LICENSE-2.0
7::
8:: Unless required by applicable law or agreed to in writing, software
9:: distributed under the License is distributed on an "AS IS" BASIS,
10:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11:: See the License for the specific language governing permissions and
12:: limitations under the License.
13::
14
15::
16:: Appveyor script for MINGW on MSYS2
17::
18
19::
20:: Installs third party packages we need for a cmake build
21::
22
23@ECHO ON
24SETLOCAL EnableDelayedExpansion
25
26CD build\appveyor || EXIT /B
27
28SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
29SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
30SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\..\install\%PROFILE%\%PLATFORM%
31SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
32
33
34:: PLATFORM is x86 or x64
35:: NORM_PLATFORM is 32 or 64
36IF "%PLATFORM%" == "x86" (
37    SET NORM_PLATFORM=32
38) ELSE (
39    SET NORM_PLATFORM=64
40)
41
42:: PLATFORM = x86 means MINGWPLAT i686
43:: PLATFORM = x64 means MINGWPLAT x86_64
44IF "%PLATFORM%" == "x86" (
45  SET MINGWPLAT=i686
46) ELSE (
47  SET MINGWPLAT=x86_64
48)
49
50
51:: compiler and generator detection
52SET COMPILER=gcc
53SET GENERATOR=MinGW Makefiles
54
55
56SET BASH=C:\msys64\usr\bin\bash.exe
57!BASH! -lc "sed -i '/export PATH=\/mingw32\/bin/d' ~/.bash_profile && sed -i '/export PATH=\/mingw64\/bin/d' ~/.bash_profile && echo 'export PATH=/mingw%NORM_PLATFORM%/bin:$PATH' >> ~/.bash_profile" || EXIT /B
58
59SET BUILDDIR=%BUILDDIR:\=/%
60SET BUILDDIR=/c!BUILDDIR:~2!
61SET INSTDIR=%INSTDIR:\=/%
62SET INSTDIR=/c!INSTDIR:~2!
63SET SRCDIR=%SRCDIR:\=/%
64SET SRCDIR=/c!SRCDIR:~2!
65
66CALL win_showenv.bat || EXIT /B
67
68
69SET PACKAGES=^
70  base-devel ^
71  mingw-w64-x86_64-toolchain ^
72  bison ^
73  flex ^
74  make ^
75  mingw-w64-%MINGWPLAT%-boost ^
76  mingw-w64-%MINGWPLAT%-cmake ^
77  mingw-w64-%MINGWPLAT%-libevent ^
78  mingw-w64-%MINGWPLAT%-openssl ^
79  mingw-w64-%MINGWPLAT%-toolchain ^
80  mingw-w64-%MINGWPLAT%-zlib
81
82::mingw-w64-%MINGWPLAT%-qt5 : WAY too large (1GB download!) - tested in cygwin builds anyway
83
84:: Upgrade things
85%BASH% -lc "pacman --noconfirm -Syu %IGNORE%" || EXIT /B
86%BASH% -lc "pacman --noconfirm -Syu %IGNORE%" || EXIT /B
87%BASH% -lc "pacman --noconfirm --needed -S %PACKAGES%" || EXIT /B
88
89
90:: These instructions are for a manual update of specific package versions.
91:: Fall back to this in case the above does not work anymore (broken upstream).
92:::: Updata the new key
93::%BASH% -lc "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-1~20210213-2-any.pkg.tar.xz" || EXIT /B
94::%BASH% -lc "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-1~20210213-2-any.pkg.tar.xz.sig" || EXIT /B
95::%BASH% -lc "pacman-key --verify msys2-keyring-1~20210213-2-any.pkg.tar.xz.sig" || EXIT /B
96::%BASH% -lc "pacman --noconfirm -U --config <(echo) msys2-keyring-1~20210213-2-any.pkg.tar.xz" || EXIT /B
97:::: Upgrade things
98::%BASH% -lc "pacman --noconfirm -Sy" || EXIT /B
99::%BASH% -lc "pacman --noconfirm -Udd https://repo.msys2.org/msys/x86_64/pacman-5.2.2-5-x86_64.pkg.tar.xz" || EXIT /B
100::%BASH% -lc "pacman --noconfirm --needed -S %PACKAGES%" || EXIT /B
101
102
103::
104:: Configure and build our software with cmake
105::
106
107SET CMAKEARGS=^
108  -G'%GENERATOR%' ^
109  -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
110  -DCMAKE_INSTALL_PREFIX=%INSTDIR% ^
111  -DCMAKE_MAKE_PROGRAM=/mingw%NORM_PLATFORM%/bin/mingw32-make ^
112  -DCMAKE_C_COMPILER=/mingw%NORM_PLATFORM%/bin/gcc.exe ^
113  -DCMAKE_CXX_COMPILER=/mingw%NORM_PLATFORM%/bin/g++.exe ^
114  -DOPENSSL_ROOT_DIR=/mingw%NORM_PLATFORM% ^
115  -DWITH_PYTHON=OFF
116
117%BASH% -lc "mkdir -p %BUILDDIR% && cd %BUILDDIR% && cmake.exe %SRCDIR% %CMAKEARGS% && cmake --build . --config %CONFIGURATION% && cmake --install . --config %CONFIGURATION%" || EXIT /B
118
119
120::
121:: Execute our tests
122::
123
124SET DISABLED_TESTS_COMMAND=--exclude-regex '%DISABLED_TESTS%'
125
126%BASH% -lc "cd %BUILDDIR% && ctest.exe --build-config %CONFIGURATION% --timeout 300 --extra-verbose %DISABLED_TESTS_COMMAND%" || EXIT /B
127