mariadb-connector-odbc: fix build with clang 16 on Darwin

* Use libkrb5 on Darwin;
* Use nixpkgs zlib instead of vendored zlib to fix call to undeclared
  function `close`; and
* Include `unistd.h` for `sleep`.
This commit is contained in:
Randy Eckenrode
2023-09-05 00:19:57 -04:00
parent dba6d77ad2
commit 7a2e2458a6
2 changed files with 20 additions and 1 deletions
@@ -41,8 +41,14 @@
fetchSubmodules = true;
};
patches = [
# Fix `call to undeclared function 'sleep'` with clang 16
./mariadb-connector-odbc-unistd.patch
];
nativeBuildInputs = [ cmake ];
buildInputs = [ unixODBC openssl libiconv ];
buildInputs = [ unixODBC openssl libiconv zlib ]
++ lib.optionals stdenv.isDarwin [ libkrb5 ];
preConfigure = ''
# we don't want to build a .pkg
@@ -52,6 +58,7 @@
'';
cmakeFlags = [
"-DWITH_EXTERNAL_ZLIB=ON"
"-DODBC_LIB_DIR=${lib.getLib unixODBC}/lib"
"-DODBC_INCLUDE_DIR=${lib.getDev unixODBC}/include"
"-DWITH_OPENSSL=ON"
@@ -0,0 +1,12 @@
diff -ur a/test/use_result.c b/test/use_result.c
--- a/test/use_result.c 1969-12-31 19:00:01.000000000 -0500
+++ b/test/use_result.c 2023-09-05 00:08:12.979889343 -0400
@@ -23,6 +23,8 @@
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
+
#include "tap.h"
SQLINTEGER my_max_rows= 100;