Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / sql / mysql / 8.0.x.nix
blob20bf870af5ea9a3db5da3bcacc8e6683db7c8b63
1 { lib, stdenv, fetchurl, bison, cmake, pkg-config
2 , boost, icu, libedit, libevent, lz4, ncurses, openssl, protobuf, re2, readline, zlib, zstd, libfido2
3 , numactl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools, nixosTests
4 }:
6 stdenv.mkDerivation (finalAttrs: {
7   pname = "mysql";
8   version = "8.0.38";
10   src = fetchurl {
11     url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
12     hash = "sha256-0qXCL4tWLX4PEdm441yYeaUWYDlCTBNCclN9Ao1yGRQ=";
13   };
15   nativeBuildInputs = [ bison cmake pkg-config ]
16     ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
18   patches = [
19     ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
20   ];
22   ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
23   postPatch = ''
24     substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
25     substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
26   '';
28   buildInputs = [
29     boost (curl.override { inherit openssl; }) icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
30     zstd libfido2
31   ] ++ lib.optionals stdenv.isLinux [
32     numactl libtirpc
33   ] ++ lib.optionals stdenv.isDarwin [
34     cctools CoreServices developer_cmds DarwinTools
35   ];
37   outputs = [ "out" "static" ];
39   cmakeFlags = [
40     "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
41     "-DWITH_ROUTER=OFF" # It may be packaged separately.
42     "-DWITH_SYSTEM_LIBS=ON"
43     "-DWITH_UNIT_TESTS=OFF"
44     "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
45     "-DMYSQL_DATADIR=/var/lib/mysql"
46     "-DINSTALL_INFODIR=share/mysql/docs"
47     "-DINSTALL_MANDIR=share/man"
48     "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
49     "-DINSTALL_INCLUDEDIR=include/mysql"
50     "-DINSTALL_DOCREADMEDIR=share/mysql"
51     "-DINSTALL_SUPPORTFILESDIR=share/mysql"
52     "-DINSTALL_MYSQLSHAREDIR=share/mysql"
53     "-DINSTALL_MYSQLTESTDIR="
54     "-DINSTALL_DOCDIR=share/mysql/docs"
55     "-DINSTALL_SHAREDIR=share/mysql"
56   ];
58   postInstall = ''
59     moveToOutput "lib/*.a" $static
60     so=${stdenv.hostPlatform.extensions.sharedLibrary}
61     ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
62   '';
64   passthru = {
65     client = finalAttrs.finalPackage;
66     connector-c = finalAttrs.finalPackage;
67     server = finalAttrs.finalPackage;
68     mysqlVersion = lib.versions.majorMinor finalAttrs.version;
69     tests = nixosTests.mysql.mysql80;
70   };
72   meta = with lib; {
73     homepage = "https://www.mysql.com/";
74     description = "World's most popular open source database";
75     license = licenses.gpl2Only;
76     maintainers = with maintainers; [ orivej ];
77     platforms = platforms.unix;
78   };