Commit 644b9636 authored by Kan-Ru Chen's avatar Kan-Ru Chen

d/patches: fresh patches

parent 5172504d
......@@ -7,15 +7,15 @@ Subject: Sort files in static library to make the build reproducible
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8e47e3a..98e6567 100644
index 37fc48e..dde1840 100644
--- a/Makefile
+++ b/Makefile
@@ -74,7 +74,7 @@ endif
CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
CXX_CMD = $(QUIET_CXX) $(CXX) $(filter-out -Wdeclaration-after-statement,$(CFLAGS)) -o $@ -c $<
-AR_CMD = $(QUIET_AR) $(AR) cr $@ $^
+AR_CMD = $(QUIET_AR) $(AR) cr $@ `LC_ALL=C ls $^ 2>/dev/null`
LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
RM_CMD = $(QUIET_RM) rm -f $@
@@ -53,7 +53,7 @@ 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 $@ $^
+AR_CMD = $(QUIET_AR) $(MKTGTDIR) ; $(AR) cr $@ `LC_ALL=C ls $^ 2>/dev/null`
ifdef RANLIB
RANLIB_CMD = $(QUIET_RANLIB) $(RANLIB) $@
endif
......@@ -9,29 +9,29 @@ Do not strip binaries by default and use Debian LDFLAGS
2 files changed, 5 insertions(+)
diff --git a/Makerules b/Makerules
index 57065f3..9f06b98 100644
index fc9bf99..b7e64f2 100644
--- a/Makerules
+++ b/Makerules
@@ -27,6 +27,9 @@ SANITIZE_FLAGS += -fsanitize=leak
ifeq "$(build)" "debug"
CFLAGS += -pipe -g
LDFLAGS += -g
@@ -23,6 +23,9 @@ SANITIZE_FLAGS += -fsanitize=leak
ifeq ($(build),debug)
CFLAGS += -pipe -g
LDFLAGS += -g $(LDREMOVEUNREACH)
+else ifeq "$(build)" "debian"
+CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
+LDFLAGS += $(LDREMOVEUNREACH)
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
+ CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
+ LDFLAGS += $(LDREMOVEUNREACH)
else ifeq ($(build),release)
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
diff --git a/thirdparty/mujs/Makefile b/thirdparty/mujs/Makefile
index 2193c96..85842b0 100644
index 7284f51..3920f4a 100644
--- a/thirdparty/mujs/Makefile
+++ b/thirdparty/mujs/Makefile
@@ -31,6 +31,8 @@ CFLAGS += -g
@@ -30,6 +30,8 @@ ifeq "$(build)" "debug"
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
+else ifeq "$(build)" "debian"
+LDFLAGS += $(XLDFLAGS)
+ LDFLAGS += $(XLDFLAGS)
else
CFLAGS += -Os
LDFLAGS += -Wl,-s
CFLAGS += -Os
LDFLAGS += -Wl,-s
From: Sebastian Rasmussen <sebras@gmail.com>
Date: Tue, 21 Aug 2018 19:07:57 +0800
Subject: Bug 699271: Fix eternal loop when skipping space before EOF.
Thanks to Michael J Gruber for providing this oneliner.
---
source/pdf/pdf-xref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 8515090..baaab12 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -647,7 +647,7 @@ fz_skip_space(fz_context *ctx, fz_stream *stm)
do
{
int c = fz_peek_byte(ctx, stm);
- if (c > 32 && c != EOF)
+ if (c == EOF || c > 32)
return;
(void)fz_read_byte(ctx, stm);
}
From: Kan-Ru Chen <kanru@kanru.info>
Date: Mon, 3 Sep 2018 08:51:04 +0900
Subject: MuPDF crossbuild use target arch pkg-config
mupdf fails to cross build, because it uses the build architecture
pkg-config and thus fails to find a pile of .pc files.
---
Makerules | 58 +++++++++++++++++++++++++++++++---------------------------
1 file changed, 31 insertions(+), 27 deletions(-)
diff --git a/Makerules b/Makerules
index b7e64f2..0d444f1 100644
--- a/Makerules
+++ b/Makerules
@@ -6,6 +6,10 @@ OS := $(OS:MSYS%=MINGW)
OS := $(OS:Windows_NT=MINGW)
OS := $(OS:Darwin=MACOS)
+PKG_CONFIG ?= pkg-config
+
+HAVE_LIBDL ?= yes
+
ifeq ($(findstring -fembed-bitcode,$(XCFLAGS)),)
# clang does not support these in combination with -fembed-bitcode
CFLAGS += -ffunction-sections -fdata-sections
@@ -91,35 +95,35 @@ else ifeq ($(OS),MACOS)
else ifeq ($(OS),Linux)
HAVE_OBJCOPY := yes
- 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 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_CURL := $(shell pkg-config --exists libcurl && echo yes)
+ HAVE_CURL := $(shell $(PKG_CONFIG) --exists libcurl && echo yes)
ifeq ($(HAVE_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
@@ -128,16 +132,16 @@ else ifeq ($(OS),Linux)
SYS_GLUT_LIBS := -lglut -lGL
endif
- HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
+ HAVE_X11 := $(shell $(PKG_CONFIG) --exists x11 xext && echo yes)
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 := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
+ HAVE_LIBCRYPTO := $(shell $(PKG_CONFIG) --exists 'libcrypto >= 1.1.0' && echo yes)
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
......@@ -3,34 +3,25 @@ Date: Mon, 3 Sep 2018 08:53:44 +0900
Subject: MuPDF crossbuild use host cc for utils
---
Makefile | 4 ++++
Makefile | 2 ++
Makerules | 1 +
2 files changed, 5 insertions(+)
2 files changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index 98e6567..3002bb5 100644
index dde1840..cb76e87 100644
--- a/Makefile
+++ b/Makefile
@@ -180,6 +180,8 @@ $(SIGNATURE_OBJ) : $(PKCS7_HDR)
# --- Generated PDF name tables ---
NAMEDUMP_EXE := $(OUT)/scripts/namedump.exe
+$(NAMEDUMP_EXE): scripts/namedump.c | $(ALL_DIR)
+ $(QUIET_CC) $(CC_FOR_BUILD) $(CFLAGS) $< -o $@
include/mupdf/pdf.h : include/mupdf/pdf/name-table.h
NAME_GEN := include/mupdf/pdf/name-table.h source/pdf/pdf-name-table.h
@@ -197,6 +199,8 @@ generate: $(NAME_GEN)
@@ -134,6 +134,8 @@ PKCS7_OBJ := $(PKCS7_SRC:%.c=$(OUT)/%.o)
# --- Generated embedded font files ---
HEXDUMP_EXE := $(OUT)/scripts/hexdump.exe
+$(HEXDUMP_EXE): scripts/hexdump.c | $(ALL_DIR)
+ $(QUIET_CC) $(CC_FOR_BUILD) $(CFLAGS) -o $@ $<
FONT_BIN_DROID := $(sort $(wildcard resources/fonts/droid/*.ttf))
FONT_BIN_NOTO := $(sort $(wildcard resources/fonts/noto/*.ttf))
FONT_BIN := $(sort $(wildcard resources/fonts/urw/*.cff))
FONT_BIN += $(sort $(wildcard resources/fonts/han/*.ttc))
diff --git a/Makerules b/Makerules
index 2e5bbce..fed3ce6 100644
index 0d444f1..35c9cbe 100644
--- a/Makerules
+++ b/Makerules
@@ -7,6 +7,7 @@ OS := $(OS:Windows_NT=MINGW)
......
From: Kan-Ru Chen <kanru@kanru.info>
Date: Mon, 3 Sep 2018 08:51:04 +0900
Subject: MuPDF crossbuild use target arch pkg-config
mupdf fails to cross build, because it uses the build architecture
pkg-config and thus fails to find a pile of .pc files.
---
Makerules | 44 +++++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/Makerules b/Makerules
index 9f06b98..2e5bbce 100644
--- a/Makerules
+++ b/Makerules
@@ -6,6 +6,8 @@ OS := $(OS:MSYS%=MINGW)
OS := $(OS:Windows_NT=MINGW)
OS := $(OS:Darwin=MACOS)
+PKG_CONFIG ?= pkg-config
+
HAVE_LIBDL ?= yes
CFLAGS += -Wall -Wdeclaration-after-statement
@@ -100,43 +102,43 @@ HAVE_GLUT := yes
SYS_GLUT_CFLAGS :=
SYS_GLUT_LIBS := -lglut -lGL
-ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes"
+ifeq "$(shell $(PKG_CONFIG) --exists 'libcrypto >= 1.1.0' && echo yes)" "yes"
HAVE_LIBCRYPTO := yes
-SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto)
-SYS_LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
+SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell $(PKG_CONFIG) --cflags libcrypto)
+SYS_LIBCRYPTO_LIBS := $(shell $(PKG_CONFIG) --libs libcrypto)
endif
-ifeq "$(shell pkg-config --exists libcurl && echo yes)" "yes"
+ifeq "$(shell $(PKG_CONFIG) --exists libcurl && echo yes)" "yes"
HAVE_CURL := yes
-SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
-SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
-ifeq "$(shell pkg-config --exists openssl && echo yes)" "yes"
+SYS_CURL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libcurl)
+SYS_CURL_LIBS := $(shell $(PKG_CONFIG) --libs libcurl)
+ifeq "$(shell $(PKG_CONFIG) --exists openssl && echo yes)" "yes"
HAVE_OPENSSL_SSL := yes
-SYS_CURL_CFLAGS += $(shell pkg-config --cflags openssl)
-SYS_CURL_DEPS += $(shell pkg-config --libs openssl)
+SYS_CURL_CFLAGS += $(shell $(PKG_CONFIG) --cflags openssl)
+SYS_CURL_DEPS += $(shell $(PKG_CONFIG) --libs openssl)
endif
endif
SYS_CURL_DEPS += -lpthread -lrt
-ifeq "$(shell pkg-config --exists x11 xext && echo yes)" "yes"
+ifeq "$(shell $(PKG_CONFIG) --exists x11 xext && echo yes)" "yes"
HAVE_X11 := yes
-SYS_X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
-SYS_X11_LIBS := $(shell pkg-config --libs x11 xext)
+SYS_X11_CFLAGS := $(shell $(PKG_CONFIG) --cflags x11 xext)
+SYS_X11_LIBS := $(shell $(PKG_CONFIG) --libs x11 xext)
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 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 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
SYS_JBIG2DEC_LIBS := -ljbig2dec
0001-mupdf_manpage.patch
0003-Sort-files-in-static-library-to-make-the-build-repro.patch
0003-use-debian-flavor-build-options.patch
0004-Bug-699271-Fix-eternal-loop-when-skipping-space-befo.patch
0005-MuPDF-crossbuild-use-target-arch-pkg-config.patch
0006-MuPDF-crossbuild-use-host-cc-for-utils.patch
0004-MuPDF-crossbuild-use-target-arch-pkg-config.patch
0005-MuPDF-crossbuild-use-host-cc-for-utils.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment