Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/glm/, media-libs/glm/files/
Date: Fri, 05 Feb 2021 21:57:25
Message-Id: 1612562236.c74dcd154317d93fc07455b0f03bb442d592ca35.sam@gentoo
1 commit: c74dcd154317d93fc07455b0f03bb442d592ca35
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 5 21:57:16 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 5 21:57:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c74dcd15
7
8 media-libs/glm: fix tests on big endian arches
9
10 Closes: https://bugs.gentoo.org/673972
11 Package-Manager: Portage-3.0.14, Repoman-3.0.2
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 .../glm/files/glm-0.9.9.8-big-endian-tests.patch | 186 +++++++++++++++++++++
15 media-libs/glm/glm-0.9.9.8-r1.ebuild | 3 +-
16 2 files changed, 187 insertions(+), 2 deletions(-)
17
18 diff --git a/media-libs/glm/files/glm-0.9.9.8-big-endian-tests.patch b/media-libs/glm/files/glm-0.9.9.8-big-endian-tests.patch
19 new file mode 100644
20 index 00000000000..cc8b1b637a8
21 --- /dev/null
22 +++ b/media-libs/glm/files/glm-0.9.9.8-big-endian-tests.patch
23 @@ -0,0 +1,186 @@
24 +https://github.com/g-truc/glm/commit/06ce42e72324b32b1f4c37c646e99950c2bd5f6b.patch
25 +https://bugs.gentoo.org/673972
26 +
27 +Not yet applied upstream because <endian.h> is not available on non-Linux platforms.
28 +
29 +From 06ce42e72324b32b1f4c37c646e99950c2bd5f6b Mon Sep 17 00:00:00 2001
30 +From: Max Rees <maxcrees@××.com>
31 +Date: Sun, 15 Mar 2020 15:13:27 -0400
32 +Subject: [PATCH] Fix test suite on big endian platforms
33 +
34 +---
35 + glm/gtc/packing.inl | 55 ++++++++++++++++++++++++++++++++++++++++
36 + test/gtc/gtc_packing.cpp | 3 ++-
37 + 2 files changed, 57 insertions(+), 1 deletion(-)
38 +
39 +diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl
40 +index 8c906e16c..b1c99a507 100644
41 +--- a/glm/gtc/packing.inl
42 ++++ b/glm/gtc/packing.inl
43 +@@ -9,6 +9,9 @@
44 + #include "../detail/type_half.hpp"
45 + #include <cstring>
46 + #include <limits>
47 ++extern "C" {
48 ++#include <endian.h>
49 ++}
50 +
51 + namespace glm{
52 + namespace detail
53 +@@ -183,9 +186,15 @@ namespace detail
54 + {
55 + struct
56 + {
57 ++#if BYTE_ORDER == LITTLE_ENDIAN
58 + uint x : 3;
59 + uint y : 3;
60 + uint z : 2;
61 ++#else
62 ++ uint z : 2;
63 ++ uint y : 3;
64 ++ uint x : 3;
65 ++#endif
66 + } data;
67 + uint8 pack;
68 + };
69 +@@ -194,8 +203,13 @@ namespace detail
70 + {
71 + struct
72 + {
73 ++#if BYTE_ORDER == LITTLE_ENDIAN
74 + uint x : 4;
75 + uint y : 4;
76 ++#else
77 ++ uint y : 4;
78 ++ uint x : 4;
79 ++#endif
80 + } data;
81 + uint8 pack;
82 + };
83 +@@ -204,10 +218,17 @@ namespace detail
84 + {
85 + struct
86 + {
87 ++#if BYTE_ORDER == LITTLE_ENDIAN
88 + uint x : 4;
89 + uint y : 4;
90 + uint z : 4;
91 + uint w : 4;
92 ++#else
93 ++ uint w : 4;
94 ++ uint z : 4;
95 ++ uint y : 4;
96 ++ uint x : 4;
97 ++#endif
98 + } data;
99 + uint16 pack;
100 + };
101 +@@ -216,9 +237,15 @@ namespace detail
102 + {
103 + struct
104 + {
105 ++#if BYTE_ORDER == LITTLE_ENDIAN
106 + uint x : 5;
107 + uint y : 6;
108 + uint z : 5;
109 ++#else
110 ++ uint z : 5;
111 ++ uint y : 6;
112 ++ uint x : 5;
113 ++#endif
114 + } data;
115 + uint16 pack;
116 + };
117 +@@ -227,10 +254,17 @@ namespace detail
118 + {
119 + struct
120 + {
121 ++#if BYTE_ORDER == LITTLE_ENDIAN
122 + uint x : 5;
123 + uint y : 5;
124 + uint z : 5;
125 + uint w : 1;
126 ++#else
127 ++ uint w : 1;
128 ++ uint z : 5;
129 ++ uint y : 5;
130 ++ uint x : 5;
131 ++#endif
132 + } data;
133 + uint16 pack;
134 + };
135 +@@ -239,10 +273,17 @@ namespace detail
136 + {
137 + struct
138 + {
139 ++#if BYTE_ORDER == LITTLE_ENDIAN
140 + uint x : 10;
141 + uint y : 10;
142 + uint z : 10;
143 + uint w : 2;
144 ++#else
145 ++ uint w : 2;
146 ++ uint z : 10;
147 ++ uint y : 10;
148 ++ uint x : 10;
149 ++#endif
150 + } data;
151 + uint32 pack;
152 + };
153 +@@ -251,10 +292,17 @@ namespace detail
154 + {
155 + struct
156 + {
157 ++#if BYTE_ORDER == LITTLE_ENDIAN
158 + int x : 10;
159 + int y : 10;
160 + int z : 10;
161 + int w : 2;
162 ++#else
163 ++ int w : 2;
164 ++ int z : 10;
165 ++ int y : 10;
166 ++ int x : 10;
167 ++#endif
168 + } data;
169 + uint32 pack;
170 + };
171 +@@ -263,10 +311,17 @@ namespace detail
172 + {
173 + struct
174 + {
175 ++#if BYTE_ORDER == LITTLE_ENDIAN
176 + uint x : 9;
177 + uint y : 9;
178 + uint z : 9;
179 + uint w : 5;
180 ++#else
181 ++ uint w : 5;
182 ++ uint z : 9;
183 ++ uint y : 9;
184 ++ uint x : 9;
185 ++#endif
186 + } data;
187 + uint32 pack;
188 + };
189 +diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp
190 +index df5b3bb1a..fbaaa5bcc 100644
191 +--- a/test/gtc/gtc_packing.cpp
192 ++++ b/test/gtc/gtc_packing.cpp
193 +@@ -4,6 +4,7 @@
194 + #include <glm/ext/vector_relational.hpp>
195 + #include <cstdio>
196 + #include <vector>
197 ++#include <arpa/inet.h>
198 +
199 + void print_bits(float const& s)
200 + {
201 +@@ -156,7 +157,7 @@ int test_U3x10_1x2()
202 +
203 + glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
204 + glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
205 +- glm::uint32 const r0 = 0x330077ff;
206 ++ glm::uint32 const r0 = htonl(0xff770033);
207 +
208 + Error += p0 == r0 ? 0 : 1;
209 +
210
211 diff --git a/media-libs/glm/glm-0.9.9.8-r1.ebuild b/media-libs/glm/glm-0.9.9.8-r1.ebuild
212 index 10f370ff15e..96a90be0b01 100644
213 --- a/media-libs/glm/glm-0.9.9.8-r1.ebuild
214 +++ b/media-libs/glm/glm-0.9.9.8-r1.ebuild
215 @@ -15,11 +15,10 @@ KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 ~sparc x86"
216 IUSE="test cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_avx cpu_flags_x86_avx2"
217 RESTRICT="!test? ( test )"
218
219 -RDEPEND=""
220 -
221 PATCHES=(
222 "${FILESDIR}"/${PN}-0.9.9.6-simd.patch
223 "${FILESDIR}"/${P}-clang.patch
224 + "${FILESDIR}"/${PN}-0.9.9.8-big-endian-tests.patch
225 )
226
227 src_configure() {