lol
1{ lib, stdenv, fetchurl, bison, cmake, pkg-config
2, boost, icu, libedit, libevent, lz4, ncurses, openssl, protobuf, re2, readline, zlib, zstd
3, numactl, perl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools
4}:
5
6let
7self = stdenv.mkDerivation rec {
8 pname = "mysql";
9 version = "8.0.26";
10
11 src = fetchurl {
12 url = "https://dev.mysql.com/get/Downloads/MySQL-${self.mysqlVersion}/${pname}-${version}.tar.gz";
13 sha256 = "sha256-293Nx3L4BscRo3MTY6UPPTWeqsnF0UgAhHKKHCzl2k0=";
14 };
15
16 patches = [
17 ./abi-check.patch
18 ];
19
20 nativeBuildInputs = [ bison cmake pkg-config ]
21 ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
22
23 ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
24 postPatch = ''
25 substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
26 substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
27 '';
28
29 buildInputs = [
30 boost curl icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
31 zstd
32 ] ++ lib.optionals stdenv.isLinux [
33 numactl libtirpc
34 ] ++ lib.optionals stdenv.isDarwin [
35 cctools CoreServices developer_cmds DarwinTools
36 ];
37
38 outputs = [ "out" "static" ];
39
40 cmakeFlags = [
41 "-DCMAKE_SKIP_BUILD_RPATH=OFF" # To run libmysql/libmysql_api_test during build.
42 "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
43 "-DWITH_ROUTER=OFF" # It may be packaged separately.
44 "-DWITH_SYSTEM_LIBS=ON"
45 "-DWITH_UNIT_TESTS=OFF"
46 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
47 "-DMYSQL_DATADIR=/var/lib/mysql"
48 "-DINSTALL_INFODIR=share/mysql/docs"
49 "-DINSTALL_MANDIR=share/man"
50 "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
51 "-DINSTALL_INCLUDEDIR=include/mysql"
52 "-DINSTALL_DOCREADMEDIR=share/mysql"
53 "-DINSTALL_SUPPORTFILESDIR=share/mysql"
54 "-DINSTALL_MYSQLSHAREDIR=share/mysql"
55 "-DINSTALL_MYSQLTESTDIR="
56 "-DINSTALL_DOCDIR=share/mysql/docs"
57 "-DINSTALL_SHAREDIR=share/mysql"
58 ];
59
60 postInstall = ''
61 moveToOutput "lib/*.a" $static
62 so=${stdenv.hostPlatform.extensions.sharedLibrary}
63 ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
64 '';
65
66 passthru = {
67 client = self;
68 connector-c = self;
69 server = self;
70 mysqlVersion = "8.0";
71 };
72
73 meta = with lib; {
74 homepage = "https://www.mysql.com/";
75 description = "The world's most popular open source database";
76 license = licenses.gpl2;
77 maintainers = with maintainers; [ orivej ];
78 platforms = platforms.unix;
79 };
80}; in self