Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-misc/barrier/, x11-misc/barrier/files/
Date: Tue, 10 Mar 2020 23:31:33
Message-Id: 1583883059.eaf2c3827ffcfe39e5e5eb7dbe13a653095ffdc7.chewi@gentoo
1 commit: eaf2c3827ffcfe39e5e5eb7dbe13a653095ffdc7
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 10 23:30:59 2020 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 10 23:30:59 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eaf2c382
7
8 x11-misc/barrier: New package
9
10 Package-Manager: Portage-2.3.93, Repoman-2.3.20
11 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
12
13 x11-misc/barrier/Manifest | 1 +
14 x11-misc/barrier/barrier-2.3.2.ebuild | 73 +++++++++++++
15 x11-misc/barrier/files/barrier-2.3.2-pthread.patch | 115 +++++++++++++++++++++
16 x11-misc/barrier/metadata.xml | 11 ++
17 4 files changed, 200 insertions(+)
18
19 diff --git a/x11-misc/barrier/Manifest b/x11-misc/barrier/Manifest
20 new file mode 100644
21 index 00000000000..7630b04f56f
22 --- /dev/null
23 +++ b/x11-misc/barrier/Manifest
24 @@ -0,0 +1 @@
25 +DIST barrier-2.3.2.tar.gz 7244128 BLAKE2B 263be99ffb692e5b8e3e3450565fbaf5c5e2f23beca4beaf5d699547933be1bcdcbf1ed6b9ce8bd53f2a5dbb1eba3fc06490620555520fcff0e8d34ff2ad52cb SHA512 0452244afc3294aaafd89f18d2472e24fb2fc62426e7be91ab4ffceca4697c7acb8f4438fc299835f1312f0ada83911679abe6b8e1268631130c5877e193ff83
26
27 diff --git a/x11-misc/barrier/barrier-2.3.2.ebuild b/x11-misc/barrier/barrier-2.3.2.ebuild
28 new file mode 100644
29 index 00000000000..e5595798265
30 --- /dev/null
31 +++ b/x11-misc/barrier/barrier-2.3.2.ebuild
32 @@ -0,0 +1,73 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +inherit desktop xdg cmake
39 +
40 +DESCRIPTION="Share a mouse and keyboard between computers (fork of Synergy)"
41 +HOMEPAGE="https://github.com/debauchee/barrier"
42 +SRC_URI="https://github.com/debauchee/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
43 +
44 +LICENSE="GPL-2"
45 +SLOT="0"
46 +KEYWORDS="~amd64"
47 +IUSE="gui libressl"
48 +
49 +RDEPEND="
50 + net-misc/curl
51 + x11-libs/libICE
52 + x11-libs/libSM
53 + x11-libs/libX11
54 + x11-libs/libXext
55 + x11-libs/libXi
56 + x11-libs/libXinerama
57 + x11-libs/libXrandr
58 + x11-libs/libXtst
59 + gui? (
60 + dev-qt/qtcore:5
61 + dev-qt/qtgui:5
62 + dev-qt/qtnetwork:5
63 + dev-qt/qtwidgets:5
64 + net-dns/avahi[mdnsresponder-compat]
65 + )
66 + !libressl? ( dev-libs/openssl:0= )
67 + libressl? ( dev-libs/libressl:0= )
68 +"
69 +DEPEND="
70 + ${RDEPEND}
71 + x11-base/xorg-proto
72 +"
73 +
74 +PATCHES=(
75 + "${FILESDIR}"/${P}-pthread.patch
76 +)
77 +
78 +DOCS=(
79 + ChangeLog
80 + README.md
81 + doc/${PN}.conf.example{,-advanced,-basic}
82 +)
83 +
84 +src_configure() {
85 + local mycmakeargs=(
86 + -DBARRIER_BUILD_GUI=$(usex gui)
87 + -DBARRIER_BUILD_INSTALLER=OFF
88 + -DBARRIER_REVISION=00000000
89 + -DBARRIER_VERSION_STAGE=gentoo
90 + )
91 +
92 + cmake_src_configure
93 +}
94 +
95 +src_install() {
96 + cmake_src_install
97 + einstalldocs
98 + doman doc/${PN}{c,s}.1
99 +
100 + if use gui; then
101 + doicon -s scalable res/${PN}.svg
102 + doicon -s 256 res/${PN}.png
103 + make_desktop_entry ${PN} Barrier ${PN} Utility
104 + fi
105 +}
106
107 diff --git a/x11-misc/barrier/files/barrier-2.3.2-pthread.patch b/x11-misc/barrier/files/barrier-2.3.2-pthread.patch
108 new file mode 100644
109 index 00000000000..d29844843e4
110 --- /dev/null
111 +++ b/x11-misc/barrier/files/barrier-2.3.2-pthread.patch
112 @@ -0,0 +1,115 @@
113 +From a0b3124f80f5696cbf070b3b714533ab4012398d Mon Sep 17 00:00:00 2001
114 +From: James Le Cuirot <chewi@g.o>
115 +Date: Tue, 10 Mar 2020 21:10:48 +0000
116 +Subject: [PATCH] Use -pthread flag and simplify pthread build logic
117 +
118 +Sometimes -lpthread is not enough. This has caused build failures on
119 +Gentoo Linux in the past.
120 +
121 +The logic also seems needlessly complex. We check for HAVE_PTHREAD on
122 +UNIX platforms even though CMake errors out if pthreads are not
123 +found. Similarly, we have a fallback for HAVE_PTHREAD_SIGNAL being
124 +false even though we always set it to true.
125 +---
126 + CMakeLists.txt | 11 ++++-------
127 + res/config.h.in | 6 ------
128 + src/lib/arch/Arch.h | 4 +---
129 + src/lib/arch/unix/ArchMultithreadPosix.cpp | 13 -------------
130 + 4 files changed, 5 insertions(+), 29 deletions(-)
131 +
132 +diff --git a/CMakeLists.txt b/CMakeLists.txt
133 +index 8e10776e..ae7ccb21 100644
134 +--- a/CMakeLists.txt
135 ++++ b/CMakeLists.txt
136 +@@ -123,12 +123,10 @@ if (UNIX)
137 + check_type_size (short SIZEOF_SHORT)
138 +
139 + # pthread is used on both Linux and Mac
140 +- check_library_exists ("pthread" pthread_create "" HAVE_PTHREAD)
141 +- if (HAVE_PTHREAD)
142 +- list (APPEND libs pthread)
143 +- else()
144 +- message (FATAL_ERROR "Missing library: pthread")
145 +- endif()
146 ++ set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
147 ++ set (THREADS_PREFER_PTHREAD_FLAG TRUE)
148 ++ find_package (Threads REQUIRED)
149 ++ list (APPEND libs Threads::Threads)
150 +
151 + # curl is used on both Linux and Mac
152 + find_package (CURL)
153 +@@ -269,7 +267,6 @@ if (UNIX)
154 + set (HAVE_CXX_EXCEPTIONS 1)
155 + set (HAVE_CXX_MUTABLE 1)
156 + set (HAVE_CXX_STDLIB 1)
157 +- set (HAVE_PTHREAD_SIGNAL 1)
158 + set (SELECT_TYPE_ARG1 int)
159 + set (SELECT_TYPE_ARG234 " (fd_set *)")
160 + set (SELECT_TYPE_ARG5 " (struct timeval *)")
161 +diff --git a/res/config.h.in b/res/config.h.in
162 +index f3a72449..2bd3b3bf 100644
163 +--- a/res/config.h.in
164 ++++ b/res/config.h.in
165 +@@ -55,12 +55,6 @@
166 + /* Define if you have a POSIX `sigwait` function. */
167 + #cmakedefine HAVE_POSIX_SIGWAIT ${HAVE_POSIX_SIGWAIT}
168 +
169 +-/* Define if you have POSIX threads libraries and header files. */
170 +-#cmakedefine HAVE_PTHREAD ${HAVE_PTHREAD}
171 +-
172 +-/* Define if you have `pthread_sigmask` and `pthread_kill` functions. */
173 +-#cmakedefine HAVE_PTHREAD_SIGNAL ${HAVE_PTHREAD_SIGNAL}
174 +-
175 + /* Define if your compiler defines socklen_t. */
176 + #cmakedefine HAVE_SOCKLEN_T ${HAVE_SOCKLEN_T}
177 +
178 +diff --git a/src/lib/arch/Arch.h b/src/lib/arch/Arch.h
179 +index c062d6f3..940a2e3a 100644
180 +--- a/src/lib/arch/Arch.h
181 ++++ b/src/lib/arch/Arch.h
182 +@@ -54,9 +54,7 @@
183 + # include "arch/unix/ArchConsoleUnix.h"
184 + # include "arch/unix/ArchDaemonUnix.h"
185 + # include "arch/unix/ArchLogUnix.h"
186 +-# if HAVE_PTHREAD
187 +-# include "arch/unix/ArchMultithreadPosix.h"
188 +-# endif
189 ++# include "arch/unix/ArchMultithreadPosix.h"
190 + # include "arch/unix/ArchNetworkBSD.h"
191 + # include "arch/unix/ArchSleepUnix.h"
192 + # include "arch/unix/ArchStringUnix.h"
193 +diff --git a/src/lib/arch/unix/ArchMultithreadPosix.cpp b/src/lib/arch/unix/ArchMultithreadPosix.cpp
194 +index c9ddc6ce..4866edce 100644
195 +--- a/src/lib/arch/unix/ArchMultithreadPosix.cpp
196 ++++ b/src/lib/arch/unix/ArchMultithreadPosix.cpp
197 +@@ -36,17 +36,6 @@
198 +
199 + #define SIGWAKEUP SIGUSR1
200 +
201 +-#if !HAVE_PTHREAD_SIGNAL
202 +- // boy, is this platform broken. forget about pthread signal
203 +- // handling and let signals through to every process. barrier
204 +- // will not terminate cleanly when it gets SIGTERM or SIGINT.
205 +-# define pthread_sigmask sigprocmask
206 +-# define pthread_kill(tid_, sig_) kill(0, (sig_))
207 +-# define sigwait(set_, sig_)
208 +-# undef HAVE_POSIX_SIGWAIT
209 +-# define HAVE_POSIX_SIGWAIT 1
210 +-#endif
211 +-
212 + static
213 + void
214 + setSignalSet(sigset_t* sigset)
215 +@@ -344,9 +333,7 @@ ArchMultithreadPosix::newThread(ThreadFunc func, void* data)
216 + // can't tell the difference.
217 + if (!m_newThreadCalled) {
218 + m_newThreadCalled = true;
219 +-#if HAVE_PTHREAD_SIGNAL
220 + startSignalHandler();
221 +-#endif
222 + }
223 +
224 + // note that the child thread will wait until we release this mutex
225 +--
226 +2.24.1
227 +
228
229 diff --git a/x11-misc/barrier/metadata.xml b/x11-misc/barrier/metadata.xml
230 new file mode 100644
231 index 00000000000..4ec6c623e4b
232 --- /dev/null
233 +++ b/x11-misc/barrier/metadata.xml
234 @@ -0,0 +1,11 @@
235 +<?xml version="1.0" encoding="UTF-8"?>
236 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
237 +<pkgmetadata>
238 + <maintainer type="person">
239 + <email>chewi@g.o</email>
240 + <name>James Le Cuirot</name>
241 + </maintainer>
242 + <upstream>
243 + <remote-id type="github">debauchee/barrier</remote-id>
244 + </upstream>
245 +</pkgmetadata>