forked from ArtifexSoftware/mupdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makethird
493 lines (427 loc) · 16 KB
/
Makethird
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# GNU Makefile for third party libraries used by MuPDF
ifeq ($(USE_SYSTEM_LIBS),yes)
USE_SYSTEM_FREETYPE := yes
USE_SYSTEM_GUMBO := yes
USE_SYSTEM_HARFBUZZ := yes
USE_SYSTEM_JBIG2DEC := no
USE_SYSTEM_JPEGXR := no # not available
# lcms2mt is strongly preferred
USE_SYSTEM_LCMS2 := yes
USE_SYSTEM_LIBJPEG := yes
USE_SYSTEM_LIBWEBP := yes
USE_SYSTEM_MUJS := no # not available
USE_SYSTEM_OPENJPEG := yes
USE_SYSTEM_ZLIB := yes
USE_SYSTEM_GLUT := yes
USE_SYSTEM_CURL := yes
USE_SYSTEM_LEPTONICA := yes
USE_SYSTEM_TESSERACT := yes
USE_SYSTEM_JBIG2ENC := yes
USE_SYSTEM_JPEGXL := yes
#USE_SYSTEM_OPENCV := yes
endif
# Unlike the other libraries, we default to using system
# libarchive if it is requested - because we offer no
# packaged version.
USE_SYSTEM_LIBARCHIVE ?= yes
ifeq ($(OS),MACOS)
USE_SYSTEM_GLUT := yes
endif
ifeq ($(OS),Linux)
USE_SYSTEM_CURL ?= yes
endif
# Use of JBIG2ENC is optional:
ifeq ($(USE_JBIG2ENC),yes)
USE_LEPTONICA := yes
ifeq ($(USE_SYSTEM_JBIG2ENC),yes)
HAVE_JBIG2ENC := $(HAVE_SYS_JBIG2ENC)
else
ifneq ($(wildcard thirdparty/jbig2enc/src/*),)
HAVE_JBIG2ENC := yes
endif
endif
endif
# Use of Tesseract is optional:
ifeq ($(USE_TESSERACT),yes)
USE_LEPTONICA := yes
ifeq ($(USE_SYSTEM_TESSERACT),yes)
HAVE_TESSERACT := $(HAVE_SYS_TESSERACT)
else
ifneq ($(wildcard thirdparty/tesseract/src/*),)
HAVE_TESSERACT := yes
endif
endif
endif
ifeq ($(USE_LEPTONICA),yes)
ifeq ($(USE_SYSTEM_LEPTONICA),yes)
HAVE_LEPTONICA := $(HAVE_SYS_LEPTONICA)
else
ifneq ($(wildcard thirdparty/leptonica/src/*),)
HAVE_LEPTONICA := yes
endif
endif
endif
ifeq ($(USE_TESSERACT),yes)
ifneq ($(HAVE_LEPTONICA),yes)
echo "Build will fail! Tesseract requires LEPTONICA"
endif
endif
ifeq ($(USE_JBIG2ENC),yes)
ifneq ($(HAVE_LEPTONICA),yes)
echo "Build will fail! Jbig2Enc requires LEPTONICA"
endif
endif
# Use of jpeg-xl is optional:
ifeq ($(USE_JPEGXL),yes)
ifneq ($(wildcard thirdparty/jpeg-xl/lib/jxl/*),)
HAVE_JPEGXL := yes
endif
endif
# --- Include source file lists ---
include Makelists
# --- FREETYPE 2 ---
ifeq ($(USE_SYSTEM_FREETYPE),yes)
THIRD_CFLAGS += $(SYS_FREETYPE_CFLAGS)
THIRD_LIBS += $(SYS_FREETYPE_LIBS)
else
THIRD_CFLAGS += $(FREETYPE_CFLAGS)
THIRD_LIBS += $(FREETYPE_LIBS)
THIRD_SRC += $(FREETYPE_SRC)
$(OUT)/thirdparty/freetype/%.o: thirdparty/freetype/%.c
$(CC_CMD) $(LIB_CFLAGS) $(FREETYPE_CFLAGS) $(FREETYPE_BUILD_CFLAGS)
endif
# --- GUMBO (HTML5 parser) ---
ifeq ($(USE_SYSTEM_GUMBO),yes)
THIRD_CFLAGS += $(SYS_GUMBO_CFLAGS)
THIRD_LIBS += $(SYS_GUMBO_LIBS)
else
THIRD_CFLAGS += $(GUMBO_CFLAGS)
THIRD_LIBS += $(GUMBO_LIBS)
THIRD_SRC += $(GUMBO_SRC)
$(OUT)/thirdparty/gumbo-parser/%.o: thirdparty/gumbo-parser/%.c
$(CC_CMD) $(LIB_CFLAGS) $(GUMBO_CFLAGS) $(GUMBO_BUILD_CFLAGS)
endif
# --- HARFBUZZ ---
ifeq ($(USE_SYSTEM_HARFBUZZ),yes)
THIRD_CFLAGS += $(SYS_HARFBUZZ_CFLAGS)
THIRD_LIBS += $(SYS_HARFBUZZ_LIBS)
else
THIRD_CFLAGS += $(HARFBUZZ_CFLAGS)
THIRD_LIBS += $(HARFBUZZ_LIBS)
THIRD_SRC += $(HARFBUZZ_SRC)
$(OUT)/thirdparty/harfbuzz/%.o: thirdparty/harfbuzz/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(HARFBUZZ_CFLAGS) $(HARFBUZZ_BUILD_CFLAGS)
endif
# --- JPEG-XR ---
ifeq ($(HAVE_JPEGXR),yes)
THIRD_CFLAGS += -DHAVE_JPEGXR
ifeq ($(USE_SYSTEM_JPEGXR),yes)
THIRD_CFLAGS += $(SYS_JPEGXR_CFLAGS)
THIRD_LIBS += $(SYS_JPEGXR_LIBS)
else
THIRD_CFLAGS += $(JPEGXR_CFLAGS)
THIRD_LIBS += $(JPEGXR_LIBS)
THIRD_SRC += $(JPEGXR_SRC)
$(OUT)/thirdparty/jpegxr/%.o: thirdparty/jpegxr/%.c
$(CC_CMD) $(LIB_CFLAGS) $(JPEGXR_CFLAGS) $(JPEGXR_BUILD_CFLAGS)
endif
endif
# --- LIBJPEG ---
ifeq ($(USE_SYSTEM_LIBJPEG),yes)
THIRD_CFLAGS += $(SYS_LIBJPEG_CFLAGS) -DSHARE_JPEG
THIRD_LIBS += $(SYS_LIBJPEG_LIBS)
else
ifeq ($(HAVE_LIBJPEG_TURBO),yes)
THIRD_CFLAGS += $(LIBJPEG_TURBO_CFLAGS)
THIRD_SRC += $(LIBJPEG_TURBO_SRC)
LIBJPEG_BUILD_CFLAGS = $(LIBJPEG_TURBO_BUILD_CFLAGS)
$(OUT)/thirdparty/libjpeg/simd/x86_64/%.o: thirdparty/libjpeg/simd/x86_64/%.asm
$(AS_CMD) $(LIB_ASFLAGS) $(LIBJPEG_ASFLAGS) $(LIBJPEG_BUILD_ASFLAGS)
endif
THIRD_CFLAGS += $(LIBJPEG_CFLAGS)
THIRD_LIBS += $(LIBJPEG_LIBS)
THIRD_SRC += $(LIBJPEG_SRC)
$(OUT)/thirdparty/libjpeg/%.o: thirdparty/libjpeg/%.c
$(CC_CMD) $(LIB_CFLAGS) $(LIBJPEG_CFLAGS) $(LIBJPEG_BUILD_CFLAGS)
endif
# --- LCMS2 ---
ifeq ($(USE_SYSTEM_LCMS2),yes)
THIRD_CFLAGS += $(SYS_LCMS2_CFLAGS)
THIRD_LIBS += $(SYS_LCMS2_LIBS)
else
THIRD_CFLAGS += $(LCMS2_CFLAGS)
THIRD_LIBS += $(LCMS2_LIBS)
THIRD_SRC += $(LCMS2_SRC)
$(OUT)/thirdparty/lcms2/%.o: thirdparty/lcms2/%.c
$(CC_CMD) $(LIB_CFLAGS) $(LCMS2_CFLAGS) $(LCMS2_BUILD_CFLAGS)
endif
# --- MuJS ---
ifeq ($(USE_SYSTEM_MUJS),yes)
THIRD_CFLAGS += $(SYS_MUJS_CFLAGS)
THIRD_LIBS += $(SYS_MUJS_LIBS)
else
THIRD_CFLAGS += $(MUJS_CFLAGS)
THIRD_LIBS += $(MUJS_LIBS)
THIRD_SRC += $(MUJS_SRC)
$(OUT)/thirdparty/mujs/%.o: thirdparty/mujs/%.c
$(CC_CMD) $(LIB_CFLAGS) $(MUJS_CFLAGS) $(MUJS_BUILD_CFLAGS)
endif
# --- WebP ---
ifeq ($(USE_SYSTEM_WEBP),yes)
THIRD_CFLAGS += $(SYS_WEBP_CFLAGS)
THIRD_LIBS += $(SYS_WEBP_LIBS)
else
THIRD_SRC += thirdparty/libwebp/src/dec/alpha_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/buffer_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/frame_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/idec_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/io_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/quant_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/tree_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/vp8_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/vp8l_dec.c
THIRD_SRC += thirdparty/libwebp/src/dec/webp_dec.c
THIRD_SRC += thirdparty/libwebp/src/dsp/alpha_processing.c
THIRD_SRC += thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/alpha_processing_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/alpha_processing_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/alpha_processing_sse41.c
THIRD_SRC += thirdparty/libwebp/src/dsp/cpu.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_clip_tables.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_mips32.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_msa.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/dec_sse41.c
THIRD_SRC += thirdparty/libwebp/src/dsp/filters.c
THIRD_SRC += thirdparty/libwebp/src/dsp/filters_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/filters_msa.c
THIRD_SRC += thirdparty/libwebp/src/dsp/filters_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/filters_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/lossless.c
THIRD_SRC += thirdparty/libwebp/src/dsp/lossless_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/lossless_msa.c
THIRD_SRC += thirdparty/libwebp/src/dsp/lossless_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/lossless_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler_mips32.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler_msa.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/rescaler_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/upsampling.c
THIRD_SRC += thirdparty/libwebp/src/dsp/upsampling_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/upsampling_msa.c
THIRD_SRC += thirdparty/libwebp/src/dsp/upsampling_neon.c
THIRD_SRC += thirdparty/libwebp/src/dsp/upsampling_sse2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/yuv.c
THIRD_SRC += thirdparty/libwebp/src/dsp/yuv_mips32.c
THIRD_SRC += thirdparty/libwebp/src/dsp/yuv_mips_dsp_r2.c
THIRD_SRC += thirdparty/libwebp/src/dsp/yuv_sse2.c
THIRD_SRC += thirdparty/libwebp/src/utils/bit_reader_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/color_cache_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/huffman_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/quant_levels_dec_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/random_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/rescaler_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/thread_utils.c
THIRD_SRC += thirdparty/libwebp/src/utils/utils.c
THIRD_CFLAGS += -Ithirdparty/libwebp/src
$(OUT)/thirdparty/libwebp/%.o: thirdparty/libwebp/%.c
$(CC_CMD) -Ithirdparty/libwebp
endif
# --- WebP ---
ifeq ($(USE_SYSTEM_LIBWEBP),yes)
THIRD_CFLAGS += $(SYS_WEBP_CFLAGS)
THIRD_LIBS += $(SYS_WEBP_LIBS)
else
THIRD_CFLAGS += $(LIBWEBP_CFLAGS)
THIRD_LIBS += $(LIBWEBP_LIBS)
THIRD_SRC += $(LIBWEBP_SRC)
$(OUT)/thirdparty/libwebp/%.o: thirdparty/libwebp/%.c
$(CC_CMD) $(LIB_CFLAGS) $(LIBWEBP_CFLAGS) $(LIBWEBP_BUILD_CFLAGS)
endif
# --- ZLIB ---
ifeq ($(USE_SYSTEM_ZLIB),yes)
THIRD_CFLAGS += $(SYS_ZLIB_CFLAGS)
THIRD_LIBS += $(SYS_ZLIB_LIBS)
else
THIRD_CFLAGS += $(ZLIB_CFLAGS)
THIRD_LIBS += $(ZLIB_LIBS)
THIRD_SRC += $(ZLIB_SRC)
$(OUT)/thirdparty/zlib/%.o: thirdparty/zlib/%.c
$(CC_CMD) $(LIB_CFLAGS) $(ZLIB_CFLAGS) $(ZLIB_BUILD_CFLAGS)
endif
# --- JBIG2DEC ---
ifeq ($(USE_SYSTEM_JBIG2DEC),yes)
THIRD_CFLAGS += $(SYS_JBIG2DEC_CFLAGS)
THIRD_LIBS += $(SYS_JBIG2DEC_LIBS)
else
THIRD_CFLAGS += $(JBIG2DEC_CFLAGS)
THIRD_LIBS += $(JBIG2DEC_LIBS)
THIRD_SRC += $(JBIG2DEC_SRC)
$(OUT)/thirdparty/jbig2dec/%.o: thirdparty/jbig2dec/%.c
$(CC_CMD) $(WARNING_CFLAGS) $(LIB_CFLAGS) $(JBIG2DEC_CFLAGS) $(JBIG2DEC_BUILD_CFLAGS)
endif
# --- OPENJPEG ---
ifeq ($(USE_SYSTEM_OPENJPEG),yes)
THIRD_CFLAGS += $(SYS_OPENJPEG_CFLAGS)
THIRD_LIBS += $(SYS_OPENJPEG_LIBS)
else
THIRD_CFLAGS += $(OPENJPEG_CFLAGS)
THIRD_LIBS += $(OPENJPEG_LIBS)
THIRD_SRC += $(OPENJPEG_SRC)
$(OUT)/thirdparty/openjpeg/%.o: thirdparty/openjpeg/%.c
$(CC_CMD) $(LIB_CFLAGS) $(OPENJPEG_CFLAGS) $(OPENJPEG_BUILD_CFLAGS)
endif
# --- FreeGLUT ---
ifeq ($(USE_SYSTEM_GLUT),yes)
THIRD_GLUT_CFLAGS := $(SYS_GLUT_CFLAGS)
THIRD_GLUT_LIBS += $(SYS_GLUT_LIBS)
else
THIRD_GLUT_CFLAGS += $(GLUT_CFLAGS)
THIRD_GLUT_LIBS += $(GLUT_LIBS)
THIRD_GLUT_SRC += $(GLUT_SRC)
$(OUT)/thirdparty/freeglut/%.o: thirdparty/freeglut/%.c
$(CC_CMD) $(LIB_CFLAGS) $(GLUT_CFLAGS) $(GLUT_BUILD_CFLAGS)
endif
# --- cURL ---
ifeq ($(USE_SYSTEM_CURL),yes)
ifeq ($(HAVE_SYS_CURL),yes)
HAVE_CURL := yes
CURL_CFLAGS := $(SYS_CURL_CFLAGS) -DHAVE_CURL
CURL_LIBS := $(SYS_CURL_LIBS)
endif
endif
# --- LEPTONICA ---
ifeq ($(HAVE_LEPTONICA),yes)
THIRD_CFLAGS += -DHAVE_LEPTONICA
ifeq ($(USE_SYSTEM_LEPTONICA),yes)
THIRD_CFLAGS += $(SYS_LEPTONICA_CFLAGS)
THIRD_LIBS += $(SYS_LEPTONICA_LIBS)
else
THIRD_CFLAGS += $(LEPTONICA_CFLAGS)
THIRD_LIBS += $(LEPTONICA_LIBS)
THIRD_SRC += $(LEPTONICA_SRC)
$(OUT)/thirdparty/leptonica/%.o: thirdparty/leptonica/%.c
$(CC_CMD) $(LIB_CFLAGS) $(LEPTONICA_CFLAGS) $(LEPTONICA_BUILD_CFLAGS)
endif
endif
# --- TESSERACT ---
ifeq ($(HAVE_TESSERACT),yes)
THIRD_CFLAGS += -DHAVE_TESSERACT
ifeq ($(USE_SYSTEM_TESSERACT),yes)
THIRD_CFLAGS += $(SYS_TESSERACT_CFLAGS)
THIRD_LIBS += $(SYS_TESSERACT_LIBS) -lstdc++
else
THIRD_CFLAGS += $(TESSERACT_CFLAGS)
THIRD_LIBS += $(TESSERACT_LIBS)
THIRD_SRC += $(TESSERACT_SRC)
$(OUT)/thirdparty/tesseract/%.o: thirdparty/tesseract/%.cpp
$(CXX_CMD) $(LIB_CFLAGS) $(TESSERACT_CFLAGS) $(TESSERACT_BUILD_CFLAGS)
endif
endif
# --- JBIG2ENC ---
ifeq ($(HAVE_JBIG2ENC),yes)
THIRD_CFLAGS += -DHAVE_JBIG2ENC
ifeq ($(USE_SYSTEM_JBIG2ENC),yes)
THIRD_CFLAGS += $(SYS_JBIG2ENC_CFLAGS)
THIRD_LIBS += $(SYS_JBIG2ENC_LIBS) -lstdc++
else
THIRD_CFLAGS += $(JBIG2ENC_CFLAGS)
THIRD_LIBS += $(JBIG2ENC_LIBS)
THIRD_SRC += $(JBIG2ENC_SRC)
THIRD_SRC += $(JBIG2ENC_SRC)
$(OUT)/thirdparty/jbig2enc/src/%.o: thirdparty/jbig2enc/src/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JBIG2ENC_CFLAGS) $(JBIG2ENC_BUILD_CFLAGS) $(LEPTONICA_BUILD_CFLAGS)
endif
endif
# --- OPEN_CV ---
#THIRD_LIBS += -L /usr/local/lib -l opencv_core -l opencv_imgproc -l opencv_imgcodecs -lstdc++
# --- EXTRACT ---
THIRD_CFLAGS += $(EXTRACT_CFLAGS)
THIRD_LIBS += $(EXTRACT_LIBS)
THIRD_SRC += $(EXTRACT_SRC)
$(OUT)/thirdparty/extract/%.o: thirdparty/extract/%.c
$(CC_CMD) $(WARNING_CFLAGS) $(LIB_CFLAGS) $(EXTRACT_CFLAGS) $(ZLIB_CFLAGS) $(EXTRACT_BUILD_CFLAGS)
$(OUT)/thirdparty/extract/%.o: thirdparty/extract/%.cpp
$(CXX_CMD) $(WARNING_CFLAGS) $(LIB_CFLAGS) $(EXTRACT_CFLAGS) $(ZLIB_CFLAGS) $(EXTRACT_BUILD_CFLAGS) -I /usr/local/include/opencv4 -I /usr/include/opencv4
# The first python3 command in the next two rules returns 0 (success) iff
# python3 exists and is version 3.6 or later.
thirdparty/extract/src/docx_template.c: thirdparty/extract/src/template.docx thirdparty/extract/src/docx_template_build.py
$(QUIET_GEN) if python3 -c 'import sys; sys.exit(sys.version_info < (3,6))'; \
then python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.docx \
-n docx \
-o thirdparty/extract/src/docx_template ; \
else echo python3 is older than 3.6 so not running docx_template_build.py; \
fi
@touch $@
thirdparty/extract/src/odt_template.c: thirdparty/extract/src/template.odt thirdparty/extract/src/docx_template_build.py
$(QUIET_GEN) if python3 -c 'import sys; sys.exit(sys.version_info < (3,6))'; \
then python3 thirdparty/extract/src/docx_template_build.py \
-i thirdparty/extract/src/template.odt \
-n odt \
-o thirdparty/extract/src/odt_template ; \
else echo python3 is older than 3.6 so not running docx_template_build.py; \
fi
@touch $@
generate: thirdparty/extract/src/docx_template.c
# --- JPEGXL ---
ifeq ($(HAVE_JPEGXL),yes)
THIRD_CFLAGS += -DHAVE_JPEGXL
ifeq ($(USE_SYSTEM_JPEGXL),yes)
THIRD_CFLAGS += $(SYS_JPEGXL_CFLAGS)
THIRD_LIBS += $(SYS_JPEGXL_LIBS) -lstdc++
else
THIRD_CFLAGS += $(JPEGXL_CFLAGS)
THIRD_LIBS += $(JPEGXL_LIBS)
THIRD_SRC += $(JPEGXL_SRC)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/%.o: thirdparty/jpeg-xl/lib/jxl/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/base/%.o: thirdparty/jpeg-xl/lib/jxl/base/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/jpeg/%.o: thirdparty/jpeg-xl/lib/jxl/jpeg/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/modular/%.o: thirdparty/jpeg-xl/lib/jxl/modular/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/modular/encoding/%.o: thirdparty/jpeg-xl/lib/jxl/modular/encoding/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/lib/jxl/modular/transform/%.o: thirdparty/jpeg-xl/lib/jxl/modular/transform/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/third_party/brotli/c/common/%.o: thirdparty/jpeg-xl/third_party/brotli/c/common/%.c
$(CC_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/third_party/brotli/c/dec/%.o: thirdparty/jpeg-xl/third_party/brotli/c/dec/%.c
$(CC_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/third_party/brotli/c/enc/%.o: thirdparty/jpeg-xl/third_party/brotli/c/enc/%.c
$(CC_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
$(OUT)/thirdparty/jpeg-xl/third_party/highway/hwy/%.o: thirdparty/jpeg-xl/third_party/highway/hwy/%.cc
$(CXX_CMD) $(LIB_CFLAGS) $(JPEGXL_CFLAGS) $(JPEGXL_BUILD_CFLAGS)
endif
endif
# --- LIBARCHIVE ---
ifeq ($(HAVE_LIBARCHIVE),yes)
THIRD_CFLAGS += -DHAVE_LIBARCHIVE
ifeq ($(USE_SYSTEM_LIBARCHIVE),yes)
THIRD_CFLAGS += $(SYS_LIBARCHIVE_CFLAGS)
THIRD_LIBS += $(SYS_LIBARCHIVE_LIBS) -lstdc++
else
THIRD_CFLAGS += $(LIBARCHIVE_CFLAGS)
THIRD_LIBS += $(LIBARCHIVE_LIBS)
THIRD_SRC += $(LIBARCHIVE_SRC)
THIRD_SRC += $(LIBARCHIVE_SRC)
endif
endif
# --- HAVE_SMARTOFFICE ---
ifeq ($(HAVE_SMARTOFFICE),yes)
THIRD_CFLAGS += -DHAVE_SMARTOFFICE -Ithirdparty/so/include
SODOCHANDLER_LIB = $(OUT)/libsodochandler.a
COMMERCIAL_LIBS = $(SODOCHANDLER_LIB)
SOLIB_PATH ?= thirdparty/so/lib/linux/x64/
THIRD_LIBS += -L$(OUT) -L$(SOLIB_PATH) -lsodochandler -l:smart-office-lib.a
endif
SODOCHANDLER_SRC := $(sort $(wildcard thirdparty/so/source/*.c))
SODOCHANDLER_OBJ := $(SODOCHANDLER_SRC:%.c=$(OUT)/%.o)
$(SODOCHANDLER_LIB) : $(SODOCHANDLER_OBJ)