forked from ArtifexSoftware/mupdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makethird
410 lines (325 loc) · 13.3 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
# GNU Makefile for third party libraries used by MuPDF
ifeq ($(USE_SYSTEM_LIBS),yes)
USE_SYSTEM_FREETYPE := yes
USE_SYSTEM_HARFBUZZ := yes
USE_SYSTEM_JBIG2DEC := yes
USE_SYSTEM_JPEGXR := no # not available
USE_SYSTEM_LCMS2 := no # need lcms2-art fork
USE_SYSTEM_LIBJPEG := yes
USE_SYSTEM_MUJS := no # not available
USE_SYSTEM_OPENJPEG := yes
USE_SYSTEM_ZLIB := yes
USE_SYSTEM_GLUT := yes
USE_SYSTEM_CURL := yes
endif
ifeq ($(OS),MACOS)
USE_SYSTEM_GLUT := yes
endif
# --- FREETYPE 2 ---
ifeq ($(USE_SYSTEM_FREETYPE),yes)
FREETYPE_CFLAGS += $(SYS_FREETYPE_CFLAGS)
THIRD_CFLAGS += $(FREETYPE_CFLAGS)
THIRD_LIBS += $(SYS_FREETYPE_LIBS)
else
FREETYPE_CFLAGS += -Iscripts/freetype -Ithirdparty/freetype/include
THIRD_SRC += thirdparty/freetype/src/base/ftbase.c
THIRD_SRC += thirdparty/freetype/src/base/ftbbox.c
THIRD_SRC += thirdparty/freetype/src/base/ftbitmap.c
THIRD_SRC += thirdparty/freetype/src/base/ftdebug.c
THIRD_SRC += thirdparty/freetype/src/base/ftgasp.c
THIRD_SRC += thirdparty/freetype/src/base/ftglyph.c
THIRD_SRC += thirdparty/freetype/src/base/ftinit.c
THIRD_SRC += thirdparty/freetype/src/base/ftstroke.c
THIRD_SRC += thirdparty/freetype/src/base/ftsynth.c
THIRD_SRC += thirdparty/freetype/src/base/ftsystem.c
THIRD_SRC += thirdparty/freetype/src/base/fttype1.c
THIRD_SRC += thirdparty/freetype/src/cff/cff.c
THIRD_SRC += thirdparty/freetype/src/cid/type1cid.c
THIRD_SRC += thirdparty/freetype/src/psaux/psaux.c
THIRD_SRC += thirdparty/freetype/src/pshinter/pshinter.c
THIRD_SRC += thirdparty/freetype/src/psnames/psnames.c
THIRD_SRC += thirdparty/freetype/src/raster/raster.c
THIRD_SRC += thirdparty/freetype/src/sfnt/sfnt.c
THIRD_SRC += thirdparty/freetype/src/smooth/smooth.c
THIRD_SRC += thirdparty/freetype/src/truetype/truetype.c
THIRD_SRC += thirdparty/freetype/src/type1/type1.c
THIRD_CFLAGS += $(FREETYPE_CFLAGS)
$(OUT)/thirdparty/freetype/%.o: thirdparty/freetype/%.c
$(CC_CMD) $(FREETYPE_CFLAGS) \
-DFT_CONFIG_MODULES_H=\"slimftmodules.h\" \
-DFT_CONFIG_OPTIONS_H=\"slimftoptions.h\" \
-DFT2_BUILD_LIBRARY
endif
# --- HARFBUZZ ---
ifeq ($(USE_SYSTEM_HARFBUZZ),yes)
THIRD_CFLAGS += $(SYS_HARFBUZZ_CFLAGS)
THIRD_LIBS += $(SYS_HARFBUZZ_LIBS)
else
THIRD_SRC += thirdparty/harfbuzz/src/hb-aat-layout.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-blob.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-buffer-serialize.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-buffer.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-common.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-face.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-fallback-shape.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-font.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ft.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-color.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-face.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-font.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-layout.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-map.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-math.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-arabic.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-default.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-hangul.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-hebrew.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-indic-table.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-indic.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-khmer.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-myanmar.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-thai.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-tibetan.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-fallback.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape-normalize.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-shape.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-tag.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ot-var.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-set.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-shape-plan.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-shape.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-shaper.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-static.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-ucdn.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-unicode.cc
THIRD_SRC += thirdparty/harfbuzz/src/hb-warning.cc
THIRD_CFLAGS += -Ithirdparty/harfbuzz/src
$(OUT)/thirdparty/harfbuzz/%.o: thirdparty/harfbuzz/%.cc
$(CXX_CMD) $(FREETYPE_CFLAGS) -Iinclude/mupdf \
-DHAVE_FALLBACK=1 \
-DHAVE_OT \
-DHAVE_ROUND \
-DHAVE_UCDN \
-DHB_NO_MT \
-Dhb_malloc_impl=fz_hb_malloc \
-Dhb_calloc_impl=fz_hb_calloc \
-Dhb_free_impl=fz_hb_free \
-Dhb_realloc_impl=fz_hb_realloc \
-fno-exceptions \
-fno-rtti \
-fvisibility-inlines-hidden
endif
# --- JPEG-XR ---
ifeq ($(HAVE_JPEGXR),yes)
ifeq ($(USE_SYSTEM_JPEGXR),yes)
THIRD_CFLAGS += $(SYS_JPEGXR_CFLAGS) -DHAVE_JPEGXR
THIRD_LIBS += $(SYS_JPEGXR_LIBS)
else
THIRD_SRC += thirdparty/jpegxr/Software/algo.c
THIRD_SRC += thirdparty/jpegxr/Software/api.c
THIRD_SRC += thirdparty/jpegxr/Software/cr_parse.c
THIRD_SRC += thirdparty/jpegxr/Software/flags.c
THIRD_SRC += thirdparty/jpegxr/Software/init.c
THIRD_SRC += thirdparty/jpegxr/Software/io.c
THIRD_SRC += thirdparty/jpegxr/Software/jpegxr_pixelformat.c
THIRD_SRC += thirdparty/jpegxr/Software/r_parse.c
THIRD_SRC += thirdparty/jpegxr/Software/r_strip.c
THIRD_SRC += thirdparty/jpegxr/Software/r_tile_frequency.c
THIRD_SRC += thirdparty/jpegxr/Software/r_tile_spatial.c
THIRD_SRC += thirdparty/jpegxr/Software/x_strip.c
THIRD_CFLAGS += -Ithirdparty/jpegxr
THIRD_CFLAGS += -Ithirdparty/jpegxr/Software
THIRD_CFLAGS += -DHAVE_JPEGXR
$(OUT)/thirdparty/jpegxr/%.o: thirdparty/jpegxr/%.c
$(CC_CMD) -Ithirdparty/jpegxr -Ithirdparty/jpegxr/Software -Wno-tautological-compare
endif
endif
# --- LIBJPEG ---
ifeq ($(USE_SYSTEM_LIBJPEG),yes)
THIRD_CFLAGS += $(SYS_LIBJPEG_CFLAGS) -DSHARE_JPEG
THIRD_LIBS += $(SYS_LIBJPEG_LIBS)
else
THIRD_SRC += thirdparty/libjpeg/jaricom.c
THIRD_SRC += thirdparty/libjpeg/jcomapi.c
THIRD_SRC += thirdparty/libjpeg/jdapimin.c
THIRD_SRC += thirdparty/libjpeg/jdapistd.c
THIRD_SRC += thirdparty/libjpeg/jdarith.c
THIRD_SRC += thirdparty/libjpeg/jdatadst.c
THIRD_SRC += thirdparty/libjpeg/jdatasrc.c
THIRD_SRC += thirdparty/libjpeg/jdcoefct.c
THIRD_SRC += thirdparty/libjpeg/jdcolor.c
THIRD_SRC += thirdparty/libjpeg/jddctmgr.c
THIRD_SRC += thirdparty/libjpeg/jdhuff.c
THIRD_SRC += thirdparty/libjpeg/jdinput.c
THIRD_SRC += thirdparty/libjpeg/jdmainct.c
THIRD_SRC += thirdparty/libjpeg/jdmarker.c
THIRD_SRC += thirdparty/libjpeg/jdmaster.c
THIRD_SRC += thirdparty/libjpeg/jdmerge.c
THIRD_SRC += thirdparty/libjpeg/jdpostct.c
THIRD_SRC += thirdparty/libjpeg/jdsample.c
THIRD_SRC += thirdparty/libjpeg/jdtrans.c
THIRD_SRC += thirdparty/libjpeg/jerror.c
THIRD_SRC += thirdparty/libjpeg/jfdctflt.c
THIRD_SRC += thirdparty/libjpeg/jfdctfst.c
THIRD_SRC += thirdparty/libjpeg/jfdctint.c
THIRD_SRC += thirdparty/libjpeg/jidctflt.c
THIRD_SRC += thirdparty/libjpeg/jidctfst.c
THIRD_SRC += thirdparty/libjpeg/jidctint.c
THIRD_SRC += thirdparty/libjpeg/jmemmgr.c
THIRD_SRC += thirdparty/libjpeg/jquant1.c
THIRD_SRC += thirdparty/libjpeg/jquant2.c
THIRD_SRC += thirdparty/libjpeg/jutils.c
THIRD_CFLAGS += -Iscripts/libjpeg -Ithirdparty/libjpeg
$(OUT)/thirdparty/libjpeg/%.o: thirdparty/libjpeg/%.c
$(CC_CMD) -Iscripts/libjpeg
endif
# --- LCMS2 ---
ifeq ($(USE_SYSTEM_LCMS2),yes)
THIRD_CFLAGS += $(SYS_LCMS2_CFLAGS)
THIRD_LIBS += $(SYS_LCMS2_CFLAGS)
else
THIRD_SRC += $(sort $(wildcard thirdparty/lcms2/src/cms*.c))
THIRD_CFLAGS += -Ithirdparty/lcms2/include
$(OUT)/thirdparty/lcms2/%.o: thirdparty/lcms2/%.c
$(CC_CMD) -Ithirdparty/lcms2/include
endif
# --- MuJS ---
ifeq ($(USE_SYSTEM_MUJS),yes)
THIRD_CFLAGS += $(SYS_MUJS_CFLAGS)
THIRD_LIBS += $(SYS_MUJS_LIBS)
else
THIRD_SRC += thirdparty/mujs/one.c
THIRD_CFLAGS += -Ithirdparty/mujs
$(OUT)/thirdparty/mujs/%.o: thirdparty/mujs/%.c
$(CC_CMD)
endif
# --- ZLIB ---
ifeq ($(USE_SYSTEM_ZLIB),yes)
THIRD_CFLAGS += $(SYS_ZLIB_CFLAGS)
THIRD_LIBS += $(SYS_ZLIB_LIBS)
else
THIRD_SRC += thirdparty/zlib/adler32.c
THIRD_SRC += thirdparty/zlib/compress.c
THIRD_SRC += thirdparty/zlib/crc32.c
THIRD_SRC += thirdparty/zlib/deflate.c
THIRD_SRC += thirdparty/zlib/inffast.c
THIRD_SRC += thirdparty/zlib/inflate.c
THIRD_SRC += thirdparty/zlib/inftrees.c
THIRD_SRC += thirdparty/zlib/trees.c
THIRD_SRC += thirdparty/zlib/uncompr.c
THIRD_SRC += thirdparty/zlib/zutil.c
THIRD_CFLAGS += -Ithirdparty/zlib
$(OUT)/thirdparty/zlib/%.o: thirdparty/zlib/%.c
$(CC_CMD) -DHAVE_UNISTD_H -DHAVE_STDARG_H
endif
# --- LURATECH ---
ifeq ($(HAVE_LURATECH),yes)
THIRD_SRC += $(sort $(wildcard thirdparty/luratech/ldf_jb2/source/common/*.c))
THIRD_SRC += $(sort $(wildcard thirdparty/luratech/ldf_jb2/source/compress/*.c))
THIRD_SRC += $(sort $(wildcard thirdparty/luratech/lwf_jp2/library/source/*.c))
LURATECH_CFLAGS += -Ithirdparty/luratech/ldf_jb2/source/libraries
LURATECH_CFLAGS += -Ithirdparty/luratech/ldf_jb2/source/compress
LURATECH_CFLAGS += -Ithirdparty/luratech/ldf_jb2/source/common
LURATECH_CFLAGS += -Ithirdparty/luratech/lwf_jp2/library/source
THIRD_CFLAGS += $(LURATECH_CFLAGS) -DHAVE_LURATECH=1
$(OUT)/thirdparty/luratech/%.o: thirdparty/luratech/%.c
$(CC_CMD) -DLINUX $(LURATECH_CFLAGS) -Wno-tautological-compare -Wno-absolute-value
else # HAVE_LURATECH
# --- JBIG2DEC ---
ifeq ($(USE_SYSTEM_JBIG2DEC),yes)
THIRD_CFLAGS += $(SYS_JBIG2DEC_CFLAGS)
THIRD_LIBS += $(SYS_JBIG2DEC_LIBS)
else
THIRD_SRC += thirdparty/jbig2dec/jbig2.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_arith.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_arith_iaid.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_arith_int.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_generic.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_halftone.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_huffman.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_image.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_mmr.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_page.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_refinement.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_segment.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_symbol_dict.c
THIRD_SRC += thirdparty/jbig2dec/jbig2_text.c
THIRD_CFLAGS += -Ithirdparty/jbig2dec
$(OUT)/thirdparty/jbig2dec/%.o: thirdparty/jbig2dec/%.c
$(CC_CMD) -DHAVE_STDINT_H -DJBIG_EXTERNAL_MEMENTO_H=\"mupdf/memento.h\"
endif
# --- OPENJPEG ---
ifeq ($(USE_SYSTEM_OPENJPEG),yes)
THIRD_CFLAGS += $(SYS_OPENJPEG_CFLAGS)
THIRD_LIBS += $(SYS_OPENJPEG_LIBS)
else
OPENJPEG_CFLAGS += -Ithirdparty/openjpeg/src/lib/openjp2
OPENJPEG_CFLAGS += -DOPJ_STATIC
OPENJPEG_CFLAGS += -DOPJ_HAVE_STDINT_H -DOPJ_HAVE_INTTYPES_H
OPENJPEG_CFLAGS += -DMUTEX_pthread=0
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/bio.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/cio.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/dwt.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/event.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/function_list.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/image.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/invert.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/j2k.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/jp2.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/mct.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/mqc.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/openjpeg.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/pi.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/sparse_array.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/t1.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/t2.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/tcd.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/tgt.c
THIRD_SRC += thirdparty/openjpeg/src/lib/openjp2/thread.c
THIRD_CFLAGS += $(OPENJPEG_CFLAGS)
$(OUT)/thirdparty/openjpeg/%.o: thirdparty/openjpeg/%.c
$(CC_CMD) $(OPENJPEG_CFLAGS)
endif
endif # HAVE_LURATECH
# --- FreeGLUT ---
ifeq ($(USE_SYSTEM_GLUT),yes)
GLUT_CFLAGS := $(SYS_GLUT_CFLAGS)
GLUT_LIBS := $(SYS_GLUT_LIBS)
else
GLUT_SRC += $(sort $(wildcard thirdparty/freeglut/src/fg_*.c))
GLUT_SRC += $(sort $(wildcard thirdparty/freeglut/src/x11/*.c))
GLUT_OBJ := $(GLUT_SRC:%.c=$(OUT)/%.o)
LOCAL_GLUT_CFLAGS += -Ithirdparty/freeglut/include
LOCAL_GLUT_CFLAGS += -Ithirdparty/freeglut/src
LOCAL_GLUT_CFLAGS += -DHAVE_UNISTD_H -DHAVE_STDINT_H -DHAVE_X11_EXTENSIONS_XRANDR_H
GLUT_LIB := $(OUT)/libfreeglut.a
$(GLUT_LIB): $(GLUT_OBJ)
$(OUT)/thirdparty/freeglut/%.o: thirdparty/freeglut/%.c
$(CC_CMD) $(LOCAL_GLUT_CFLAGS)
GLUT_CFLAGS := -Ithirdparty/freeglut/include
GLUT_LIBS := -lGL -lX11 -lXrandr
endif
# --- cURL ---
ifeq ($(USE_SYSTEM_CURL),yes)
CURL_CFLAGS := $(SYS_CURL_CFLAGS)
CURL_LIBS := $(SYS_CURL_LIBS)
else
CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/*.c))
CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/vauth/*.c))
CURL_SRC += $(sort $(wildcard thirdparty/curl/lib/vtls/*.c))
CURL_OBJ := $(CURL_SRC:%.c=$(OUT)/%.o)
LOCAL_CURL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CURL_CFLAGS += -DBUILDING_LIBCURL
LOCAL_CURL_CFLAGS += -DCURL_STATICLIB
LOCAL_CURL_CFLAGS += -DCURL_DISABLE_LDAP
LOCAL_CURL_CFLAGS += -Ithirdparty/curl/include
LOCAL_CURL_CFLAGS += -Ithirdparty/curl/lib
CURL_LIB := $(OUT)/libcurl.a
$(CURL_LIB): $(CURL_OBJ)
$(OUT)/thirdparty/curl/%.o: thirdparty/curl/%.c
$(CC_CMD) $(LOCAL_CURL_CFLAGS)
CURL_CFLAGS := -Ithirdparty/curl/include
CURL_LIBS := -lpthread
endif