Skip to content

Commit

Permalink
unixODBCDrivers.mariadb: build against subrepo instead of libmysqlclient
Browse files Browse the repository at this point in the history
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 #73928
  • Loading branch information
jamii committed Nov 23, 2019
1 parent a6934e3 commit fa9a981
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions 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

Expand Down Expand Up @@ -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;
};
};

Expand Down

0 comments on commit fa9a981

Please sign in to comment.