pdfstudio: fix hash mismatch (#360194)
[NixPkgs.git] / pkgs / development / tools / mysql-shell / innovation.nix
blob75bd98d9681a09ad90fd5c0d9911a3f37ced3d33
2   lib,
3   stdenv,
4   pkg-config,
5   cmake,
6   fetchurl,
7   git,
8   cctools,
9   darwin,
10   makeWrapper,
11   bison,
12   openssl,
13   protobuf,
14   curl,
15   zlib,
16   libssh,
17   zstd,
18   lz4,
19   readline,
20   libtirpc,
21   rpcsvc-proto,
22   libedit,
23   libevent,
24   icu,
25   re2,
26   ncurses,
27   libfido2,
28   python3,
29   cyrus_sasl,
30   openldap,
31   antlr,
34 let
35   pythonDeps = with python3.pkgs; [
36     certifi
37     paramiko
38     pyyaml
39   ];
41   mysqlShellVersion = "9.1.0";
42   mysqlServerVersion = "9.1.0";
44 stdenv.mkDerivation (finalAttrs: {
45   pname = "mysql-shell-innovation";
46   version = mysqlShellVersion;
48   srcs = [
49     (fetchurl {
50       url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor mysqlServerVersion}/mysql-${mysqlServerVersion}.tar.gz";
51       hash = "sha256-UsNnUjm/2dPIMiT/IAKqbihvq5e/WytcoahcnDR3Zvw=";
52     })
53     (fetchurl {
54       url = "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-${finalAttrs.version}-src.tar.gz";
55       hash = "sha256-YHlM/heqV8vQnIGxwEESXx+wRVr++TFjSb00tPwBb2s=";
56     })
57   ];
59   sourceRoot = "mysql-shell-${finalAttrs.version}-src";
61   postUnpack = ''
62     mv mysql-${mysqlServerVersion} mysql
63   '';
65   patches = [
66     # No openssl bundling on macOS. It's not working.
67     # See https://github.com/mysql/mysql-shell/blob/5b84e0be59fc0e027ef3f4920df15f7be97624c1/cmake/ssl.cmake#L53
68     ./no-openssl-bundling.patch
69   ];
71   postPatch = ''
72     substituteInPlace ../mysql/cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
73     substituteInPlace ../mysql/cmake/os/Darwin.cmake --replace-fail /usr/bin/libtool libtool
75     substituteInPlace cmake/libutils.cmake --replace-fail /usr/bin/libtool libtool
76   '';
78   nativeBuildInputs =
79     [
80       pkg-config
81       cmake
82       git
83       bison
84       makeWrapper
85     ]
86     ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ]
87     ++ lib.optionals stdenv.hostPlatform.isDarwin [
88       cctools
89       darwin.DarwinTools
90     ];
92   buildInputs =
93     [
94       curl
95       libedit
96       libssh
97       lz4
98       openssl
99       protobuf
100       readline
101       zlib
102       zstd
103       libevent
104       icu
105       re2
106       ncurses
107       libfido2
108       cyrus_sasl
109       openldap
110       python3
111       antlr.runtime.cpp
112     ]
113     ++ pythonDeps
114     ++ lib.optionals stdenv.hostPlatform.isLinux [ libtirpc ]
115     ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.libutil ];
117   preConfigure = ''
118     # Build MySQL
119     echo "Building mysqlclient mysqlxclient"
121     cmake -DWITH_SYSTEM_LIBS=ON -DWITH_FIDO=system -DWITH_ROUTER=OFF -DWITH_UNIT_TESTS=OFF \
122       -DFORCE_UNSUPPORTED_COMPILER=1 -S ../mysql -B ../mysql/build
124     cmake --build ../mysql/build --parallel ''${NIX_BUILD_CORES:-1} --target mysqlclient mysqlxclient
126     cmakeFlagsArray+=(
127       "-DMYSQL_SOURCE_DIR=''${NIX_BUILD_TOP}/mysql"
128       "-DMYSQL_BUILD_DIR=''${NIX_BUILD_TOP}/mysql/build"
129       "-DMYSQL_CONFIG_EXECUTABLE=''${NIX_BUILD_TOP}/mysql/build/scripts/mysql_config"
130       "-DWITH_ZSTD=system"
131       "-DWITH_LZ4=system"
132       "-DWITH_ZLIB=system"
133       "-DWITH_PROTOBUF=system"
134       "-DHAVE_PYTHON=1"
135     )
136   '';
138   postFixup = ''
139     wrapProgram $out/bin/mysqlsh --set PYTHONPATH "${lib.makeSearchPath python3.sitePackages pythonDeps}"
140   '';
142   meta = with lib; {
143     homepage = "https://dev.mysql.com/doc/mysql-shell/${lib.versions.majorMinor finalAttrs.version}/en/";
144     description = "New command line scriptable shell for MySQL";
145     license = licenses.gpl2;
146     maintainers = with maintainers; [ aaronjheng ];
147     mainProgram = "mysqlsh";
148   };