@@ -12,6 +12,305 @@ export PATH=${TOOLS_PATH}/${TOOLCHAIN}/bin:${TOOLS_PATH}/host/bin:$PATH
1212tar -xf libuuid-${UUID_VERSION} .tar.gz
1313pushd libuuid-${UUID_VERSION}
1414
15+ patch -p1 << "EOF "
16+ diff --git a/config.h.in b/config.h.in
17+ index 8eb0959..616f74a 100644
18+ --- a/config.h.in
19+ +++ b/config.h.in
20+ @@ -31,6 +31,15 @@
21+ /* Define to 1 if you have the <netinet/in.h> header file. */
22+ #undef HAVE_NETINET_IN_H
23+
24+ +/* Define to 1 if you have the <net/if_dl.h> header file. */
25+ +#undef HAVE_NET_IF_DL_H
26+ +
27+ +/* Define to 1 if you have the <net/if.h> header file. */
28+ +#undef HAVE_NET_IF_H
29+ +
30+ +/* Define if struct sockaddr contains sa_len */
31+ +#undef HAVE_SA_LEN
32+ +
33+ /* Define to 1 if you have the `socket' function. */
34+ #undef HAVE_SOCKET
35+
36+ diff --git a/configure b/configure
37+ index f73a9ea..9f6a04c 100755
38+ --- a/configure
39+ +++ b/configure
40+ @@ -2083,6 +2095,63 @@ $as_echo "$ac_res" >&6; }
41+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
42+
43+ } # ac_fn_c_find_uintX_t
44+ +
45+ +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
46+ +# ----------------------------------------------------
47+ +# Tries to find if the field MEMBER exists in type AGGR, after including
48+ +# INCLUDES, setting cache variable VAR accordingly.
49+ +ac_fn_c_check_member ()
50+ +{
51+ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
52+ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
53+ +$as_echo_n "checking for $2.$3... " >&6; }
54+ +if eval \${$4+:} false; then :
55+ + $as_echo_n "(cached) " >&6
56+ +else
57+ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
58+ +/* end confdefs.h. */
59+ +$5
60+ +int
61+ +main ()
62+ +{
63+ +static $2 ac_aggr;
64+ +if (ac_aggr.$3)
65+ +return 0;
66+ + ;
67+ + return 0;
68+ +}
69+ +_ACEOF
70+ +if ac_fn_c_try_compile "$LINENO"; then :
71+ + eval "$4=yes"
72+ +else
73+ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
74+ +/* end confdefs.h. */
75+ +$5
76+ +int
77+ +main ()
78+ +{
79+ +static $2 ac_aggr;
80+ +if (sizeof ac_aggr.$3)
81+ +return 0;
82+ + ;
83+ + return 0;
84+ +}
85+ +_ACEOF
86+ +if ac_fn_c_try_compile "$LINENO"; then :
87+ + eval "$4=yes"
88+ +else
89+ + eval "$4=no"
90+ +fi
91+ +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
92+ +fi
93+ +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
94+ +fi
95+ +eval ac_res=\$$4q
96+ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
97+ +$as_echo "$ac_res" >&6; }
98+ + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
99+ +
100+ +} # ac_fn_c_check_member
101+ cat >config.log <<_ACEOF
102+ This file contains any messages produced by compilers while
103+ running configure, to aid debugging if configure makes a mistake.
104+ @@ -12306,7 +12375,7 @@ fi
105+
106+
107+ # Checks for header files.
108+ -for ac_header in fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/file.h sys/ioctl.h sys/socket.h sys/time.h unistd.h
109+ +for ac_header in fcntl.h inttypes.h limits.h net/if.h netinet/in.h net/if_dl.h stdlib.h string.h sys/file.h sys/ioctl.h sys/socket.h sys/time.h unistd.h
110+ do :
111+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
112+ ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
113+ @@ -12445,6 +12514,17 @@ fi
114+ done
115+
116+
117+ +
118+ +ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include <sys/types.h>
119+ + #include <sys/socket.h>
120+ +"
121+ +if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then :
122+ +
123+ +$as_echo "#define HAVE_SA_LEN 1" >>confdefs.h
124+ +
125+ +fi
126+ +
127+ +
128+ PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
129+ PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}')
130+ PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{print $3}')
131+
132+ diff --git a/gen_uuid.c b/gen_uuid.c
133+ index c7b71f2..b52d0fc 100644
134+ --- a/gen_uuid.c
135+ +++ b/gen_uuid.c
136+ @@ -38,6 +38,12 @@
137+ */
138+ #define _SVID_SOURCE
139+
140+ +#if defined(__linux__)
141+ + #ifndef _GNU_SOURCE
142+ + #define _GNU_SOURCE
143+ + #endif
144+ +#endif
145+ +
146+ #ifdef _WIN32
147+ #define _WIN32_WINNT 0x0500
148+ #include <windows.h>
149+ @@ -175,84 +203,84 @@ static int getuid (void)
150+ * commenting out get_node_id just to get gen_uuid to compile under windows
151+ * is not the right way to go!
152+ */
153+ -static int get_node_id(unsigned char *node_id)
154+ -{
155+ -#ifdef HAVE_NET_IF_H
156+ - int sd;
157+ - struct ifreq ifr, *ifrp;
158+ - struct ifconf ifc;
159+ - char buf[1024];
160+ - int n, i;
161+ - unsigned char *a;
162+ -#ifdef HAVE_NET_IF_DL_H
163+ - struct sockaddr_dl *sdlp;
164+ -#endif
165+ -
166+ -/*
167+ - * BSD 4.4 defines the size of an ifreq to be
168+ - * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
169+ - * However, under earlier systems, sa_len isn't present, so the size is
170+ - * just sizeof(struct ifreq)
171+ - */
172+ -#ifdef HAVE_SA_LEN
173+ -#define ifreq_size(i) max(sizeof(struct ifreq),\
174+ - sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
175+ -#else
176+ -#define ifreq_size(i) sizeof(struct ifreq)
177+ -#endif /* HAVE_SA_LEN */
178+ -
179+ - sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
180+ - if (sd < 0) {
181+ - return -1;
182+ - }
183+ - memset(buf, 0, sizeof(buf));
184+ - ifc.ifc_len = sizeof(buf);
185+ - ifc.ifc_buf = buf;
186+ - if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
187+ - close(sd);
188+ - return -1;
189+ - }
190+ - n = ifc.ifc_len;
191+ - for (i = 0; i < n; i+= ifreq_size(*ifrp) ) {
192+ - ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
193+ - strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
194+ -#ifdef SIOCGIFHWADDR
195+ - if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
196+ - continue;
197+ - a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
198+ -#else
199+ -#ifdef SIOCGENADDR
200+ - if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
201+ - continue;
202+ - a = (unsigned char *) ifr.ifr_enaddr;
203+ -#else
204+ -#ifdef HAVE_NET_IF_DL_H
205+ - sdlp = (struct sockaddr_dl *) &ifrp->ifr_addr;
206+ - if ((sdlp->sdl_family != AF_LINK) || (sdlp->sdl_alen != 6))
207+ - continue;
208+ - a = (unsigned char *) &sdlp->sdl_data[sdlp->sdl_nlen];
209+ -#else
210+ - /*
211+ - * XXX we don't have a way of getting the hardware
212+ - * address
213+ - */
214+ - close(sd);
215+ - return 0;
216+ -#endif /* HAVE_NET_IF_DL_H */
217+ -#endif /* SIOCGENADDR */
218+ -#endif /* SIOCGIFHWADDR */
219+ - if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
220+ - continue;
221+ - if (node_id) {
222+ - memcpy(node_id, a, 6);
223+ - close(sd);
224+ - return 1;
225+ - }
226+ - }
227+ - close(sd);
228+ -#endif
229+ - return 0;
230+ -}
231+ + static int get_node_id(unsigned char *node_id)
232+ + {
233+ + #ifdef HAVE_NET_IF_H
234+ + int sd;
235+ + struct ifreq ifr, *ifrp;
236+ + struct ifconf ifc;
237+ + char buf[1024];
238+ + int n, i;
239+ + unsigned char *a = NULL;
240+ + #ifdef HAVE_NET_IF_DL_H
241+ + struct sockaddr_dl *sdlp;
242+ + #endif
243+ +
244+ + /*
245+ + * BSD 4.4 defines the size of an ifreq to be
246+ + * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
247+ + * However, under earlier systems, sa_len isn't present, so the size is
248+ + * just sizeof(struct ifreq)
249+ + */
250+ + #ifdef HAVE_SA_LEN
251+ + #define ifreq_size(i) max(sizeof(struct ifreq),\
252+ + sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
253+ + #else
254+ + #define ifreq_size(i) sizeof(struct ifreq)
255+ + #endif /* HAVE_SA_LEN */
256+ +
257+ + sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
258+ + if (sd < 0) {
259+ + return -1;
260+ + }
261+ + memset(buf, 0, sizeof(buf));
262+ + ifc.ifc_len = sizeof(buf);
263+ + ifc.ifc_buf = buf;
264+ + if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
265+ + close(sd);
266+ + return -1;
267+ + }
268+ + n = ifc.ifc_len;
269+ + for (i = 0; i < n; i+= ifreq_size(*ifrp) ) {
270+ + ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
271+ + strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
272+ + #ifdef SIOCGIFHWADDR
273+ + if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
274+ + continue;
275+ + a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
276+ + #else
277+ + #ifdef SIOCGENADDR
278+ + if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
279+ + continue;
280+ + a = (unsigned char *) ifr.ifr_enaddr;
281+ + #else
282+ + #ifdef HAVE_NET_IF_DL_H
283+ + sdlp = (struct sockaddr_dl *) &ifrp->ifr_addr;
284+ + if ((sdlp->sdl_family != AF_LINK) || (sdlp->sdl_alen != 6))
285+ + continue;
286+ + a = (unsigned char *) &sdlp->sdl_data[sdlp->sdl_nlen];
287+ + #else
288+ + /*
289+ + * XXX we don't have a way of getting the hardware
290+ + * address
291+ + */
292+ + close(sd);
293+ + return 0;
294+ + #endif /* HAVE_NET_IF_DL_H */
295+ + #endif /* SIOCGENADDR */
296+ + #endif /* SIOCGIFHWADDR */
297+ + if (a == NULL || (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5]))
298+ + continue;
299+ + if (node_id) {
300+ + memcpy(node_id, a, 6);
301+ + close(sd);
302+ + return 1;
303+ + }
304+ + }
305+ + close(sd);
306+ + #endif
307+ + return 0;
308+ + }
309+
310+ /* Assume that the gettimeofday() has microsecond granularity */
311+ #define MAX_ADJUSTMENT 10
312+ EOF
313+
15314CFLAGS=" ${EXTRA_TARGET_CFLAGS} -fPIC"
16315
17316# Error by default in Clang 16.
0 commit comments