Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / sql / percona-server / lts.nix
blob4531a2db7b7ad454591f5689647d53982a35df9d
1 { lib, stdenv, fetchurl, bison, cmake, pkg-config
2 , boost, icu, libedit, libevent, lz4, ncurses, openssl, perl, protobuf, re2, readline, zlib, zstd, libfido2
3 , numactl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto, curl, DarwinTools, nixosTests
4 # Percona-specific deps
5 , coreutils, cyrus_sasl, gnumake, openldap
6 }:
8 stdenv.mkDerivation (finalAttrs: {
9   pname = "percona-server_lts";
10   version = "8.0.36-28";
12   src = fetchurl {
13     url = "https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-${finalAttrs.version}/source/tarball/percona-server-${finalAttrs.version}.tar.gz";
14     hash = "sha256-iktEvZz3mjjmJ16PX51OjSwwiFS3H9W/XRco//Q6aEQ=";
15   };
17   nativeBuildInputs = [ bison cmake pkg-config ]
18     ++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
20   patches = [
21     ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
22   ];
24   ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
25   postPatch = ''
26     substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
27     substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
28     # The rocksdb setup script is called with `env -i` and cannot find anything in PATH.
29     patchShebangs storage/rocksdb/get_rocksdb_files.sh
30     substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace mktemp ${coreutils}/bin/mktemp
31     substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "rm $MKFILE" "${coreutils}/bin/rm $MKFILE"
32     substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "make --" "${gnumake}/bin/make --"
33   '';
35   buildInputs = [
36     boost (curl.override { inherit openssl; }) icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
37     zstd libfido2 openldap perl cyrus_sasl
38   ] ++ lib.optionals stdenv.isLinux [
39     numactl libtirpc
40   ] ++ lib.optionals stdenv.isDarwin [
41     cctools CoreServices developer_cmds DarwinTools
42   ];
44   outputs = [ "out" "static" ];
46   cmakeFlags = [
47     # Percona-specific flags.
48     "-DPORTABLE=1"
49     "-DWITH_LDAP=system"
50     "-DROCKSDB_DISABLE_AVX2=1"
51     "-DROCKSDB_DISABLE_MARCH_NATIVE=1"
53     # Flags taken from mysql package.
54     "-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
55     "-DWITH_ROUTER=OFF" # It may be packaged separately.
56     "-DWITH_SYSTEM_LIBS=ON"
57     "-DWITH_UNIT_TESTS=OFF"
58     "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
59     "-DMYSQL_DATADIR=/var/lib/mysql"
60     "-DINSTALL_INFODIR=share/mysql/docs"
61     "-DINSTALL_MANDIR=share/man"
62     "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
63     "-DINSTALL_INCLUDEDIR=include/mysql"
64     "-DINSTALL_DOCREADMEDIR=share/mysql"
65     "-DINSTALL_SUPPORTFILESDIR=share/mysql"
66     "-DINSTALL_MYSQLSHAREDIR=share/mysql"
67     "-DINSTALL_MYSQLTESTDIR="
68     "-DINSTALL_DOCDIR=share/mysql/docs"
69     "-DINSTALL_SHAREDIR=share/mysql"
70   ];
72   postInstall = ''
73     moveToOutput "lib/*.a" $static
74     so=${stdenv.hostPlatform.extensions.sharedLibrary}
75     ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
76   '';
78   passthru = {
79     client = finalAttrs.finalPackage;
80     connector-c = finalAttrs.finalPackage;
81     server = finalAttrs.finalPackage;
82     mysqlVersion = lib.versions.majorMinor finalAttrs.version;
83     tests = nixosTests.mysql.percona-server_lts;
84   };
86   meta = with lib; {
87     homepage = "https://www.percona.com/software/mysql-database/percona-server";
88     description = ''
89       A free, fully compatible, enhanced, open source drop-in replacement for
90       MySQL® that provides superior performance, scalability and instrumentation.
91     '';
92     license = licenses.gpl2Plus;
93     maintainers = teams.flyingcircus.members;
94     platforms = platforms.unix;
95   };