Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/lsof/files/, sys-process/lsof/
Date: Mon, 12 Sep 2022 18:04:25
Message-Id: 1663005856.8069922c8c22acaae7dde8ac2a479864b47f2294.sam@gentoo
1 commit: 8069922c8c22acaae7dde8ac2a479864b47f2294
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 12 18:04:04 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 12 18:04:16 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8069922c
7
8 sys-process/lsof: fix configure tests with Clang 15
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 .../files/lsof-4.95.0-clang-15-configure.patch | 134 +++++++++++++++++++++
13 sys-process/lsof/lsof-4.95.0-r1.ebuild | 116 ++++++++++++++++++
14 2 files changed, 250 insertions(+)
15
16 diff --git a/sys-process/lsof/files/lsof-4.95.0-clang-15-configure.patch b/sys-process/lsof/files/lsof-4.95.0-clang-15-configure.patch
17 new file mode 100644
18 index 000000000000..2e81a089e273
19 --- /dev/null
20 +++ b/sys-process/lsof/files/lsof-4.95.0-clang-15-configure.patch
21 @@ -0,0 +1,134 @@
22 +https://github.com/lsof-org/lsof/pull/248
23 +
24 +From 52f2c48790ced81aeef98807363ec94a867bbd88 Mon Sep 17 00:00:00 2001
25 +From: Sam James <sam@g.o>
26 +Date: Mon, 12 Sep 2022 19:02:14 +0100
27 +Subject: [PATCH] Configure: fix configure tests broken with Clang 15
28 + (-Wimplicit-int)
29 +
30 +Clang 15 makes -Wimplicit-int an error by default.
31 +
32 +Before this fix, configure would think localtime() and strftime() support
33 +was not present.
34 +
35 +Signed-off-by: Sam James <sam@g.o>
36 +--- a/Configure
37 ++++ b/Configure
38 +@@ -681,7 +681,7 @@ case $LSOF_TGT in # {
39 +
40 + rm -f ${LSOF_TMPC}.*
41 + echo "#include <sys/systemcfg.h>" > ${LSOF_TMPC}.c
42 +- echo 'main(){ if (__KERNEL_32()) printf("32\\n");' >> ${LSOF_TMPC}.c
43 ++ echo 'int main(){ if (__KERNEL_32()) printf("32\\n");' >> ${LSOF_TMPC}.c
44 + echo 'else if (__KERNEL_64()) printf("64\\n");' >> ${LSOF_TMPC}.c
45 + echo 'else printf("0\\n");' >> ${LSOF_TMPC}.c
46 + echo "return(0); }" >> ${LSOF_TMPC}.c
47 +@@ -778,7 +778,7 @@ case $LSOF_TGT in # {
48 + rm -f ${LSOF_TMPC}.*
49 + echo "#include <stddef.h>" > ${LSOF_TMPC}.c
50 + echo "#include <sys/user.h>" >> ${LSOF_TMPC}.c
51 +- echo "main(){exit((offsetof(struct user, U_irss) & 0x7) ? 1 : 0);}" >>${LSOF_TMPC}.c
52 ++ echo "int main(){exit((offsetof(struct user, U_irss) & 0x7) ? 1 : 0);}" >>${LSOF_TMPC}.c
53 + echo "Testing user.h with $LSOF_CC"
54 + $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
55 + if ! ${LSOF_TMPC}.x # {
56 +@@ -811,7 +811,7 @@ case $LSOF_TGT in # {
57 + # Get xlc version number
58 +
59 + rm -f ${LSOF_TMPC}.*
60 +- echo "main(){}" > ${LSOF_TMPC}.c
61 ++ echo "int main(){}" > ${LSOF_TMPC}.c
62 + echo "Getting version number of ${LSOF_CC}."
63 + $LSOF_CC -c ${LSOF_TMPC}.c -I${LSOF_INCLUDE} -o ${LSOF_TMPC}.o -qlist > /dev/null 2>&1
64 + LSOF_CCV=`head -1 ${LSOF_TMPC}.lst | sed 's/\(.*\) ---.*/\1/'`
65 +@@ -1783,7 +1783,7 @@ kernel generation process.
66 + cat > ${LSOF_TMPC}.c << .LSOF_END_HERE_DOC3
67 + #undef _KERNEL
68 + #include <sys/types.h>
69 +-main() {
70 ++int main() {
71 + cpumask_t c;
72 + }
73 + .LSOF_END_HERE_DOC3
74 +@@ -2400,7 +2400,7 @@ LOCKF_OWNER4
75 + # Test for "const void" support.
76 +
77 + rm -f ${LSOF_TMPC}.*
78 +- echo "main() { const void *x; return(0); }" >> $LSOF_TMPC.c
79 ++ echo "int main() { const void *x; return(0); }" >> $LSOF_TMPC.c
80 + $LSOF_CC $LSOF_TMPC.c -o $LSOF_TMPC.x > /dev/null 2>&1
81 + if test $? -eq 0 # {
82 + then
83 +@@ -2532,7 +2532,7 @@ LOCKF_OWNER4
84 + echo ""
85 + echo "Testing $LSOF_CC for 64 bit support"
86 + rm -f ${LSOF_TMPC}.*
87 +- echo "main(){}" > ${LSOF_TMPC}.c
88 ++ echo "int main(){}" > ${LSOF_TMPC}.c
89 + LSOF_TMP1=""
90 + $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
91 + if test $? -eq 0 # {
92 +@@ -4605,7 +4605,7 @@ return(0); }
93 + rm -f ${LSOF_TMPC}.*
94 + echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
95 + echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
96 +- echo "main(){" >> ${LSOF_TMPC}.c
97 ++ echo "int main(){" >> ${LSOF_TMPC}.c
98 + echo "enum prnodetype p=PR_GWINDOWS;}" >> ${LSOF_TMPC}.c
99 + echo "Testing prdata.h for PR_GWINDOWS, using $LSOF_CC"
100 + echo $LSOF_CC | grep gcc > /dev/null
101 +@@ -4630,7 +4630,7 @@ return(0); }
102 + rm -f ${LSOF_TMPC}.*
103 + echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
104 + echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
105 +- echo "main(){" >> ${LSOF_TMPC}.c
106 ++ echo "int main(){" >> ${LSOF_TMPC}.c
107 + echo "enum prnodetype p=PR_LDT;}" >> ${LSOF_TMPC}.c
108 + echo "Testing prdata.h for PR_LDT, using $LSOF_CC"
109 + echo $LSOF_CC | grep gcc > /dev/null
110 +@@ -4675,7 +4675,7 @@ return(0); }
111 +
112 + echo "Testing $LSOF_CC for 64 bit support"
113 + rm -f ${LSOF_TMPC}.*
114 +- echo "main(){}" > ${LSOF_TMPC}.c
115 ++ echo "int main(){}" > ${LSOF_TMPC}.c
116 + LSOF_TMP1=""
117 +
118 + # First try gcc's -m64 option -- it's the most current possibility.
119 +@@ -4695,7 +4695,7 @@ return(0); }
120 +
121 + # Try using the older -mcpu=v9 option with gcc instead of -m64.
122 +
123 +- echo "main(){}" > ${LSOF_TMPC}.c
124 ++ echo "int main(){}" > ${LSOF_TMPC}.c
125 + $LSOF_CC ${LSOF_TMPC}.c -mcpu=v9 -o ${LSOF_TMPC}.x > /dev/null 2>&1
126 + if test $? -eq 0 # {
127 + then
128 +@@ -4751,7 +4751,7 @@ return(0); }
129 + echo "Testing $LSOF_CC for 64 bit $LSOF_TMP2 support"
130 + rm -f ${LSOF_TMPC}.*
131 + LSOF_TMP3="-xarch=$LSOF_TMP1"
132 +- echo "main(){}" > ${LSOF_TMPC}.c
133 ++ echo "int main(){}" > ${LSOF_TMPC}.c
134 + LSOF_TMP4=`$LSOF_CC ${LSOF_TMPC}.c $LSOF_TMP3 -o ${LSOF_TMPC}.x 2>&1`
135 + if test $? -eq 0 # {
136 + then
137 +@@ -5003,7 +5003,7 @@ return(0); }
138 + then
139 + rm -f ${LSOF_TMPC}.*
140 + echo "#include <sys/vnode.h>" > ${LSOF_TMPC}.c
141 +- echo "main(){" >> ${LSOF_TMPC}.c
142 ++ echo "int main(){" >> ${LSOF_TMPC}.c
143 + echo "enum vtype p=VSOCK;}" >> ${LSOF_TMPC}.c
144 + echo "Testing vnode.h for VSOCK, using $LSOF_CC"
145 + echo $LSOF_CC | grep gcc > /dev/null
146 +@@ -5490,7 +5490,7 @@ fi # }
147 + rm -f ${LSOF_TMPC}.*
148 + cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC2
149 + #include <time.h>
150 +-main(){
151 ++int main(){
152 + time_t cl;
153 + struct tm *ts;
154 + char bf[32];
155 +
156
157 diff --git a/sys-process/lsof/lsof-4.95.0-r1.ebuild b/sys-process/lsof/lsof-4.95.0-r1.ebuild
158 new file mode 100644
159 index 000000000000..b5cabe286fcd
160 --- /dev/null
161 +++ b/sys-process/lsof/lsof-4.95.0-r1.ebuild
162 @@ -0,0 +1,116 @@
163 +# Copyright 1999-2022 Gentoo Authors
164 +# Distributed under the terms of the GNU General Public License v2
165 +
166 +EAPI=7
167 +
168 +inherit flag-o-matic toolchain-funcs
169 +
170 +MY_P="${P/-/_}"
171 +DESCRIPTION="Lists open files for running Unix processes"
172 +HOMEPAGE="https://github.com/lsof-org/lsof"
173 +SRC_URI="https://github.com/lsof-org/lsof/archive/${PV}.tar.gz -> ${P}.tar.gz"
174 +
175 +LICENSE="lsof"
176 +SLOT="0"
177 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
178 +IUSE="examples ipv6 rpc selinux"
179 +
180 +RDEPEND="rpc? ( net-libs/libtirpc )
181 + selinux? ( sys-libs/libselinux )"
182 +DEPEND="${RDEPEND}"
183 +BDEPEND="sys-apps/groff
184 + rpc? ( virtual/pkgconfig )"
185 +
186 +# Needs fixing first
187 +RESTRICT="test"
188 +
189 +PATCHES=(
190 + "${FILESDIR}"/${PN}-4.85-cross.patch # bug #432120
191 + "${FILESDIR}"/${P}-test-typo.patch
192 + "${FILESDIR}"/${PN}-4.95.0-clang-15-configure.patch
193 +)
194 +
195 +src_prepare() {
196 + default
197 + # fix POSIX compliance with `echo`
198 + sed -i \
199 + -e 's:echo -n:printf:' \
200 + AFSConfig Configure Customize Inventory tests/CkTestDB || die
201 + # Convert `test -r header.h` into a compile test.
202 + # Make sure we convert `test ... -a ...` into two `test` commands
203 + # so we can then convert both over into a compile test. #601432
204 + sed -i -E \
205 + -e '/if test .* -a /s: -a : \&\& test :g' \
206 + -e '/test -r/s:test -r \$\{LSOF_INCLUDE\}/([[:alnum:]/._]*):echo "#include <\1>" | ${LSOF_CC} ${LSOF_CFGF} -E - >/dev/null 2>\&1:g' \
207 + -e 's:grep (.*) \$\{LSOF_INCLUDE\}/([[:alnum:]/._]*):echo "#include <\2>" | ${LSOF_CC} ${LSOF_CFGF} -E -P -dD - 2>/dev/null | grep \1:' \
208 + Configure || die
209 +
210 + # "create" man-page (bug #689462)
211 + # inspired by shipped "makeman" ksh script
212 + soelim < Lsof.8 > lsof.8 || die
213 +}
214 +
215 +target() {
216 + case ${CHOST} in
217 + *-darwin*) echo darwin ;;
218 + *-freebsd*) echo freebsd ;;
219 + *-solaris*) echo solaris ;;
220 + *-aix*) echo aixgcc ;;
221 + *) echo linux ;;
222 + esac
223 +}
224 +
225 +src_configure() {
226 + append-cppflags $(use rpc && $(tc-getPKG_CONFIG) libtirpc --cflags || echo "-DHASNOTRPC -DHASNORPC_H")
227 + append-cppflags $(usex ipv6 -{D,U}HASIPv6)
228 + [[ ${CHOST} == *-solaris2.11 ]] && append-cppflags -DHAS_PAD_MUTEX
229 + if [[ ${CHOST} == *-darwin* ]] ; then
230 + # make sys/proc_info.h available in ${T} because of LSOF_INCLUDE
231 + # dummy location -- Darwin needs this for a Configure check to
232 + # succeed
233 + if [[ -e /usr/include/sys/proc_info.h ]] ; then
234 + mkdir -p "${T}"/sys || die
235 + ( cd "${T}"/sys && ln -s /usr/include/sys/proc_info.h ) || die
236 + fi
237 + fi
238 +
239 + export LSOF_CFGL="${CFLAGS} ${LDFLAGS} \
240 + $(use rpc && $(tc-getPKG_CONFIG) libtirpc --libs)"
241 +
242 + # Set LSOF_INCLUDE to a dummy location so the script doesn't poke
243 + # around in it and mix /usr/include paths with cross-compile/etc.
244 + touch .neverInv
245 + LINUX_HASSELINUX=$(usex selinux y n) \
246 + LSOF_INCLUDE=${T} \
247 + LSOF_CC=$(tc-getCC) \
248 + LSOF_AR="$(tc-getAR) rc" \
249 + LSOF_RANLIB=$(tc-getRANLIB) \
250 + LSOF_CFGF="${CFLAGS} ${CPPFLAGS}" \
251 + ./Configure -n $(target) || die
252 +}
253 +
254 +src_compile() {
255 + emake DEBUG="" all
256 +}
257 +
258 +src_install() {
259 + dobin lsof
260 +
261 + if use examples ; then
262 + insinto /usr/share/lsof/scripts
263 + doins scripts/*
264 + fi
265 +
266 + doman lsof.8
267 + dodoc 00*
268 +}
269 +
270 +pkg_postinst() {
271 + if [[ ${CHOST} == *-solaris* ]] ; then
272 + einfo "Note: to use lsof on Solaris you need read permissions on"
273 + einfo "/dev/kmem, i.e. you need to be root, or to be in the group sys"
274 + elif [[ ${CHOST} == *-aix* ]] ; then
275 + einfo "Note: to use lsof on AIX you need read permissions on /dev/mem and"
276 + einfo "/dev/kmem, i.e. you need to be root, or to be in the group system"
277 + fi
278 +}