--- /dev/null
+Don't pass external input as format string. Detected by -Werror=format-security.
+
+https://bugs.gentoo.org/530630
+--- a/src/print.c
++++ b/src/print.c
+@@ -1220,7 +1220,7 @@ static void print_job_ps_page_image_pixel(FILE *f, guchar *pix)
+ }
+ text[6] = '\0';
+
+- fprintf(f, text);
++ fprintf(f, "%s", text);
+ }
+ static gint print_job_ps_page_image(PrintWindow *pw, GdkPixbuf *pixbuf,
+ gdouble x, gdouble y, gdouble w, gdouble h,
+@@ -1345,7 +1345,7 @@ static const gchar *ps_text_to_hex_array(FILE *f, const gchar *text, gdouble x,
+ text[1] = hex_digits[*p & 0xf];
+ text[2] = '\0';
+
+- fprintf(f, text);
++ fprintf(f, "%s", text);
+
+ p++;
+ }
+--- a/src/ui_fileops.c
++++ b/src/ui_fileops.c
+@@ -44,7 +44,7 @@ void print_term(const gchar *text_utf8)
+ gchar *text_l;
+
+ text_l = g_locale_from_utf8(text_utf8, -1, NULL, NULL, NULL);
+- printf((text_l) ? text_l : text_utf8);
++ printf("%s", (text_l) ? text_l : text_utf8);
+ g_free(text_l);
+ }
+
+--- a/src/view_file_icon.c
++++ b/src/view_file_icon.c
+@@ -614,7 +614,7 @@ static void vficon_dnd_get(GtkWidget *widget, GdkDragContext *context,
+ uri_text = uri_text_from_list(list, &total, (info == TARGET_TEXT_PLAIN));
+ path_list_free(list);
+
+- if (debug) printf(uri_text);
++ if (debug) printf("%s", uri_text);
+
+ gtk_selection_data_set(selection_data, selection_data->target,
+ 8, (guchar *)uri_text, total);
+--- a/src/view_file_list.c
++++ b/src/view_file_list.c
+@@ -136,7 +136,7 @@ static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
+ uri_text = uri_text_from_list(list, &total, (info == TARGET_TEXT_PLAIN));
+ path_list_free(list);
+
+- if (debug) printf(uri_text);
++ if (debug) printf("%s", uri_text);
+
+ gtk_selection_data_set(selection_data, selection_data->target,
+ 8, (guchar *)uri_text, total);
--- /dev/null
+--- a/configure.in
++++ b/configure.in
+@@ -19,8 +19,8 @@ fi
+
+ AM_PATH_GTK_2_0(2.4.0,,AC_MSG_ERROR(GTK+ >= 2.4.0 not installed.))
+
+-AC_DEFINE_UNQUOTED(GQVIEW_HELPDIR, "$prefix/share/doc/gqview-$VERSION", [Location of documentation files])
+-AC_DEFINE_UNQUOTED(GQVIEW_HTMLDIR, "$prefix/share/doc/gqview-$VERSION/html", [Location of html documentation])
++AC_DEFINE_UNQUOTED(GQVIEW_HELPDIR, "$docdir", [Location of documentation files])
++AC_DEFINE_UNQUOTED(GQVIEW_HTMLDIR, "$docdir/html", [Location of html documentation])
+
+ dnl checks for functions
+ AC_CHECK_FUNCS(strverscmp)
+--- a/doc/Makefile.am
++++ b/doc/Makefile.am
+@@ -1,6 +1,6 @@
+ ## Process this file with automake to produce Makefile.in.
+
+-helpdir = $(datadir)/doc/gqview-$(VERSION)/html
++helpdir = $(docdir)/html
+ help_DATA = \
+ gnu_fdl.txt \
+ gqview_faq.html \
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit autotools xdg-utils
+
+DESCRIPTION="A GTK-based image browser"
+HOMEPAGE="http://gqview.sourceforge.net/"
+SRC_URI="mirror://sourceforge/gqview/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+RDEPEND=">=x11-libs/gtk+-2.4:2
+ virtual/libintl"
+
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-windows.patch
+ "${FILESDIR}"/${P}-glibc.patch
+ "${FILESDIR}"/${P}-gcc-10.patch
+ "${FILESDIR}"/${P}-helpdir.patch
+ "${FILESDIR}"/${P}-readmedir.patch
+ "${FILESDIR}"/${P}-format-security.patch
+)
+
+src_prepare() {
+ default
+
+ sed -i \
+ -e '/^Encoding/d' \
+ -e '/^Icon/s/\.png//' \
+ -e '/^Categories/s/Application;//' \
+ gqview.desktop || die
+ mv configure.in configure.ac || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF} \
+ --without-lcms
+}
+
+src_install() {
+ default
+ # bug #30111
+ docompress -x /usr/share/doc/${PF}/README
+}
+
+pkg_postinst() {
+ xdg_desktop_database_update
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}