Gentoo Archives: gentoo-commits

From: Craig Andrews <candrews@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-misc/virtualgl/, x11-misc/virtualgl/files/
Date: Fri, 11 Jan 2019 21:31:12
Message-Id: 1547242251.74eced9102a1189d33f113ac5b0ad3149930b048.candrews@gentoo
1 commit: 74eced9102a1189d33f113ac5b0ad3149930b048
2 Author: Craig Andrews <candrews <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 9 16:08:31 2019 +0000
4 Commit: Craig Andrews <candrews <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 11 21:30:51 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74eced91
7
8 x11-misc/virtualgl: OpenSSL 1.1 compatibility
9
10 Closes: https://bugs.gentoo.org/673988
11 Package-Manager: Portage-2.3.54, Repoman-2.3.12
12 Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>
13
14 ...-a974c22141d0ded9ff60a0b903f81e6b484d6ba4.patch | 168 +++++++++++++++++++++
15 x11-misc/virtualgl/virtualgl-2.5.2-r1.ebuild | 91 +++++++++++
16 2 files changed, 259 insertions(+)
17
18 diff --git a/x11-misc/virtualgl/files/virtualgl-2.5.2-openssl-1.1-compat-a974c22141d0ded9ff60a0b903f81e6b484d6ba4.patch b/x11-misc/virtualgl/files/virtualgl-2.5.2-openssl-1.1-compat-a974c22141d0ded9ff60a0b903f81e6b484d6ba4.patch
19 new file mode 100644
20 index 00000000000..d5d923f89d1
21 --- /dev/null
22 +++ b/x11-misc/virtualgl/files/virtualgl-2.5.2-openssl-1.1-compat-a974c22141d0ded9ff60a0b903f81e6b484d6ba4.patch
23 @@ -0,0 +1,168 @@
24 +Patch modified to apply to VirtualGL 2.5.2, before
25 +1b82bceb3723b24ea5dc32edffbe019a8a37ab39 reformatted whitespace
26 +
27 +
28 +From a974c22141d0ded9ff60a0b903f81e6b484d6ba4 Mon Sep 17 00:00:00 2001
29 +From: DRC <information@×××××××××.org>
30 +Date: Mon, 16 Apr 2018 15:06:07 -0500
31 +Subject: [PATCH] OpenSSL improvements
32 +
33 +- Fix build issues with OpenSSL 1.1 (OpenSSL 1.1 and later no longer
34 + provides CRYPTO_set_locking_callback(), since locking is now performed
35 + internally.)
36 +- Detect whether the platform has /dev/urandom at compile time, rather
37 + than assuming that all Sun and SGI machines don't have it (Solaris 10
38 + and later supports /dev/urandom.)
39 +---
40 + ChangeLog.md | 2 ++
41 + include/Socket.h | 8 ++++++--
42 + util/CMakeLists.txt | 5 +++++
43 + util/Socket.cpp | 25 ++++++++++++++++---------
44 + 4 files changed, 29 insertions(+), 11 deletions(-)
45 +
46 +diff --git a/ChangeLog.md b/ChangeLog.md
47 +index 3632c1d8..5c9bff84 100644
48 +--- a/ChangeLog.md
49 ++++ b/ChangeLog.md
50 +@@ -52,6 +52,8 @@ a subsequent segfault when VTK tried to call `glBlendFuncSeparate()`.
51 + VirtualGL's implementation of `glXGetVisualFromFBConfig()` now returns NULL
52 + unless the FB config has a corresponding visual on the 3D X server.
53 +
54 ++6. VirtualGL can now be built and run with OpenSSL 1.1.
55 ++
56 +
57 + 2.5.2
58 + =====
59 +diff --git a/include/Socket.h b/include/Socket.h
60 +index dfe45e3a..f7409956 100644
61 +--- a/include/Socket.h
62 ++++ b/include/Socket.h
63 +@@ -1,6 +1,6 @@
64 + /* Copyright (C)2004 Landmark Graphics Corporation
65 + * Copyright (C)2005 Sun Microsystems, Inc.
66 +- * Copyright (C)2014, 2016 D. R. Commander
67 ++ * Copyright (C)2014, 2016, 2018 D. R. Commander
68 + *
69 + * This library is free software and may be redistributed and/or modified under
70 + * the terms of the wxWindows Library License, Version 3.1 or (at your option)
71 +@@ -23,7 +23,7 @@
72 + #endif
73 + #include <openssl/ssl.h>
74 + #include <openssl/err.h>
75 +-#if defined(sun) || defined(sgi)
76 ++#if !defined(HAVE_DEVURANDOM) && !defined(_WIN32)
77 + #include <openssl/rand.h>
78 + #endif
79 + #endif
80 +@@ -161,15 +161,19 @@ namespace vglutil
81 +
82 + #ifdef USESSL
83 +
84 ++ #if OPENSSL_VERSION_NUMBER < 0x10100000L
85 + static void lockingCallback(int mode, int type, const char *file,
86 + int line)
87 + {
88 + if(mode&CRYPTO_LOCK) cryptoLock[type].lock();
89 + else cryptoLock[type].unlock();
90 + }
91 ++ #endif
92 +
93 + static bool sslInit;
94 ++ #if OPENSSL_VERSION_NUMBER < 0x10100000L
95 + static CriticalSection cryptoLock[CRYPTO_NUM_LOCKS];
96 ++ #endif
97 + bool doSSL; SSL_CTX *sslctx; SSL *ssl;
98 +
99 + #endif
100 +diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt
101 +index 65ef59e7..ed1dfb39 100644
102 +--- a/util/CMakeLists.txt
103 ++++ b/util/CMakeLists.txt
104 +@@ -13,6 +13,11 @@ target_link_libraries(bmptest vglutil)
105 + add_executable(pftest pftest.c)
106 + target_link_libraries(pftest vglutil)
107 +
108 ++if(EXISTS /dev/urandom)
109 ++ message(STATUS "Using /dev/urandom for random number generation")
110 ++ add_definitions(-DHAVE_DEVURANDOM)
111 ++endif()
112 ++
113 + add_library(vglsocket STATIC Socket.cpp)
114 + target_link_libraries(vglsocket vglutil)
115 + if(WIN32)
116 +diff --git a/util/Socket.cpp b/util/Socket.cpp
117 +index 0d230841..b41c25e9 100644
118 +--- a/util/Socket.cpp
119 ++++ b/util/Socket.cpp
120 +@@ -1,6 +1,6 @@
121 + /* Copyright (C)2004 Landmark Graphics Corporation
122 + * Copyright (C)2005 Sun Microsystems, Inc.
123 +- * Copyright (C)2014, 2016 D. R. Commander
124 ++ * Copyright (C)2014, 2016, 2018 D. R. Commander
125 + *
126 + * This library is free software and may be redistributed and/or modified under
127 + * the terms of the wxWindows Library License, Version 3.1 or (at your option)
128 +@@ -43,32 +43,37 @@ typedef socklen_t SOCKLEN_T;
129 +
130 + #ifdef USESSL
131 + bool Socket::sslInit=false;
132 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L
133 + CriticalSection Socket::cryptoLock[CRYPTO_NUM_LOCKS];
134 + #endif
135 ++#endif
136 + CriticalSection Socket::mutex;
137 + int Socket::instanceCount=0;
138 +
139 +
140 + #ifdef USESSL
141 +
142 +-static void progressCallback(int p, int n, void *arg)
143 +-{
144 +-}
145 +-
146 +-
147 + static EVP_PKEY *newPrivateKey(int bits)
148 + {
149 ++ BIGNUM *bn = NULL;
150 ++ RSA *rsa = NULL;
151 + EVP_PKEY *pk=NULL;
152 +
153 + try
154 + {
155 ++ if(!(bn = BN_new())) _throwssl();
156 ++ if(!BN_set_word(bn, RSA_F4)) _throwssl();
157 ++ if(!(rsa = RSA_new())) _throwssl();
158 ++ if(!RSA_generate_key_ex(rsa, bits, bn, NULL)) _throwssl();
159 + if(!(pk=EVP_PKEY_new())) _throwssl();
160 +- if(!EVP_PKEY_assign_RSA(pk, RSA_generate_key(bits, 0x10001,
161 +- progressCallback, NULL))) _throwssl();
162 ++ if(!EVP_PKEY_assign_RSA(pk, rsa)) _throwssl();
163 ++ BN_free(bn);
164 + return pk;
165 + }
166 + catch (...)
167 + {
168 ++ if(bn) BN_free(bn);
169 ++ if(rsa) RSA_free(rsa);
170 + if(pk) EVP_PKEY_free(pk);
171 + throw;
172 + }
173 +@@ -147,7 +152,7 @@ Socket::Socket(bool doSSL_)
174 + #ifdef USESSL
175 + if(!sslInit && doSSL)
176 + {
177 +- #if defined(sun) || defined(sgi)
178 ++ #if !defined(HAVE_DEVURANDOM) && !defined(_WIN32)
179 + char buf[128]; int i;
180 + srandom(getpid());
181 + for(i = 0; i < 128; i++)
182 +@@ -158,7 +163,9 @@ Socket::Socket(bool doSSL_)
183 + SSL_load_error_strings();
184 + ERR_load_crypto_strings();
185 + CRYPTO_set_id_callback(Thread::threadID);
186 ++ #if OPENSSL_VERSION_NUMBER < 0x10100000L
187 + CRYPTO_set_locking_callback(lockingCallback);
188 ++ #endif
189 + SSL_library_init();
190 + sslInit = true;
191 + char *env = NULL;
192
193 diff --git a/x11-misc/virtualgl/virtualgl-2.5.2-r1.ebuild b/x11-misc/virtualgl/virtualgl-2.5.2-r1.ebuild
194 new file mode 100644
195 index 00000000000..aa35612ba1b
196 --- /dev/null
197 +++ b/x11-misc/virtualgl/virtualgl-2.5.2-r1.ebuild
198 @@ -0,0 +1,91 @@
199 +# Copyright 1999-2019 Gentoo Authors
200 +# Distributed under the terms of the GNU General Public License v2
201 +
202 +EAPI=6
203 +inherit cmake-multilib flag-o-matic multilib systemd
204 +
205 +DESCRIPTION="Run OpenGL applications remotely with full 3D hardware acceleration"
206 +HOMEPAGE="https://www.virtualgl.org/"
207 +
208 +MY_PN="VirtualGL"
209 +MY_P="${MY_PN}-${PV}"
210 +S="${WORKDIR}/${MY_P}"
211 +SRC_URI="mirror://sourceforge/${PN}/files/${PV}/${MY_P}.tar.gz"
212 +
213 +SLOT="0"
214 +LICENSE="LGPL-2.1 wxWinLL-3.1 FLTK"
215 +KEYWORDS="~amd64 ~arm64 ~x86"
216 +IUSE="libressl ssl"
217 +
218 +RDEPEND="
219 + ssl? (
220 + !libressl? ( dev-libs/openssl:0=[${MULTILIB_USEDEP}] )
221 + libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
222 + )
223 + media-libs/libjpeg-turbo[${MULTILIB_USEDEP}]
224 + x11-libs/libX11[${MULTILIB_USEDEP}]
225 + x11-libs/libXext[${MULTILIB_USEDEP}]
226 + x11-libs/libXv[${MULTILIB_USEDEP}]
227 + virtual/glu[${MULTILIB_USEDEP}]
228 + virtual/opengl[${MULTILIB_USEDEP}]
229 + amd64? ( abi_x86_32? (
230 + >=media-libs/libjpeg-turbo-1.3.0-r3[abi_x86_32]
231 + >=x11-libs/libX11-1.6.2[abi_x86_32]
232 + >=x11-libs/libXext-1.3.2[abi_x86_32]
233 + >=x11-libs/libXv-1.0.10[abi_x86_32]
234 + >=virtual/glu-9.0-r1[abi_x86_32]
235 + >=virtual/opengl-7.0-r1[abi_x86_32]
236 + ) )
237 +"
238 +DEPEND="${RDEPEND}"
239 +PATCHES=(
240 + "${FILESDIR}/virtualgl-2.5.2-openssl-1.1-compat-a974c22141d0ded9ff60a0b903f81e6b484d6ba4.patch"
241 +)
242 +
243 +src_prepare() {
244 + # Use /var/lib, bug #428122
245 + sed -e "s#/etc/opt#/var/lib#g" -i doc/unixconfig.txt doc/index.html doc/advancedopengl.txt \
246 + server/vglrun.in server/vglgenkey server/vglserver_config || die
247 +
248 + cmake-utils_src_prepare
249 +}
250 +
251 +src_configure() {
252 + # Completely breaks steam/wine for discrete graphics otherwise
253 + # see https://github.com/VirtualGL/virtualgl/issues/16
254 + append-ldflags "-Wl,--no-as-needed"
255 +
256 + abi_configure() {
257 + local mycmakeargs=(
258 + -DVGL_USESSL="$(usex ssl)"
259 + -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/"${PF}"
260 + -DTJPEG_INCLUDE_DIR=/usr/include
261 + -DCMAKE_INSTALL_LIBDIR=/usr/$(get_libdir)
262 + -DTJPEG_LIBRARY=/usr/$(get_libdir)/libturbojpeg.so
263 + -DCMAKE_LIBRARY_PATH=/usr/$(get_libdir)
264 + )
265 + cmake-utils_src_configure
266 + }
267 + multilib_parallel_foreach_abi abi_configure
268 +}
269 +
270 +src_install() {
271 + cmake-multilib_src_install
272 +
273 + # Make config dir
274 + dodir /var/lib/VirtualGL
275 + fowners root:video /var/lib/VirtualGL
276 + fperms 0750 /var/lib/VirtualGL
277 + newinitd "${FILESDIR}/vgl.initd-r3" vgl
278 + newconfd "${FILESDIR}/vgl.confd-r2" vgl
279 +
280 + exeinto /usr/libexec
281 + doexe "${FILESDIR}/vgl-helper.sh"
282 + systemd_dounit "${FILESDIR}/vgl.service"
283 +
284 + # Rename glxinfo to vglxinfo to avoid conflict with x11-apps/mesa-progs
285 + mv "${D}"/usr/bin/{,v}glxinfo || die
286 +
287 + # Remove license files, bug 536284
288 + rm "${D}"/usr/share/doc/${PF}/{LGPL.txt*,LICENSE*} || die
289 +}