python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / tools / mysql-shell / default.nix
blobb84c8843401707919fb70ed6d7a88e27c7ce1094
1 { lib
2 , stdenv
3 , pkg-config
4 , cmake
5 , fetchurl
6 , git
7 , bison
8 , openssl
9 , protobuf
10 , curl
11 , zlib
12 , libssh
13 , zstd
14 , lz4
15 , boost
16 , readline
17 , libtirpc
18 , rpcsvc-proto
19 , libedit
20 , libevent
21 , icu
22 , re2
23 , ncurses
24 , libfido2
25 , v8
26 , python3
27 , cyrus_sasl
28 , openldap
29 , numactl
30 , cctools
31 , CoreServices
32 , developer_cmds
33 , DarwinTools
34 , makeWrapper
37 let
38   pythonDeps = with python3.pkgs; [ certifi paramiko pyyaml ];
39   pythonPath = lib.makeSearchPath python3.sitePackages pythonDeps;
41 stdenv.mkDerivation rec{
42   pname = "mysql-shell";
43   version = "8.0.30";
45   srcs = [
46     (fetchurl {
47       url = "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${version}-src.tar.gz";
48       sha256 = "sha256-/UJgcYkPG8RShZzybqdcMQDpNUTVWAfAa2p0Cm23fXA=";
49     })
50     (fetchurl {
51       url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor version}/mysql-${version}.tar.gz";
52       sha256 = "sha256-yYjVxrqaVmkqbNbpgTRltfyTaO1LRh35cFmi/BYMi4Q=";
53     })
54   ];
56   sourceRoot = "mysql-shell-${version}-src";
58   postPatch = ''
59     substituteInPlace ../mysql-${version}/cmake/libutils.cmake --replace /usr/bin/libtool libtool
60     substituteInPlace ../mysql-${version}/cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
62     substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
63   '';
65   nativeBuildInputs = [ pkg-config cmake git bison makeWrapper ] ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
67   buildInputs = [
68     boost
69     curl
70     libedit
71     libssh
72     lz4
73     openssl
74     protobuf
75     readline
76     zlib
77     zstd
78     libevent
79     icu
80     re2
81     ncurses
82     libfido2
83     cyrus_sasl
84     openldap
85     v8
86     python3
87   ] ++ pythonDeps ++ lib.optionals stdenv.isLinux [
88     numactl
89     libtirpc
90   ] ++ lib.optionals stdenv.isDarwin [ cctools CoreServices developer_cmds DarwinTools ];
92   preConfigure = ''
93     # Build MySQL
94     cmake -DWITH_BOOST=system -DWITH_SYSTEM_LIBS=ON -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
95       -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql-${version} -B ../mysql-${version}/build
97     cmake --build ../mysql-${version}/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
98   '';
100   cmakeFlags = [
101     "-DMYSQL_SOURCE_DIR=../mysql-${version}"
102     "-DMYSQL_BUILD_DIR=../mysql-${version}/build"
103     "-DMYSQL_CONFIG_EXECUTABLE=../../mysql-${version}/build/scripts/mysql_config"
104     "-DWITH_ZSTD=system"
105     "-DWITH_LZ4=system"
106     "-DWITH_ZLIB=system"
107     "-DWITH_PROTOBUF=${protobuf}"
108     "-DHAVE_V8=1"
109     "-DV8_INCLUDE_DIR=${v8}/include"
110     "-DV8_LIB_DIR=${v8}/lib"
111     "-DHAVE_PYTHON=1"
112   ];
114   CXXFLAGS = [ "-DV8_COMPRESS_POINTERS=1" "-DV8_31BIT_SMIS_ON_64BIT_ARCH=1" ];
116   postFixup = ''
117     wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${pythonPath}"
118   '';
120   meta = with lib; {
121     homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor version}/en/";
122     description = "A new command line scriptable shell for MySQL";
123     license = licenses.gpl2;
124     maintainers = with maintainers; [ aaronjheng ];
125     mainProgram = "mysqlsh";
126   };