commit:     bad533b8968d8ad4a78854aee6caf4c9d811bbfe
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 27 14:02:06 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Aug 27 15:29:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bad533b8

app-text/gv: Version bump to 3.7.4

v3.7.4 was released in 2013, so this is a little overdue...

* Bump to EAPI=8
* Fix build with CFLAGS=-lflto (bug #855011)
* Fix build to call toolchain's AR (bug #729564)
* Add (+) to x11-libs/libXaw3d's unicode USE-dep
* Run gnuconfig_update since the included config.guess is ancient
* Apply a bunch of patches from Fedora

Closes: https://bugs.gentoo.org/729564
Closes: https://bugs.gentoo.org/855011
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 app-text/gv/Manifest                               |  1 +
 app-text/gv/files/gv-3.7.4-bounding-box.patch      | 15 ++++++
 app-text/gv/files/gv-3.7.4-bug1071238.patch        | 22 ++++++++
 app-text/gv/files/gv-3.7.4-bz1536211.patch         | 28 ++++++++++
 app-text/gv/files/gv-3.7.4-dat.patch               | 15 ++++++
 app-text/gv/files/gv-3.7.4-overflow.patch          | 27 ++++++++++
 .../files/gv-3.7.4-remove-aliasing-violation.patch | 18 +++++++
 app-text/gv/files/gv-3.7.4-resource.patch          | 33 ++++++++++++
 app-text/gv/gv-3.7.4.ebuild                        | 62 ++++++++++++++++++++++
 9 files changed, 221 insertions(+)

diff --git a/app-text/gv/Manifest b/app-text/gv/Manifest
index bdd011b0171e..b22dca3b813f 100644
--- a/app-text/gv/Manifest
+++ b/app-text/gv/Manifest
@@ -1 +1,2 @@
 DIST gv-3.7.3.90.tar.gz 757506 BLAKE2B 
f856d23d3b9b9164db414534dec4b9a1c441a88d644011a46429b29127364fe429fc72ed3ce76d4142106d10c6a5305b81ec22ed353716df1c1a824907f7b191
 SHA512 
a80ff303fda1d6f13d66847f4b20aee4b364a05ec750bdb08267aa46470b201edf9762e16ad39dfe9da03118658598697f411dc8c32ab8bbad05a1161e816c50
+DIST gv-3.7.4.tar.gz 759287 BLAKE2B 
2f18309d16a3c11dc0da0fa507f43c8128a4cabff8c1675895fac011702db677ef51989d2536bcbc7d3b4aa3e3cdf470a2a3e4699109b501141caffeb7e532a8
 SHA512 
f6dc072b6b72b6c543733501c719aa38c81a2e2fc63fbf1459b8a3a50a1a70eca9fc9def2fbeb51cb7bb81cfc3b20f136732d935740693bf541d7135975df648

diff --git a/app-text/gv/files/gv-3.7.4-bounding-box.patch 
b/app-text/gv/files/gv-3.7.4-bounding-box.patch
new file mode 100644
index 000000000000..b55ddbd4a3ee
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-bounding-box.patch
@@ -0,0 +1,15 @@
+Fix bounding box recognition
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-bounding-box.patch
+
+diff a/src/ps.c b/src/ps.c
+--- a/src/ps.c
++++ b/src/ps.c
+@@ -357,7 +357,7 @@ static int parse_boundingbox(const char *l, int 
*boundingbox) {
+       while (*p == ' ' || *p == '\t')
+               p++;
+       fury = strtod(p, &pe);
+-      if (*pe != '\n' && *pe != '\0' && *pe != ' ' && *pe != '\t') {
++      if (*pe != '\n'  && *pe != '\r'&& *pe != '\0' && *pe != ' ' && *pe != 
'\t') {
+               return 0;
+       }
+ 

diff --git a/app-text/gv/files/gv-3.7.4-bug1071238.patch 
b/app-text/gv/files/gv-3.7.4-bug1071238.patch
new file mode 100644
index 000000000000..d50f67c79cb8
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-bug1071238.patch
@@ -0,0 +1,22 @@
+Fix NULL access segfault
+https://bugzilla.redhat.com/show_bug.cgi?id=1071238
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-bug1071238.patch
+
+diff a/src/zoom.c b/src/zoom.c
+--- a/src/zoom.c
++++ b/src/zoom.c
+@@ -104,12 +104,12 @@ zoom_createZoom(Widget w _GL_UNUSED, XtP
+ 
+     BEGINMESSAGE(zoom_createZoom)
+ 
+-    if (!(gv_psfile != NULL || (gv_gs_arguments && *gv_gs_arguments))) {
++    if (!gv_psfile) {
+        INFMESSAGE(no file) ENDMESSAGE(zoom_createZoom)
+        return;
+     }
+ 
+-    if (strcmp(gv_filename, "-")) {
++    if (gv_filename != NULL && strcmp(gv_filename, "-")) {
+        stat(gv_filename, &sbuf);
+        if (mtime != sbuf.st_mtime) {
+         INFMESSAGE1(file has changed) ENDMESSAGE1(zoom_createZoom)return;

diff --git a/app-text/gv/files/gv-3.7.4-bz1536211.patch 
b/app-text/gv/files/gv-3.7.4-bz1536211.patch
new file mode 100644
index 000000000000..94808a8b8ea8
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-bz1536211.patch
@@ -0,0 +1,28 @@
+Fix PDF printing
+https://bugzilla.redhat.com/show_bug.cgi?id=1536211
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-bz1536211.patch
+
+diff -up a/src/Makefile.am b/src/Makefile.am
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -198,7 +198,7 @@ gv_intern_res_unix.dat :
+       @echo ""                                                        >> 
gv_intern_res_unix.dat
+       @echo "GV.gsInterpreter:        gs" >> gv_intern_res_unix.dat
+       @echo "GV.gsCmdScanPDF: gs -dNODISPLAY -dQUIET -sPDFname=%s 
-sDSCname=%s %s pdf2dsc.ps -c quit" >> gv_intern_res_unix.dat
+-      @echo "GV.gsCmdConvPDF: gs -dNOPAUSE -dQUIET -dBATCH -sDEVICE=pswrite 
-sOutputFile=%s -f %s -c save pop quit" >> gv_intern_res_unix.dat
++      @echo "GV.gsCmdConvPDF: gs -dNOPAUSE -dQUIET -dBATCH -sDEVICE=ps2write 
-sOutputFile=%s -f %s -c save pop quit" >> gv_intern_res_unix.dat
+       @echo "GV.gsX11Device:          -sDEVICE=x11" >> gv_intern_res_unix.dat
+       @echo "GV.gsX11AlphaDevice:     -sDEVICE=x11 -dTextAlphaBits=4 
-dGraphicsAlphaBits=2 -dMaxBitmap=10000000 -dNOPLATFONTS" >> 
gv_intern_res_unix.dat
+       @echo "GV.gsSafeDir:            True" >> gv_intern_res_unix.dat
+diff -up a/src/Makefile.in b/src/Makefile.in
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -1134,7 +1134,7 @@ gv_intern_res_unix.dat :
+       @echo ""                                                        >> 
gv_intern_res_unix.dat
+       @echo "GV.gsInterpreter:        gs" >> gv_intern_res_unix.dat
+       @echo "GV.gsCmdScanPDF: gs -dNODISPLAY -dQUIET -sPDFname=%s 
-sDSCname=%s %s pdf2dsc.ps -c quit" >> gv_intern_res_unix.dat
+-      @echo "GV.gsCmdConvPDF: gs -dNOPAUSE -dQUIET -dBATCH -sDEVICE=pswrite 
-sOutputFile=%s -f %s -c save pop quit" >> gv_intern_res_unix.dat
++      @echo "GV.gsCmdConvPDF: gs -dNOPAUSE -dQUIET -dBATCH -sDEVICE=ps2write 
-sOutputFile=%s -f %s -c save pop quit" >> gv_intern_res_unix.dat
+       @echo "GV.gsX11Device:          -sDEVICE=x11" >> gv_intern_res_unix.dat
+       @echo "GV.gsX11AlphaDevice:     -sDEVICE=x11 -dTextAlphaBits=4 
-dGraphicsAlphaBits=2 -dMaxBitmap=10000000 -dNOPLATFONTS" >> 
gv_intern_res_unix.dat
+       @echo "GV.gsSafeDir:            True" >> gv_intern_res_unix.dat

diff --git a/app-text/gv/files/gv-3.7.4-dat.patch 
b/app-text/gv/files/gv-3.7.4-dat.patch
new file mode 100644
index 000000000000..aeaea246d029
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-dat.patch
@@ -0,0 +1,15 @@
+Change tab to space in gv_user_res.dat
+http://savannah.gnu.org/patch/?7998
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-dat.patch
+
+--- a/src/gv_user_res.dat
++++ b/src/gv_user_res.dat
+@@ -39,7 +39,7 @@
+                       save_marked
+ GV.scale:             0
+ GV.scaleBase:         1
+-GV.scales:            Natural size,   1.000,  screen  \n\
++GV.scales:            Natural size,   1.000,  screen  \n\
+                       Pixel based,    1.000,  pixel   \n\
+                       Arbitrary magnification,        -2              \n\
+                       Fit height to window,   -3              \n\

diff --git a/app-text/gv/files/gv-3.7.4-overflow.patch 
b/app-text/gv/files/gv-3.7.4-overflow.patch
new file mode 100644
index 000000000000..05cbda055f63
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-overflow.patch
@@ -0,0 +1,27 @@
+Fix buffer overflows in resource.c
+https://savannah.gnu.org/patch/?10096
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-overflow.patch
+
+diff a/src/resource.c b/src/resource.c
+--- a/src/resource.c
++++ b/src/resource.c
+@@ -230,15 +230,15 @@ resource_buildDatabase (
+   s = resource_getResource(db,app_class,app_name, "international",0);
+   if (s == NULL || !strcasecmp(s, "False"))
+   {
+-     sprintf(locale1, "noint:%s%s", loc_lang, loc_terr);
+-     sprintf(locale2, "noint:%s", loc_lang);
++     snprintf(locale1, 100, "noint:%s%s", loc_lang, loc_terr);
++     snprintf(locale2, 100, "noint:%s", loc_lang);
+      strcpy(locale3, "C");
+   }
+   else
+   {
+      strcpy(locale1, locale);
+-     sprintf(locale2, "%s%s%s", loc_lang, loc_terr, loc_cs);
+-     sprintf(locale3, "%s%s", loc_lang, loc_cs);
++     snprintf(locale2, 100, "%s%s%s", loc_lang, loc_terr, loc_cs);
++     snprintf(locale3, 100, "%s%s", loc_lang, loc_cs);
+   }
+ 
+   if (debug_p)

diff --git a/app-text/gv/files/gv-3.7.4-remove-aliasing-violation.patch 
b/app-text/gv/files/gv-3.7.4-remove-aliasing-violation.patch
new file mode 100644
index 000000000000..540d590e4520
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-remove-aliasing-violation.patch
@@ -0,0 +1,18 @@
+https://bugs.gentoo.org/855011
+
+diff -ruN a/src/Scrollbar.c b/src/Scrollbar.c
+--- a/src/Scrollbar.c
++++ b/src/Scrollbar.c
+@@ -1364,12 +1364,6 @@
+       INFMESSAGE(returning due to LookAhead) ENDMESSAGE(NotifyThumb)
+       return;
+    }
+-    /*
+-       thumbProc is not pretty, but is necessary for backwards
+-       compatibility on those architectures for which it work{s,ed};
+-       the intent is to pass a (truncated) float by value.
+-    */
+-   XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&TOP);
+    XtCallCallbacks (w, XtNjumpProc, (XtPointer)&TOP);
+    ENDMESSAGE(NotifyThumb)
+ }

diff --git a/app-text/gv/files/gv-3.7.4-resource.patch 
b/app-text/gv/files/gv-3.7.4-resource.patch
new file mode 100644
index 000000000000..15c39e3cbdae
--- /dev/null
+++ b/app-text/gv/files/gv-3.7.4-resource.patch
@@ -0,0 +1,33 @@
+Check for null pointers in resource requests
+https://savannah.gnu.org/bugs/?38727
+https://src.fedoraproject.org/rpms/gv/blob/rawhide/f/gv-resource.patch
+
+--- a/src/main.c
++++ b/src/main.c
+@@ -1449,7 +1449,7 @@
+   if (s) gv_gs_arguments = s;
+ 
+   s = resource_getResource(db,gv_class,gv_name,"gsSafeDir",NULL);
+-  if (!strcasecmp(s,"true"))  gv_gs_safeDir = 1; else gv_gs_safeDir = 0;
++  if (s && !strcasecmp(s,"true"))  gv_gs_safeDir = 1; else gv_gs_safeDir = 0;
+ 
+   s = resource_getResource(db,gv_class,gv_name,"gsSafer",NULL);
+   if (s && !strcasecmp(s,"true"))  gv_gs_safer = 1; else gv_gs_safer = 0;
+@@ -1468,13 +1468,13 @@
+   }
+ 
+   s = resource_getResource(db,gv_class,gv_name,"infoVerbose",NULL);
+-  if (!strcasecmp(s, "Silent"))      gv_infoVerbose=0;
+-  else if (!strcasecmp(s, "Errors")) gv_infoVerbose=1;
+-  else if (!strcasecmp(s, "All"))    gv_infoVerbose=2;
++  if (!s || !strcasecmp(s, "Errors")) gv_infoVerbose=1;
++  else if (!strcasecmp(s, "Silent"))  gv_infoVerbose=0;
++  else if (!strcasecmp(s, "All"))     gv_infoVerbose=2;
+   else gv_infoVerbose = 1;
+ 
+   s = resource_getResource(db,gv_class,gv_name,"xinerama",NULL);
+-  if (!strcasecmp(s, "Off"))      gv_xinerama=0;
++  if (!s || !strcasecmp(s, "Off"))    gv_xinerama=0;
+   else if (!strcasecmp(s, "On")) gv_xinerama=1;
+   else if (!strcasecmp(s, "Auto"))    gv_xinerama=-1;
+   else gv_xinerama = 0;

diff --git a/app-text/gv/gv-3.7.4.ebuild b/app-text/gv/gv-3.7.4.ebuild
new file mode 100644
index 000000000000..5e5666d70fdd
--- /dev/null
+++ b/app-text/gv/gv-3.7.4.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit desktop gnuconfig toolchain-funcs
+
+DESCRIPTION="Viewer for PostScript and PDF documents using Ghostscript"
+HOMEPAGE="https://www.gnu.org/software/gv/";
+SRC_URI="https://ftp.gnu.org/gnu/gv/${P}.tar.gz";
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="xinerama"
+
+RDEPEND="
+       app-text/ghostscript-gpl
+       x11-libs/libICE
+       x11-libs/libSM
+       x11-libs/libX11
+       >=x11-libs/libXaw3d-1.6-r1[unicode(+)]
+       x11-libs/libXext
+       x11-libs/libXmu
+       x11-libs/libXpm
+       x11-libs/libXt
+       xinerama? ( x11-libs/libXinerama )"
+DEPEND="${RDEPEND}
+       x11-base/xorg-proto"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-resource.patch
+       "${FILESDIR}"/${P}-dat.patch
+       "${FILESDIR}"/${P}-bounding-box.patch
+       "${FILESDIR}"/${P}-bug1071238.patch
+       "${FILESDIR}"/${P}-bz1536211.patch
+       "${FILESDIR}"/${P}-overflow.patch
+       "${FILESDIR}"/${P}-remove-aliasing-violation.patch
+)
+
+src_prepare() {
+       default
+       gnuconfig_update
+}
+
+src_configure() {
+       export ac_cv_lib_Xinerama_main=$(usex xinerama)
+       econf --enable-scrollbar-code
+}
+
+src_compile() {
+       emake AR="$(tc-getAR)"
+}
+
+src_install() {
+       rm README.{I18N,TRANSLATION} || die
+       default
+
+       doicon "${FILESDIR}"/gv_icon.xpm
+       make_desktop_entry gv GhostView gv_icon 'Graphics;Viewer'
+}

Reply via email to