summaryrefslogtreecommitdiff
path: root/Makethird
blob: cc7478c27012940f84414b2872cdeddd32b344ab (plain)
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
# 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/libopenjpeg
OPENSSL_DIR := thirdparty/openssl
ZLIB_DIR := thirdparty/zlib
CURL_DIR := thirdparty/curl

# --- 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"
V8_LIB_CHOICE := release
else ifeq "$(build)" "profile"
V8_LIB_CHOICE := release
else
V8_LIB_CHOICE := debug
endif

V8_ARCH ?= x64

# If you are building for 32bit linux use V8_ARCH=ia32
ifeq "$(OS)" "Darwin"
V8_LIBS = -L$(V8_DIR)/out-mac/$(V8_ARCH).$(V8_LIB_CHOICE)/ -lv8_base -lv8_snapshot -lstdc++
else
V8_LIBS = -L$(V8_DIR)/out/$(V8_ARCH).$(V8_LIB_CHOICE)/obj.target/tools/gyp -lv8_base -lv8_snapshot -lpthread -ldl -lstdc++
endif

V8_PRESENT := yes
else
V8_PRESENT := no
endif

# --- FreeType 2 ---

ifneq "$(wildcard $(FREETYPE_DIR)/README)" ""

FREETYPE_LIB := $(OUT)/libfreetype.a
FREETYPE_OUT := $(OUT)/freetype
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 $(FREETYPE_OUT)/, $(FREETYPE_SRC:%.c=%.o))

$(FREETYPE_OUT):
	$(MKDIR_CMD)

FT_CFLAGS := -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
	'-DFT_CONFIG_MODULES_H="slimftmodules.h"' \
	'-DFT_CONFIG_OPTIONS_H="slimftoptions.h"'

$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/base/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/cff/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/cid/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/psaux/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/pshinter/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/psnames/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/raster/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/smooth/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/sfnt/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/truetype/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)
$(FREETYPE_OUT)/%.o: $(FREETYPE_DIR)/src/type1/%.c	| $(FREETYPE_OUT)
	$(CC_CMD) $(FT_CFLAGS)

FREETYPE_CFLAGS := -Iscripts/freetype -I$(FREETYPE_DIR)/include
else
FREETYPE_CFLAGS := $(SYS_FREETYPE_CFLAGS)
FREETYPE_LIBS := $(SYS_FREETYPE_LIBS)
endif

# --- JBIG2DEC ---

ifneq "$(wildcard $(JBIG2DEC_DIR)/README)" ""

JBIG2DEC_LIB := $(OUT)/libjbig2dec.a
JBIG2DEC_OUT := $(OUT)/jbig2dec
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 $(JBIG2DEC_OUT)/, $(JBIG2DEC_SRC:%.c=%.o))
$(JBIG2DEC_OUT):
	$(MKDIR_CMD)
$(JBIG2DEC_OUT)/%.o: $(JBIG2DEC_DIR)/%.c | $(JBIG2DEC_OUT)
	$(CC_CMD) -DHAVE_STDINT_H

JBIG2DEC_CFLAGS := -I$(JBIG2DEC_DIR)
else
JBIG2DEC_CFLAGS := $(SYS_JBIG2DEC_CFLAGS)
JBIG2DEC_LIBS := $(SYS_JBIG2DEC_LIBS)
endif

# --- JPEG library from IJG ---

ifneq "$(wildcard $(JPEG_DIR)/README)" ""

JPEG_LIB := $(OUT)/libjpeg.a
JPEG_OUT := $(OUT)/jpeg
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 $(JPEG_OUT)/, $(JPEG_SRC:%.c=%.o))
$(JPEG_OUT):
	$(MKDIR_CMD)
$(JPEG_OUT)/%.o: $(JPEG_DIR)/%.c | $(JPEG_OUT)
	$(CC_CMD) -Dmain=xxxmain

JPEG_CFLAGS := -Iscripts/jpeg -I$(JPEG_DIR)
else
JPEG_CFLAGS := $(SYS_JPEG_CFLAGS)
JPEG_LIBS := $(SYS_JPEG_LIBS)
endif

# --- OpenJPEG ---

ifneq "$(wildcard $(OPENJPEG_DIR)/CMakeLists.txt)" ""

OPENJPEG_LIB := $(OUT)/libopenjpeg.a
OPENJPEG_OUT := $(OUT)/openjpeg
OPENJPEG_SRC := \
	bio.c \
	cidx_manager.c \
	cio.c \
	dwt.c \
	event.c \
	function_list.c \
	image.c \
	invert.c \
	j2k.c \
	jp2.c \
	mct.c \
	mqc.c \
	openjpeg.c \
	opj_clock.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 $(OPENJPEG_OUT)/, $(OPENJPEG_SRC:%.c=%.o))
$(OPENJPEG_OUT):
	$(MKDIR_CMD)
$(OPENJPEG_OUT)/%.o: $(OPENJPEG_DIR)/%.c | $(OPENJPEG_OUT)
	$(CC_CMD) -DOPJ_STATIC -DOPJ_HAVE_STDINT_H

OPENJPEG_CFLAGS += -Iscripts/openjpeg -I$(OPENJPEG_DIR)
else
OPENJPEG_CFLAGS := $(SYS_OPENJPEG_CFLAGS)
OPENJPEG_LIBS := $(SYS_OPENJPEG_LIBS)
endif

# --- ZLIB ---

ifneq "$(wildcard $(ZLIB_DIR)/README)" ""

ZLIB_LIB := $(OUT)/libz.a
ZLIB_OUT := $(OUT)/zlib
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 $(ZLIB_OUT)/, $(ZLIB_SRC:%.c=%.o))
$(ZLIB_OUT):
	$(MKDIR_CMD)
$(ZLIB_OUT)/%.o: $(ZLIB_DIR)/%.c | $(ZLIB_OUT)
	$(CC_CMD) -Dverbose=-1

ZLIB_CFLAGS := -I$(ZLIB_DIR)
else
ZLIB_CFLAGS := $(SYS_ZLIB_CFLAGS)
ZLIB_LIBS := $(SYS_ZLIB_LIBS)
endif

# --- OpenSSL ---

ifneq "$(wildcard $(OPENSSL_DIR)/README)" ""

OPENSSL_LIB := $(OUT)/libcrypto.a

OPENSSL_DIR_MAK := $(OPENSSL_DIR)/Makefile
OPENSSL_DIR_LIB := $(OPENSSL_DIR)/libcrypto.a

$(OPENSSL_DIR_MAK):
	cd $(OPENSSL_DIR) && ./config no-threads no-zlib no-shared no-asm no-dso

$(OPENSSL_DIR_LIB): $(OPENSSL_DIR_MAK)
	$(MAKE) -C $(OPENSSL_DIR) build_crypto

$(OPENSSL_LIB): $(OPENSSL_DIR_LIB) | $(OUT)
	cp $(OPENSSL_DIR_LIB) $(OPENSSL_LIB)

openssl-clean:
	$(MAKE) -C $(OPENSSL_DIR) clean
	rm -f thirdparty/openssl/Makefile thirdparty/openssl/libcrypto.a

OPENSSL_CFLAGS := -DHAVE_OPENSSL -I$(OPENSSL_DIR)/include
else
OPENSSL_CFLAGS := $(SYS_OPENSSL_CFLAGS)
OPENSSL_LIBS := $(SYS_OPENSSL_LIBS)
endif

# --- X11 ---

ifeq "$(NOX11)" ""
X11_CFLAGS := $(SYS_X11_CFLAGS)
X11_LIBS := $(SYS_X11_LIBS)
else
X11_CFLAGS :=
X11_LIBS :=
endif

# --- cURL ---

ifneq "$(wildcard $(CURL_DIR)/README)" ""

CURL_LIB := $(OUT)/libcurl.a
CURL_OUT := $(OUT)/curl
CURL_SRC := \
	amigaos.c \
	asyn-ares.c \
	asyn-thread.c \
	axtls.c \
	base64.c \
	bundles.c \
	conncache.c \
	connect.c \
	content_encoding.c \
	cookie.c \
	curl_addrinfo.c \
	curl_darwinssl.c \
	curl_fnmatch.c \
	curl_gethostname.c \
	curl_gssapi.c \
	curl_memrchr.c \
	curl_multibyte.c \
	curl_ntlm.c \
	curl_ntlm_core.c \
	curl_ntlm_msgs.c \
	curl_ntlm_wb.c \
	curl_rand.c \
	curl_rtmp.c \
	curl_sasl.c \
	curl_schannel.c \
	curl_sspi.c \
	curl_threads.c \
	cyassl.c \
	dict.c \
	easy.c \
	escape.c \
	file.c \
	fileinfo.c \
	formdata.c \
	ftp.c \
	ftplistparser.c \
	getenv.c \
	getinfo.c \
	gopher.c \
	gtls.c \
	hash.c \
	hmac.c \
	hostasyn.c \
	hostcheck.c \
	hostip.c \
	hostip4.c \
	hostip6.c \
	hostsyn.c \
	http.c \
	http_chunks.c \
	http_digest.c \
	http_negotiate.c \
	http_negotiate_sspi.c \
	http_proxy.c \
	idn_win32.c \
	if2ip.c \
	imap.c \
	inet_ntop.c \
	inet_pton.c \
	krb4.c \
	krb5.c \
	ldap.c \
	llist.c \
	md4.c \
	md5.c \
	memdebug.c \
	mprintf.c \
	multi.c \
	netrc.c \
	non-ascii.c \
	nonblock.c \
	nss.c \
	openldap.c \
	parsedate.c \
	pingpong.c \
	pipeline.c \
	polarssl.c \
	polarssl_threadlock.c \
	pop3.c \
	progress.c \
	qssl.c \
	rawstr.c \
	rtsp.c \
	security.c \
	select.c \
	sendf.c \
	share.c \
	slist.c \
	smtp.c \
	socks.c \
	socks_gssapi.c \
	speedcheck.c \
	splay.c \
	ssh.c \
	sslgen.c \
	ssluse.c \
	strdup.c \
	strequal.c \
	strerror.c \
	strtok.c \
	strtoofft.c \
	telnet.c \
	tftp.c \
	timeval.c \
	transfer.c \
	url.c \
	version.c \
	warnless.c \
	wildcard.c \


$(CURL_LIB): $(addprefix $(CURL_OUT)/, $(CURL_SRC:%.c=%.o))

$(CURL_OUT):
	$(MKDIR_CMD)

CRL_CFLAGS := -DHAVE_CONFIG_H -DBUILDING_LIBCURL -DCURL_STATICLIB \
	-DCURL_DISABLE_LDAP -I$(CURL_DIR)/include

$(CURL_OUT)/%.o: $(CURL_DIR)/lib/%.c	| $(CURL_OUT)
	$(CC_CMD) $(CRL_CFLAGS)

CURL_CFLAGS := -I$(CURL_DIR)/include
CURL_LIBS := $(SYS_CURL_DEPS)
else
NOCURL := yes
endif