Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-astronomy/stellarium/, sci-astronomy/stellarium/files/
Date: Thu, 26 May 2022 12:58:19
Message-Id: 1653569884.15111b1b893f75756fafbbb4757825dcc810af19.juippis@gentoo
1 commit: 15111b1b893f75756fafbbb4757825dcc810af19
2 Author: Alexey Sokolov <alexey+gentoo <AT> asokolov <DOT> org>
3 AuthorDate: Tue May 24 21:53:03 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 12:58:04 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15111b1b
7
8 sci-astronomy/stellarium: fix test on x86
9
10 Patches from https://github.com/Stellarium/stellarium/issues/2460
11
12 Closes: https://bugs.gentoo.org/847064
13 Package-Manager: Portage-3.0.30, Repoman-3.0.3
14 Signed-off-by: Alexey Sokolov <alexey+gentoo <AT> asokolov.org>
15 Closes: https://github.com/gentoo/gentoo/pull/25626
16 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
17
18 .../files/stellarium-0.22.1-fix-conv.patch | 23 ++++
19 .../files/stellarium-0.22.1-fix-test-x86.patch | 93 +++++++++++++
20 .../stellarium/stellarium-0.22.1-r1.ebuild | 148 +++++++++++++++++++++
21 3 files changed, 264 insertions(+)
22
23 diff --git a/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-conv.patch b/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-conv.patch
24 new file mode 100644
25 index 000000000000..5187837fbb61
26 --- /dev/null
27 +++ b/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-conv.patch
28 @@ -0,0 +1,23 @@
29 +From dd65fdf5a332d62834ac1cfe9639e220ea635c55 Mon Sep 17 00:00:00 2001
30 +From: "Alexander V. Wolf" <alex.v.wolf@×××××.com>
31 +Date: Wed, 25 May 2022 20:55:15 +0700
32 +Subject: [PATCH] Fixed conversion tool radToHms(): avoiding possible negative
33 + zero for value of seconds (see #2460)
34 +
35 +---
36 + src/core/StelUtils.cpp | 2 +-
37 + 1 file changed, 1 insertion(+), 1 deletion(-)
38 +
39 +diff --git a/src/core/StelUtils.cpp b/src/core/StelUtils.cpp
40 +index 93a55ebb957..b03f55a68ec 100644
41 +--- a/src/core/StelUtils.cpp
42 ++++ b/src/core/StelUtils.cpp
43 +@@ -140,7 +140,7 @@ void radToHms(double angle, unsigned int& h, unsigned int& m, double& s)
44 +
45 + h = static_cast<unsigned int>(angle);
46 + m = static_cast<unsigned int>((angle-h)*60);
47 +- s = (angle-h)*3600.-60.*m;
48 ++ s = qAbs((angle-h)*3600.-60.*m);
49 + }
50 +
51 + /*************************************************************************
52
53 diff --git a/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-test-x86.patch b/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-test-x86.patch
54 new file mode 100644
55 index 000000000000..784b388b2534
56 --- /dev/null
57 +++ b/sci-astronomy/stellarium/files/stellarium-0.22.1-fix-test-x86.patch
58 @@ -0,0 +1,93 @@
59 +From 802065e025c8b435dc39b4fdd9262efdc1dcd2a8 Mon Sep 17 00:00:00 2001
60 +From: "Alexander V. Wolf" <alex.v.wolf@×××××.com>
61 +Date: Tue, 24 May 2022 14:47:50 +0700
62 +Subject: [PATCH] Fixed something strange in radToHMSStr and radToHMSStrAdapt
63 + convertors
64 +
65 +probably ancient bug (?), maybe related to issue #2460
66 +---
67 + src/core/StelUtils.cpp | 6 +++---
68 + src/tests/testConversions.cpp | 16 ++++++----------
69 + 2 files changed, 9 insertions(+), 13 deletions(-)
70 +
71 +diff --git a/src/core/StelUtils.cpp b/src/core/StelUtils.cpp
72 +index 521d538315e..93a55ebb957 100644
73 +--- a/src/core/StelUtils.cpp
74 ++++ b/src/core/StelUtils.cpp
75 +@@ -225,9 +225,9 @@ QString radToHmsStr(const double angle, const bool decimal)
76 + {
77 + unsigned int h,m;
78 + double s;
79 +- StelUtils::radToHms(angle+0.005*M_PI/12/(60*60), h, m, s);
80 ++ StelUtils::radToHms(angle, h, m, s);
81 + int width, precision;
82 +- QString carry, r;
83 ++ QString carry;
84 + if (decimal)
85 + {
86 + width=5;
87 +@@ -268,7 +268,7 @@ QString radToDmsStrAdapt(const double angle, const bool useD)
88 + bool sign;
89 + unsigned int d,m;
90 + double s;
91 +- StelUtils::radToDms(angle+0.005*M_PI/180/(60*60)*(angle<0?-1.:1.), sign, d, m, s); // NOTE: WTF???
92 ++ StelUtils::radToDms(angle, sign, d, m, s);
93 + QString str;
94 + QTextStream os(&str);
95 +
96 +diff --git a/src/tests/testConversions.cpp b/src/tests/testConversions.cpp
97 +index a37db14307c..6e8a4c6f04c 100644
98 +--- a/src/tests/testConversions.cpp
99 ++++ b/src/tests/testConversions.cpp
100 +@@ -248,12 +248,12 @@ void TestConversions::testRadToDMSStrAdapt()
101 + data << 61*M_PI/360 << "+30°30'" << false;
102 + data << M_PI/648000 << "+0°0'1\"" << false;
103 + data << 1213*M_PI/2400 << "+90°58'30\"" << false;
104 +- data << 39599*M_PI/648000 << "+10°59'59\"" << false;
105 ++ data << 39599*M_PI/648000 << "+10°59'59.00\"" << false;
106 + data << -M_PI/36 << "-5°" << false;
107 + data << -7*M_PI/8 << "-157°30'" << false;
108 + data << -2*M_PI/5 << "-72°" << false;
109 + data << -M_PI << "-180°" << false;
110 +- data << -10*M_PI/648 << "-2°46'40\"" << false;
111 ++ data << -10*M_PI/648 << "-2°46'40.00\"" << false;
112 +
113 + data << 0. << "+0d" << true;
114 + data << M_PI/6 << "+30d" << true;
115 +@@ -268,12 +268,12 @@ void TestConversions::testRadToDMSStrAdapt()
116 + data << 61*M_PI/360 << "+30d30'" << true;
117 + data << M_PI/648000 << "+0d0'1\"" << true;
118 + data << 1213*M_PI/2400 << "+90d58'30\"" << true;
119 +- data << 39599*M_PI/648000 << "+10d59'59\"" << true;
120 ++ data << 39599*M_PI/648000 << "+10d59'59.00\"" << true;
121 + data << -M_PI/36 << "-5d" << true;
122 + data << -7*M_PI/8 << "-157d30'" << true;
123 + data << -2*M_PI/5 << "-72d" << true;
124 + data << -M_PI << "-180d" << true;
125 +- data << -10*M_PI/648 << "-2d46'40\"" << true;
126 ++ data << -10*M_PI/648 << "-2d46'40.00\"" << true;
127 +
128 + while (data.count()>=3)
129 + {
130 +@@ -282,9 +282,7 @@ void TestConversions::testRadToDMSStrAdapt()
131 + bool flag = data.takeFirst().toBool();
132 + QString rdms = StelUtils::radToDmsStrAdapt(rad, flag);
133 + QVERIFY2(rdms==edms, qPrintable(QString("%1 radians = %2 (expected %3) [flag: %4]")
134 +- .arg(QString::number(rad, 'f', 5))
135 +- .arg(rdms)
136 +- .arg(edms)
137 ++ .arg(QString::number(rad, 'f', 5), rdms, edms)
138 + .arg(flag)));
139 + }
140 + }
141 +@@ -381,9 +379,7 @@ void TestConversions::testRadToDMSStr()
142 + bool useDF = data.takeFirst().toBool();
143 + QString rdms = StelUtils::radToDmsStr(rad, decimalF, useDF);
144 + QVERIFY2(rdms==edms, qPrintable(QString("%1 radians = %2 (expected %3) [flags: %4, %5]")
145 +- .arg(QString::number(rad, 'f', 5))
146 +- .arg(rdms)
147 +- .arg(edms)
148 ++ .arg(QString::number(rad, 'f', 5), rdms, edms)
149 + .arg(decimalF)
150 + .arg(useDF)));
151 + }
152
153 diff --git a/sci-astronomy/stellarium/stellarium-0.22.1-r1.ebuild b/sci-astronomy/stellarium/stellarium-0.22.1-r1.ebuild
154 new file mode 100644
155 index 000000000000..1a50f8899404
156 --- /dev/null
157 +++ b/sci-astronomy/stellarium/stellarium-0.22.1-r1.ebuild
158 @@ -0,0 +1,148 @@
159 +# Copyright 1999-2022 Gentoo Authors
160 +# Distributed under the terms of the GNU General Public License v2
161 +
162 +EAPI=8
163 +
164 +PYTHON_COMPAT=( python3_{8..10} )
165 +inherit cmake desktop flag-o-matic python-any-r1 xdg virtualx
166 +
167 +DESCRIPTION="3D photo-realistic skies in real time"
168 +HOMEPAGE="https://stellarium.org/"
169 +MY_DSO_VERSION="3.15"
170 +SRC_URI="
171 + https://github.com/Stellarium/stellarium/releases/download/v${PV}/${P}.tar.gz
172 + deep-sky? (
173 + https://github.com/Stellarium/stellarium-data/releases/download/dso-${MY_DSO_VERSION}/catalog-${MY_DSO_VERSION}.dat -> ${PN}-dso-catalog-${MY_DSO_VERSION}.dat
174 + )
175 + doc? (
176 + https://github.com/Stellarium/stellarium/releases/download/v${PV}/stellarium_user_guide-${PV}-1.pdf
177 + )
178 + stars? (
179 + https://github.com/Stellarium/stellarium-data/releases/download/stars-2.0/stars_4_1v0_2.cat
180 + https://github.com/Stellarium/stellarium-data/releases/download/stars-2.0/stars_5_2v0_1.cat
181 + https://github.com/Stellarium/stellarium-data/releases/download/stars-2.0/stars_6_2v0_1.cat
182 + https://github.com/Stellarium/stellarium-data/releases/download/stars-2.0/stars_7_2v0_1.cat
183 + https://github.com/Stellarium/stellarium-data/releases/download/stars-2.0/stars_8_2v0_1.cat
184 + )"
185 +
186 +LICENSE="GPL-2+ SGI-B-2.0"
187 +SLOT="0"
188 +KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv ~x86"
189 +IUSE="debug deep-sky doc gps media nls stars telescope test webengine"
190 +
191 +# Python interpreter is used while building RemoteControl plugin
192 +BDEPEND="
193 + ${PYTHON_DEPS}
194 + doc? ( app-doc/doxygen[dot] )
195 + nls? ( dev-qt/linguist-tools:5 )
196 +"
197 +RDEPEND="
198 + dev-libs/qtcompress:=
199 + dev-qt/qtcharts:5
200 + dev-qt/qtcore:5
201 + dev-qt/qtgui:5
202 + dev-qt/qtnetwork:5
203 + dev-qt/qtopengl:5
204 + dev-qt/qtprintsupport:5
205 + dev-qt/qtscript:5
206 + dev-qt/qtwidgets:5
207 + media-fonts/dejavu
208 + sys-libs/zlib
209 + virtual/opengl
210 + gps? (
211 + dev-qt/qtpositioning:5
212 + dev-qt/qtserialport:5
213 + sci-geosciences/gpsd:=[cxx]
214 + )
215 + media? ( dev-qt/qtmultimedia:5[widgets] )
216 + telescope? (
217 + dev-qt/qtserialport:5
218 + sci-libs/indilib:=
219 + )
220 + webengine? ( dev-qt/qtwebengine:5[widgets] )
221 +"
222 +DEPEND="${RDEPEND}
223 + dev-qt/qtconcurrent:5
224 + test? ( dev-qt/qttest:5 )
225 +"
226 +
227 +RESTRICT="!test? ( test )"
228 +
229 +PATCHES=(
230 + "${FILESDIR}/stellarium-0.20.3-unbundle-indi.patch"
231 + "${FILESDIR}/stellarium-0.20.3-unbundle-zlib.patch"
232 + "${FILESDIR}/stellarium-0.22.1-fix-star-manager-segfault.patch"
233 + "${FILESDIR}/stellarium-0.22.1-unbundle-qtcompress.patch"
234 + "${FILESDIR}/stellarium-0.22.1-fix-test-x86.patch"
235 + "${FILESDIR}/stellarium-0.22.1-fix-conv.patch"
236 +)
237 +
238 +src_prepare() {
239 + cmake_src_prepare
240 + use debug || append-cppflags -DQT_NO_DEBUG #415769
241 +
242 + # Several libraries are bundled, remove them.
243 + rm -r src/external/{libindi,qtcompress,zlib}/ || die
244 +
245 + # qcustomplot can't be easily unbundled because it uses qcustomplot 1
246 + # while we have qcustomplot 2 in tree which changed API a bit
247 + # Also the license of the external qcustomplot is incompatible with stellarium
248 +
249 + # for glues_stel aka libtess I couldn't find an upstream with the same API
250 +
251 + # unbundling of qxlsx depends on https://github.com/QtExcel/QXlsx/pull/185
252 +
253 + local remaining="$(cd src/external/ && echo */)"
254 + if [[ "${remaining}" != "glues_stel/ qcustomplot/ qxlsx/" ]]; then
255 + eqawarn "Need to unbundle more deps: ${remaining}"
256 + fi
257 +}
258 +
259 +src_configure() {
260 + local mycmakeargs=(
261 + -DENABLE_GPS="$(usex gps)"
262 + -DENABLE_MEDIA="$(usex media)"
263 + -DENABLE_NLS="$(usex nls)"
264 + -DENABLE_TESTING="$(usex test)"
265 + -DUSE_PLUGIN_TELESCOPECONTROL="$(usex telescope)"
266 + $(cmake_use_find_package webengine Qt5WebEngine)
267 + $(cmake_use_find_package webengine Qt5WebEngineWidgets)
268 + )
269 + cmake_src_configure
270 +}
271 +
272 +src_test() {
273 + virtx cmake_src_test
274 +}
275 +
276 +src_compile() {
277 + cmake_src_compile
278 +
279 + if use doc ; then
280 + cmake_build apidoc
281 + fi
282 +}
283 +
284 +src_install() {
285 + if use doc ; then
286 + local HTML_DOCS=( "${BUILD_DIR}/doc/html/." )
287 + dodoc "${DISTDIR}/stellarium_user_guide-${PV}-1.pdf"
288 + fi
289 + cmake_src_install
290 +
291 + # use the more up-to-date system fonts
292 + rm "${ED}"/usr/share/stellarium/data/DejaVuSans{Mono,}.ttf || die
293 + dosym ../../fonts/dejavu/DejaVuSans.ttf /usr/share/stellarium/data/DejaVuSans.ttf
294 + dosym ../../fonts/dejavu/DejaVuSansMono.ttf /usr/share/stellarium/data/DejaVuSansMono.ttf
295 +
296 + if use stars ; then
297 + insinto /usr/share/${PN}/stars/default
298 + doins "${DISTDIR}"/stars_4_1v0_2.cat
299 + doins "${DISTDIR}"/stars_{5,6,7,8}_2v0_1.cat
300 + fi
301 + if use deep-sky ; then
302 + insinto /usr/share/${PN}/nebulae/default
303 + newins "${DISTDIR}/${PN}-dso-catalog-${MY_DSO_VERSION}.dat" catalog.dat
304 + fi
305 + newicon doc/images/stellarium-logo.png ${PN}.png
306 +}