Skip to content

Commit 2a74f9e

Browse files
authored
Enable build on travis windows (#163)
1 parent 4733d4e commit 2a74f9e

File tree

1 file changed

+56
-15
lines changed

1 file changed

+56
-15
lines changed

.travis.yml

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: cpp
22
os:
33
- linux
44
- osx
5+
- windows
56
compiler:
67
- gcc
78
- clang
@@ -10,29 +11,57 @@ env:
1011
- DEBUG="nodebug" COVERAGE="nocoverage"
1112
- LINKING="static"
1213
before_install:
14+
- ps -ef
15+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi
1316
- eval "${MATRIX_EVAL}"
14-
- export LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib"
15-
- export PATH=$PATH:/usr/local/lib
16-
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
17-
- export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib
17+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then export LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib"; fi
18+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then export PATH=$PATH:/usr/local/lib; fi
19+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib; fi
20+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib; fi
1821
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install info install-info; fi
1922
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip install codecov; fi
2023
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip install gcovr; fi
2124
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install cppcheck; fi
2225
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export CFLAGS='-mtune=generic'; fi
26+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install -r --no-progress -y msys2 make; fi
27+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then PATH=$PATH:/c/tools/msys64/usr/bin/ ; fi
28+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then powershell -executionpolicy bypass "pacman -Syu --noconfirm autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre" ; fi
29+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then
30+
ln -s /c/tools/msys64/usr/share/autoconf* /usr/share/ ;
31+
ln -s /c/tools/msys64/usr/share/automake* /usr/share/ ;
32+
ln -s /c/tools/msys64/usr/share/aclocal* /usr/share/ ;
33+
ln -s /c/tools/msys64/usr/share/libtool* /usr/share/ ;
34+
ln -s /c/tools/msys64/usr/share/pkgconfig /usr/share/ ;
35+
ln -s /c/tools/msys64/usr/bin/autom4te /usr/bin/ ;
36+
ln -s /c/tools/msys64/usr/bin/autoconf /usr/bin/ ;
37+
ln -s /c/tools/msys64/usr/bin/autoheader /usr/bin/ ;
38+
ln -s /c/tools/msys64/usr/bin/m4 /usr/bin/ ;
39+
40+
PATH=$PATH:/c/tools/msys64/usr/bin/ ;
41+
export SHELL=/usr/bin/sh.exe ;
42+
fi
2343
- curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz
24-
- tar -xvzf libmicrohttpd-0.9.59.tar.gz
44+
- tar -xzf libmicrohttpd-0.9.59.tar.gz
2545
- cd libmicrohttpd-0.9.59
26-
- if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; else ./configure --disable-examples; fi
46+
- if [[ "$ARM_ARCH_DIR" != "" ]]; then
47+
./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples;
48+
elif [[ "$TRAVIS_OS_NAME" = "windows" ]]; then
49+
./configure --prefix=/usr --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-examples --disable-https --enable-shared --enable-static ;
50+
else
51+
./configure --disable-examples;
52+
fi
53+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then find . -name Makefile -type f -exec sed -i "s/\${SHELL}/\/usr\/bin\/sh.exe/" "{}" + ; fi
54+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then find . -name Makefile -type f -exec sed -i "s/\$(SHELL)/\/usr\/bin\/sh.exe/" "{}" + ; fi
2755
- make
28-
- sudo make install
56+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then make install; else sudo make install; fi
2957
- cd ..
3058
- if [ "$BUILD_TYPE" = "asan" ]; then export CFLAGS='-fsanitize=address'; export CXXLAGS='-fsanitize=address'; export LDFLAGS='-fsanitize=address'; fi
3159
- if [ "$BUILD_TYPE" = "msan" ]; then export CFLAGS='-fsanitize=memory'; export CXXLAGS='-fsanitize=memory'; export LDFLAGS='-fsanitize=memory'; fi
3260
- if [ "$BUILD_TYPE" = "lsan" ]; then export CFLAGS='-fsanitize=leak'; export CXXLAGS='-fsanitize=leak'; export LDFLAGS='-fsanitize=leak'; fi
3361
- if [ "$BUILD_TYPE" = "tsan" ]; then export CFLAGS='-fsanitize=thread'; export CXXLAGS='-fsanitize=thread'; export LDFLAGS='-fsanitize=thread'; fi
3462
- if [ "$BUILD_TYPE" = "ubsan" ]; then export export CFLAGS='-fsanitize=undefined'; export CXXLAGS='-fsanitize=undefined'; export LDFLAGS='-fsanitize=undefined'; fi
3563
install:
64+
- ps -ef
3665
- if [[ "$CROSS_COMPILE" == 1 ]] ; then
3766
if [[ "$ARM_ARCH_DIR" == "aarch64-linux-gnu" ]] ; then
3867
mkdir $HOME/linker_bin ;
@@ -45,7 +74,12 @@ install:
4574
- ./bootstrap
4675
- mkdir build
4776
- cd build
48-
- if [ "$LINKING" = "static" ]; then
77+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then
78+
../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-fastopen --disable-examples CPPFLAGS='-I/c/tools/msys64/mingw64/include/ -I/usr/include/' LDFLAGS='-L/c/tools/msys64/mingw64/lib -L/usr/lib/' ;
79+
cd .. ;
80+
find . -name Makefile -type f -exec sed -i "s/\$(SHELL)/\/usr\/bin\/sh.exe/" "{}" + ;
81+
cd build ;
82+
elif [ "$LINKING" = "static" ]; then
4983
../configure --enable-static --disable-fastopen;
5084
elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then
5185
../configure --enable-debug --enable-coverage --disable-shared --disable-fastopen;
@@ -63,8 +97,9 @@ install:
6397
- if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' libtool; fi
6498
- if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' Makefile; fi
6599
- make
66-
- make check TESTS=
100+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then make check TESTS= ; fi
67101
script:
102+
- ps -ef
68103
- if [[ "$CROSS_COMPILE" == 1 ]]; then
69104
cd test ;
70105
if [[ "$ARM_ARCH_DIR" == "aarch64-linux-gnu" ]]; then
@@ -85,12 +120,10 @@ script:
85120
qemu-arm -L /usr/arm-linux-gnueabi/ ./.libs/threaded ;
86121
fi
87122
fi
88-
- make check
89-
- cat test/test-suite.log
123+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then make check ; fi
124+
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then cat test/test-suite.log; fi
90125
- if [ "$VALGRIND" = "valgrind" ]; then make check-valgrind; fi;
91126
- if [ "$VALGRIND" = "valgrind" ]; then cat test/test-suite-memcheck.log; fi;
92-
- ls -l /usr/local/lib/
93-
- ls -l /usr/lib/
94127
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ../src/; cppcheck --error-exitcode=1 .; cd ../build; fi
95128
- |
96129
if [ "$PERFORMANCE" = "select" ]; then
@@ -110,15 +143,23 @@ script:
110143
./benchmark_threads 8080 &
111144
sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext
112145
fi
146+
after_script:
147+
- ps -ef
148+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi
149+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then gpgconf --kill gpg-agent ; fi
150+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then taskkill //F //PID $(ps -Wla | tr -s ' ' | grep gpg | cut -f2 -d' ') ; fi
151+
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi
152+
- echo $$
113153
after_success:
114154
- if [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then bash <(curl -s https://codecov.io/bash); fi
115155
matrix:
116156
exclude:
117157
- compiler: clang
118158
env: DEBUG="debug" COVERAGE="coverage"
119-
- compiler: clang
120-
env: LINKING='static'
159+
- os: windows
121160
include:
161+
- os: windows
162+
env: DEBUG="nodebug" COVERAGE="nocoverage" YARN_GPG=no
122163
- os: linux
123164
addons:
124165
apt:

0 commit comments

Comments
 (0)