summaryrefslogtreecommitdiff
path: root/print/mupdf/patches/patch-ac
blob: 62c6ba1ffb68abcbaf7739302725c0a28f9566ef (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
$NetBSD: patch-ac,v 1.20 2018/10/04 19:02:33 leot Exp $

- libtool support 
- Install target cleanup
- Also install muthreads and mupkcs7 libraries (needed by various tools)
- Do not force `-O0' flag when building
- Get rid of unused VERSION variable and `version:' target (otherwise `git' can
  be invoked during the building phase)
- Install only one `mupdf' binary, prefer the featureful one and always
  install it as `mupdf'.
- Install all EXTRA_APPS (muraster, mujstest, mjsgen)

--- Makefile.orig	2018-09-25 12:39:17.000000000 +0000
+++ Makefile
@@ -51,68 +51,68 @@ ifneq ($(verbose),yes)
 endif
 
 MKTGTDIR = mkdir -p $(dir $@)
-CC_CMD = $(QUIET_CC) $(MKTGTDIR) ; $(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
-CXX_CMD = $(QUIET_CXX) $(MKTGTDIR) ; $(CXX) $(CFLAGS) -MMD -MP -o $@ -c $<
-AR_CMD = $(QUIET_AR) $(MKTGTDIR) ; $(AR) cr $@ $^
+CC_CMD = $(QUIET_CC) $(MKTGTDIR) ; ${LIBTOOL} --mode=compile $(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
+CXX_CMD = $(QUIET_CXX) $(MKTGTDIR) ; ${LIBTOOL} --mode=compile $(CXX) $(CFLAGS) -MMD -MP -o $@ -c $<
+AR_CMD = $(QUIET_AR) $(MKTGTDIR) ; ${LIBTOOL} --mode=link $(CC) $(LDFLAGS) -o $@ -version-info 0:0:0 -rpath ${PREFIX}/lib $^
 ifdef RANLIB
   RANLIB_CMD = $(QUIET_RANLIB) $(RANLIB) $@
 endif
-LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; ${LIBTOOL} --mode=link $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 TAGS_CMD = $(QUIET_TAGS) ctags $^
 WINDRES_CMD = $(QUIET_WINDRES) $(MKTGTDIR) ; $(WINDRES) $< $@
 OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(LD) -r -b binary -o $@ $<
 
 # --- Rules ---
 
-$(OUT)/%.a :
+$(OUT)/%.la :
 	$(AR_CMD)
 	$(RANLIB_CMD)
 
 $(OUT)/%.exe: %.c
 	$(LINK_CMD)
 
-$(OUT)/source/helpers/mu-threads/%.o : source/helpers/mu-threads/%.c
+$(OUT)/source/helpers/mu-threads/%.lo : source/helpers/mu-threads/%.c
 	$(CC_CMD) $(THREADING_CFLAGS)
 
-$(OUT)/source/helpers/pkcs7/%.o : source/helpers/pkcs7/%.c
+$(OUT)/source/helpers/pkcs7/%.lo : source/helpers/pkcs7/%.c
 	$(CC_CMD) $(LIBCRYPTO_CFLAGS)
 
-$(OUT)/source/tools/%.o : source/tools/%.c
+$(OUT)/source/tools/%.lo : source/tools/%.c
 	$(CC_CMD) -Wall $(THIRD_CFLAGS) $(THREADING_CFLAGS)
 
-$(OUT)/generated/%.o : generated/%.c
-	$(CC_CMD) -O0
+$(OUT)/generated/%.lo : generated/%.c
+	$(CC_CMD)
 
-$(OUT)/platform/x11/%.o : platform/x11/%.c
+$(OUT)/platform/x11/%.lo : platform/x11/%.c
 	$(CC_CMD) -Wall $(X11_CFLAGS)
 
-$(OUT)/platform/x11/curl/%.o : platform/x11/%.c
+$(OUT)/platform/x11/curl/%.lo : platform/x11/%.c
 	$(CC_CMD) -Wall $(X11_CFLAGS) $(CURL_CFLAGS) -DHAVE_CURL
 
-$(OUT)/platform/gl/%.o : platform/gl/%.c
+$(OUT)/platform/gl/%.lo : platform/gl/%.c
 	$(CC_CMD) -Wall $(THIRD_CFLAGS) $(GLUT_CFLAGS)
 
 ifeq ($(HAVE_OBJCOPY),yes)
-  $(OUT)/source/fitz/noto.o : source/fitz/noto.c
+  $(OUT)/source/fitz/noto.lo : source/fitz/noto.c
 	$(CC_CMD) -Wall -Wdeclaration-after-statement -DHAVE_OBJCOPY $(THIRD_CFLAGS)
 endif
 
-$(OUT)/source/%.o : source/%.c
+$(OUT)/source/%.lo : source/%.c
 	$(CC_CMD) -Wall -Wdeclaration-after-statement $(THIRD_CFLAGS)
 
-$(OUT)/platform/%.o : platform/%.c
+$(OUT)/platform/%.lo : platform/%.c
 	$(CC_CMD) -Wall
 
-$(OUT)/%.o: %.rc
+$(OUT)/%.lo: %.rc
 	$(WINDRES_CMD)
 
-.PRECIOUS : $(OUT)/%.o # Keep intermediates from chained rules
+.PRECIOUS : $(OUT)/%.lo # Keep intermediates from chained rules
 .PRECIOUS : $(OUT)/%.exe # Keep intermediates from chained rules
 
 # --- File lists ---
 
-THIRD_OBJ := $(THIRD_SRC:%.c=$(OUT)/%.o)
-THIRD_OBJ := $(THIRD_OBJ:%.cc=$(OUT)/%.o)
+THIRD_OBJ := $(THIRD_SRC:%.c=$(OUT)/%.lo)
+THIRD_OBJ := $(THIRD_OBJ:%.cc=$(OUT)/%.lo)
 
 MUPDF_SRC := $(sort $(wildcard source/fitz/*.c))
 MUPDF_SRC += $(sort $(wildcard source/pdf/*.c))
@@ -122,14 +122,14 @@ MUPDF_SRC += $(sort $(wildcard source/ht
 MUPDF_SRC += $(sort $(wildcard source/cbz/*.c))
 MUPDF_SRC += $(sort $(wildcard source/gprf/*.c))
 
-MUPDF_OBJ := $(MUPDF_SRC:%.c=$(OUT)/%.o)
+MUPDF_OBJ := $(MUPDF_SRC:%.c=$(OUT)/%.lo)
 
 THREAD_SRC := source/helpers/mu-threads/mu-threads.c
-THREAD_OBJ := $(THREAD_SRC:%.c=$(OUT)/%.o)
+THREAD_OBJ := $(THREAD_SRC:%.c=$(OUT)/%.lo)
 
 PKCS7_SRC := source/helpers/pkcs7/pkcs7-check.c
 PKCS7_SRC += source/helpers/pkcs7/pkcs7-openssl.c
-PKCS7_OBJ := $(PKCS7_SRC:%.c=$(OUT)/%.o)
+PKCS7_OBJ := $(PKCS7_SRC:%.c=$(OUT)/%.lo)
 
 # --- Generated embedded font files ---
 
@@ -156,7 +156,7 @@ ifeq ($(HAVE_OBJCOPY),yes)
   $(OUT)/%.ttf.o : %.ttf ; $(OBJCOPY_CMD)
   $(OUT)/%.ttc.o : %.ttc ; $(OBJCOPY_CMD)
 else
-  MUPDF_OBJ += $(FONT_GEN:%.c=$(OUT)/%.o)
+  MUPDF_OBJ += $(FONT_GEN:%.c=$(OUT)/%.lo)
 endif
 
 generate: $(FONT_GEN)
@@ -190,17 +190,17 @@ generate: source/pdf/js/util.js.h
 
 # --- Library ---
 
-MUPDF_LIB = $(OUT)/libmupdf.a
-THIRD_LIB = $(OUT)/libmupdf-third.a
-THREAD_LIB = $(OUT)/libmupdf-threads.a
-PKCS7_LIB = $(OUT)/libmupdf-pkcs7.a
+MUPDF_LIB = $(OUT)/libmupdf.la
+THIRD_LIB = $(OUT)/libmupdf-third.la
+THREAD_LIB = $(OUT)/libmupdf-threads.la
+PKCS7_LIB = $(OUT)/libmupdf-pkcs7.la
 
 $(MUPDF_LIB) : $(MUPDF_OBJ)
 $(THIRD_LIB) : $(THIRD_OBJ)
 $(THREAD_LIB) : $(THREAD_OBJ)
 $(PKCS7_LIB) : $(PKCS7_OBJ)
 
-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
+INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
 
 # --- Main tools and viewers ---
 
@@ -211,7 +211,7 @@ MUTOOL_SRC += source/tools/murun.c
 MUTOOL_SRC += source/tools/mutrace.c
 MUTOOL_SRC += source/tools/cmapdump.c
 MUTOOL_SRC += $(sort $(wildcard source/tools/pdf*.c))
-MUTOOL_OBJ := $(MUTOOL_SRC:%.c=$(OUT)/%.o)
+MUTOOL_OBJ := $(MUTOOL_SRC:%.c=$(OUT)/%.lo)
 MUTOOL_EXE := $(OUT)/mutool
 $(MUTOOL_EXE) : $(MUTOOL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(THREAD_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(THREADING_LIBS) $(LIBCRYPTO_LIBS)
@@ -219,28 +219,27 @@ INSTALL_APPS += $(MUTOOL_EXE)
 
 ifeq ($(HAVE_GLUT),yes)
   MUVIEW_GLUT_SRC += $(sort $(wildcard platform/gl/*.c))
-  MUVIEW_GLUT_OBJ := $(MUVIEW_GLUT_SRC:%.c=$(OUT)/%.o)
-  MUVIEW_GLUT_EXE := $(OUT)/mupdf-gl
+  MUVIEW_GLUT_OBJ := $(MUVIEW_GLUT_SRC:%.c=$(OUT)/%.lo)
+  MUVIEW_GLUT_EXE := $(OUT)/platform/gl/mupdf-gl
   $(MUVIEW_GLUT_EXE) : $(MUVIEW_GLUT_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(GLUT_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(LIBCRYPTO_LIBS) $(WIN32_LDFLAGS) $(GLUT_LIBS)
   INSTALL_APPS += $(MUVIEW_GLUT_EXE)
 endif
 
 ifeq ($(HAVE_X11),yes)
-  MUVIEW_X11_EXE := $(OUT)/mupdf-x11
-  MUVIEW_X11_OBJ += $(OUT)/platform/x11/pdfapp.o
-  MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_main.o
-  MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_image.o
+  MUVIEW_X11_EXE := $(OUT)/platform/x11/mupdf
+  MUVIEW_X11_OBJ += $(OUT)/platform/x11/pdfapp.lo
+  MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_main.lo
+  MUVIEW_X11_OBJ += $(OUT)/platform/x11/x11_image.lo
   $(MUVIEW_X11_EXE) : $(MUVIEW_X11_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(X11_LIBS) $(LIBCRYPTO_LIBS)
-  INSTALL_APPS += $(MUVIEW_X11_EXE)
 endif
 
 ifeq ($(HAVE_WIN32),yes)
   MUVIEW_WIN32_EXE := $(OUT)/mupdf-w32
-  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/pdfapp.o
-  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/win_main.o
-  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/win_res.o
+  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/pdfapp.lo
+  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/win_main.lo
+  MUVIEW_WIN32_OBJ += $(OUT)/platform/x11/win_res.lo
   $(MUVIEW_WIN32_EXE) : $(MUVIEW_WIN32_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(WIN32_LDFLAGS) $(WIN32_LIBS) $(LIBCRYPTO_LIBS)
   INSTALL_APPS += $(MUVIEW_WIN32_EXE)
@@ -248,19 +247,19 @@ endif
 
 # --- Extra tools and viewers ---
 
-MURASTER_OBJ := $(OUT)/source/tools/muraster.o
+MURASTER_OBJ := $(OUT)/source/tools/muraster.lo
 MURASTER_EXE := $(OUT)/muraster
 $(MURASTER_EXE) : $(MURASTER_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(THREADING_LIBS)
 EXTRA_APPS += $(MURASTER_EXE)
 
-MJSGEN_OBJ := $(OUT)/source/tools/mjsgen.o
+MJSGEN_OBJ := $(OUT)/source/tools/mjsgen.lo
 MJSGEN_EXE := $(OUT)/mjsgen
 $(MJSGEN_EXE) : $(MJSGEN_OBJ) $(MUPDF_LIB) $(THIRD_LIB)
 	$(LINK_CMD) $(THIRD_LIBS)
 EXTRA_APPS += $(MJSGEN_EXE)
 
-MUJSTEST_OBJ := $(addprefix $(OUT)/platform/x11/, jstest_main.o pdfapp.o)
+MUJSTEST_OBJ := $(addprefix $(OUT)/platform/x11/, jstest_main.lo pdfapp.lo)
 MUJSTEST_EXE := $(OUT)/mujstest
 $(MUJSTEST_EXE) : $(MUJSTEST_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(LIBCRYPTO_LIBS)
@@ -268,33 +267,38 @@ EXTRA_APPS += $(MUJSTEST_EXE)
 
 ifeq ($(HAVE_X11),yes)
 ifeq ($(HAVE_CURL),yes)
-  MUVIEW_X11_CURL_EXE := $(OUT)/mupdf-x11-curl
-  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/pdfapp.o
-  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_main.o
-  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_image.o
-  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/curl_stream.o
+  MUVIEW_X11_CURL_EXE := $(OUT)/platform/x11/curl/mupdf
+  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/pdfapp.lo
+  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_main.lo
+  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/x11_image.lo
+  MUVIEW_X11_CURL_OBJ += $(OUT)/platform/x11/curl/curl_stream.lo
   $(MUVIEW_X11_CURL_EXE) : $(MUVIEW_X11_CURL_OBJ) $(MUPDF_LIB) $(THIRD_LIB) $(PKCS7_LIB) $(CURL_LIB)
 	$(LINK_CMD) $(THIRD_LIBS) $(X11_LIBS) $(CURL_LIBS) $(LIBCRYPTO_LIBS)
-  EXTRA_APPS += $(MUVIEW_X11_CURL_EXE)
 endif
 endif
 
+ifeq "$(HAVE_CURL)" "yes"
+INSTALL_APPS += $(MUVIEW_X11_CURL_EXE)
+else ifeq "$(HAVE_X11)" "yes"
+INSTALL_APPS += $(MUVIEW_X11_EXE)
+endif
+
 # --- Generated dependencies ---
 
--include $(MUPDF_OBJ:%.o=%.d)
--include $(PKCS7_OBJ:%.o=%.d)
--include $(THREAD_OBJ:%.o=%.d)
--include $(THIRD_OBJ:%.o=%.d)
--include $(GLUT_OBJ:%.o=%.d)
--include $(CURL_OBJ:%.o=%.d)
-
--include $(MUTOOL_OBJ:%.o=%.d)
--include $(MUVIEW_GLUT_OBJ:%.o=%.d)
--include $(MUVIEW_X11_OBJ:%.o=%.d)
--include $(MUVIEW_WIN32_OBJ:%.o=%.d)
+-include $(MUPDF_OBJ:%.lo=%.d)
+-include $(PKCS7_OBJ:%.lo=%.d)
+-include $(THREAD_OBJ:%.lo=%.d)
+-include $(THIRD_OBJ:%.lo=%.d)
+-include $(GLUT_OBJ:%.lo=%.d)
+-include $(CURL_OBJ:%.lo=%.d)
+
+-include $(MUTOOL_OBJ:%.lo=%.d)
+-include $(MUVIEW_GLUT_OBJ:%.lo=%.d)
+-include $(MUVIEW_X11_OBJ:%.lo=%.d)
+-include $(MUVIEW_WIN32_OBJ:%.lo=%.d)
 
--include $(MURASTER_OBJ:%.o=%.d)
--include $(MUVIEW_X11_CURL_OBJ:%.o=%.d)
+-include $(MURASTER_OBJ:%.lo=%.d)
+-include $(MUVIEW_X11_CURL_OBJ:%.lo=%.d)
 
 # --- Examples ---
 
@@ -305,10 +309,10 @@ $(OUT)/multi-threaded: docs/examples/mul
 
 # --- Update version string header ---
 
-VERSION = $(shell git describe --tags)
-
-version:
-	sed -i~ -e '/FZ_VERSION /s/".*"/"'$(VERSION)'"/' include/mupdf/fitz/version.h
+#VERSION = $(shell git describe --tags)
+#
+#version:
+#	sed -i~ -e '/FZ_VERSION /s/".*"/"'$(VERSION)'"/' include/mupdf/fitz/version.h
 
 # --- Format man pages ---
 
@@ -336,28 +340,30 @@ apps: $(INSTALL_APPS)
 extra-apps: $(EXTRA_APPS)
 extra: extra-libs extra-apps
 
-install: libs apps
-	install -d $(DESTDIR)$(incdir)/mupdf
-	install -d $(DESTDIR)$(incdir)/mupdf/fitz
-	install -d $(DESTDIR)$(incdir)/mupdf/pdf
-	install include/mupdf/*.h $(DESTDIR)$(incdir)/mupdf
-	install include/mupdf/fitz/*.h $(DESTDIR)$(incdir)/mupdf/fitz
-	install include/mupdf/pdf/*.h $(DESTDIR)$(incdir)/mupdf/pdf
-
-	install -d $(DESTDIR)$(libdir)
-	install $(INSTALL_LIBS) $(DESTDIR)$(libdir)
-
-	install -d $(DESTDIR)$(bindir)
-	install $(INSTALL_APPS) $(DESTDIR)$(bindir)
-
-	install -d $(DESTDIR)$(mandir)/man1
-	install docs/man/*.1 $(DESTDIR)$(mandir)/man1
-
-	install -d $(DESTDIR)$(docdir)
-	install -d $(DESTDIR)$(docdir)/examples
-	install README COPYING CHANGES $(DESTDIR)$(docdir)
-	install docs/*.html docs/*.css docs/*.png $(DESTDIR)$(docdir)
-	install docs/examples/* $(DESTDIR)$(docdir)/examples
+install: libs apps extra-apps
+	${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(incdir) $(DESTDIR)$(incdir)/mupdf $(DESTDIR)$(incdir)/mupdf/fitz $(DESTDIR)$(incdir)/mupdf/pdf
+	${BSD_INSTALL_DATA} include/mupdf/*.h $(DESTDIR)$(incdir)/mupdf
+	${BSD_INSTALL_DATA} include/mupdf/fitz/*.h $(DESTDIR)$(incdir)/mupdf/fitz
+	${BSD_INSTALL_DATA} include/mupdf/pdf/*.h $(DESTDIR)$(incdir)/mupdf/pdf
+
+	${BSD_INSTALL_LIB_DIR} $(DESTDIR)$(libdir)
+	for f in $(INSTALL_LIBS); do \
+		${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} $$f $(DESTDIR)$(libdir); \
+	done
+
+	${BSD_INSTALL_PROGRAM_DIR} $(DESTDIR)$(bindir)
+	for f in $(INSTALL_APPS) $(EXTRA_APPS); do \
+		${LIBTOOL} --mode=install ${BSD_INSTALL_PROGRAM} $$f $(DESTDIR)$(bindir); \
+	done
+
+	${BSD_INSTALL_MAN_DIR} $(DESTDIR)$(mandir)/man1
+	${BSD_INSTALL_MAN} docs/man/*.1 $(DESTDIR)$(mandir)/man1
+
+	${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(docdir)
+	${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(docdir)/examples
+	${BSD_INSTALL_DATA} README COPYING CHANGES $(DESTDIR)$(docdir)
+	${BSD_INSTALL_DATA} docs/*.html docs/*.css docs/*.png $(DESTDIR)$(docdir)
+	${BSD_INSTALL_DATA} docs/examples/* $(DESTDIR)$(docdir)/examples
 
 tarball:
 	bash scripts/archive.sh