summaryrefslogtreecommitdiff
blob: 643b6d2c8b1e9dc99e563e41704188e64cdcee98 (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
Refreshed patches based on:
https://sources.debian.org/patches/mupdf/1.17.0+ds1-1/0004-MuPDF-crossbuild-use-target-arch-pkg-config.patch/
https://sources.debian.org/patches/mupdf/1.17.0+ds1-1/0005-MuPDF-crossbuild-use-host-cc-for-utils.patch/
--- a/Makefile
+++ b/Makefile
@@ -147,6 +147,9 @@ PKCS7_OBJ := $(PKCS7_SRC:%.c=$(OUT)/%.o)

 HEXDUMP_EXE := $(OUT)/scripts/hexdump.exe

+$(HEXDUMP_EXE): scripts/hexdump.c
+	$(QUIET_CC) $(MKTGTDIR) ; $(CC_FOR_BUILD) $(CFLAGS) -o $@ $<
+
 FONT_BIN := $(sort $(wildcard resources/fonts/urw/*.cff))
 FONT_BIN += $(sort $(wildcard resources/fonts/han/*.ttc))
 FONT_BIN += $(sort $(wildcard resources/fonts/droid/*.ttf))
--- a/Makerules
+++ b/Makerules
@@ -6,6 +6,9 @@ OS := $(OS:MSYS%=MINGW)
 OS := $(OS:Windows_NT=MINGW)
 OS := $(OS:Darwin=MACOS)
 
+PKG_CONFIG ?= pkg-config
+CC_FOR_BUILD ?= $(CC)
+
 WARNING_CFLAGS := -Wall -Wsign-compare
 
 # Feature configuration options
@@ -156,51 +159,51 @@ else ifeq ($(OS),MACOS)
   endif
 endif
 
-  ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes)
-	SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2)
-	SYS_FREETYPE_LIBS := $(shell pkg-config --libs freetype2)
+  ifeq ($(shell $(PKG_CONFIG) --exists freetype2 && echo yes),yes)
+	SYS_FREETYPE_CFLAGS := $(shell $(PKG_CONFIG) --cflags freetype2)
+	SYS_FREETYPE_LIBS := $(shell $(PKG_CONFIG) --libs freetype2)
   endif
-  ifeq ($(shell pkg-config --exists gumbo && echo yes),yes)
-	SYS_GUMBO_CFLAGS := $(shell pkg-config --cflags gumbo)
-	SYS_GUMBO_LIBS := $(shell pkg-config --libs gumbo)
+  ifeq ($(shell $(PKG_CONFIG) --exists gumbo && echo yes),yes)
+	SYS_GUMBO_CFLAGS := $(shell $(PKG_CONFIG) --cflags gumbo)
+	SYS_GUMBO_LIBS := $(shell $(PKG_CONFIG) --libs gumbo)
   endif
-  ifeq ($(shell pkg-config --exists harfbuzz && echo yes),yes)
-	SYS_HARFBUZZ_CFLAGS := $(shell pkg-config --cflags harfbuzz)
-	SYS_HARFBUZZ_LIBS := $(shell pkg-config --libs harfbuzz)
+  ifeq ($(shell $(PKG_CONFIG) --exists harfbuzz && echo yes),yes)
+	SYS_HARFBUZZ_CFLAGS := $(shell $(PKG_CONFIG) --cflags harfbuzz)
+	SYS_HARFBUZZ_LIBS := $(shell $(PKG_CONFIG) --libs harfbuzz)
   endif
-  ifeq ($(shell pkg-config --exists lcms2 && echo yes),yes)
-	SYS_LCMS2_CFLAGS := $(shell pkg-config --cflags lcms2)
-	SYS_LCMS2_LIBS := $(shell pkg-config --libs lcms2)
+  ifeq ($(shell $(PKG_CONFIG) --exists lcms2 && echo yes),yes)
+	SYS_LCMS2_CFLAGS := $(shell $(PKG_CONFIG) --cflags lcms2)
+	SYS_LCMS2_LIBS := $(shell $(PKG_CONFIG) --libs lcms2)
   endif
-  ifeq ($(shell pkg-config --exists libjpeg && echo yes),yes)
-	SYS_LIBJPEG_CFLAGS := $(shell pkg-config --cflags libjpeg)
-	SYS_LIBJPEG_LIBS := $(shell pkg-config --libs libjpeg)
+  ifeq ($(shell $(PKG_CONFIG) --exists libjpeg && echo yes),yes)
+	SYS_LIBJPEG_CFLAGS := $(shell $(PKG_CONFIG) --cflags libjpeg)
+	SYS_LIBJPEG_LIBS := $(shell $(PKG_CONFIG) --libs libjpeg)
   endif
-  ifeq ($(shell pkg-config --exists libopenjp2 && echo yes),yes)
-	SYS_OPENJPEG_CFLAGS := $(shell pkg-config --cflags libopenjp2)
-	SYS_OPENJPEG_LIBS := $(shell pkg-config --libs libopenjp2)
+  ifeq ($(shell $(PKG_CONFIG) --exists libopenjp2 && echo yes),yes)
+	SYS_OPENJPEG_CFLAGS := $(shell $(PKG_CONFIG) --cflags libopenjp2)
+	SYS_OPENJPEG_LIBS := $(shell $(PKG_CONFIG) --libs libopenjp2)
   endif
-  ifeq ($(shell pkg-config --exists zlib && echo yes),yes)
-	SYS_ZLIB_CFLAGS := $(shell pkg-config --cflags zlib)
-	SYS_ZLIB_LIBS := $(shell pkg-config --libs zlib)
+  ifeq ($(shell $(PKG_CONFIG) --exists zlib && echo yes),yes)
+	SYS_ZLIB_CFLAGS := $(shell $(PKG_CONFIG) --cflags zlib)
+	SYS_ZLIB_LIBS := $(shell $(PKG_CONFIG) --libs zlib)
   endif
 
-  HAVE_SYS_LEPTONICA := $(shell pkg-config --exists 'lept >= 1.7.4' && echo yes)
+  HAVE_SYS_LEPTONICA := $(shell $(PKG_CONFIG) --exists 'lept >= 1.7.4' && echo yes)
   ifeq ($(HAVE_SYS_LEPTONICA),yes)
-	SYS_LEPTONICA_CFLAGS := $(shell pkg-config --cflags lept)
-	SYS_LEPTONICA_LIBS := $(shell pkg-config --libs lept)
+	SYS_LEPTONICA_CFLAGS := $(shell $(PKG_CONFIG) --cflags lept)
+	SYS_LEPTONICA_LIBS := $(shell $(PKG_CONFIG) --libs lept)
   endif
 
-  HAVE_SYS_TESSERACT := $(shell pkg-config --exists 'tesseract >= 4.0.0' && echo yes)
+  HAVE_SYS_TESSERACT := $(shell $(PKG_CONFIG) --exists 'tesseract >= 4.0.0' && echo yes)
   ifeq ($(HAVE_SYS_TESSERACT),yes)
-	SYS_TESSERACT_CFLAGS := $(shell pkg-config --cflags tesseract)
-	SYS_TESSERACT_LIBS := $(shell pkg-config --libs tesseract)
+	SYS_TESSERACT_CFLAGS := $(shell $(PKG_CONFIG) --cflags tesseract)
+	SYS_TESSERACT_LIBS := $(shell $(PKG_CONFIG) --libs tesseract)
   endif
 
-  HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes)
+  HAVE_SYS_CURL := $(shell $(PKG_CONFIG) --exists libcurl && echo yes)
   ifeq ($(HAVE_SYS_CURL),yes)
-	SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
-	SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
+	SYS_CURL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libcurl)
+	SYS_CURL_LIBS := $(shell $(PKG_CONFIG) --libs libcurl)
   endif
 
   HAVE_GLUT := yes
@@ -209,16 +212,16 @@ endif
 	SYS_GLUT_LIBS := -lglut -lGL
   endif
 
   HAVE_X11 := not-unless-portage-tells-me
   ifeq ($(HAVE_X11),yes)
-	X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
-	X11_LIBS := $(shell pkg-config --libs x11 xext)
+	X11_CFLAGS := $(shell $(PKG_CONFIG) --cflags x11 xext)
+	X11_LIBS := $(shell $(PKG_CONFIG) --libs x11 xext)
   endif
 
   HAVE_LIBCRYPTO := not-unless-portage-tells-me
   ifeq ($(HAVE_LIBCRYPTO),yes)
-	LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
-	LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
+	LIBCRYPTO_CFLAGS := $(shell $(PKG_CONFIG) --cflags libcrypto) -DHAVE_LIBCRYPTO
+	LIBCRYPTO_LIBS := $(shell $(PKG_CONFIG) --libs libcrypto)
   endif
 
   HAVE_PTHREAD := yes