https://gitlab.gnome.org/GNOME/yelp/-/issues/50 --- yelp-42.2/Makefile.am.orig +++ yelp-42.2/Makefile.am @@ -7,6 +7,8 @@ lib_LTLIBRARIES = libyelp/libyelp.la +libexec_SCRIPTS = libyelp/yelp-groff + libyelp_libyelp_la_SOURCES = \ libyelp/yelp-bookmarks.c \ libyelp/yelp-debug.c \ @@ -58,6 +60,7 @@ libyelp_libyelp_la_CPPFLAGS = \ -DDATADIR=\""$(datadir)"\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ -DYELP_ICON_PATH=\"$(YELP_ICON_PATH)\" \ -DYELP_WEB_EXTENSIONS_DIR=\""$(pkglibdir)/"web-extensions\" \ -I$(top_builddir)/libyelp --- /dev/null +++ yelp-42.2/libyelp/yelp-groff @@ -0,0 +1,49 @@ +#!/usr/bin/sh +# +# Copyright (c) 2011 Alexandre Rostovtsev +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +### +# +# Process the requested compressed source nroff file and output groff +# intermediate format. +# + +filename=$1 + +if [ -z ${filename} ] ; then + echo "Usage: yelp-groff [FILE]" >&2 + echo "Process a man FILE and output groff intermediate format." + exit 1 +fi + +# If "man -Z -Tutf8 -EUTF-8" works (i.e. if man is man-db), use that. +#man -Z -Tutf8 -EUTF-8 ${filename} 2>/dev/null && exit 0 + +# Otherwise, manually uncompress the file ... +cat="cat" +case ${filename} in + *.bz2) cat="bzip2 -c -d" ;; + *.gz) cat="gunzip -c" ;; + *.lzma) cat="unlzma -c -d" ;; + *.xz) cat="unxz -c" ;; + *.Z) cat="zcat" ;; +esac + +# ... and run groff to get the intermediate format; preprocess with tbl +# unless MANROFFSEQ is defined. +${cat} ${filename} | groff -${MANROFFSEQ:-t} -man -Z -Tutf8 --- yelp-42.2/libyelp/yelp-man-parser.c.orig +++ yelp-42.2/libyelp/yelp-man-parser.c @@ -369,7 +369,7 @@ { gint ystdout; GError *err = NULL; - const gchar *argv[] = { "man", "-Z", "-Tutf8", "-EUTF-8", path, NULL }; + const gchar *argv[] = { LIBEXECDIR "/yelp-groff", path, NULL }; gchar **my_argv; /* g_strdupv() should accept a "const gchar **". */