forked from wallix/redemption
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jamroot
287 lines (237 loc) · 7.01 KB
/
Jamroot
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
JAM_INCLUDE_PATH ?= jam ;
#############################
# Internal help (`bjam --help`/`b2 --help`)
#
# # Setting build variables
#
# List with `sed -E 's/.*\[ setvar ([^ ]+).*\] ;/\1/;t;d' jam/defines.jam`
#
# bjam -s FFMPEG_INC_PATH=$HOME/ffmpeg/includes ....
#
# `BOOST_STACKTRACE=1`: (debug only) compile with `boost_stacktrace_backtrace`.
# `REDEMPTION_FILTER_ERROR`: (runtime) Only with `BOOST_STACKTRACE=1`. no backtrace for specific error (see `src/core/error.hpp`). example: `export REDEMPTION_FILTER_ERROR=ERR_TRANSPORT_NO_MORE_DATA,ERR_SEC`.
# `NO_FFMPEG=1`: disable ffmpeg
#
# # Compilation
#
# (Extra `cxx_*` options list with `sed -E 's/^constant jln_[^[]+\[ jln-get-env ([^ ]+) : ([^]]+) \].*/\1 = \2/;t;d' jam/cxxflags.jam`)
#
# Compile executables without tests (as user):
#
# bjam exe libs
#
# and install (as administrator):
#
# bjam install
#
# Binaries are located by default in `/usr/local/bin`.
#
# ## Tests
#
# bjam tests
# bjam tests/utils` all tests in tests/utils
# bjam tests/utils.norec` tests selected by tests/utils/test_*.cpp
#
# Verbose tests:
#
# export REDEMPTION_LOG_PRINT=1
# bjam tests
#
# REDEMPTION_LOG_PRINT=e for error and debug only
# REDEMPTION_LOG_PRINT=d for debug only
# REDEMPTION_LOG_PRINT=w for other than info
#
#############################
include $(JAM_INCLUDE_PATH)/redemption-config.jam ;
include $(JAM_INCLUDE_PATH)/cxxflags.jam ;
include $(JAM_INCLUDE_PATH)/defines.jam ;
include $(JAM_INCLUDE_PATH)/includes.jam ;
include $(JAM_INCLUDE_PATH)/sanitizer.jam ;
include $(JAM_INCLUDE_PATH)/libs.jam ;
project redemption
: requirements
$(REDEMPTION_CXXFLAGS)
$(REDEMPTION_FFMPEG_FLAGS)
$(REDEMPTION_BOOST_STACKTRACE_FLAGS)
$(GCOV)
<cxxflags>-fno-rtti
<toolset>gcc:<cxxflags>-pipe
# <cxx-lto-default>on
# <cxx-stack-protector-default>on # strong, all
# <cxxflags>-fpie
: default-build release
;
include $(JAM_INCLUDE_PATH)/testing-coverage.jam ;
include $(JAM_INCLUDE_PATH)/ocr.jam ;
include $(JAM_INCLUDE_PATH)/redemption-dependencies.jam ;
obj program_options : $(PROGRAM_OPTIONS_SRC_PATH)/program_options.cpp ;
make test_libredrec : libredrec : @test_libredrec : <variant>san:<build>no ;
actions test_libredrec
{
# check is loadable
$(TOOLS_PATH)/redrec rec $(>) -h > /dev/null && :> $(<)
}
include $(REDEMPTION_PUBLIC_PATH)/targets.jam ;
actions gen_targets
{
./tools/bjam/gen_targets.py > targets.jam
./tools/bjam/gen_targets.py src/main/headlessclient.cpp |
sed 's#^obj #add_obj #;t
/^\s*</!d
s/^\s*</requirement_list += </
s/$/ ;/' \
| sort > projects/ClientQtGraphicAPI/redemption_deps.jam
}
explicit targets.jam ;
make targets.jam : : @gen_targets ;
## { test_web_video_mp4
explicit test_web_video_mp4 tests/web_video/test.mp4 generate_video ;
exe generate_video
:
$(REDEMPTION_TEST_PATH)/web_video/generate_video.cpp
src/utils/set_exception_handler_pretty_message.o
:
$(EXE_DEPENDENCIES_NO_SYSLOG)
$(FFMPEG_CXXFLAGS)
<library>libredrec
<library>ffmpeg
<library>png
<library>dl
;
actions run_web_video_mp4 {
set -e
TMP=/tmp/web_video_mp4_test/
VIDEO=$TMP/test.mp4
rm -f "$VIDEO"
mkdir -p $TMP
"$(>)" $VIDEO
cp "$(REDEMPTION_TEST_PATH)/web_video/test.html" "$TMP"
cd $TMP
python -m SimpleHTTPServer 4104 &
xdg-open 'http://0000:4104/test.html'
sleep 3
pkill -P $$
}
make tests/web_video/test.mp4 : generate_video : @run_web_video_mp4 ;
alias test_web_video_mp4 : tests/web_video/test.mp4 ;
## } test_web_video_mp4
explicit
install
instexe
install-bin
install-lib
install-share
install-etc
install-etc-themes
install-etc-ppocr
install-etc-ppocr-latin
install-etc-ppocr-latin-cyrillic
exe
libs
;
alias instexe : install-bin ;
alias install :
install-bin install-lib
install-etc
install-etc-themes
install-etc-ppocr
install-share
;
alias exe : rdpproxy rdpclient rdpinichecker ;
alias libs : libredrec ;
alias ocr_tools : display_learning extract_text ppocr_extract_text ;
alias install-etc-ppocr : install-etc-ppocr-latin install-etc-ppocr-latin-cyrillic ;
install install-bin
: exe
: <install-type>EXE
#<install-dependencies>on
: <location>$(INSTALLDIR)$(BIN_PREFIX)
;
install install-share
: [ glob "$(REDEMPTION_SYS_PATH)/share/rdpproxy/[^.k]*" ]
:
: <location>$(INSTALLDIR)$(SHARE_PREFIX)
;
install install-etc
: [ glob
$(REDEMPTION_ETC_DH_GLOG)
]
:
: <location>$(INSTALLDIR)$(ETC_PREFIX)
;
install install-etc-ppocr-latin
: [ glob $(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin/* ]
:
: <location>$(INSTALLDIR)$(ETC_PREFIX)/ppocr.latin
;
install install-etc-ppocr-latin-cyrillic
: [ glob $(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin-cyrillic/* ]
:
: <location>$(INSTALLDIR)$(ETC_PREFIX)/ppocr.latin-cyrillic
;
install install-etc-themes
: [ glob $(REDEMPTION_SYS_PATH)/etc/rdpproxy/themes/HOWTO ]
:
: <location>$(INSTALLDIR)$(ETC_PREFIX)/themes
;
install install-lib
: libs
:
: <location>$(INSTALLDIR)$(LIB_PREFIX)
;
exe redrec
:
$(REDEMPTION_SRC_PATH)/main/redrec.cpp
libredrec
:
$(EXE_DEPENDENCIES)
;
## ppocr resources {
exe ppocr_write_glyphs :
$(PPOCR_SRC_PATH)/ppocr/write_glyphs.cpp
ppocr
:
$(EXE_DEPENDENCIES_NO_SYSLOG)
;
exe ppocr_normalize_glyphs :
$(PPOCR_SRC_PATH)/ppocr/normalize_glyphs.cpp
ppocr
:
$(EXE_DEPENDENCIES_NO_SYSLOG)
;
exe ppocr_write_datas :
$(PPOCR_SRC_PATH)/ppocr/write_datas.cpp
ppocr
:
$(EXE_DEPENDENCIES_NO_SYSLOG)
;
actions make_ppocr_resources {
$(PPOCR_MODULE_PATH)/learning "$(>)"
# latin
cp $(PPOCR_MODULE_PATH)/resources/glyphs/normalized-glyphs-latin.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin/glyphs.txt
cp $(PPOCR_MODULE_PATH)/resources/datas/latin.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin/datas.txt
cp $(PPOCR_MODULE_PATH)/resources/dict_fr.trie \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin/dict.trie.txt
cp $(PPOCR_MODULE_PATH)/resources/words_lines-latin.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin/words_lines.txt
# latin-cyrillic
cp $(PPOCR_MODULE_PATH)/resources/glyphs/normalized-glyphs-latin-cyrillic.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin-cyrillic/glyphs.txt
cp $(PPOCR_MODULE_PATH)/resources/datas/latin-cyrillic.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin-cyrillic/datas.txt
cp $(PPOCR_MODULE_PATH)/resources/words_lines-latin-cyrillic.txt \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin-cyrillic/words_lines.txt
cp $(PPOCR_MODULE_PATH)/resources/dict_fr.trie \
$(REDEMPTION_SYS_PATH)/etc/rdpproxy/ppocr.latin-cyrillic/dict.trie.txt
}
explicit ppocr_resources ppocr_write_glyphs ppocr_normalize_glyphs ppocr_write_datas ;
make ppocr_resources :
ppocr_write_glyphs
ppocr_normalize_glyphs
ppocr_write_datas
:
@make_ppocr_resources
;
## } ppocr resources