uwimap: gcc-14 fixes (#364738)

This commit is contained in:
Vladimír Čunát
2024-12-17 08:45:54 +01:00
2 changed files with 76 additions and 5 deletions
+57
View File
@@ -0,0 +1,57 @@
diff --git a/src/mtest/mtest.c b/src/mtest/mtest.c
index 69af568..8278c60 100644
--- a/src/mtest/mtest.c
+++ b/src/mtest/mtest.c
@@ -39,6 +39,8 @@
#include "c-client.h"
#include "imap4r1.h"
+char *gets(char *s);
+
/* Excellent reasons to hate ifdefs, and why my real code never uses them */
#ifndef unix
diff --git a/src/osdep/unix/flocklnx.c b/src/osdep/unix/flocklnx.c
index ca0112a..f4366ee 100644
--- a/src/osdep/unix/flocklnx.c
+++ b/src/osdep/unix/flocklnx.c
@@ -32,6 +32,7 @@
#ifndef NFS_SUPER_MAGIC
#define NFS_SUPER_MAGIC 0x6969
#endif
+#include "flocklnx.h"
int safe_flock (int fd,int op)
{
diff --git a/src/osdep/unix/flocklnx.h b/src/osdep/unix/flocklnx.h
new file mode 100644
index 0000000..03a71f7
--- /dev/null
+++ b/src/osdep/unix/flocklnx.h
@@ -0,0 +1,2 @@
+
+int safe_flock (int fd,int op);
diff --git a/src/osdep/unix/os_lnx.h b/src/osdep/unix/os_lnx.h
index b5f39ff..963765c 100644
--- a/src/osdep/unix/os_lnx.h
+++ b/src/osdep/unix/os_lnx.h
@@ -60,6 +60,7 @@
#define flock safe_flock
+#include "flocklnx.h"
#include "env_unix.h"
#include "fs.h"
#include "ftl.h"
diff --git a/src/osdep/unix/os_slx.h b/src/osdep/unix/os_slx.h
index b5f39ff..963765c 100644
--- a/src/osdep/unix/os_slx.h
+++ b/src/osdep/unix/os_slx.h
@@ -60,6 +60,7 @@
#define flock safe_flock
+#include "flocklnx.h"
#include "env_unix.h"
#include "fs.h"
#include "ftl.h"
+19 -5
View File
@@ -38,13 +38,27 @@ stdenv.mkDerivation rec {
# Required to build with newer versions of clang. Fixes call to undeclared functions errors
# and incompatible function pointer conversions.
./clang-fix.patch
./gcc-14-fix.diff
];
postPatch = ''
sed -i src/osdep/unix/Makefile -e 's,/usr/local/ssl,${openssl.dev},'
sed -i src/osdep/unix/Makefile -e 's,^SSLCERTS=.*,SSLCERTS=/etc/ssl/certs,'
sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
'';
postPatch =
''
sed -i src/osdep/unix/Makefile -e 's,/usr/local/ssl,${openssl.dev},'
sed -i src/osdep/unix/Makefile -e 's,^SSLCERTS=.*,SSLCERTS=/etc/ssl/certs,'
sed -i src/osdep/unix/Makefile -e 's,^SSLLIB=.*,SSLLIB=${lib.getLib openssl}/lib,'
''
# utime takes a struct utimbuf rather than an array of time_t[2]
# convert time_t tp[2] to a struct utimbuf where
# tp[0] -> tp.actime and tp[1] -> tp.modtime, where actime and modtime are
# type time_t.
+ ''
sed -i \
-e 's/time_t tp\[2]/struct utimbuf tp/' \
-e 's/\<tp\[0]/tp.actime/g' \
-e 's/\<tp\[1]/tp.modtime/g' \
-e 's/\(utime *([-a-z>]*\),tp)/\1,\&tp)/' \
src/osdep/unix/{mbx.c,mh.c,mmdf.c,mtx.c,mx.c,tenex.c,unix.c}
'';
preConfigure = ''
makeFlagsArray+=("ARRC=${stdenv.cc.targetPrefix}ar rc")