From ee58ffd6428b3926c2edfbd854b6b8c675a17691 Mon Sep 17 00:00:00 2001 From: 4fury-c3440d8 Date: Fri, 15 Oct 2021 11:19:22 +0300 Subject: [PATCH] mupdf. --- office/misc/mupdf/actions.py | 23 ++-- .../mupdf/files/32e4e8b4bcbacbf92af7c.patch | 41 ------- .../mupdf/files/b82e9b6d6b46877e5c376.patch | 102 ------------------ office/misc/mupdf/files/shared-lib.patch | 11 ++ office/misc/mupdf/files/shared-libs.patch | 59 ---------- office/misc/mupdf/pspec.xml | 27 +++-- 6 files changed, 44 insertions(+), 219 deletions(-) delete mode 100644 office/misc/mupdf/files/32e4e8b4bcbacbf92af7c.patch delete mode 100644 office/misc/mupdf/files/b82e9b6d6b46877e5c376.patch create mode 100644 office/misc/mupdf/files/shared-lib.patch delete mode 100644 office/misc/mupdf/files/shared-libs.patch diff --git a/office/misc/mupdf/actions.py b/office/misc/mupdf/actions.py index 0c1539b5b9..526c222165 100644 --- a/office/misc/mupdf/actions.py +++ b/office/misc/mupdf/actions.py @@ -4,27 +4,28 @@ # Licensed under the GNU General Public License, version 3. # See the file https://www.gnu.org/licenses/gpl-3.0.txt -from pisi.actionsapi import get -from pisi.actionsapi import autotools -from pisi.actionsapi import pisitools from pisi.actionsapi import shelltools +from pisi.actionsapi import pisitools +from pisi.actionsapi import autotools +from pisi.actionsapi import get i = ''.join([ - 'USE_SYSTEM_LIBS=yes ', - 'USE_SYSTEM_GLUT=no ', - 'USE_SYSTEM_LCMS2=no ', - 'USE_SYSTEM_GUMBO=no ', - 'USE_SYSTEM_JBIG2DEC=no ']) + ' USE_SYSTEM_LIBS=yes', + ' USE_SYSTEM_GLUT=no', + ' USE_SYSTEM_LCMS2=no', + ' USE_SYSTEM_GUMBO=no', + ' USE_SYSTEM_JBIG2DEC=no', + ' shared=yes ' + ]) def build(): - shelltools.export("CFLAGS", "%s -fcommon" % get.CFLAGS()) shelltools.system("sed '/TOFU_CJK /c #define TOFU_CJK 1/' -i include/mupdf/fitz/config.h") shelltools.system("sed -i '/ttc/s/^/#/' Makefile") - autotools.make("prefix=/usr %s" % i) - # remove bundled packages, use our system libraries shelltools.system("rm -rf thirdparty/{curl,freetype,harfbuzz,libjpeg,openjpeg,zlib}") + autotools.make("prefix=/usr %s" % i) + def install(): autotools.rawInstall("DESTDIR=%s prefix=/usr %s" % (get.installDIR(), i)) diff --git a/office/misc/mupdf/files/32e4e8b4bcbacbf92af7c.patch b/office/misc/mupdf/files/32e4e8b4bcbacbf92af7c.patch deleted file mode 100644 index d19f0593a1..0000000000 --- a/office/misc/mupdf/files/32e4e8b4bcbacbf92af7c.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 32e4e8b4bcbacbf92af7c88337efae21986d9603 Mon Sep 17 00:00:00 2001 -From: Robin Watts -Date: Thu, 8 Oct 2020 18:10:28 +0100 -Subject: [PATCH] Bug 702958: Fix overflow in fz_clear_pixmap_with_value. - ---- - source/fitz/pixmap.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c -index 66873d214..80d8bb62f 100644 ---- a/source/fitz/pixmap.c -+++ b/source/fitz/pixmap.c -@@ -555,7 +555,8 @@ void - fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value) - { - unsigned char *s; -- int w, h, n, stride, len; -+ int w, h, n; -+ ptrdiff_t stride, len; - int alpha = pix->alpha; - - w = pix->w; -@@ -572,7 +573,7 @@ fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value) - - n = pix->n; - stride = pix->stride; -- len = w * n; -+ len = (ptrdiff_t)w * n; - - s = pix->samples; - if (value == 255 || !alpha) -@@ -584,7 +585,7 @@ fz_clear_pixmap_with_value(fz_context *ctx, fz_pixmap *pix, int value) - } - while (h--) - { -- memset(s, value, (unsigned int)len); -+ memset(s, value, len); - s += stride; - } - } diff --git a/office/misc/mupdf/files/b82e9b6d6b46877e5c376.patch b/office/misc/mupdf/files/b82e9b6d6b46877e5c376.patch deleted file mode 100644 index dc4000b4cd..0000000000 --- a/office/misc/mupdf/files/b82e9b6d6b46877e5c376.patch +++ /dev/null @@ -1,102 +0,0 @@ -From b82e9b6d6b46877e5c3763cc3bc641c66fa7eb54 Mon Sep 17 00:00:00 2001 -From: Robin Watts -Date: Thu, 8 Oct 2020 16:15:40 +0100 -Subject: [PATCH] Bug 701297: Harden populate_ui against unexpected repairs. - -We count the number of layers, and allocate space for them in -an array. We then walk the tree reading details of those layers -in. If we hit a problem that causes a repair while reading the -information, the number of layers can magically increase. In -the existing code we run off the end of the array. - -In the new code we watch for hitting the end of the array and -realloc as required. ---- - source/pdf/pdf-layer.c | 32 +++++++++++++++++++++++++------- - 1 file changed, 25 insertions(+), 7 deletions(-) - -diff --git a/source/pdf/pdf-layer.c b/source/pdf/pdf-layer.c -index 177f0c947..b8e9d7cad 100644 ---- a/source/pdf/pdf-layer.c -+++ b/source/pdf/pdf-layer.c -@@ -104,10 +104,27 @@ count_entries(fz_context *ctx, pdf_obj *obj) - } - - static pdf_ocg_ui * --populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_ocg_ui *ui, pdf_obj *order, int depth, pdf_obj *rbgroups, pdf_obj *locked) -+get_ocg_ui(fz_context *ctx, pdf_ocg_descriptor *desc, int fill) -+{ -+ if (fill == desc->num_ui_entries) -+ { -+ /* Number of layers changed while parsing; -+ * probably due to a repair. */ -+ int newsize = desc->num_ui_entries * 2; -+ if (newsize == 0) -+ newsize = 4; /* Arbitrary non-zero */ -+ desc->ui = fz_realloc_array(ctx, desc->ui, newsize, pdf_ocg_ui); -+ desc->num_ui_entries = newsize; -+ } -+ return &desc->ui[fill]; -+} -+ -+static int -+populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, int fill, pdf_obj *order, int depth, pdf_obj *rbgroups, pdf_obj *locked) - { - int len = pdf_array_len(ctx, order); - int i, j; -+ pdf_ocg_ui *ui; - - for (i = 0; i < len; i++) - { -@@ -118,7 +135,7 @@ populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_ocg_ui *ui, pdf_obj * - continue; - - fz_try(ctx) -- ui = populate_ui(ctx, desc, ui, o, depth+1, rbgroups, locked); -+ fill = populate_ui(ctx, desc, fill, o, depth+1, rbgroups, locked); - fz_always(ctx) - pdf_unmark_obj(ctx, o); - fz_catch(ctx) -@@ -126,14 +143,14 @@ populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_ocg_ui *ui, pdf_obj * - - continue; - } -- ui->depth = depth; - if (pdf_is_string(ctx, o)) - { -+ ui = get_ocg_ui(ctx, desc, fill++); -+ ui->depth = depth; - ui->ocg = -1; - ui->name = pdf_to_str_buf(ctx, o); - ui->button_flags = PDF_LAYER_UI_LABEL; - ui->locked = 1; -- ui++; - continue; - } - -@@ -144,13 +161,14 @@ populate_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_ocg_ui *ui, pdf_obj * - } - if (j == desc->len) - continue; /* OCG not found in main list! Just ignore it */ -+ ui = get_ocg_ui(ctx, desc, fill++); -+ ui->depth = depth; - ui->ocg = j; - ui->name = pdf_dict_get_string(ctx, o, PDF_NAME(Name), NULL); - ui->button_flags = pdf_array_contains(ctx, o, rbgroups) ? PDF_LAYER_UI_RADIOBOX : PDF_LAYER_UI_CHECKBOX; - ui->locked = pdf_array_contains(ctx, o, locked); -- ui++; - } -- return ui; -+ return fill; - } - - static void -@@ -188,7 +206,7 @@ load_ui(fz_context *ctx, pdf_ocg_descriptor *desc, pdf_obj *ocprops, pdf_obj *oc - desc->ui = Memento_label(fz_calloc(ctx, count, sizeof(pdf_ocg_ui)), "pdf_ocg_ui"); - fz_try(ctx) - { -- (void)populate_ui(ctx, desc, desc->ui, order, 0, rbgroups, locked); -+ desc->num_ui_entries = populate_ui(ctx, desc, 0, order, 0, rbgroups, locked); - } - fz_catch(ctx) - { diff --git a/office/misc/mupdf/files/shared-lib.patch b/office/misc/mupdf/files/shared-lib.patch new file mode 100644 index 0000000000..edbfa4b2f4 --- /dev/null +++ b/office/misc/mupdf/files/shared-lib.patch @@ -0,0 +1,11 @@ +--- a/Makefile 2020-11-22 16:06:50.382848861 +0000 ++++ b/Makefile 2020-11-22 16:11:49.044201863 +0000 +@@ -24,7 +24,7 @@ + # Do not specify CFLAGS or LIBS on the make invocation line - specify + # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that + # set a variable that was set on the command line. +-CFLAGS += $(XCFLAGS) -Iinclude ++CFLAGS += $(XCFLAGS) -Iinclude -fPIC -fcommon + LIBS += $(XLIBS) -lm + + ifneq ($(threading),no) diff --git a/office/misc/mupdf/files/shared-libs.patch b/office/misc/mupdf/files/shared-libs.patch deleted file mode 100644 index e0ca039e22..0000000000 --- a/office/misc/mupdf/files/shared-libs.patch +++ /dev/null @@ -1,59 +0,0 @@ -From aaa2d5971fa8419c2a7aec5361d909a45226d20a Mon Sep 17 00:00:00 2001 -From: Fabio Forni -Date: Sun, 6 Dec 2020 13:25:20 +0100 -Subject: [PATCH] Link against shared libs - ---- - Makefile | 18 +++++++++++------- - 1 file changed, 11 insertions(+), 7 deletions(-) - -diff --git a/Makefile b/Makefile -index b0fb617..9fe5001 100644 ---- a/Makefile -+++ b/Makefile -@@ -24,7 +24,7 @@ include Makethird - # Do not specify CFLAGS or LIBS on the make invocation line - specify - # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that - # set a variable that was set on the command line. --CFLAGS += $(XCFLAGS) -Iinclude -+CFLAGS += $(XCFLAGS) -Iinclude -fPIC - LIBS += $(XLIBS) -lm - - ifneq ($(threading),no) -@@ -214,15 +214,19 @@ MUPDF_LIB = $(OUT)/libmupdf.$(SO) - - $(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_OBJ) $(THREAD_OBJ) $(PKCS7_OBJ) - else --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.so -+THIRD_LIB = $(OUT)/libmupdf-third.so -+THREAD_LIB = $(OUT)/libmupdf-threads.so -+PKCS7_LIB = $(OUT)/libmupdf-pkcs7.so - --$(MUPDF_LIB) : $(MUPDF_OBJ) -+$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined $(THIRD_LIBS) - $(THIRD_LIB) : $(THIRD_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-third.so -Wl,--no-undefined - $(THREAD_LIB) : $(THREAD_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-threads.so -Wl,--no-undefined -lpthread - $(PKCS7_LIB) : $(PKCS7_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-pkcs7.so - endif - - $(MUPDF_LIB) : $(MUPDF_OBJ) -@@ -230,7 +234,7 @@ $(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 --- - --- -2.29.2 - diff --git a/office/misc/mupdf/pspec.xml b/office/misc/mupdf/pspec.xml index d801627b70..a7e17927d3 100644 --- a/office/misc/mupdf/pspec.xml +++ b/office/misc/mupdf/pspec.xml @@ -14,8 +14,8 @@ MuPDF is a lightweight open source software framework for viewing and converting PDF, XPS, and E-book documents. - - https://mupdf.com/downloads/archive/mupdf-1.18.0-source.tar.xz + + https://mupdf.com/downloads/archive/mupdf-1.19.0-source.tar.xz zlib-devel @@ -37,9 +37,7 @@ libjpeg-turbo-devel - shared-libs.patch - 32e4e8b4bcbacbf92af7c.patch - b82e9b6d6b46877e5c376.patch + shared-lib.patch fix-build-on-big-endian.patch @@ -64,7 +62,6 @@ /usr/bin /usr/lib /usr/share/man - /usr/share/doc @@ -81,7 +78,25 @@ + + mupdf-doc + mupdf html documentation. + + + + + /usr/share/doc/mupdf + + + + + 2021-10-15 + 1.19.0 + Version bump. + fury + uglyside@yandex.ru + 2021-03-14 1.18.0