mupdf.
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From 32e4e8b4bcbacbf92af7c88337efae21986d9603 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Watts <Robin.Watts@artifex.com>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
From b82e9b6d6b46877e5c3763cc3bc641c66fa7eb54 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Watts <Robin.Watts@artifex.com>
|
||||
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)
|
||||
{
|
||||
@@ -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)
|
||||
@@ -1,59 +0,0 @@
|
||||
From aaa2d5971fa8419c2a7aec5361d909a45226d20a Mon Sep 17 00:00:00 2001
|
||||
From: Fabio Forni <livingsilver94.solus@redaril.me>
|
||||
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
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<Description>
|
||||
MuPDF is a lightweight open source software framework for viewing and converting PDF, XPS, and E-book documents.
|
||||
</Description>
|
||||
<Archive sha1sum="fc17bd01d5860e49b009f28a5ddb629e94af4510" type="tarxz">
|
||||
https://mupdf.com/downloads/archive/mupdf-1.18.0-source.tar.xz
|
||||
<Archive sha1sum="df36cdf7f23a3ff98835278eea885b30da6887d1" type="tarxz">
|
||||
https://mupdf.com/downloads/archive/mupdf-1.19.0-source.tar.xz
|
||||
</Archive>
|
||||
<BuildDependencies>
|
||||
<Dependency>zlib-devel</Dependency>
|
||||
@@ -37,9 +37,7 @@
|
||||
<Dependency>libjpeg-turbo-devel</Dependency>
|
||||
</BuildDependencies>
|
||||
<Patches>
|
||||
<Patch>shared-libs.patch</Patch>
|
||||
<Patch>32e4e8b4bcbacbf92af7c.patch</Patch>
|
||||
<Patch>b82e9b6d6b46877e5c376.patch</Patch>
|
||||
<Patch>shared-lib.patch</Patch>
|
||||
<Patch>fix-build-on-big-endian.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
@@ -64,7 +62,6 @@
|
||||
<Path fileType="executable">/usr/bin</Path>
|
||||
<Path fileType="library">/usr/lib</Path>
|
||||
<Path fileType="man">/usr/share/man</Path>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
@@ -81,7 +78,25 @@
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<Package>
|
||||
<Name>mupdf-doc</Name>
|
||||
<Summary>mupdf html documentation.</Summary>
|
||||
<RuntimeDependencies>
|
||||
<!-- <Dependency release="current">mupdf</Dependency> -->
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="doc">/usr/share/doc/mupdf</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="9">
|
||||
<Date>2021-10-15</Date>
|
||||
<Version>1.19.0</Version>
|
||||
<Comment>Version bump.</Comment>
|
||||
<Name>fury</Name>
|
||||
<Email>uglyside@yandex.ru</Email>
|
||||
</Update>
|
||||
<Update release="8">
|
||||
<Date>2021-03-14</Date>
|
||||
<Version>1.18.0</Version>
|
||||
|
||||
Reference in New Issue
Block a user