From deed2d13adb7470d215ac3442b909b48f4bcf38d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Lled=C3=B3?= <jlledom@member.fsf.org>
Date: Sat, 16 Dec 2023 11:41:28 +0100
Subject: [PATCH 1/7] Posixlib: Minor fixes

* Fix project description
* Allow building in the Hurd
* Rename headers macros
* Fix a comment
---
 contrib/ports/unix/port/sys_arch.c                  | 2 +-
 contrib/ports/unix/posixlib/CMakeLists.txt          | 6 +++---
 contrib/ports/unix/posixlib/include/posix/inet.h    | 6 +++---
 contrib/ports/unix/posixlib/include/posix/sockets.h | 8 ++++----
 contrib/ports/unix/posixlib/lwipopts.h              | 6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/contrib/ports/unix/port/sys_arch.c b/contrib/ports/unix/port/sys_arch.c
index 1e094e80..45631865 100644
--- a/contrib/ports/unix/port/sys_arch.c
+++ b/contrib/ports/unix/port/sys_arch.c
@@ -532,7 +532,7 @@ cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, u32_t timeout)
   if (ret == ETIMEDOUT) {
     return SYS_ARCH_TIMEOUT;
 #ifdef LWIP_UNIX_HURD
-    /* On the Hurd, ret == 1 means the RPC has been cancelled.
+    /* On the Hurd, ret == EINTR means the RPC has been cancelled.
      * The thread is awakened (not terminated) and execution must continue */
   } else if (ret == EINTR) {
     return SYS_ARCH_INTR;
diff --git a/contrib/ports/unix/posixlib/CMakeLists.txt b/contrib/ports/unix/posixlib/CMakeLists.txt
index ee8af054..e0e61b3e 100644
--- a/contrib/ports/unix/posixlib/CMakeLists.txt
+++ b/contrib/ports/unix/posixlib/CMakeLists.txt
@@ -1,8 +1,8 @@
 cmake_minimum_required(VERSION 3.8)
 project(liblwip
     VERSION 2.2.0
-    DESCRIPTION "lwip library for linux"
-    HOMEPAGE_URL "http://wiki.virtualsquare.org"
+    DESCRIPTION "lwip library for POSIX systems"
+    HOMEPAGE_URL "https://savannah.nongnu.org/projects/lwip/"
     LANGUAGES C)
 
 include(GNUInstallDirs)
@@ -10,7 +10,7 @@ include(CheckIncludeFile)
 
 set (BUILD_SHARED_LIBS ON)
 
-if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU")
     message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd")
 endif()
 
diff --git a/contrib/ports/unix/posixlib/include/posix/inet.h b/contrib/ports/unix/posixlib/include/posix/inet.h
index c7bc1249..ad940ce7 100644
--- a/contrib/ports/unix/posixlib/include/posix/inet.h
+++ b/contrib/ports/unix/posixlib/include/posix/inet.h
@@ -24,8 +24,8 @@
  * OF SUCH DAMAGE.
  */
 
-#ifndef HURD_LWIP_POSIX_INET_H
-#define HURD_LWIP_POSIX_INET_H
+#ifndef POSIX_LWIP_POSIX_INET_H
+#define POSIX_LWIP_POSIX_INET_H
 
 #include <arpa/inet.h>
 #include <netinet/in.h>
@@ -73,4 +73,4 @@ struct in_pktinfo {
 }
 #endif
 
-#endif /* HURD_LWIP_POSIX_INET_H */
+#endif /* POSIX_LWIP_POSIX_INET_H */
diff --git a/contrib/ports/unix/posixlib/include/posix/sockets.h b/contrib/ports/unix/posixlib/include/posix/sockets.h
index 2370bb7f..3888c9bd 100644
--- a/contrib/ports/unix/posixlib/include/posix/sockets.h
+++ b/contrib/ports/unix/posixlib/include/posix/sockets.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2023 Joan Lled� <jlledom@member.fsf.org>
+ * Copyright (C) 2023 Joan Lled� <jlledom@member.fsf.org>
  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
@@ -24,8 +24,8 @@
  * OF SUCH DAMAGE.
  */
 
-#ifndef HURD_LWIP_POSIX_SOCKET_H
-#define HURD_LWIP_POSIX_SOCKET_H
+#ifndef POSIX_LWIP_POSIX_SOCKET_H
+#define POSIX_LWIP_POSIX_SOCKET_H
 
 #include <sys/socket.h>
 #include <poll.h>
@@ -147,4 +147,4 @@ int lwip_inet_pton(int af, const char *src, void *dst);
 }
 #endif
 
-#endif /* HURD_LWIP_POSIX_SOCKET_H */
+#endif /* POSIX_LWIP_POSIX_SOCKET_H */
diff --git a/contrib/ports/unix/posixlib/lwipopts.h b/contrib/ports/unix/posixlib/lwipopts.h
index 1b38aa3a..7579531a 100644
--- a/contrib/ports/unix/posixlib/lwipopts.h
+++ b/contrib/ports/unix/posixlib/lwipopts.h
@@ -24,8 +24,8 @@
  * OF SUCH DAMAGE.
  */
 
-#ifndef UNIX_LWIP_LWIPOPTS_H
-#define UNIX_LWIP_LWIPOPTS_H
+#ifndef POSIX_LWIP_LWIPOPTS_H
+#define POSIX_LWIP_LWIPOPTS_H
 
 /* An OS is present */
 #define NO_SYS    0
@@ -177,4 +177,4 @@ void sys_unlock_tcpip_core(void);
 #define IP6_DEBUG         LWIP_DBG_OFF
 #endif
 
-#endif /* UNIX_LWIP_LWIPOPTS_H */
+#endif /* POSIX_LWIP_LWIPOPTS_H */
-- 
2.39.2

