summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-08-10 22:54:30 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-12 19:22:04 +0100
commit537c61b2cabcc0881bb8a1b0406fe19fb2eccc55 (patch)
tree17a02f76318abe691ef3e9d30e6f80dfc9c24396
parente2bc5106234e3ac0f7f43bd933d7741bd2df8fc8 (diff)
downloadpoky-537c61b2cabcc0881bb8a1b0406fe19fb2eccc55.tar.gz
zip: Make configure checks to be more robust
Newer compilers are strict and have turned some warnings into hard errors which results in subtle configure check failures. Therefore fix these tests and also enable largefile support via cflags when its desired (From OE-Core rev: 64e575a62ac2606e8f1037e712de66dff8156b46) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/zip/zip-3.0/0001-configure-Specify-correct-function-signatures-and-de.patch134
-rw-r--r--meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch35
-rw-r--r--meta/recipes-extended/zip/zip_3.0.bb2
3 files changed, 171 insertions, 0 deletions
diff --git a/meta/recipes-extended/zip/zip-3.0/0001-configure-Specify-correct-function-signatures-and-de.patch b/meta/recipes-extended/zip/zip-3.0/0001-configure-Specify-correct-function-signatures-and-de.patch
new file mode 100644
index 0000000000..a4f8382625
--- /dev/null
+++ b/meta/recipes-extended/zip/zip-3.0/0001-configure-Specify-correct-function-signatures-and-de.patch
@@ -0,0 +1,134 @@
1From 8810f2643c9372a8083272dc1fc157427646d961 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 10 Aug 2022 17:16:23 -0700
4Subject: [PATCH 1/2] configure: Specify correct function signatures and
5 declarations
6
7Include needed system headers in configure tests, this is needed because
8newer compilers are getting stricter about the C99 specs and turning
9-Wimplicit-function-declaration into hard error e.g. clang-15+
10
11Upstream-Status: Inactive-Upstream
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 unix/configure | 79 +++++++++++++++++++++++++++++++++++++++++---------
15 1 file changed, 66 insertions(+), 13 deletions(-)
16
17diff --git a/unix/configure b/unix/configure
18index 1d9a9bb..f2b3d02 100644
19--- a/unix/configure
20+++ b/unix/configure
21@@ -513,21 +513,70 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
22 # Check for missing functions
23 # add NO_'function_name' to flags if missing
24
25-for func in rmdir strchr strrchr rename mktemp mktime mkstemp
26-do
27- echo Check for $func
28- echo "int main(){ $func(); return 0; }" > conftest.c
29- $CC $CFLAGS $LDFLAGS $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
30- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
31-done
32+echo Check for rmdir
33+cat > conftest.c << _EOF_
34+#include <unistd.h>
35+int main(){ rmdir(NULL); return 0; }
36+_EOF_
37+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
38+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RMDIR"
39+
40+echo Check for strchr
41+cat > conftest.c << _EOF_
42+#include <string.h>
43+int main(){ strchr(NULL,0); return 0; }
44+_EOF_
45+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
46+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRCHR"
47
48+echo Check for strrchr
49+cat > conftest.c << _EOF_
50+#include <string.h>
51+int main(){ strrchr(NULL,0); return 0; }
52+_EOF_
53+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
54+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRRCHR"
55+
56+echo Check for rename
57+cat > conftest.c << _EOF_
58+#include <stdio.h>
59+int main(){ rename(NULL,NULL); return 0; }
60+_EOF_
61+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
62+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RENAME"
63+
64+echo Check for mktemp
65+cat > conftest.c << _EOF_
66+#include <stdlib.h>
67+int main(){ mktemp(NULL); return 0; }
68+_EOF_
69+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
70+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTEMP"
71+
72+echo Check for mktime
73+cat > conftest.c << _EOF_
74+#include <time.h>
75+int main(){ mktime(NULL); return 0; }
76+_EOF_
77+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
78+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTIME"
79+
80+echo Check for mkstemp
81+cat > conftest.c << _EOF_
82+#include <stdlib.h>
83+int main(){ return mkstemp(NULL); }
84+_EOF_
85+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
86+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKSTEMP"
87
88 echo Check for memset
89-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
90+cat > conftest.c << _EOF_
91+#include <string.h>
92+int main(){ char k; memset(&k,0,0); return 0; }
93+_EOF_
94 $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
95 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
96
97-
98 echo Check for memmove
99 cat > conftest.c << _EOF_
100 #include <string.h>
101@@ -548,7 +597,7 @@ $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
102 echo Check for errno declaration
103 cat > conftest.c << _EOF_
104 #include <errno.h>
105-main()
106+int main()
107 {
108 errno = 0;
109 return 0;
110@@ -625,14 +674,18 @@ CFLAGS="${CFLAGS} ${OPT}"
111
112 echo Check for valloc
113 cat > conftest.c << _EOF_
114-main()
115+#include <stdlib.h>
116+int main()
117 {
118 #ifdef MMAP
119- valloc();
120+ valloc(0);
121 #endif
122+ return 0;
123 }
124 _EOF_
125-$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
126+#$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
127+$CC ${CFLAGS} -c conftest.c
128+echo "==========================================="
129 [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
130
131
132--
1332.37.1
134
diff --git a/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch b/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch
new file mode 100644
index 0000000000..a86e03e620
--- /dev/null
+++ b/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch
@@ -0,0 +1,35 @@
1From 76f5bf3546d826dcbc03acbefcf0b10b972bf136 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 10 Aug 2022 17:19:38 -0700
4Subject: [PATCH 2/2] unix.c: Do not redefine DIR as FILE
5
6DIR is already provided on Linux via
7/usr/include/dirent.h system header
8
9Upstream-Status: Inactive-Upstream
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 unix/unix.c | 2 --
13 1 file changed, 2 deletions(-)
14
15diff --git a/unix/unix.c b/unix/unix.c
16index ba87614..6e6f4d2 100644
17--- a/unix/unix.c
18+++ b/unix/unix.c
19@@ -61,13 +61,11 @@ local time_t label_utim = 0;
20 /* Local functions */
21 local char *readd OF((DIR *));
22
23-
24 #ifdef NO_DIR /* for AT&T 3B1 */
25 #include <sys/dir.h>
26 #ifndef dirent
27 # define dirent direct
28 #endif
29-typedef FILE DIR;
30 /*
31 ** Apparently originally by Rich Salz.
32 ** Cleaned up and modified by James W. Birdsall.
33--
342.37.1
35
diff --git a/meta/recipes-extended/zip/zip_3.0.bb b/meta/recipes-extended/zip/zip_3.0.bb
index d560c83464..65d9b0995b 100644
--- a/meta/recipes-extended/zip/zip_3.0.bb
+++ b/meta/recipes-extended/zip/zip_3.0.bb
@@ -17,6 +17,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.
17 file://0001-configure-use-correct-CPP.patch \ 17 file://0001-configure-use-correct-CPP.patch \
18 file://0002-configure-support-PIC-code-build.patch \ 18 file://0002-configure-support-PIC-code-build.patch \
19 file://0001-configure-Use-CFLAGS-and-LDFLAGS-when-doing-link-tes.patch \ 19 file://0001-configure-Use-CFLAGS-and-LDFLAGS-when-doing-link-tes.patch \
20 file://0001-configure-Specify-correct-function-signatures-and-de.patch \
21 file://0002-unix.c-Do-not-redefine-DIR-as-FILE.patch \
20 " 22 "
21UPSTREAM_VERSION_UNKNOWN = "1" 23UPSTREAM_VERSION_UNKNOWN = "1"
22 24