commit:     165c2d309aa4a44c84dd65a34d6e95643229c30d
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  6 23:43:24 2026 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Mar  6 23:45:49 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=165c2d30

media-libs/libharu: fix doc location, and add USE=examples

Add a patch (PR open upstream) to install the docs and bindings to
DOCDIR, and also enable USE=examples. The upstream build for the example
programs is apparently broken, but we can dodoc the sources.

Closes: https://bugs.gentoo.org/912244
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../libharu/files/libharu-2.4.5-docdir.patch       | 59 ++++++++++++++++++++++
 media-libs/libharu/libharu-2.4.5-r1.ebuild         | 49 ++++++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/media-libs/libharu/files/libharu-2.4.5-docdir.patch 
b/media-libs/libharu/files/libharu-2.4.5-docdir.patch
new file mode 100644
index 000000000000..35784b42c481
--- /dev/null
+++ b/media-libs/libharu/files/libharu-2.4.5-docdir.patch
@@ -0,0 +1,59 @@
+https://github.com/libharu/libharu/pull/359
+
+From 430de0d7c9091ef4af42f2c833ff13d904a77b9d Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Fri, 6 Mar 2026 17:48:25 -0500
+Subject: [PATCH] CMakeLists.txt: install docs and bindings to DOCDIR
+
+We are already using the GNUInstallDirs module,
+
+  https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
+
+that provides access to the "familiar" GNU directories like BINDIR,
+LIBDIR, and DOCDIR. The documentation and bindings however are
+currently installed to DATAROOTDIR/libharu, which on a typical linux
+system will lead to paths like
+
+  /usr/share/libharu/README.md
+
+In this case, it would clearly be preferable to install to DOCDIR,
+since README.md is unambiguously documentation. We also get, for
+example,
+
+  /usr/share/libharu/bindings/vb.net/hpdfvb.vb
+
+The usage instructions for our bindings essentially tell you to copy &
+paste them into an appropriate location; they are not immediately
+usable when installed. For example, with the python bindings in mind,
+
+  /usr/share/libharu/bindings/python
+
+would not be on one's PYTHONPATH. In that sense, these bindings also
+act more like documentation than as package data, and should therefore
+be installed to DOCDIR.
+
+This commit makes both of those changes, and afterwards drops the
+INSTALL file from the install rule: if libharu is installed, you don't
+need the INSTALL file.
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bb564fb..0139a13 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -134,8 +134,8 @@ set(
+ install(FILES ${haru_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+ # install various files
+-install(FILES README.md CHANGES INSTALL DESTINATION 
${CMAKE_INSTALL_DATAROOTDIR}/libharu)
+-install(DIRECTORY bindings DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/libharu)
++install(FILES README.md CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR})
++install(DIRECTORY bindings DESTINATION ${CMAKE_INSTALL_DOCDIR})
+ 
+ # =======================================================================
+ # print out some information
+-- 
+2.53.0
+

diff --git a/media-libs/libharu/libharu-2.4.5-r1.ebuild 
b/media-libs/libharu/libharu-2.4.5-r1.ebuild
new file mode 100644
index 000000000000..b4c3fce21f90
--- /dev/null
+++ b/media-libs/libharu/libharu-2.4.5-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="C/C++ library for PDF generation"
+HOMEPAGE="http://www.libharu.org/";
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+# demo/type1/COPYING is a copy of the GPLv2
+LICENSE="ZLIB examples? ( GPL-2 )"
+SLOT="0/${PV%.*}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+IUSE="examples"
+
+DEPEND="
+       media-libs/libpng:=
+       virtual/zlib:=
+"
+RDEPEND="${DEPEND}"
+
+PATCHES="${FILESDIR}/${P}-docdir.patch"
+
+src_prepare() {
+       cmake_src_prepare
+
+       # We don't build these, and it will be convenient later to dodoc the
+       # entire directory if USE=examples is set. Leave demo/type1/COPYING
+       # to identify the sole directory that is not under a ZLIB license.
+       rm demo/CMakeLists.txt || die
+       mv demo examples || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLIBHPDF_EXAMPLES=NO # Doesn't work
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       # README.md and CHANGES are handled by the build system,
+       # and we don't want README_cmake.
+       DOCS=()
+       cmake_src_install
+       use examples && dodoc -r examples
+}

Reply via email to