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-misc/tmux/, app-misc/tmux/files/
Date: Thu, 22 Sep 2022 03:04:56
Message-Id: 1663815436.29df23ad4410881b5233a0c2ce31f2bd75238ef6.sam@gentoo
1 commit: 29df23ad4410881b5233a0c2ce31f2bd75238ef6
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 22 02:57:08 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 22 02:57:16 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29df23ad
7
8 app-misc/tmux: backport Clang fixes
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 app-misc/tmux/files/tmux-3.3a-clang.patch | 59 ++++++++++++++++++++++
13 app-misc/tmux/tmux-3.3a-r1.ebuild | 84 +++++++++++++++++++++++++++++++
14 2 files changed, 143 insertions(+)
15
16 diff --git a/app-misc/tmux/files/tmux-3.3a-clang.patch b/app-misc/tmux/files/tmux-3.3a-clang.patch
17 new file mode 100644
18 index 000000000000..e292e698f310
19 --- /dev/null
20 +++ b/app-misc/tmux/files/tmux-3.3a-clang.patch
21 @@ -0,0 +1,59 @@
22 +https://github.com/tmux/tmux/pull/3332
23 +
24 +From 1b4c87de0249242309f10684761698aa880b80a5 Mon Sep 17 00:00:00 2001
25 +From: Marvin Schmidt <marv@×××××××.org>
26 +Date: Tue, 13 Sep 2022 03:25:00 +0200
27 +Subject: [PATCH 1/2] compat/systemd: Include <string.h> for strerror
28 +
29 +Recent compilers are getting stricter about function declarations being
30 +known during compilation and e.g. clang-15 now errors out if a function
31 +signature is not found:
32 +
33 +> compat/systemd.c:56:49: error: call to undeclared library function 'strerror' with type 'char *(int)'; ISO C99 and
34 +> later do not support implicit function declarations [-Wimplicit-function-declaration]
35 +> xasprintf(cause, "systemd socket error (%s)", strerror(errno));
36 +> ^
37 +> compat/systemd.c:56:49: note: include the header <string.h> or explicitly provide a declaration for 'strerror'
38 +> 1 warning and 1 error generated.
39 +
40 +Provide the declaration of `strerror` by including `<string.h>` to fix
41 +this
42 +--- a/compat/systemd.c
43 ++++ b/compat/systemd.c
44 +@@ -16,6 +16,7 @@
45 + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46 + */
47 +
48 ++#include <string.h>
49 + #include <sys/types.h>
50 + #include <sys/un.h>
51 +
52 +
53 +From 1e7ef02c52f2f8a67ab05d8a1c3fec9f4ccb7ea0 Mon Sep 17 00:00:00 2001
54 +From: Marvin Schmidt <marv@×××××××.org>
55 +Date: Tue, 13 Sep 2022 03:34:01 +0200
56 +Subject: [PATCH 2/2] compat/systemd: Use socklen_t instead of int to fix
57 + warning
58 +
59 +clang-15 warns about the pointer passed to `getsockname()` being of
60 +different signedness then the parameter declaration:
61 +
62 +> compat/systemd.c:46:47: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *')
63 +> converts between pointers to integer types with different sign [-Wpointer-sign]
64 +> if (getsockname(fd, (struct sockaddr *)&sa, &addrlen) == -1)
65 +> ^~~~~~~~
66 +> /usr/x86_64-pc-linux-musl/include/sys/socket.h:391:73: note: passing argument to parameter here
67 +> int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
68 +> ^
69 +--- a/compat/systemd.c
70 ++++ b/compat/systemd.c
71 +@@ -30,7 +30,7 @@ systemd_create_socket(int flags, char **cause)
72 + int fds;
73 + int fd;
74 + struct sockaddr_un sa;
75 +- int addrlen = sizeof sa;
76 ++ socklen_t addrlen = sizeof sa;
77 +
78 + fds = sd_listen_fds(0);
79 + if (fds > 1) { /* too many file descriptors */
80 +
81
82 diff --git a/app-misc/tmux/tmux-3.3a-r1.ebuild b/app-misc/tmux/tmux-3.3a-r1.ebuild
83 new file mode 100644
84 index 000000000000..551fa7c7e57d
85 --- /dev/null
86 +++ b/app-misc/tmux/tmux-3.3a-r1.ebuild
87 @@ -0,0 +1,84 @@
88 +# Copyright 1999-2022 Gentoo Authors
89 +# Distributed under the terms of the GNU General Public License v2
90 +
91 +EAPI=8
92 +
93 +inherit autotools flag-o-matic
94 +
95 +DESCRIPTION="Terminal multiplexer"
96 +HOMEPAGE="https://tmux.github.io/"
97 +if [[ ${PV} == 9999 ]] ; then
98 + inherit git-r3
99 + SRC_URI="https://raw.githubusercontent.com/przepompownia/tmux-bash-completion/678a27616b70c649c6701cae9cd8c92b58cc051b/completions/tmux -> tmux-bash-completion-678a27616b70c649c6701cae9cd8c92b58cc051b"
100 + EGIT_REPO_URI="https://github.com/tmux/tmux.git"
101 +else
102 + SRC_URI="https://github.com/tmux/tmux/releases/download/${PV}/${P/_/-}.tar.gz"
103 + if [[ ${PV} != *_rc* ]] ; then
104 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
105 + fi
106 + S="${WORKDIR}/${P/_/-}"
107 +fi
108 +
109 +LICENSE="ISC"
110 +SLOT="0"
111 +IUSE="debug selinux systemd utempter vim-syntax"
112 +
113 +DEPEND="
114 + dev-libs/libevent:=
115 + sys-libs/ncurses:=
116 + systemd? ( sys-apps/systemd:= )
117 + utempter? ( sys-libs/libutempter )
118 + kernel_Darwin? ( dev-libs/libutf8proc:= )
119 +"
120 +
121 +BDEPEND="
122 + virtual/pkgconfig
123 + virtual/yacc
124 +"
125 +
126 +RDEPEND="
127 + ${DEPEND}
128 + selinux? ( sec-policy/selinux-screen )
129 + vim-syntax? ( app-vim/vim-tmux )
130 +"
131 +
132 +DOCS=( CHANGES README )
133 +
134 +PATCHES=(
135 + "${FILESDIR}"/${PN}-2.4-flags.patch
136 + "${FILESDIR}"/${P}-clang.patch
137 +)
138 +
139 +src_prepare() {
140 + default
141 + eautoreconf
142 +}
143 +
144 +src_configure() {
145 + # bug 438558
146 + # 1.7 segfaults when entering copy mode if compiled with -Os
147 + replace-flags -Os -O2
148 +
149 + local myeconfargs=(
150 + --sysconfdir="${EPREFIX}"/etc
151 + $(use_enable debug)
152 + $(use_enable systemd)
153 + $(use_enable utempter)
154 +
155 + # For now, we only expose this for macOS, because
156 + # upstream strongly encourage it. I'm not sure it's
157 + # needed on Linux right now.
158 + $(use_enable kernel_Darwin utf8proc)
159 + )
160 +
161 + econf "${myeconfargs[@]}"
162 +}
163 +
164 +src_install() {
165 + default
166 +
167 + einstalldocs
168 +
169 + dodoc example_tmux.conf
170 + docompress -x /usr/share/doc/${PF}/example_tmux.conf
171 +}