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
|
# GNU Makefile for third party libraries used by MuPDF
#
# If thirdparty libraries are supplied, they will be built as
# static libraries.
#
# Use 'git submodule init' and 'git submodule update' to check
# out the thirdparty libraries from git.
FREETYPE_DIR := thirdparty/freetype
JBIG2DEC_DIR := thirdparty/jbig2dec
JPEG_DIR := thirdparty/jpeg
OPENJPEG_DIR := thirdparty/openjpeg
ZLIB_DIR := thirdparty/zlib
# --- V8 ---
#
# V8 is too big to be used as a submodule.
#
V8_DIR := $(wildcard thirdparty/v8*)
ifneq "$(V8_DIR)" ""
CFLAGS += -I$(V8_DIR)/include
ifeq "$(BUILD)" "release"
V8LIB_CHOICE := release
else ifeq "$(BUILD)" "profile"
V8LIB_CHOICE := release
else
V8LIB_CHOICE := debug
endif
# If you are building for 32bit linux use V8_ARCH=ia32
# MacOSX has a 64bit kernel, but a 32 bit userspace.
ifeq "$(OS)" "Darwin"
V8_ARCH ?= ia32
V8LIBS = -L$(V8_DIR)/out-mac/$(V8_ARCH).$(V8LIB_CHOICE)/ -lv8_base -lv8_snapshot
else
V8_ARCH ?= x64
V8LIBS = -L$(V8_DIR)/out/$(V8_ARCH).$(V8LIB_CHOICE)/obj.target/tools/gyp -lv8_base -lv8_snapshot -lpthread
endif
V8_PRESENT := 1
else
V8_PRESENT := 0
endif
# --- FreeType 2 ---
ifneq "$(wildcard $(FREETYPE_DIR)/README)" ""
CFLAGS += -I$(FREETYPE_DIR)/include
LIBS := $(filter-out -lfreetype, $(LIBS))
FREETYPE_LIB := $(OUT)/libfreetype.a
FREETYPE_SRC := \
ftbase.c \
ftbbox.c \
ftbitmap.c \
ftgasp.c \
ftglyph.c \
ftinit.c \
ftstroke.c \
ftsynth.c \
ftsystem.c \
fttype1.c \
ftxf86.c \
cff.c \
psaux.c \
pshinter.c \
psnames.c \
raster.c \
sfnt.c \
smooth.c \
truetype.c \
type1.c \
type1cid.c \
$(FREETYPE_LIB): $(addprefix $(OUT)/ft_, $(FREETYPE_SRC:%.c=%.o))
FT_CFLAGS := -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
'-DFT_CONFIG_MODULES_H="slimftmodules.h"' \
'-DFT_CONFIG_OPTIONS_H="slimftoptions.h"'
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/base/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/cff/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/cid/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/psaux/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/pshinter/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/psnames/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/raster/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/smooth/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/sfnt/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/truetype/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
$(OUT)/ft_%.o: $(FREETYPE_DIR)/src/type1/%.c | $(OUT)
$(CC_CMD) $(FT_CFLAGS)
else
CFLAGS += $(SYS_FREETYPE_INC)
endif
# --- JBIG2DEC ---
ifneq "$(wildcard $(JBIG2DEC_DIR)/README)" ""
CFLAGS += -I$(JBIG2DEC_DIR)
LIBS := $(filter-out -ljbig2dec, $(LIBS))
JBIG2DEC_LIB := $(OUT)/libjbig2dec.a
JBIG2DEC_SRC := \
jbig2.c \
jbig2_arith.c \
jbig2_arith_iaid.c \
jbig2_arith_int.c \
jbig2_generic.c \
jbig2_halftone.c \
jbig2_huffman.c \
jbig2_image.c \
jbig2_metadata.c \
jbig2_mmr.c \
jbig2_page.c \
jbig2_refinement.c \
jbig2_segment.c \
jbig2_symbol_dict.c \
jbig2_text.c \
$(JBIG2DEC_LIB): $(addprefix $(OUT)/, $(JBIG2DEC_SRC:%.c=%.o))
$(OUT)/%.o: $(JBIG2DEC_DIR)/%.c | $(OUT)
$(CC_CMD) -DHAVE_STDINT_H
endif
# --- JPEG library from IJG ---
ifneq "$(wildcard $(JPEG_DIR)/README)" ""
CFLAGS += -I$(JPEG_DIR)
LIBS := $(filter-out -ljpeg, $(LIBS))
JPEG_LIB := $(OUT)/libjpeg.a
JPEG_SRC := \
jaricom.c \
jcomapi.c \
jdapimin.c \
jdapistd.c \
jdarith.c \
jdatadst.c \
jdatasrc.c \
jdcoefct.c \
jdcolor.c \
jddctmgr.c \
jdhuff.c \
jdinput.c \
jdmainct.c \
jdmarker.c \
jdmaster.c \
jdmerge.c \
jdpostct.c \
jdsample.c \
jdtrans.c \
jerror.c \
jfdctflt.c \
jfdctfst.c \
jfdctint.c \
jidctflt.c \
jidctfst.c \
jidctint.c \
jmemmgr.c \
jmemnobs.c \
jquant1.c \
jquant2.c \
jutils.c \
$(JPEG_LIB): $(addprefix $(OUT)/jpeg_, $(JPEG_SRC:%.c=%.o))
$(OUT)/jpeg_%.o: $(JPEG_DIR)/%.c | $(OUT)
$(CC_CMD) -Dmain=xxxmain
endif
# --- OpenJPEG ---
ifneq "$(wildcard $(OPENJPEG_DIR)/README)" ""
CFLAGS += -I$(OPENJPEG_DIR)/libopenjpeg
LIBS := $(filter-out -lopenjpeg, $(LIBS))
OPENJPEG_LIB := $(OUT)/libopenjpeg.a
OPENJPEG_SRC := \
bio.c \
cidx_manager.c \
cio.c \
dwt.c \
event.c \
image.c \
j2k.c \
j2k_lib.c \
jp2.c \
jpt.c \
mct.c \
mqc.c \
openjpeg.c \
phix_manager.c \
pi.c \
ppix_manager.c \
raw.c \
t1.c \
t2.c \
tcd.c \
tgt.c \
thix_manager.c \
tpix_manager.c \
$(OPENJPEG_LIB): $(addprefix $(OUT)/opj_, $(OPENJPEG_SRC:%.c=%.o))
$(OUT)/opj_%.o: $(OPENJPEG_DIR)/libopenjpeg/%.c | $(OUT)
$(CC_CMD) -DOPJ_STATIC
else
CFLAGS += $(SYS_OPENJPEG_INC)
endif
# --- ZLIB ---
ifneq "$(wildcard $(ZLIB_DIR)/README)" ""
CFLAGS += -I$(ZLIB_DIR) -Dverbose=-1
LIBS := $(filter-out -lz, $(LIBS))
ZLIB_LIB := $(OUT)/libz.a
ZLIB_SRC := \
adler32.c \
compress.c \
crc32.c \
deflate.c \
inffast.c \
inflate.c \
inftrees.c \
trees.c \
uncompr.c \
zutil.c \
$(ZLIB_LIB): $(addprefix $(OUT)/zlib_, $(ZLIB_SRC:%.c=%.o))
$(OUT)/zlib_%.o: $(ZLIB_DIR)/%.c | $(OUT)
$(CC_CMD)
endif
|