Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-office/lyx/files/, app-office/lyx/
Date: Sat, 07 May 2022 03:53:41
Message-Id: 1651895608.8c4c4cb2567ec797af16cbdb1e072ff6fef0c0bf.sam@gentoo
1 commit: 8c4c4cb2567ec797af16cbdb1e072ff6fef0c0bf
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 7 03:52:40 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat May 7 03:53:28 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c4c4cb2
7
8 app-office/lyx: fix build with GCC 12
9
10 Also, add Python 3.10 (add a patch from Fedora too).
11
12 Closes: https://bugs.gentoo.org/841743
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 app-office/lyx/files/lyx-2.3.6.1-gcc12.patch | 22 +++
16 app-office/lyx/files/lyx-2.3.6.1-python.patch | 50 +++++++
17 app-office/lyx/lyx-2.3.6.1-r2.ebuild | 187 ++++++++++++++++++++++++++
18 3 files changed, 259 insertions(+)
19
20 diff --git a/app-office/lyx/files/lyx-2.3.6.1-gcc12.patch b/app-office/lyx/files/lyx-2.3.6.1-gcc12.patch
21 new file mode 100644
22 index 000000000000..b1acbdb9087d
23 --- /dev/null
24 +++ b/app-office/lyx/files/lyx-2.3.6.1-gcc12.patch
25 @@ -0,0 +1,22 @@
26 +https://src.fedoraproject.org/rpms/lyx/raw/rawhide/f/lyx-2.3.6-fix-gcc12.patch
27 +https://bugs.gentoo.org/841743
28 +--- a/src/insets/InsetListings.cpp
29 ++++ b/src/insets/InsetListings.cpp
30 +@@ -44,6 +44,7 @@
31 +
32 + #include "support/regex.h"
33 +
34 ++#include <cstring>
35 + #include <sstream>
36 +
37 + using namespace std;
38 +--- a/src/lyxfind.cpp
39 ++++ b/src/lyxfind.cpp
40 +@@ -52,6 +52,7 @@
41 + #include "support/lstrings.h"
42 +
43 + #include "support/regex.h"
44 ++#include <iterator>
45 +
46 + using namespace std;
47 + using namespace lyx::support;
48
49 diff --git a/app-office/lyx/files/lyx-2.3.6.1-python.patch b/app-office/lyx/files/lyx-2.3.6.1-python.patch
50 new file mode 100644
51 index 000000000000..666d82c06bf8
52 --- /dev/null
53 +++ b/app-office/lyx/files/lyx-2.3.6.1-python.patch
54 @@ -0,0 +1,50 @@
55 +https://src.fedoraproject.org/rpms/lyx/raw/054d18eb79a8ec3d4480ab4449b3c62b12770d2d/f/lyx-2.3.6-layout2layout.patch
56 +--- a/lib/scripts/layout2layout.py
57 ++++ b/lib/scripts/layout2layout.py
58 +@@ -256,7 +256,7 @@
59 +
60 + def trim_bom(line):
61 + " Remove byte order mark."
62 +- if line[0:3] == "\357\273\277":
63 ++ if line[0:3] == b"\357\273\277":
64 + return line[3:]
65 + else:
66 + return line
67 +@@ -345,8 +345,8 @@
68 + # for categories
69 + re_Declaration = re.compile(b'^#\\s*\\Declare\\w+Class.*$')
70 + re_ExtractCategory = re.compile(b'^(#\\s*\\Declare\\w+Class(?:\\[[^]]*?\\])?){([^(]+?)\\s+\\(([^)]+?)\\)\\s*}\\s*$')
71 +- ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports", \
72 +- "presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
73 ++ ConvDict = {b"article": b"Articles", b"book" : b"Books", b"letter" : b"Letters", b"report": b"Reports", \
74 ++ b"presentation" : b"Presentations", b"curriculum vitae" : b"Curricula Vitae", b"handout" : b"Handouts"}
75 + # Arguments
76 + re_OptArgs = re.compile(b'^(\\s*)OptionalArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
77 + re_ReqArgs = re.compile(b'^(\\s*)RequiredArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
78 +@@ -485,7 +485,7 @@
79 + continue
80 + col = match.group(2)
81 + if col == "collapsable":
82 +- lines[i] = match.group(1) + "collapsible"
83 ++ lines[i] = match.group(1) + b"collapsible"
84 + i += 1
85 + continue
86 +
87 +@@ -703,7 +703,7 @@
88 + # Insert the required number of arguments at the end of the style definition
89 + match = re_End.match(lines[i])
90 + if match:
91 +- newarg = ['']
92 ++ newarg = [b'']
93 + # First the optionals (this is the required order pre 2.1)
94 + if opts > 0:
95 + if opts == 1:
96 +@@ -1153,7 +1153,7 @@
97 + if latextype == b"item_environment" and label.lower() == b"counter_enumi":
98 + lines[labeltype_line] = re_LabelType.sub(b'\\1\\2\\3Enumerate', lines[labeltype_line])
99 + # Don't add the LabelCounter line later
100 +- counter = ""
101 ++ counter = b""
102 +
103 + # Replace
104 + #
105
106 diff --git a/app-office/lyx/lyx-2.3.6.1-r2.ebuild b/app-office/lyx/lyx-2.3.6.1-r2.ebuild
107 new file mode 100644
108 index 000000000000..a8d622193e27
109 --- /dev/null
110 +++ b/app-office/lyx/lyx-2.3.6.1-r2.ebuild
111 @@ -0,0 +1,187 @@
112 +# Copyright 1999-2022 Gentoo Authors
113 +# Distributed under the terms of the GNU General Public License v2
114 +
115 +EAPI=7
116 +
117 +PYTHON_COMPAT=( python3_{8..10} )
118 +
119 +MY_P="${P/_}"
120 +inherit desktop font python-single-r1 qmake-utils toolchain-funcs xdg-utils
121 +
122 +DESCRIPTION="WYSIWYM frontend for LaTeX, DocBook, etc"
123 +HOMEPAGE="https://www.lyx.org/"
124 +SRC_URI="ftp://ftp.lyx.org/pub/lyx/stable/2.3.x/${MY_P}.tar.xz
125 + ftp://ftp.lyx.org/pub/lyx/devel/lyx-2.3/${MY_P}/${MY_P}.tar.xz"
126 +
127 +LICENSE="GPL-2"
128 +SLOT="0"
129 +KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~x64-macos"
130 +IUSE="aspell cups debug dia dot enchant gnumeric html +hunspell +latex monolithic-build nls rcs rtf svg l10n_he"
131 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
132 +
133 +# bc needed http://comments.gmane.org/gmane.editors.lyx.devel/137498 and bug #787839
134 +BDEPEND="
135 + sys-devel/bc
136 + virtual/pkgconfig
137 + nls? ( sys-devel/gettext )
138 +"
139 +RDEPEND="${PYTHON_DEPS}
140 + app-text/mythes
141 + dev-libs/boost:=
142 + dev-qt/qtcore:5
143 + dev-qt/qtgui:5
144 + dev-qt/qtsvg:5
145 + dev-qt/qtwidgets:5
146 + dev-qt/qtx11extras:5
147 + dev-texlive/texlive-fontsextra
148 + sys-apps/file
149 + sys-libs/zlib
150 + virtual/imagemagick-tools[png,svg?]
151 +
152 + x11-misc/xdg-utils
153 +
154 + aspell? ( app-text/aspell )
155 + cups? ( net-print/cups )
156 + dia? ( app-office/dia )
157 + dot? ( media-gfx/graphviz )
158 + enchant? ( app-text/enchant:2 )
159 + gnumeric? ( app-office/gnumeric )
160 + html? ( dev-tex/html2latex )
161 + hunspell? ( app-text/hunspell )
162 + l10n_he? ( dev-tex/culmus-latex )
163 + latex? (
164 + app-text/dvipng
165 + app-text/ghostscript-gpl
166 + app-text/ps2eps
167 + app-text/texlive
168 + dev-texlive/texlive-fontsrecommended
169 + dev-texlive/texlive-latexextra
170 + dev-texlive/texlive-mathscience
171 + dev-texlive/texlive-pictures
172 + dev-texlive/texlive-plaingeneric
173 + || (
174 + dev-tex/hevea
175 + dev-tex/latex2html
176 + dev-tex/tex4ht[java]
177 + dev-tex/tth
178 + )
179 + )
180 + rcs? ( dev-vcs/rcs )
181 + rtf? (
182 + app-text/unrtf
183 + dev-tex/html2latex
184 + dev-tex/latex2rtf
185 + )
186 + svg? ( || ( gnome-base/librsvg media-gfx/inkscape ) )
187 +"
188 +DEPEND="${RDEPEND}
189 + dev-qt/qtconcurrent:5
190 +"
191 +
192 +DOCS=( ANNOUNCE NEWS README RELEASE-NOTES UPGRADING )
193 +
194 +S="${WORKDIR}/${MY_P}"
195 +
196 +FONT_S="${S}/lib/fonts"
197 +FONT_SUFFIX="ttf"
198 +
199 +PATCHES=(
200 + # Try first with xdg-open before hardcoded commands
201 + # Patch from Debian using a similar approach to Fedora
202 + "${FILESDIR}"/${PN}-prefer-xdg-open.patch
203 +
204 + "${FILESDIR}"/${P}-python.patch
205 + "${FILESDIR}"/${P}-gcc12.patch
206 +)
207 +
208 +pkg_setup() {
209 + python-single-r1_pkg_setup
210 + font_pkg_setup
211 +}
212 +
213 +src_prepare() {
214 + default
215 +
216 + sed "s:python -tt:${EPYTHON} -tt:g" -i lib/configure.py || die
217 +}
218 +
219 +src_configure() {
220 + tc-export CXX
221 + #bug 221921
222 + export VARTEXFONTS="${T}"/fonts
223 +
224 + econf \
225 + $(use_with aspell) \
226 + $(use_enable debug) \
227 + $(use_with enchant) \
228 + $(use_with hunspell) \
229 + $(use_enable monolithic-build) \
230 + $(use_enable nls) \
231 + --enable-qt5 \
232 + --with-qt-dir=$(qt5_get_libdir)/qt5 \
233 + --disable-stdlib-debug \
234 + --without-included-boost \
235 + --with-packaging=posix
236 +}
237 +
238 +src_install() {
239 + default
240 +
241 + if use l10n_he ; then
242 + echo "\bind_file cua" > "${T}"/hebrew.bind || die
243 + echo "\bind \"F12\" \"language hebrew\"" >> "${T}"/hebrew.bind || die
244 +
245 + insinto /usr/share/lyx/bind
246 + doins "${T}"/hebrew.bind
247 + fi
248 +
249 + newicon -s 32 "development/Win32/packaging/icons/lyx_32x32.png" ${PN}.png
250 + doicon -s 48 "lib/images/lyx.png"
251 + doicon -s scalable "lib/images/lyx.svg"
252 +
253 + # fix for bug 91108
254 + if use latex ; then
255 + dosym ../../../lyx/tex /usr/share/texmf-site/tex/latex/lyx
256 + fi
257 +
258 + # fonts needed for proper math display, see also bug #15629
259 + font_src_install
260 +
261 + python_fix_shebang "${ED}"/usr/share/${PN}
262 +
263 + if use hunspell ; then
264 + dosym ../myspell /usr/share/lyx/dicts
265 + dosym ../myspell /usr/share/lyx/thes
266 + fi
267 +}
268 +
269 +pkg_postinst() {
270 + font_pkg_postinst
271 + xdg_icon_cache_update
272 + xdg_desktop_database_update
273 +
274 + # fix for bug 91108
275 + if use latex ; then
276 + texhash || die
277 + fi
278 +
279 + # instructions for RTL support. See also bug 168331.
280 + if use l10n_he || has he ${LINGUAS} || has ar ${LINGUAS} ; then
281 + elog
282 + elog "Enabling RTL support in LyX:"
283 + elog "If you intend to use a RTL language (such as Hebrew or Arabic)"
284 + elog "You must enable RTL support in LyX. To do so start LyX and go to"
285 + elog "Tools->Preferences->Language settings->Language"
286 + elog "and make sure the \"Right-to-left language support\" is checked"
287 + elog
288 + fi
289 +}
290 +
291 +pkg_postrm() {
292 + xdg_icon_cache_update
293 + xdg_desktop_database_update
294 +
295 + if use latex ; then
296 + texhash || die
297 + fi
298 +}