Gentoo Archives: gentoo-commits

From: Aric Belsito <lluixhi@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-kernel/linux-headers/files/, sys-kernel/linux-headers/
Date: Tue, 30 Jan 2018 21:17:21
Message-Id: 1517347003.9140a9596d82701700e82bfee718161a2a93599f.lluixhi@gentoo
1 commit: 9140a9596d82701700e82bfee718161a2a93599f
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Tue Jan 30 21:16:43 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Tue Jan 30 21:16:43 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=9140a959
7
8 sys-kernel/linux-headers: version bump to 4.15
9
10 .../files/libc-4.15-portability.patch | 165 +++++++++++++++++++++
11 sys-kernel/linux-headers/linux-headers-4.15.ebuild | 58 ++++++++
12 2 files changed, 223 insertions(+)
13
14 diff --git a/sys-kernel/linux-headers/files/libc-4.15-portability.patch b/sys-kernel/linux-headers/files/libc-4.15-portability.patch
15 new file mode 100644
16 index 0000000..09af412
17 --- /dev/null
18 +++ b/sys-kernel/linux-headers/files/libc-4.15-portability.patch
19 @@ -0,0 +1,165 @@
20 +diff -Naur gentoo-headers-base-4.15.orig/include/uapi/linux/kernel.h gentoo-headers-base-4.15/include/uapi/linux/kernel.h
21 +--- gentoo-headers-base-4.15.orig/include/uapi/linux/kernel.h 2018-01-29 21:22:19.000000000 -0800
22 ++++ gentoo-headers-base-4.15/include/uapi/linux/kernel.h 2018-01-30 13:05:03.399378810 -0800
23 +@@ -2,7 +2,9 @@
24 + #ifndef _UAPI_LINUX_KERNEL_H
25 + #define _UAPI_LINUX_KERNEL_H
26 +
27 ++#ifdef __GLIBC__
28 + #include <linux/sysinfo.h>
29 ++#endif
30 +
31 + /*
32 + * 'kernel.h' contains some often-used function prototypes etc
33 +diff -Naur gentoo-headers-base-4.15.orig/include/uapi/linux/libc-compat.h gentoo-headers-base-4.15/include/uapi/linux/libc-compat.h
34 +--- gentoo-headers-base-4.15.orig/include/uapi/linux/libc-compat.h 2018-01-29 21:22:19.000000000 -0800
35 ++++ gentoo-headers-base-4.15/include/uapi/linux/libc-compat.h 2018-01-30 13:14:11.470368995 -0800
36 +@@ -49,47 +49,57 @@
37 + #ifndef _UAPI_LIBC_COMPAT_H
38 + #define _UAPI_LIBC_COMPAT_H
39 +
40 +-/* We have included glibc headers... */
41 +-#if defined(__GLIBC__)
42 ++/* We're used from userspace... */
43 ++#if !defined(__KERNEL__)
44 +
45 +-/* Coordinate with glibc net/if.h header. */
46 ++/* Coordinate with libc net/if.h header. */
47 + #if defined(_NET_IF_H) && defined(__USE_MISC)
48 +
49 +-/* GLIBC headers included first so don't define anything
50 ++/* libc headers included first so don't define anything
51 + * that would already be defined. */
52 +
53 + #define __UAPI_DEF_IF_IFCONF 0
54 + #define __UAPI_DEF_IF_IFMAP 0
55 + #define __UAPI_DEF_IF_IFNAMSIZ 0
56 + #define __UAPI_DEF_IF_IFREQ 0
57 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
58 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
59 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
60 ++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
61 ++#if !defined(__GLIBC__)
62 ++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
63 ++#else
64 + #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
65 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
66 + #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
67 ++#endif /* !defined(__GLIBC__) */
68 +
69 + #else /* _NET_IF_H */
70 +
71 + /* Linux headers included first, and we must define everything
72 +- * we need. The expectation is that glibc will check the
73 ++ * we need. The expectation is that libc will check the
74 + * __UAPI_DEF_* defines and adjust appropriately. */
75 +
76 + #define __UAPI_DEF_IF_IFCONF 1
77 + #define __UAPI_DEF_IF_IFMAP 1
78 + #define __UAPI_DEF_IF_IFNAMSIZ 1
79 + #define __UAPI_DEF_IF_IFREQ 1
80 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
81 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
82 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
83 ++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
84 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
85 +
86 + #endif /* _NET_IF_H */
87 +
88 +-/* Coordinate with glibc netinet/in.h header. */
89 ++/* Coordinate with libc netinet/if_ether.h */
90 ++#ifdef _NETINET_IF_ETHER_H
91 ++#define __UAPI_DEF_ETHHDR 0
92 ++#else
93 ++/* glibc uses __NETINET_IF_ETHER_H and uses the uapi header */
94 ++#define __UAPI_DEF_ETHHDR 1
95 ++#endif /* _NETINET_IF_ETHER_H */
96 ++
97 ++/* Coordinate with libc netinet/in.h header. */
98 + #if defined(_NETINET_IN_H)
99 +
100 +-/* GLIBC headers included first so don't define anything
101 ++/* libc headers included first so don't define anything
102 + * that would already be defined. */
103 + #define __UAPI_DEF_IN_ADDR 0
104 + #define __UAPI_DEF_IN_IPPROTO 0
105 +@@ -99,15 +109,7 @@
106 + #define __UAPI_DEF_IN_CLASS 0
107 +
108 + #define __UAPI_DEF_IN6_ADDR 0
109 +-/* The exception is the in6_addr macros which must be defined
110 +- * if the glibc code didn't define them. This guard matches
111 +- * the guard in glibc/inet/netinet/in.h which defines the
112 +- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
113 +-#if defined(__USE_MISC) || defined (__USE_GNU)
114 + #define __UAPI_DEF_IN6_ADDR_ALT 0
115 +-#else
116 +-#define __UAPI_DEF_IN6_ADDR_ALT 1
117 +-#endif
118 + #define __UAPI_DEF_SOCKADDR_IN6 0
119 + #define __UAPI_DEF_IPV6_MREQ 0
120 + #define __UAPI_DEF_IPPROTO_V6 0
121 +@@ -118,7 +120,7 @@
122 + #else
123 +
124 + /* Linux headers included first, and we must define everything
125 +- * we need. The expectation is that glibc will check the
126 ++ * we need. The expectation is that libc will check the
127 + * __UAPI_DEF_* defines and adjust appropriately. */
128 + #define __UAPI_DEF_IN_ADDR 1
129 + #define __UAPI_DEF_IN_IPPROTO 1
130 +@@ -128,7 +130,7 @@
131 + #define __UAPI_DEF_IN_CLASS 1
132 +
133 + #define __UAPI_DEF_IN6_ADDR 1
134 +-/* We unconditionally define the in6_addr macros and glibc must
135 ++/* We unconditionally define the in6_addr macros and libc must
136 + * coordinate. */
137 + #define __UAPI_DEF_IN6_ADDR_ALT 1
138 + #define __UAPI_DEF_SOCKADDR_IN6 1
139 +@@ -170,7 +172,7 @@
140 + * or we are being included in the kernel, then define everything
141 + * that we need. Check for previous __UAPI_* definitions to give
142 + * unsupported C libraries a way to opt out of any kernel definition. */
143 +-#else /* !defined(__GLIBC__) */
144 ++#else /* defined(__KERNEL) */
145 +
146 + /* Definitions for if.h */
147 + #ifndef __UAPI_DEF_IF_IFCONF
148 +@@ -185,15 +187,20 @@
149 + #ifndef __UAPI_DEF_IF_IFREQ
150 + #define __UAPI_DEF_IF_IFREQ 1
151 + #endif
152 +-/* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */
153 + #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS
154 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
155 + #endif
156 +-/* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
157 ++/* If libc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
158 + #ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
159 + #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
160 + #endif
161 +
162 ++/* Definitions for if_ether.h */
163 ++/* allow libcs like musl to deactivate this, glibc does not implement this. */
164 ++#ifndef __UAPI_DEF_ETHHDR
165 ++#define __UAPI_DEF_ETHHDR 1
166 ++#endif
167 ++
168 + /* Definitions for in.h */
169 + #ifndef __UAPI_DEF_IN_ADDR
170 + #define __UAPI_DEF_IN_ADDR 1
171 +@@ -262,12 +269,6 @@
172 + #define __UAPI_DEF_XATTR 1
173 + #endif
174 +
175 +-#endif /* __GLIBC__ */
176 +-
177 +-/* Definitions for if_ether.h */
178 +-/* allow libcs like musl to deactivate this, glibc does not implement this. */
179 +-#ifndef __UAPI_DEF_ETHHDR
180 +-#define __UAPI_DEF_ETHHDR 1
181 +-#endif
182 ++#endif /* defined(__KERNEL__) */
183 +
184 + #endif /* _UAPI_LIBC_COMPAT_H */
185
186 diff --git a/sys-kernel/linux-headers/linux-headers-4.15.ebuild b/sys-kernel/linux-headers/linux-headers-4.15.ebuild
187 new file mode 100644
188 index 0000000..f230669
189 --- /dev/null
190 +++ b/sys-kernel/linux-headers/linux-headers-4.15.ebuild
191 @@ -0,0 +1,58 @@
192 +# Copyright 1999-2018 Gentoo Foundation
193 +# Distributed under the terms of the GNU General Public License v2
194 +
195 +EAPI="6"
196 +
197 +ETYPE="headers"
198 +H_SUPPORTEDARCH="alpha amd64 arc arm arm64 avr32 bfin cris frv hexagon hppa ia64 m32r m68k metag microblaze mips mn10300 nios2 openrisc ppc ppc64 s390 score sh sparc tile x86 xtensa"
199 +inherit kernel-2
200 +detect_version
201 +
202 +PATCH_VER="1"
203 +SRC_URI="mirror://gentoo/gentoo-headers-base-${PV}.tar.xz
204 + ${PATCH_VER:+mirror://gentoo/gentoo-headers-${PV}-${PATCH_VER}.tar.xz}"
205 +
206 +KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
207 +
208 +DEPEND="app-arch/xz-utils
209 + dev-lang/perl"
210 +RDEPEND="!!media-sound/alsa-headers"
211 +
212 +S=${WORKDIR}/gentoo-headers-base-${PV}
213 +
214 +src_unpack() {
215 + unpack ${A}
216 +}
217 +
218 +src_prepare() {
219 + default
220 +
221 + [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/${PV}
222 + epatch "${FILESDIR}"/libc-4.15-portability.patch
223 +}
224 +
225 +src_install() {
226 + kernel-2_src_install
227 +
228 + # hrm, build system sucks
229 + find "${ED}" '(' -name '.install' -o -name '*.cmd' ')' -delete
230 + find "${ED}" -depth -type d -delete 2>/dev/null
231 +}
232 +
233 +src_test() {
234 + # Make sure no uapi/ include paths are used by accident.
235 + egrep -r \
236 + -e '# *include.*["<]uapi/' \
237 + "${D}" && die "#include uapi/xxx detected"
238 +
239 + einfo "Possible unescaped attribute/type usage"
240 + egrep -r \
241 + -e '(^|[[:space:](])(asm|volatile|inline)[[:space:](]' \
242 + -e '\<([us](8|16|32|64))\>' \
243 + .
244 +
245 + einfo "Missing linux/types.h include"
246 + egrep -l -r -e '__[us](8|16|32|64)' "${ED}" | xargs grep -L linux/types.h
247 +
248 + emake ARCH=$(tc-arch-kernel) headers_check
249 +}