Debian Codegraph @

LspCpp/third_party/ixwebsocket/makefile.dev

raw
1 #
2 # This makefile is used for convenience, and wrap simple cmake commands
3 # You don't need to use it as an end user, it is more for developer.
4 #
5 # * work with docker (linux build)
6 # * execute the unittest
7 #
8 # The default target will install ws, the command line tool coming with
9 # IXWebSocket into /usr/local/bin
10 #
11 #
12 all: brew
13
14 install: brew
15
16 -DCMAKE_INSTALL_PREFIX=/opt/homebrew
17
18 # Use -DCMAKE_INSTALL_PREFIX= to install into another location
19 # on osx it is good practice to make /usr/local user writable
20 # sudo chown -R `whoami`/staff /usr/local
21 #
22 # Those days (since Apple Silicon mac shipped), on macOS homebrew installs in /opt/homebrew, and /usr/local is readonly
23 #
24 # Release, Debug, MinSizeRel, RelWithDebInfo are the build types
25 #
26 # Default rule does not use python as that requires first time users to have Python3 installed
27 #
28 brew:
29 ifeq ($(shell uname),Darwin)
30 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_PREFIX=/opt/homebrew -DCMAKE_UNITY_BUILD=OFF -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; ninja)
31 else
32 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_UNITY_BUILD=OFF -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; ninja)
33 endif
34
35 # Docker default target. We've had problems with OpenSSL and TLS 1.3 (on the
36 # server side ?) and I can't work-around it easily, so we're using mbedtls on
37 # Linux for the SSL backend, which works great.
38 ws_mbedtls_install:
39 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_UNITY_BUILD=ON -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_ZLIB=OFF -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; ninja install)
40
41 ws:
42 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. && ninja)
43
44 ws_unity:
45 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_UNITY_BUILD=ON -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. && ninja)
46
47 ws_install:
48 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_TLS=1 -DUSE_WS=1 .. -DUSE_TEST=0 && ninja install)
49
50 ws_install_release:
51 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_TLS=1 -DUSE_WS=1 .. -DUSE_TEST=0 && ninja install)
52
53 ws_openssl_install:
54 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_OPEN_SSL=1 .. ; ninja install)
55
56 ws_mbedtls:
57 mkdir -p build && (cd build ; cmake -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; ninja)
58
59 ws_no_ssl:
60 mkdir -p build && (cd build ; cmake -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=Debug -DUSE_WS=1 .. ; ninja)
61
62 ws_no_python:
63 mkdir -p build && (cd build ; cmake -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_TLS=1 -DUSE_WS=1 .. ; ninja install)
64
65 uninstall:
66 xargs rm -fv < build/install_manifest.txt
67
68 tag:
69 git tag v"`sh tools/extract_version.sh`"
70
71 xcode:
72 cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 -GXcode && open ixwebsocket.xcodeproj
73
74 xcode_openssl:
75 cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 -DUSE_OPEN_SSL=1 -GXcode && open ixwebsocket.xcodeproj
76
77 .PHONY: docker
78
79 NAME := ${DOCKER_REPO}/ws
80 TAG := $(shell sh tools/extract_version.sh)
81 IMG := ${NAME}:${TAG}
82 LATEST := ${NAME}:latest
83 BUILD := ${NAME}:build
84
85 print_version:
86 @echo 'IXWebSocket version =>' ${TAG}
87
88 set_version:
89 sh tools/update_version.sh ${VERSION}
90
91 docker_test:
92 docker build -f docker/Dockerfile.debian -t bsergean/ixwebsocket_test:build .
93
94 docker:
95 git clean -dfx
96 docker build -t ${IMG} .
97 docker tag ${IMG} ${BUILD}
98
99 docker_push:
100 docker tag ${IMG} ${LATEST}
101 docker push ${LATEST}
102 docker push ${IMG}
103
104 deploy: docker docker_push
105
106 run:
107 docker run --cap-add sys_ptrace --entrypoint=sh -it bsergean/ws:build
108
109 # this is helpful to remove trailing whitespaces
110 trail:
111 sh third_party/remote_trailing_whitespaces.sh
112
113 format:
114 clang-format -i `find test ixwebsocket ws -name '*.cpp' -o -name '*.h'`
115
116 # That target is used to start a node server, but isn't required as we have
117 # a builtin C++ server started in the unittest now
118 test_server:
119 (cd test && npm i ws && node broadcast-server.js)
120
121 test:
122 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 ..)
123 (cd build ; ninja)
124 (cd build ; ninja -v test)
125
126 test_asan:
127 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 .. -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer")
128 (cd build ; ninja)
129 (cd build ; ctest -V .)
130
131 test_tsan_mbedtls:
132 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_MBED_TLS=1 -DUSE_TEST=1 .. -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer")
133 (cd build ; ninja)
134 (cd build ; ninja test)
135
136 test_tsan_openssl:
137 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_UNITY_BUILD=ON DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_OPENS_SSL=1 -DUSE_TEST=1 .. -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer")
138 (cd build ; ninja)
139 (cd build ; ninja test)
140
141 test_tsan_sectransport:
142 mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_OPENS_SSL=1 -DUSE_TEST=1 .. -DCMAKE_C_FLAGS="-fsanitize=thread -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=thread -fno-omit-frame-pointer")
143 (cd build ; ninja)
144 (cd build ; ninja test)
145
146 ws_test: ws
147 (cd ws ; env DEBUG=1 PATH=../ws/build:$$PATH bash test_ws.sh)
148
149 autobahn_report:
150 cp -rvf ~/sandbox/reports/clients/* ../bsergean.github.io/IXWebSocket/autobahn/
151
152 httpd:
153 clang++ --std=c++14 --stdlib=libc++ -o ixhttpd httpd.cpp \
154 ixwebsocket/IXSelectInterruptFactory.cpp \
155 ixwebsocket/IXCancellationRequest.cpp \
156 ixwebsocket/IXSocketTLSOptions.cpp \
157 ixwebsocket/IXUserAgent.cpp \
158 ixwebsocket/IXDNSLookup.cpp \
159 ixwebsocket/IXBench.cpp \
160 ixwebsocket/IXWebSocketHttpHeaders.cpp \
161 ixwebsocket/IXSelectInterruptPipe.cpp \
162 ixwebsocket/IXHttp.cpp \
163 ixwebsocket/IXSocketConnect.cpp \
164 ixwebsocket/IXSocket.cpp \
165 ixwebsocket/IXSocketServer.cpp \
166 ixwebsocket/IXNetSystem.cpp \
167 ixwebsocket/IXHttpServer.cpp \
168 ixwebsocket/IXSocketFactory.cpp \
169 ixwebsocket/IXConnectionState.cpp \
170 ixwebsocket/IXUrlParser.cpp \
171 ixwebsocket/IXSelectInterrupt.cpp \
172 ixwebsocket/IXSetThreadName.cpp \
173 -lz
174
175 httpd_linux:
176 g++ --std=c++14 -o ixhttpd httpd.cpp -Iixwebsocket \
177 ixwebsocket/IXSelectInterruptFactory.cpp \
178 ixwebsocket/IXCancellationRequest.cpp \
179 ixwebsocket/IXSocketTLSOptions.cpp \
180 ixwebsocket/IXUserAgent.cpp \
181 ixwebsocket/IXDNSLookup.cpp \
182 ixwebsocket/IXBench.cpp \
183 ixwebsocket/IXWebSocketHttpHeaders.cpp \
184 ixwebsocket/IXSelectInterruptPipe.cpp \
185 ixwebsocket/IXHttp.cpp \
186 ixwebsocket/IXSocketConnect.cpp \
187 ixwebsocket/IXSocket.cpp \
188 ixwebsocket/IXSocketServer.cpp \
189 ixwebsocket/IXNetSystem.cpp \
190 ixwebsocket/IXHttpServer.cpp \
191 ixwebsocket/IXSocketFactory.cpp \
192 ixwebsocket/IXConnectionState.cpp \
193 ixwebsocket/IXUrlParser.cpp \
194 ixwebsocket/IXSelectInterrupt.cpp \
195 ixwebsocket/IXSetThreadName.cpp \
196 -lz -lpthread
197 cp -f ixhttpd /usr/local/bin
198
199 # For the fork that is configured with appveyor
200 rebase_upstream:
201 git fetch upstream
202 git checkout master
203 git reset --hard upstream/master
204 git push origin master --force
205
206 # Legacy target
207 install_cmake_for_linux:
208 mkdir -p /tmp/cmake
209 (cd /tmp/cmake ; curl -L -O https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.tar.gz ; tar zxf cmake-3.14.0-Linux-x86_64.tar.gz)
210
211 # python -m venv venv
212 # source venv/bin/activate
213 # pip install mkdocs
214 doc:
215 mkdocs gh-deploy
216
217 change: format
218 vim ixwebsocket/IXWebSocketVersion.h docs/CHANGELOG.md
219
220 change_no_format:
221 vim ixwebsocket/IXWebSocketVersion.h docs/CHANGELOG.md
222
223 commit:
224 git commit -am "`sh tools/extract_latest_change.sh`"
225
226 .PHONY: test
227 .PHONY: build
228 .PHONY: ws