1 |
commit: a745219c1cabe91c6df157cc89d5689b985a2cb9 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 30 20:00:18 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 30 20:01:07 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a745219c |
7 |
|
8 |
sys-apps/attr: provide generated autotools patch |
9 |
|
10 |
for bootstrapping |
11 |
|
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
sys-apps/attr/attr-2.5.1-r2.ebuild | 104 +++++++++++ |
15 |
sys-apps/attr/files/attr-2.5.1-r2-fix-symver.patch | 206 +++++++++++++++++++++ |
16 |
2 files changed, 310 insertions(+) |
17 |
|
18 |
diff --git a/sys-apps/attr/attr-2.5.1-r2.ebuild b/sys-apps/attr/attr-2.5.1-r2.ebuild |
19 |
new file mode 100644 |
20 |
index 000000000000..2046677daddd |
21 |
--- /dev/null |
22 |
+++ b/sys-apps/attr/attr-2.5.1-r2.ebuild |
23 |
@@ -0,0 +1,104 @@ |
24 |
+# Copyright 1999-2022 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=8 |
28 |
+ |
29 |
+inherit flag-o-matic toolchain-funcs multilib-minimal usr-ldscript |
30 |
+ |
31 |
+if [[ ${PV} == 9999 ]] ; then |
32 |
+ EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git" |
33 |
+ inherit autotools git-r3 |
34 |
+else |
35 |
+ inherit libtool |
36 |
+ |
37 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" |
38 |
+ SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz" |
39 |
+fi |
40 |
+ |
41 |
+DESCRIPTION="Extended attributes tools" |
42 |
+HOMEPAGE="https://savannah.nongnu.org/projects/attr" |
43 |
+ |
44 |
+LICENSE="LGPL-2.1" |
45 |
+SLOT="0" |
46 |
+IUSE="debug nls static-libs" |
47 |
+ |
48 |
+BDEPEND="nls? ( sys-devel/gettext )" |
49 |
+ |
50 |
+PATCHES=( |
51 |
+ "${FILESDIR}"/${PN}-2.5.1-r2-fix-symver.patch |
52 |
+) |
53 |
+ |
54 |
+src_prepare() { |
55 |
+ default |
56 |
+ |
57 |
+ if [[ ${PV} == 9999 ]] ; then |
58 |
+ po/update-potfiles || die |
59 |
+ eautopoint |
60 |
+ eautoreconf |
61 |
+ else |
62 |
+ # bug #580792 |
63 |
+ elibtoolize |
64 |
+ fi |
65 |
+} |
66 |
+ |
67 |
+src_configure() { |
68 |
+ # bug #760857 |
69 |
+ append-lfs-flags |
70 |
+ |
71 |
+ multilib-minimal_src_configure |
72 |
+} |
73 |
+ |
74 |
+multilib_src_configure() { |
75 |
+ local myeconfargs=( |
76 |
+ --bindir="${EPREFIX}"/bin |
77 |
+ --libexecdir="${EPREFIX}"/usr/$(get_libdir) |
78 |
+ --enable-shared |
79 |
+ $(use_enable static-libs static) |
80 |
+ $(use_enable nls) |
81 |
+ $(use_enable debug) |
82 |
+ ) |
83 |
+ |
84 |
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" |
85 |
+} |
86 |
+ |
87 |
+multilib_src_install() { |
88 |
+ emake DESTDIR="${D}" install |
89 |
+ |
90 |
+ # Sanity check until we track down why this is happening. bug #644048 |
91 |
+ local lib="${ED}/usr/$(get_libdir)/libattr.so.1" |
92 |
+ if [[ -e ${lib} ]] ; then |
93 |
+ local versions=$($(tc-getREADELF) -V "${lib}") |
94 |
+ local symbols=$($(tc-getREADELF) -sW "${lib}") |
95 |
+ if [[ "${versions}" != *"ATTR_1.0"* || \ |
96 |
+ "${versions}" != *"ATTR_1.1"* || \ |
97 |
+ "${versions}" != *"ATTR_1.2"* || \ |
98 |
+ "${versions}" != *"ATTR_1.3"* || \ |
99 |
+ "${symbols}" != *"getxattr@ATTR_1.0"* ]] ; then |
100 |
+ echo "# readelf -V ${lib}" |
101 |
+ echo "${versions}" |
102 |
+ echo "# readelf -sW ${lib}" |
103 |
+ echo "${symbols}" |
104 |
+ die "Symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048" |
105 |
+ else |
106 |
+ einfo "${lib} passed symbol checks" |
107 |
+ fi |
108 |
+ fi |
109 |
+ |
110 |
+ if multilib_is_native_abi; then |
111 |
+ # We install attr into /bin, so we need the shared lib with it |
112 |
+ gen_usr_ldscript -a attr |
113 |
+ fi |
114 |
+ |
115 |
+ # Add a wrapper until people upgrade. |
116 |
+ # TODO: figure out when this was added & when we can drop it! |
117 |
+ insinto /usr/include/attr |
118 |
+ newins "${FILESDIR}"/xattr-shim.h xattr.h |
119 |
+} |
120 |
+ |
121 |
+multilib_src_install_all() { |
122 |
+ if ! use static-libs; then |
123 |
+ find "${ED}" -name '*.la' -delete || die |
124 |
+ fi |
125 |
+ |
126 |
+ einstalldocs |
127 |
+} |
128 |
|
129 |
diff --git a/sys-apps/attr/files/attr-2.5.1-r2-fix-symver.patch b/sys-apps/attr/files/attr-2.5.1-r2-fix-symver.patch |
130 |
new file mode 100644 |
131 |
index 000000000000..ee25b13166ff |
132 |
--- /dev/null |
133 |
+++ b/sys-apps/attr/files/attr-2.5.1-r2-fix-symver.patch |
134 |
@@ -0,0 +1,206 @@ |
135 |
+https://lists.nongnu.org/archive/html/acl-devel/2022-05/msg00000.html |
136 |
+Bug: https://bugs.gentoo.org/644048 |
137 |
+Bug: https://bugs.gentoo.org/700116 |
138 |
+ |
139 |
+From a9ca51afd2b9f68f57de3a4c3d962d1d763572ca Mon Sep 17 00:00:00 2001 |
140 |
+From: Alexander Miller <alex.miller@×××.de> |
141 |
+Date: Thu, 28 Nov 2019 22:17:24 +0100 |
142 |
+Subject: [PATCH] Better supported way to set symbol versions for legacy |
143 |
+ syscalls |
144 |
+ |
145 |
+Using a linker script to set a symbol versions is an undocumented |
146 |
+hack and doesn't work reliably in many cases. It works (to some |
147 |
+degree) with the bfd linker, but fails with gold or lld. And even |
148 |
+with bfd it can break when using --gc-sections or LTO. |
149 |
+ |
150 |
+The result may be a library where the code has been discarded and |
151 |
+the versioned symbols are unusable, e.g. |
152 |
+ 23: 00000000 0 NOTYPE GLOBAL DEFAULT ABS getxattr@ATTR_1.0 |
153 |
+instead of |
154 |
+ 23: 000033c0 0 FUNC GLOBAL DEFAULT 11 getxattr@ATTR_1.0 |
155 |
+ |
156 |
+Remove the linker script entirely and set symbol versions with the |
157 |
+symver attribute if available (in gcc >= 10, but not in clang), |
158 |
+otherwise use the traditional global asm solution with a .symver |
159 |
+directive. |
160 |
+Those are the documented ways to do it and well supported by (almost) |
161 |
+all configurations. (The exception is old gcc with LTO; a workaround |
162 |
+is included, but some versions may still need -flto-partition=none). |
163 |
+ |
164 |
+Signed-off-by: Alexander Miller <alex.miller@×××.de> |
165 |
+ |
166 |
+--- a/libattr/Makemodule.am |
167 |
++++ b/libattr/Makemodule.am |
168 |
+@@ -8,7 +8,7 @@ LT_CURRENT = 2 |
169 |
+ LT_AGE = 1 |
170 |
+ LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) |
171 |
+ |
172 |
+-libattr_la_DEPENDENCIES = exports libattr/libattr.lds |
173 |
++libattr_la_DEPENDENCIES = exports |
174 |
+ libattr_la_SOURCES = \ |
175 |
+ libattr/attr_copy_action.c \ |
176 |
+ libattr/attr_copy_check.c \ |
177 |
+@@ -20,7 +20,4 @@ libattr_la_SOURCES = \ |
178 |
+ libattr_la_CFLAGS = -include libattr/libattr.h |
179 |
+ libattr_la_LDFLAGS = \ |
180 |
+ -Wl,--version-script,$(top_srcdir)/exports \ |
181 |
+- -Wl,$(top_srcdir)/libattr/libattr.lds \ |
182 |
+ -version-info $(LTVERSION) |
183 |
+- |
184 |
+-EXTRA_DIST += libattr/libattr.lds |
185 |
+ |
186 |
+--- a/Makefile.in |
187 |
++++ b/Makefile.in |
188 |
+@@ -647,9 +647,8 @@ top_build_prefix = @top_build_prefix@ |
189 |
+ top_builddir = @top_builddir@ |
190 |
+ top_srcdir = @top_srcdir@ |
191 |
+ ACLOCAL_AMFLAGS = -I m4 |
192 |
+-EXTRA_DIST = exports examples/copyattr.c examples/Makefile \ |
193 |
+- libattr/libattr.lds test/README test/run \ |
194 |
+- test/sort-getfattr-output $(TESTS) |
195 |
++EXTRA_DIST = exports examples/copyattr.c examples/Makefile test/README \ |
196 |
++ test/run test/sort-getfattr-output $(TESTS) |
197 |
+ SUBDIRS = po |
198 |
+ AM_CPPFLAGS = \ |
199 |
+ -I$(top_builddir)/include \ |
200 |
+@@ -689,7 +688,7 @@ LT_CURRENT = 2 |
201 |
+ #LT_REVISION = |
202 |
+ LT_AGE = 1 |
203 |
+ LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) |
204 |
+-libattr_la_DEPENDENCIES = exports libattr/libattr.lds |
205 |
++libattr_la_DEPENDENCIES = exports |
206 |
+ libattr_la_SOURCES = \ |
207 |
+ libattr/attr_copy_action.c \ |
208 |
+ libattr/attr_copy_check.c \ |
209 |
+@@ -702,7 +701,6 @@ libattr_la_SOURCES = \ |
210 |
+ libattr_la_CFLAGS = -include libattr/libattr.h |
211 |
+ libattr_la_LDFLAGS = \ |
212 |
+ -Wl,--version-script,$(top_srcdir)/exports \ |
213 |
+- -Wl,$(top_srcdir)/libattr/libattr.lds \ |
214 |
+ -version-info $(LTVERSION) |
215 |
+ |
216 |
+ libmisc_la_SOURCES = \ |
217 |
+--- a/libattr/libattr.lds |
218 |
++++ /dev/null |
219 |
+@@ -1,12 +0,0 @@ |
220 |
+-"fgetxattr@ATTR_1.0" = libattr_fgetxattr; |
221 |
+-"flistxattr@ATTR_1.0" = libattr_flistxattr; |
222 |
+-"fremovexattr@ATTR_1.0" = libattr_fremovexattr; |
223 |
+-"fsetxattr@ATTR_1.0" = libattr_fsetxattr; |
224 |
+-"getxattr@ATTR_1.0" = libattr_getxattr; |
225 |
+-"lgetxattr@ATTR_1.0" = libattr_lgetxattr; |
226 |
+-"listxattr@ATTR_1.0" = libattr_listxattr; |
227 |
+-"llistxattr@ATTR_1.0" = libattr_llistxattr; |
228 |
+-"lremovexattr@ATTR_1.0" = libattr_lremovexattr; |
229 |
+-"lsetxattr@ATTR_1.0" = libattr_lsetxattr; |
230 |
+-"removexattr@ATTR_1.0" = libattr_removexattr; |
231 |
+-"setxattr@ATTR_1.0" = libattr_setxattr; |
232 |
+--- a/libattr/syscalls.c |
233 |
++++ b/libattr/syscalls.c |
234 |
+@@ -26,6 +26,27 @@ |
235 |
+ #include <sys/syscall.h> |
236 |
+ #include <sys/xattr.h> |
237 |
+ |
238 |
++/* |
239 |
++ * Versioning of compat symbols: |
240 |
++ * prefer symver attribute if available (since gcc 10), |
241 |
++ * fall back to traditional .symver asm directive otherwise. |
242 |
++ */ |
243 |
++#ifdef __has_attribute |
244 |
++# if __has_attribute(symver) |
245 |
++# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((symver(vn))) |
246 |
++# elif __has_attribute(no_reorder) |
247 |
++ /* |
248 |
++ * Avoid wrong partitioning with older gcc and LTO. May not work reliably |
249 |
++ * with all versions; use -flto-partition=none if you encounter problems. |
250 |
++ */ |
251 |
++# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((noreorder)); \ |
252 |
++ __asm__(".symver " #cn "," vn) |
253 |
++# endif |
254 |
++#endif |
255 |
++#ifndef SYMVER |
256 |
++# define SYMVER(cn, vn) __asm__(".symver " #cn "," vn) |
257 |
++#endif |
258 |
++ |
259 |
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE |
260 |
+ # pragma GCC visibility push(default) |
261 |
+ #endif |
262 |
+@@ -35,66 +56,78 @@ int libattr_setxattr(const char *path, const char *name, |
263 |
+ { |
264 |
+ return syscall(__NR_setxattr, path, name, value, size, flags); |
265 |
+ } |
266 |
++SYMVER(libattr_setxattr, "setxattr@ATTR_1.0"); |
267 |
+ |
268 |
+ int libattr_lsetxattr(const char *path, const char *name, |
269 |
+ void *value, size_t size, int flags) |
270 |
+ { |
271 |
+ return syscall(__NR_lsetxattr, path, name, value, size, flags); |
272 |
+ } |
273 |
++SYMVER(libattr_lsetxattr, "lsetxattr@ATTR_1.0"); |
274 |
+ |
275 |
+ int libattr_fsetxattr(int filedes, const char *name, |
276 |
+ void *value, size_t size, int flags) |
277 |
+ { |
278 |
+ return syscall(__NR_fsetxattr, filedes, name, value, size, flags); |
279 |
+ } |
280 |
++SYMVER(libattr_fsetxattr, "fsetxattr@ATTR_1.0"); |
281 |
+ |
282 |
+ ssize_t libattr_getxattr(const char *path, const char *name, |
283 |
+ void *value, size_t size) |
284 |
+ { |
285 |
+ return syscall(__NR_getxattr, path, name, value, size); |
286 |
+ } |
287 |
++SYMVER(libattr_getxattr, "getxattr@ATTR_1.0"); |
288 |
+ |
289 |
+ ssize_t libattr_lgetxattr(const char *path, const char *name, |
290 |
+ void *value, size_t size) |
291 |
+ { |
292 |
+ return syscall(__NR_lgetxattr, path, name, value, size); |
293 |
+ } |
294 |
++SYMVER(libattr_lgetxattr, "lgetxattr@ATTR_1.0"); |
295 |
+ |
296 |
+ ssize_t libattr_fgetxattr(int filedes, const char *name, |
297 |
+ void *value, size_t size) |
298 |
+ { |
299 |
+ return syscall(__NR_fgetxattr, filedes, name, value, size); |
300 |
+ } |
301 |
++SYMVER(libattr_fgetxattr, "fgetxattr@ATTR_1.0"); |
302 |
+ |
303 |
+ ssize_t libattr_listxattr(const char *path, char *list, size_t size) |
304 |
+ { |
305 |
+ return syscall(__NR_listxattr, path, list, size); |
306 |
+ } |
307 |
++SYMVER(libattr_listxattr, "listxattr@ATTR_1.0"); |
308 |
+ |
309 |
+ ssize_t libattr_llistxattr(const char *path, char *list, size_t size) |
310 |
+ { |
311 |
+ return syscall(__NR_llistxattr, path, list, size); |
312 |
+ } |
313 |
++SYMVER(libattr_llistxattr, "llistxattr@ATTR_1.0"); |
314 |
+ |
315 |
+ ssize_t libattr_flistxattr(int filedes, char *list, size_t size) |
316 |
+ { |
317 |
+ return syscall(__NR_flistxattr, filedes, list, size); |
318 |
+ } |
319 |
++SYMVER(libattr_flistxattr, "flistxattr@ATTR_1.0"); |
320 |
+ |
321 |
+ int libattr_removexattr(const char *path, const char *name) |
322 |
+ { |
323 |
+ return syscall(__NR_removexattr, path, name); |
324 |
+ } |
325 |
++SYMVER(libattr_removexattr, "removexattr@ATTR_1.0"); |
326 |
+ |
327 |
+ int libattr_lremovexattr(const char *path, const char *name) |
328 |
+ { |
329 |
+ return syscall(__NR_lremovexattr, path, name); |
330 |
+ } |
331 |
++SYMVER(libattr_lremovexattr, "lremovexattr@ATTR_1.0"); |
332 |
+ |
333 |
+ int libattr_fremovexattr(int filedes, const char *name) |
334 |
+ { |
335 |
+ return syscall(__NR_fremovexattr, filedes, name); |
336 |
+ } |
337 |
++SYMVER(libattr_fremovexattr, "fremovexattr@ATTR_1.0"); |
338 |
+ |
339 |
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE |
340 |
+ # pragma GCC visibility pop |