summary refs log tree commit diff
path: root/pkgs/development/libraries/unixODBCDrivers
diff options
context:
space:
mode:
authorJamie Brandon <jamie@scattered-thoughts.net>2019-11-22 18:34:32 +0000
committerJamie Brandon <jamie@scattered-thoughts.net>2019-11-23 13:08:12 +0000
commitfa9a981fafde12540d1d19c1c7d85154409f0681 (patch)
treed4c8cee82153b3e43ddbeee9cb846ba43c086bfa /pkgs/development/libraries/unixODBCDrivers
parenta6934e36534f8a87a78f877eee65c08fa9867ba5 (diff)
downloadnixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar.gz
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar.bz2
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar.lz
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar.xz
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.tar.zst
nixpkgs-fa9a981fafde12540d1d19c1c7d85154409f0681.zip
unixODBCDrivers.mariadb: build against subrepo instead of libmysqlclient
For unknown reasons, building against libmysqlclient results in
unixODBC reporting an error when trying to load the driver, but
building against the subrepo works fine.

Fixes https://github.com/NixOS/nixpkgs/pull/73928
Diffstat (limited to 'pkgs/development/libraries/unixODBCDrivers')
-rw-r--r--pkgs/development/libraries/unixODBCDrivers/default.nix35
1 files changed, 21 insertions, 14 deletions
diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix
index c1810443bdb..78f85afca91 100644
--- a/pkgs/development/libraries/unixODBCDrivers/default.nix
+++ b/pkgs/development/libraries/unixODBCDrivers/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql, libmysqlclient, sqlite, zlib, libxml2, dpkg, lib, openssl, kerberos, libuuid, patchelf }:
+{ fetchurl, stdenv, unixODBC, cmake, postgresql, mysql, sqlite, zlib, libxml2, dpkg, lib, openssl, kerberos, libuuid, patchelf, libiconv, fetchFromGitHub }:
 
 # I haven't done any parameter tweaking.. So the defaults provided here might be bad
 
@@ -29,35 +29,42 @@
 
   mariadb = stdenv.mkDerivation rec {
     pname = "mariadb-connector-odbc";
-    version = "3.1.2";
-
-    src = fetchurl {
-      url = "https://downloads.mariadb.org/interstitial/connector-odbc-${version}/${pname}-${version}-ga-src.tar.gz";
-      sha256 = "0iibly2mbqijqyq4pzpb6dh40clqhvqrhgnj8knm4bw3nlksd0d5";
+    version = "3.1.4";
+
+    src = fetchFromGitHub {
+      owner = "MariaDB";
+      repo = "mariadb-connector-odbc";
+      rev = version;
+      sha256 = "1kbz5mng9vx89cw2sx7gsvhbv4h86zwp31fr0hxqing3cwxhkfgw";
+      # this driver only seems to build correctly when built against the mariadb-connect-c subrepo
+      # (see https://github.com/NixOS/nixpkgs/issues/73258)
+      fetchSubmodules = true;
     };
 
     nativeBuildInputs = [ cmake ];
-    buildInputs = [ unixODBC libmysqlclient openssl ];
+    buildInputs = [ unixODBC openssl libiconv ];
+
+    preConfigure = ''
+      # we don't want to build a .pkg
+      sed -i 's/ADD_SUBDIRECTORY(osxinstall)//g' CMakeLists.txt
+    '';
 
     cmakeFlags = [
       "-DWITH_OPENSSL=ON"
-    ];
-
-   NIX_CFLAGS_COMPILE = [
-     "-I${libmysqlclient}/include/mysql"
-     "-L${libmysqlclient}/lib/mysql"
+      # on darwin this defaults to ON but we want to build against unixODBC
+      "-DWITH_IODBC=OFF"
     ];
 
     passthru = {
       fancyName = "MariaDB";
-      driver = "lib/libmaodbc.so";
+      driver = if stdenv.isDarwin then "lib/libmaodbc.dylib" else "lib/libmaodbc.so";
     };
 
     meta = with stdenv.lib; {
       description = "MariaDB ODBC database driver";
       homepage =  https://downloads.mariadb.org/connector-odbc/;
       license = licenses.gpl2;
-      platforms = platforms.linux;
+      platforms = platforms.linux ++ platforms.darwin;
     };
   };