1 |
commit: 9581bec40fed2aaf7cce58fa0f4d64ce9db887aa |
2 |
Author: Philipp Rösner <rndxelement <AT> protonmail <DOT> com> |
3 |
AuthorDate: Fri Dec 23 15:51:49 2022 +0000 |
4 |
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 29 20:48:42 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9581bec4 |
7 |
|
8 |
app-text/mupdf-1.21.1: allow disabling DRM checking |
9 |
|
10 |
MuPDF by default blocks DRM content, see: |
11 |
https://github.com/ArtifexSoftware/mupdf/commit/2b3bd1b7dbbf13f82b70587676809f189354c77a |
12 |
|
13 |
Add patch and local use flag `drm` for allowing/disallowing DRM content |
14 |
in PDF files. |
15 |
|
16 |
Suggested-by: William Rabbermann <willrabbermann <AT> gmail.com> |
17 |
Signed-off-by: Philipp Rösner <rndxelement <AT> protonmail.com> |
18 |
Closes: https://github.com/gentoo/gentoo/pull/28772 |
19 |
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> |
20 |
|
21 |
app-text/mupdf/files/mupdf-1.21.1-no-drm.patch | 18 ++++++++++++++++++ |
22 |
app-text/mupdf/metadata.xml | 3 +++ |
23 |
app-text/mupdf/mupdf-1.21.1.ebuild | 5 ++++- |
24 |
3 files changed, 25 insertions(+), 1 deletion(-) |
25 |
|
26 |
diff --git a/app-text/mupdf/files/mupdf-1.21.1-no-drm.patch b/app-text/mupdf/files/mupdf-1.21.1-no-drm.patch |
27 |
new file mode 100644 |
28 |
index 000000000000..356ee4b852dd |
29 |
--- /dev/null |
30 |
+++ b/app-text/mupdf/files/mupdf-1.21.1-no-drm.patch |
31 |
@@ -0,0 +1,18 @@ |
32 |
+diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c |
33 |
+index f764242..83888dc 100644 |
34 |
+--- a/source/html/epub-doc.c |
35 |
++++ b/source/html/epub-doc.c |
36 |
+@@ -692,10 +692,12 @@ epub_parse_header(fz_context *ctx, epub_document *doc) |
37 |
+ epub_chapter **tailp; |
38 |
+ int i; |
39 |
+ |
40 |
++ #ifdef drm |
41 |
+ if (fz_has_archive_entry(ctx, zip, "META-INF/rights.xml")) |
42 |
+ fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM"); |
43 |
+ if (fz_has_archive_entry(ctx, zip, "META-INF/encryption.xml")) |
44 |
+ fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM"); |
45 |
++ #endif |
46 |
+ |
47 |
+ fz_var(buf); |
48 |
+ fz_var(container_xml); |
49 |
+ |
50 |
|
51 |
diff --git a/app-text/mupdf/metadata.xml b/app-text/mupdf/metadata.xml |
52 |
index 5d2f87cc3174..c0d61774dbcf 100644 |
53 |
--- a/app-text/mupdf/metadata.xml |
54 |
+++ b/app-text/mupdf/metadata.xml |
55 |
@@ -9,4 +9,7 @@ |
56 |
<email>proxy-maint@g.o</email> |
57 |
<name>Proxy Maintainers</name> |
58 |
</maintainer> |
59 |
+ <use> |
60 |
+ <flag name="drm">Enable support for Digital rights management (DRM)</flag> |
61 |
+ </use> |
62 |
</pkgmetadata> |
63 |
|
64 |
diff --git a/app-text/mupdf/mupdf-1.21.1.ebuild b/app-text/mupdf/mupdf-1.21.1.ebuild |
65 |
index 87efa898ece6..5b4674fadf25 100644 |
66 |
--- a/app-text/mupdf/mupdf-1.21.1.ebuild |
67 |
+++ b/app-text/mupdf/mupdf-1.21.1.ebuild |
68 |
@@ -16,7 +16,7 @@ S="${WORKDIR}"/${P}-source |
69 |
LICENSE="AGPL-3" |
70 |
SLOT="0/${PV}" |
71 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~x86" |
72 |
-IUSE="+javascript opengl ssl X" |
73 |
+IUSE="+drm +javascript opengl ssl X" |
74 |
REQUIRED_USE="opengl? ( javascript )" |
75 |
|
76 |
# Although we use the bundled, patched version of freeglut in mupdf (because of |
77 |
@@ -52,6 +52,7 @@ PATCHES=( |
78 |
"${FILESDIR}"/${PN}-1.15-openssl-x11.patch |
79 |
# General cross fixes from Debian (refreshed) |
80 |
"${FILESDIR}"/${PN}-1.19.0-cross-fixes.patch |
81 |
+ "${FILESDIR}"/$P-no-drm.patch |
82 |
) |
83 |
|
84 |
src_prepare() { |
85 |
@@ -59,6 +60,8 @@ src_prepare() { |
86 |
|
87 |
use hppa && append-cflags -ffunction-sections |
88 |
|
89 |
+ use drm && append-cflags -Ddrm |
90 |
+ |
91 |
append-cflags "-DFZ_ENABLE_JS=$(usex javascript 1 0)" |
92 |
|
93 |
sed -e "1iOS = Linux" \ |