Skip to content

Commit

Permalink
app-text/mupdf-1.21.1: allow disabling DRM checking
Browse files Browse the repository at this point in the history
MuPDF by default blocks DRM content, see:
ArtifexSoftware/mupdf@2b3bd1b

Add patch and local use flag `drm` for allowing/disallowing DRM content
in PDF files.

Suggested-by: William Rabbermann <[email protected]>
Signed-off-by: Philipp Rösner <[email protected]>
Closes: gentoo#28772
Signed-off-by: Florian Schmaus <[email protected]>
  • Loading branch information
rndxelement authored and Flowdalic committed Dec 29, 2022
1 parent 9e5a5e7 commit 9581bec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
18 changes: 18 additions & 0 deletions app-text/mupdf/files/mupdf-1.21.1-no-drm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c
index f764242..83888dc 100644
--- a/source/html/epub-doc.c
+++ b/source/html/epub-doc.c
@@ -692,10 +692,12 @@ epub_parse_header(fz_context *ctx, epub_document *doc)
epub_chapter **tailp;
int i;

+ #ifdef drm
if (fz_has_archive_entry(ctx, zip, "META-INF/rights.xml"))
fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM");
if (fz_has_archive_entry(ctx, zip, "META-INF/encryption.xml"))
fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM");
+ #endif

fz_var(buf);
fz_var(container_xml);

3 changes: 3 additions & 0 deletions app-text/mupdf/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<email>[email protected]</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="drm">Enable support for Digital rights management (DRM)</flag>
</use>
</pkgmetadata>
5 changes: 4 additions & 1 deletion app-text/mupdf/mupdf-1.21.1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ S="${WORKDIR}"/${P}-source
LICENSE="AGPL-3"
SLOT="0/${PV}"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~x86"
IUSE="+javascript opengl ssl X"
IUSE="+drm +javascript opengl ssl X"
REQUIRED_USE="opengl? ( javascript )"

# Although we use the bundled, patched version of freeglut in mupdf (because of
Expand Down Expand Up @@ -52,13 +52,16 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.15-openssl-x11.patch
# General cross fixes from Debian (refreshed)
"${FILESDIR}"/${PN}-1.19.0-cross-fixes.patch
"${FILESDIR}"/$P-no-drm.patch
)

src_prepare() {
default

use hppa && append-cflags -ffunction-sections

use drm && append-cflags -Ddrm

append-cflags "-DFZ_ENABLE_JS=$(usex javascript 1 0)"

sed -e "1iOS = Linux" \
Expand Down

0 comments on commit 9581bec

Please sign in to comment.