From a74b3012678ab9640b2bc6062ac37fe6805c2f15 Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Sat, 23 Sep 2023 20:32:36 +0800 Subject: [PATCH] mysql-shell-innovation: init at 8.1.1 --- .../tools/mysql-shell/innovation.nix | 130 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 9 ++ 2 files changed, 139 insertions(+) create mode 100644 pkgs/development/tools/mysql-shell/innovation.nix diff --git a/pkgs/development/tools/mysql-shell/innovation.nix b/pkgs/development/tools/mysql-shell/innovation.nix new file mode 100644 index 000000000000..dda169be32da --- /dev/null +++ b/pkgs/development/tools/mysql-shell/innovation.nix @@ -0,0 +1,130 @@ +{ lib +, stdenv +, pkg-config +, cmake +, fetchurl +, git +, cctools +, developer_cmds +, DarwinTools +, makeWrapper +, CoreServices +, bison +, openssl +, protobuf +, curl +, zlib +, libssh +, zstd +, lz4 +, boost +, readline +, libtirpc +, rpcsvc-proto +, libedit +, libevent +, icu +, re2 +, ncurses +, libfido2 +, python3 +, cyrus_sasl +, openldap +, antlr +}: + +let + pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ]; + + mysqlShellVersion = "8.1.1"; + mysqlServerVersion = "8.1.0"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "mysql-shell-innovation"; + version = mysqlShellVersion; + + srcs = [ + (fetchurl { + url = "https://cdn.mysql.com//Downloads/MySQL-${lib.versions.majorMinor mysqlServerVersion}/mysql-${mysqlServerVersion}.tar.gz"; + hash = "sha256-PdAXqUBzSqkHlqTGXhJeZxL2S7u+M4jTZGneqoe1mes="; + }) + (fetchurl { + url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz"; + hash = "sha256-X7A2h9PWgQgNg7h64oD+Th/KsqP3UGpJ2etaP2B0VuY="; + }) + ]; + + sourceRoot = "mysql-shell-${finalAttrs.version}-src"; + + postUnpack = '' + mv mysql-${mysqlServerVersion} mysql + ''; + + postPatch = '' + substituteInPlace ../mysql/cmake/libutils.cmake --replace /usr/bin/libtool libtool + substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool + + substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool + ''; + + nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ] + ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ] + ++ lib.optionals stdenv.isDarwin [ cctools developer_cmds DarwinTools ]; + + buildInputs = [ + boost + curl + libedit + libssh + lz4 + openssl + protobuf + readline + zlib + zstd + libevent + icu + re2 + ncurses + libfido2 + cyrus_sasl + openldap + python3 + antlr.runtime.cpp + ] ++ pythonDeps + ++ lib.optionals stdenv.isLinux [ libtirpc ] + ++ lib.optionals stdenv.isDarwin [ CoreServices ]; + + preConfigure = '' + # Build MySQL + echo "Building mysqlclient mysqlxclient" + + cmake -DWITH_BOOST=system -DWITH_SYSTEM_LIBS=ON -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" + "-DWITH_ZSTD=system" + "-DWITH_LZ4=system" + "-DWITH_ZLIB=system" + "-DWITH_PROTOBUF=${protobuf}" + "-DHAVE_PYTHON=1" + ]; + + postFixup = '' + wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}" + ''; + + meta = with lib; { + homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/"; + description = "A new command line scriptable shell for MySQL"; + license = licenses.gpl2; + maintainers = with maintainers; [ aaronjheng ]; + mainProgram = "mysqlsh"; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 55eca3490d96..712bf2e2fc63 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1080,6 +1080,15 @@ with pkgs; icu = icu69; }; + mysql-shell-innovation = callPackage ../development/tools/mysql-shell/innovation.nix { + inherit (darwin) cctools developer_cmds DarwinTools; + inherit (darwin.apple_sdk.frameworks) CoreServices; + antlr = antlr4_10; + boost = boost177; # Configure checks for specific version. + icu = icu69; + protobuf = protobuf3_21; + }; + broadlink-cli = callPackage ../tools/misc/broadlink-cli { }; fetchpatch = callPackage ../build-support/fetchpatch {