Unverified Commit 033c4a55 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #324270 from aaronjheng/mysql-shell

parents 52a4f007 7e47a024
Loading
Loading
Loading
Loading
+29 −22
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
, libssh
, zstd
, lz4
, boost
, readline
, libtirpc
, rpcsvc-proto
@@ -34,33 +33,42 @@

let
  pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];

  mysqlShellVersion = "8.4.1";
  mysqlServerVersion = "8.4.1";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "mysql-shell";
  version = "8.0.37";
  version = mysqlShellVersion;

  srcs = [
    (fetchurl {
      url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
      hash = "sha256-4GOgkazZ7EC7BfLATfZPiZan5OJuiDu2UChJ1fa0pho=";
      url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor mysqlServerVersion}/mysql-${mysqlServerVersion}.tar.gz";
      hash = "sha256-20Hxl9cXDFTX7cDQyaJzDCJfSvBeztD2S+z5u2wRAT4=";
    })
    (fetchurl {
      url = "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
      hash = "sha256-UtZ7/Ip5h9CXKy3lkSt8/TXJgbPPUO73rMSIFPfX0Is=";
      hash = "sha256-wTwoaoaCrTQqaqgE35Sg8zn8HqjsjQowbtgMZTpkYQU=";
    })
  ];

  sourceRoot = "mysql-shell-${finalAttrs.version}-src";

  postUnpack = ''
    mv mysql-${finalAttrs.version} mysql
    mv mysql-${mysqlServerVersion} mysql
  '';

  patches = [
    # No openssl bundling on macOS. It's not working.
    # See https://github.com/mysql/mysql-shell/blob/5b84e0be59fc0e027ef3f4920df15f7be97624c1/cmake/ssl.cmake#L53
    ./no-openssl-bundling.patch
  ];

  postPatch = ''
    substituteInPlace ../mysql/cmake/libutils.cmake --replace /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace-fail /usr/bin/libtool libtool

    substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
    substituteInPlace cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
  '';

  nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ]
@@ -68,7 +76,6 @@ stdenv.mkDerivation (finalAttrs: {
    ++ lib.optionals stdenv.isDarwin [ cctools DarwinTools ];

  buildInputs = [
    boost
    curl
    libedit
    libssh
@@ -95,22 +102,22 @@ stdenv.mkDerivation (finalAttrs: {
    # Build MySQL
    echo "Building mysqlclient mysqlxclient"

    cmake -DWITH_SYSTEM_LIBS=ON -DWITH_BOOST=system -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
    cmake -DWITH_SYSTEM_LIBS=ON -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
      -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build

    cmake --build ../mysql/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
  '';

  cmakeFlags = [
    "-DMYSQL_SOURCE_DIR=../mysql"
    "-DMYSQL_BUILD_DIR=../mysql/build"
    "-DMYSQL_CONFIG_EXECUTABLE=../../mysql/build/scripts/mysql_config"
    cmakeFlagsArray+=(
      "-DMYSQL_SOURCE_DIR=''${NIX_BUILD_TOP}/mysql"
      "-DMYSQL_BUILD_DIR=''${NIX_BUILD_TOP}/mysql/build"
      "-DMYSQL_CONFIG_EXECUTABLE=''${NIX_BUILD_TOP}/mysql/build/scripts/mysql_config"
      "-DWITH_ZSTD=system"
      "-DWITH_LZ4=system"
      "-DWITH_ZLIB=system"
    "-DWITH_PROTOBUF=${protobuf}"
      "-DWITH_PROTOBUF=system"
      "-DHAVE_PYTHON=1"
  ];
    )
  '';

  postFixup = ''
    wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}"
+13 −7
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@
let
  pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];

  mysqlShellVersion = "8.4.0";
  mysqlServerVersion = "8.4.0";
  mysqlShellVersion = "9.0.0";
  mysqlServerVersion = "9.0.0";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "mysql-shell-innovation";
@@ -44,11 +44,11 @@ stdenv.mkDerivation (finalAttrs: {
  srcs = [
    (fetchurl {
      url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor mysqlServerVersion}/mysql-${mysqlServerVersion}.tar.gz";
      hash = "sha256-R6VDP83WOduDa5nhtUWcK4E8va0j/ytd1K0n95K6kY4=";
      hash = "sha256-Eadqo0BGFcacgv/FKL4GnzPWwXvjsCaz01YYFBAUCy0=";
    })
    (fetchurl {
      url = "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
      hash = "sha256-QT30FNogn7JR/dQ3V86QaAZaMREMKvTocRTUaNLGVlg=";
      hash = "sha256-0b+QUVp6D1a8ed1HG7u+s4PZ8rGfM6uCOcpq/T8FPjs=";
    })
  ];

@@ -58,11 +58,17 @@ stdenv.mkDerivation (finalAttrs: {
    mv mysql-${mysqlServerVersion} mysql
  '';

  patches = [
    # No openssl bundling on macOS. It's not working.
    # See https://github.com/mysql/mysql-shell/blob/5b84e0be59fc0e027ef3f4920df15f7be97624c1/cmake/ssl.cmake#L53
    ./no-openssl-bundling.patch
  ];

  postPatch = ''
    substituteInPlace ../mysql/cmake/libutils.cmake --replace-quiet /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace-quiet /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
    substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace-fail /usr/bin/libtool libtool

    substituteInPlace cmake/libutils.cmake --replace-quiet /usr/bin/libtool libtool
    substituteInPlace cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
  '';

  nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ]
+12 −0
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33931e02a..59f613a9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -901,7 +901,6 @@ endif()
 ### Bundling of OpenSSL libraries (if needed)
 # macro MYSQL_CHECK_SSL_DLLS() adapted for Shell
 IF (WITH_SSL_PATH AND (APPLE OR WIN32 OR LINUX_STANDALONE))
-  SET(BUNDLED_OPENSSL 1)
   MESSAGE(STATUS "WITH_SSL_PATH ${WITH_SSL_PATH}")
 
   # In MySQL Server 8.0.4 and up, OpenSSL is linked dynamically and
+13 −8
Original line number Diff line number Diff line
@@ -1051,14 +1051,19 @@ with pkgs;
  mya = callPackage ../applications/misc/mya { };
  mysql-shell = callPackage ../development/tools/mysql-shell {
  mysql-shell = mysql-shell_8;
  inherit ({
    mysql-shell_8 = callPackage ../development/tools/mysql-shell/8.nix {
      inherit (darwin) cctools DarwinTools;
      inherit (darwin.apple_sdk.frameworks) CoreServices;
      antlr = antlr4_10;
    boost = boost177; # Configure checks for specific version.
      icu =  icu73;
      protobuf = protobuf_24;
    };
  })
  mysql-shell_8
  ;
  mysql-shell-innovation = callPackage ../development/tools/mysql-shell/innovation.nix {
    inherit (darwin) cctools DarwinTools;