-
Notifications
You must be signed in to change notification settings - Fork 86
/
Jamroot
316 lines (263 loc) · 7.12 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
JAM_INCLUDE_PATH ?= jam ;
#############################
# Internal help (`bjam --help`/`b2 --help`)
#
# # Setting build variables
#
# List with `bjam env_help`.
#
# bjam -s FFMPEG_INC_PATH=$HOME/ffmpeg/includes ...
#
# Or with a shell variable
#
# export FFMPEG_INC_PATH=$HOME/ffmpeg/includes
# bjam ....
#
# # Compilation
#
# (show `cxx_*` options with `bjam cxx_help`)
# (default configration with `bjam print_default`)
#
# Compile executables without tests (as user):
#
# bjam exe libs
#
# and install (as administrator):
#
# bjam install
#
# Binaries are located by default in `/usr/local/bin`.
#
# # Install only resources without executable and library
#
# bjam install-resources
#
# With this, executables created by bjam (bin folder) can be run without installation.
#
# ## 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 ;
include $(REDEMPTION_PUBLIC_PATH)/targets.jam ;
actions gen_targets
{
./tools/bjam/gen_targets.py > targets.jam
}
explicit targets.jam ;
make targets.jam : : @gen_targets ;
rule bjam_help ( targets * : sources * : properties * )
{
local ps = [ property-set.create $(properties) ] ;
local color = [ $(ps).get <cxx-color> ] ;
local options = ;
if $(color) = "never"
{
color = --color=never ;
}
else
{
color = --color=always ;
}
OPTIONS on $(targets) = $(color) [ $(ps).get <action><option> ] ;
}
actions bjam_help
{
./tools/bjam/bjam_help.sh $(OPTIONS)
}
explicit env_help cxx_help ;
make env_help : : @bjam_help <option>project ;
make cxx_help : : @bjam_help <option>compiler ;
rule print_default ( targets * : sources * : properties * )
{
echo "Properties:" ;
local ps = [ property-set.create $(properties) ] ;
for p in [ $(ps).raw ]
{
echo "$(p)" ;
}
}
explicit print_default ;
make print_default : : @print_default ;
explicit
install
instexe
install-bin
install-lib
install-resources
install-share
install-etc
install-etc-ppocr
install-etc-ppocr-latin
install-etc-ppocr-latin-cyrillic
exe
libs
;
alias instexe : install-bin ;
alias install-resources :
install-etc
install-etc-ppocr
install-share
install-gettext
;
alias install : install-bin install-lib install-resources ;
alias exe : rdpproxy headlessclient rdpinichecker ;
alias libs : libredrec ;
alias ocr_tools : 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/*" ]
:
: <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-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
# Compile all translation files and build gettext environment:
#
# bjam install-gettext
#
## gettext {
actions gen_gettext_mo
{
$(REDEMPTION_PUBLIC_PATH)/tools/i18n/gen_catalog.sh compile "$(<).d" && :>"$(<)"
}
actions gettext_install
{
d="$(INSTALLDIR)$(SHARE_PREFIX)/$(>:B)"
mkdir -p "$d"
cp -R "$(>).d"/* "$d" ;
}
explicit install-gettext ;
make install-gettext : locale : @gettext_install ;
explicit locale ;
make locale :
$(REDEMPTION_PUBLIC_PATH)/tools/i18n/po/fr/redemption.po
$(REDEMPTION_PUBLIC_PATH)/tools/i18n/po/en/redemption.po
: @gen_gettext_mo ;
actions update_gettext_po
{
$(REDEMPTION_PUBLIC_PATH)/tools/i18n/gen_catalog.sh extract
$(REDEMPTION_PUBLIC_PATH)/tools/i18n/gen_catalog.sh merge
}
explicit update-po ;
make update-po : : @update_gettext_po ;
## gettext }
actions cwd
{
echo "CWD: $(>[1]:D)"
}
make cwd : app_path_exe.o : @cwd ;
explicit cwd ;