commit:     501e2c8dc84171930394db872cb3cf145997d57b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  5 14:37:30 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan  5 14:37:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=501e2c8d

app-text/xpdf: fix urw font paths

Closes: https://bugs.gentoo.org/916446
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-text/xpdf/files/xpdf-4.04-font-paths.patch |  48 ++++++++
 app-text/xpdf/xpdf-4.04-r2.ebuild              | 163 +++++++++++++++++++++++++
 2 files changed, 211 insertions(+)

diff --git a/app-text/xpdf/files/xpdf-4.04-font-paths.patch 
b/app-text/xpdf/files/xpdf-4.04-font-paths.patch
new file mode 100644
index 000000000000..04c4994f4667
--- /dev/null
+++ b/app-text/xpdf/files/xpdf-4.04-font-paths.patch
@@ -0,0 +1,48 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=1509862
+https://bugs.gentoo.org/916446
+--- a/xpdf/GlobalParams.cc
++++ b/xpdf/GlobalParams.cc
+@@ -84,20 +84,20 @@
+   const char *obliqueFont;    // name of font to oblique
+   double obliqueFactor;               // oblique sheer factor
+ } displayFontTab[] = {
+-  {"Courier",               "n022003l.pfb", "cour.ttf",    "Courier",      
"Courier",                NULL,             0},
+-  {"Courier-Bold",          "n022004l.pfb", "courbd.ttf",  "Courier",      
"Courier Bold",           NULL,             0},
+-  {"Courier-BoldOblique",   "n022024l.pfb", "courbi.ttf",  "Courier",      
"Courier Bold Oblique",   "Courier-Bold",   0.212557},
+-  {"Courier-Oblique",       "n022023l.pfb", "couri.ttf",   "Courier",      
"Courier Oblique",        "Courier",        0.212557},
+-  {"Helvetica",             "n019003l.pfb", "arial.ttf",   "Helvetica",    
"Helvetica",              NULL,             0},
+-  {"Helvetica-Bold",        "n019004l.pfb", "arialbd.ttf", "Helvetica",    
"Helvetica Bold",         NULL,             0},
+-  {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf", "Helvetica",    
"Helvetica Bold Oblique", "Helvetica-Bold", 0.212557},
+-  {"Helvetica-Oblique",     "n019023l.pfb", "ariali.ttf",  "Helvetica",    
"Helvetica Oblique",      "Helvetica",      0.212557},
+-  {"Symbol",                "s050000l.pfb", NULL,          "Symbol",       
"Symbol",                 NULL,             0},
+-  {"Times-Bold",            "n021004l.pfb", "timesbd.ttf", "Times",        
"Times Bold",             NULL,             0},
+-  {"Times-BoldItalic",      "n021024l.pfb", "timesbi.ttf", "Times",        
"Times Bold Italic",       NULL,             0},
+-  {"Times-Italic",          "n021023l.pfb", "timesi.ttf",  "Times",        
"Times Italic",           NULL,             0},
+-  {"Times-Roman",           "n021003l.pfb", "times.ttf",   "Times",        
"Times Roman",            NULL,             0},
+-  {"ZapfDingbats",          "d050000l.pfb", NULL,          "ZapfDingbats", 
"Zapf Dingbats",          NULL,             0},
++  {"Courier",               "NimbusMonoPS-Regular.t1",    "cour.ttf",    
"Courier",      "Courier",                NULL,             0},
++  {"Courier-Bold",          "NimbusMonoPS-Bold.t1",       "courbd.ttf",  
"Courier",      "Courier Bold",           NULL,             0},
++  {"Courier-BoldOblique",   "NimbusMonoPS-BoldItalic.t1", "courbi.ttf",  
"Courier",      "Courier Bold Oblique",   "Courier-Bold",   0.212557},
++  {"Courier-Oblique",       "NimbusMonoPS-Italic.t1",     "couri.ttf",   
"Courier",      "Courier Oblique",        "Courier",        0.212557},
++  {"Helvetica",             "NimbusSans-Regular.t1",      "arial.ttf",   
"Helvetica",    "Helvetica",              NULL,             0},
++  {"Helvetica-Bold",        "NimbusSans-Bold.t1",         "arialbd.ttf", 
"Helvetica",    "Helvetica Bold",         NULL,             0},
++  {"Helvetica-BoldOblique", "NimbusSans-BoldItalic.t1",   "arialbi.ttf", 
"Helvetica",    "Helvetica Bold Oblique", "Helvetica-Bold", 0.212557},
++  {"Helvetica-Oblique",     "NimbusSans-Italic.t1",       "ariali.ttf",  
"Helvetica",    "Helvetica Oblique",      "Helvetica",      0.212557},
++  {"Symbol",                "StandardSymbolsPS.t1",       NULL,          
"Symbol",       "Symbol",                 NULL,             0},
++  {"Times-Bold",            "NimbusRoman-Bold.t1",        "timesbd.ttf", 
"Times",        "Times Bold",             NULL,             0},
++  {"Times-BoldItalic",      "NimbusRoman-BoldItalic.t1",  "timesbi.ttf", 
"Times",        "Times Bold Italic",       NULL,             0},
++  {"Times-Italic",          "NimbusRoman-Italic.t1",      "timesi.ttf",  
"Times",        "Times Italic",           NULL,             0},
++  {"Times-Roman",           "NimbusRoman-Regular.t1",     "times.ttf",   
"Times",        "Times Roman",            NULL,             0},
++  {"ZapfDingbats",          "D050000L.t1", NULL,          "ZapfDingbats", 
"Zapf Dingbats",          NULL,             0},
+   {NULL}
+ };
+ 
+@@ -109,6 +109,7 @@
+ };
+ #else
+ static const char *displayFontDirs[] = {
++  "/usr/share/fonts/urw-fonts",
+   "/usr/share/ghostscript/fonts",
+   "/usr/local/share/ghostscript/fonts",
+   "/usr/share/fonts/default/Type1",
+

diff --git a/app-text/xpdf/xpdf-4.04-r2.ebuild 
b/app-text/xpdf/xpdf-4.04-r2.ebuild
new file mode 100644
index 000000000000..11c66d17c05a
--- /dev/null
+++ b/app-text/xpdf/xpdf-4.04-r2.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/xpdf.asc
+inherit cmake desktop verify-sig xdg
+
+DESCRIPTION="The PDF viewer and tools"
+HOMEPAGE="https://www.xpdfreader.com";
+SRC_URI="https://dl.xpdfreader.com/${P}.tar.gz
+       i18n? (
+               https://dl.xpdfreader.com/xpdf-arabic.tar.gz
+               https://dl.xpdfreader.com/xpdf-chinese-simplified.tar.gz -> 
xpdf-chinese-simplified-20201222.tar.gz
+               https://dl.xpdfreader.com/xpdf-chinese-traditional.tar.gz -> 
xpdf-chinese-traditional-20201222.tar.gz
+               https://dl.xpdfreader.com/xpdf-cyrillic.tar.gz
+               https://dl.xpdfreader.com/xpdf-greek.tar.gz
+               https://dl.xpdfreader.com/xpdf-hebrew.tar.gz
+               https://dl.xpdfreader.com/xpdf-japanese.tar.gz -> 
xpdf-japanese-20201222.tar.gz
+               https://dl.xpdfreader.com/xpdf-korean.tar.gz -> 
xpdf-korean-20201222.tar.gz
+               https://dl.xpdfreader.com/xpdf-latin2.tar.gz
+               https://dl.xpdfreader.com/xpdf-thai.tar.gz
+               https://dl.xpdfreader.com/xpdf-turkish.tar.gz
+       )
+       verify-sig? ( https://dl.xpdfreader.com/${P}.tar.gz.sig )"
+
+LICENSE="|| ( GPL-2 GPL-3 ) i18n? ( BSD )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cmyk cups +fontconfig i18n icons +libpaper metric opi png +textselect 
utils"
+
+BDEPEND="
+       icons? ( gnome-base/librsvg )
+       verify-sig? ( sec-keys/openpgp-keys-xpdf )
+"
+DEPEND="
+       cups? (
+               dev-qt/qtprintsupport:5[cups]
+               net-print/cups
+       )
+       fontconfig? ( media-libs/fontconfig )
+       libpaper? ( app-text/libpaper:= )
+       utils? ( png? ( media-libs/libpng:0 ) )
+       dev-qt/qtnetwork:5
+       dev-qt/qtwidgets:5
+       media-libs/freetype
+       sys-libs/zlib
+"
+RDEPEND="${DEPEND}
+       dev-qt/qtsvg:5
+       media-fonts/urw-fonts
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-automagic.patch
+       "${FILESDIR}"/${PN}-visibility.patch
+       "${FILESDIR}"/${PN}-shared-libs.patch
+       "${FILESDIR}"/${PN}-4.04-libpaper-2.patch
+       "${FILESDIR}"/${PN}-4.04-font-paths.patch
+)
+
+DOCS=( ANNOUNCE CHANGES README )
+
+src_unpack() {
+       if use verify-sig; then
+               verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.sig}
+       fi
+       default
+}
+
+src_prepare() {
+       sed -i \
+               "s|/usr/local/etc|${EPREFIX}/etc|;
+                s|/usr/local|${EPREFIX}/usr|" \
+               doc/sample-xpdfrc || die
+
+       if use i18n; then
+               sed -i "s|/usr/local|${EPREFIX}/usr|" 
"${WORKDIR}"/*/add-to-xpdfrc || die
+       fi
+
+       xdg_environment_reset
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DA4_PAPER=$(usex metric)
+               -DNO_FONTCONFIG=$(usex fontconfig off on)
+               -DNO_TEXT_SELECT=$(usex textselect off on)
+               -DOPI_SUPPORT=$(usex opi)
+               -DSPLASH_CMYK=$(usex cmyk)
+               -DWITH_LIBPAPER=$(usex libpaper)
+               -DWITH_LIBPNG=$(usex png)
+               -DXPDFWIDGET_PRINTING=$(usex cups)
+               -DSYSTEM_XPDFRC="${EPREFIX}/etc/xpdfrc"
+               # Bug 910166
+               # https://forum.xpdfreader.com/viewtopic.php?p=45052#p45052
+               # Likely fixed in 4.05
+               -DCMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets=ON
+               -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=ON
+       )
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+
+       if use icons; then
+               sizes="16 22 24 32 36 48 64 72 96 128 192 256 512"
+               cd xpdf-qt
+               mkdir $sizes
+               local i
+               for i in $sizes; do
+                       rsvg-convert xpdf-icon.svg -w $i -h $i -o $i/xpdf.png
+               done
+       fi
+}
+
+src_install() {
+       cmake_src_install
+
+       domenu "${FILESDIR}/xpdf.desktop"
+       newicon -s scalable xpdf-qt/xpdf-icon.svg xpdf.svg
+       if use icons; then
+               local i
+               for i in $sizes; do
+                       doicon -s $i xpdf-qt/$i/xpdf.png
+               done
+               unset sizes
+       fi
+
+       insinto /etc
+       newins doc/sample-xpdfrc xpdfrc
+
+       local d i
+       if use utils; then
+               for d in "bin" "share/man/man1"; do
+                       pushd "${ED}/usr/${d}" || die
+                       for i in pdf*; do
+                               mv "${i}" "x${i}" || die
+                       done
+                       popd || die
+               done
+
+               einfo "PDF utilities were renamed from pdf* to xpdf* to avoid 
file collisions"
+               einfo "with other packages"
+       else
+               rm -rf "${ED}"/usr/bin/pdf* \
+                          "${ED}"/usr/share/man/man1/pdf* \
+                          "${ED}"/usr/$(get_libdir) || die
+       fi
+
+       if use i18n; then
+               for i in arabic chinese-simplified chinese-traditional cyrillic 
greek \
+                                hebrew japanese korean latin2 thai turkish; do
+                       insinto "/usr/share/xpdf/${i}"
+                       doins -r $(find -O3 "${WORKDIR}/xpdf-${i}" -maxdepth 1 
-mindepth 1 \
+                               ! -name README ! -name add-to-xpdfrc || die)
+
+                       cat "${WORKDIR}/xpdf-${i}/add-to-xpdfrc" >> 
"${ED}/etc/xpdfrc" || die
+               done
+       fi
+}

Reply via email to