Subject: [bug#79179] [PATCH 2/2] Add the line '#include <unistd.h>' to specific files

From: Frederick Muriuki Muriithi <[email-masked]>
Date: Tue, 5 Aug 2025 14:09:31 -0500

Without the '#include <unistd.h>' in these files, the build phase fails with
the `[-Wimplicit-function-declaration]` error, specifically for the `lseek`
and `close` functions.

This commit adds the line to the following files just before the build phase:
- zlib/gzlib.c
- zlib/gzread.c
- zlib/gzwrite.c

Change-Id: I4bc4ee8e54bc39051b4fa19cf05b70233284e5b6
---
 gnu/packages/databases.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index a13dcd2c178..79051c5d8fd 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -1324,7 +1324,20 @@ (define-public mariadb-connector-c
      (list openssl))
     (build-system cmake-build-system)
     (arguments
-     '(#:tests? #f))                    ; no tests
+     `(#:tests? #f                      ; no tests
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'include-unistd-h
+                    (lambda* (#:key source #:allow-other-keys)
+                      (substitute* (map (lambda (filename)
+                                          (string-append "../mariadb-connector-c-"
+                                                              ,version
+                                                              "-src/zlib/"
+                                                              filename))
+                                        '("gzlib.c" "gzread.c" "gzwrite.c"))
+                        (("#include \"gzguts.h\"")
+                         (string-append "#include <unistd.h>"
+                                        "\n"
+                                        "#include \"gzguts.h\""))))))))
     (home-page "https://mariadb.com/kb/en/mariadb-connector-c/")
     (synopsis "Client library to connect to MySQL or MariaDB")
     (description "The MariaDB Connector/C is used to connect applications
-- 
2.41.0