From cfb909229dd4c82441ddbf6d904def2057b62678 Mon Sep 17 00:00:00 2001 From: Izorkin Date: Sat, 17 Aug 2019 21:15:45 +0300 Subject: [PATCH] mariadb-connector-c: move to external package --- pkgs/servers/sql/mariadb/connector-c/2_3.nix | 6 +++ .../sql/mariadb/connector-c/default.nix | 49 +++++++++++++++++++ pkgs/servers/sql/mariadb/default.nix | 42 ---------------- pkgs/top-level/all-packages.nix | 3 ++ 4 files changed, 58 insertions(+), 42 deletions(-) create mode 100644 pkgs/servers/sql/mariadb/connector-c/2_3.nix create mode 100644 pkgs/servers/sql/mariadb/connector-c/default.nix diff --git a/pkgs/servers/sql/mariadb/connector-c/2_3.nix b/pkgs/servers/sql/mariadb/connector-c/2_3.nix new file mode 100644 index 000000000000..5a256887cba6 --- /dev/null +++ b/pkgs/servers/sql/mariadb/connector-c/2_3.nix @@ -0,0 +1,6 @@ +{ callPackage, ... } @ args: + +callPackage ./. (args // { + version = "2.3.7"; + sha256 = "13izi35vvxhiwl2dsnqrz75ciisy2s2k30giv7hrm01qlwnmiycl"; +}) diff --git a/pkgs/servers/sql/mariadb/connector-c/default.nix b/pkgs/servers/sql/mariadb/connector-c/default.nix new file mode 100644 index 000000000000..ed49d40180fd --- /dev/null +++ b/pkgs/servers/sql/mariadb/connector-c/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, cmake +, openssl, zlib +, libiconv +, version, sha256, ... +}: + +with stdenv.lib; + +stdenv.mkDerivation { + pname = "mariadb-connector-c"; + inherit version; + + src = fetchurl { + urls = [ + "https://downloads.mariadb.org/f/connector-c-${version}/mariadb-connector-c-${version}-src.tar.gz" + "https://downloads.mariadb.com/Connectors/c/connector-c-${version}/mariadb-connector-c-${version}-src.tar.gz" + ]; + inherit sha256; + }; + + cmakeFlags = [ + "-DWITH_EXTERNAL_ZLIB=ON" + "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock" + ]; + + # The cmake setup-hook uses $out/lib by default, this is not the case here. + preConfigure = optionalString stdenv.isDarwin '' + cmakeFlagsArray+=("-DCMAKE_INSTALL_NAME_DIR=$out/lib/mariadb") + ''; + + nativeBuildInputs = [ cmake ]; + propagatedBuildInputs = [ openssl zlib ]; + buildInputs = [ libiconv ]; + + enableParallelBuilding = true; + + postFixup = '' + ln -sv mariadb_config $out/bin/mysql_config + ln -sv mariadb $out/lib/mysql + ln -sv mariadb $out/include/mysql + ''; + + meta = { + description = "Client library that can be used to connect to MySQL or MariaDB"; + license = licenses.lgpl21; + maintainers = with maintainers; [ globin ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix index ac14015c4cf3..2e5e117bc0dc 100644 --- a/pkgs/servers/sql/mariadb/default.nix +++ b/pkgs/servers/sql/mariadb/default.nix @@ -18,7 +18,6 @@ mytopEnv = perl.withPackages (p: with p; [ DataDumper DBDmysql DBI TermReadKey ] mariadb = server // { inherit client; # MariaDB Client server = server; # MariaDB Server - inherit connector-c; # libmysqlclient.so inherit galera; }; @@ -217,47 +216,6 @@ server = stdenv.mkDerivation (common // { CXXFLAGS = optionalString stdenv.isi686 "-fpermissive"; }); -connector-c = stdenv.mkDerivation rec { - pname = "mariadb-connector-c"; - version = "2.3.7"; - - src = fetchurl { - url = "https://downloads.mariadb.org/interstitial/connector-c-${version}/mariadb-connector-c-${version}-src.tar.gz/from/http%3A//nyc2.mirrors.digitalocean.com/mariadb/"; - sha256 = "13izi35vvxhiwl2dsnqrz75ciisy2s2k30giv7hrm01qlwnmiycl"; - name = "mariadb-connector-c-${version}-src.tar.gz"; - }; - - # outputs = [ "dev" "out" ]; FIXME: cmake variables don't allow that < 3.0 - cmakeFlags = [ - "-DWITH_EXTERNAL_ZLIB=ON" - "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock" - ]; - - # The cmake setup-hook uses $out/lib by default, this is not the case here. - preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' - cmakeFlagsArray+=("-DCMAKE_INSTALL_NAME_DIR=$out/lib/mariadb") - ''; - - nativeBuildInputs = [ cmake ]; - propagatedBuildInputs = [ openssl zlib ]; - buildInputs = [ libiconv ]; - - enableParallelBuilding = true; - - postFixup = '' - ln -sv mariadb_config $out/bin/mysql_config - ln -sv mariadb $out/lib/mysql - ln -sv mariadb $out/include/mysql - ''; - - meta = with stdenv.lib; { - description = "Client library that can be used to connect to MySQL or MariaDB"; - license = licenses.lgpl21; - maintainers = with maintainers; [ globin ]; - platforms = platforms.all; - }; -}; - galera = stdenv.mkDerivation rec { pname = "mariadb-galera"; version = "25.3.26"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2021ec720a7b..560ee97e946a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14886,6 +14886,9 @@ in rpcbind = callPackage ../servers/rpcbind { }; + mariadb-connector-c = mariadb-connector-c_2_3; + mariadb-connector-c_2_3 = callPackage ../servers/sql/mariadb/connector-c/2_3.nix { }; + mariadb = callPackage ../servers/sql/mariadb { asio = asio_1_10; # As per mariadb's cmake, "static jemalloc_pic.a can only be used up to jemalloc 4".