Skip to content

Commit

Permalink
percona-server_8_4: init at 8.4.0-1
Browse files Browse the repository at this point in the history
This is a new LTS release as well.
  • Loading branch information
osnyx committed Oct 13, 2024
1 parent 188b5df commit 712028e
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 127 deletions.
123 changes: 0 additions & 123 deletions pkgs/servers/sql/percona-server/8_3.nix

This file was deleted.

221 changes: 221 additions & 0 deletions pkgs/servers/sql/percona-server/8_4.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
lib,
stdenv,
fetchurl,
bison,
cmake,
pkg-config,
boost,
icu,
libedit,
libevent,
lz4,
ncurses,
openssl,
perl,
protobuf,
re2,
readline,
zlib,
zstd,
libfido2,
numactl,
cctools,
CoreServices,
developer_cmds,
libtirpc,
rpcsvc-proto,
curl,
DarwinTools,
nixosTests,
coreutils,
procps,
gnused,
gnugrep,
hostname,
makeWrapper,
systemd,
# Percona-specific deps
cyrus_sasl,
gnumake,
openldap,
# optional: different malloc implementations
withJemalloc ? false,
withTcmalloc ? false,
jemalloc,
gperftools,
}:

assert !(withJemalloc && withTcmalloc);

stdenv.mkDerivation (finalAttrs: {
pname = "percona-server";
version = "8.4.0-1";

src = fetchurl {
url = "https://downloads.percona.com/downloads/Percona-Server-${lib.versions.majorMinor finalAttrs.version}/Percona-Server-${finalAttrs.version}/source/tarball/percona-server-${finalAttrs.version}.tar.gz";
hash = "sha256-76PXXqTNBVsD7RX2vhp7RyESiFpJL0h0zG9ucNfy3uQ=";
};

nativeBuildInputs = [
bison
cmake
pkg-config
makeWrapper
# required for scripts/CMakeLists.txt
coreutils
gnugrep
procps
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ rpcsvc-proto ];

patches = [
./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
];

## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
postPatch = ''
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
# The rocksdb setup script is called with `env -i` and cannot find anything in PATH.
patchShebangs storage/rocksdb/get_rocksdb_files.sh
substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace mktemp ${coreutils}/bin/mktemp
substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "rm $MKFILE" "${coreutils}/bin/rm $MKFILE"
substituteInPlace storage/rocksdb/get_rocksdb_files.sh --replace "make --" "${gnumake}/bin/make --"
'';

buildInputs =
[
boost
(curl.override { inherit openssl; })
icu
libedit
libevent
lz4
ncurses
openssl
protobuf
re2
readline
zlib
zstd
libfido2
openldap
perl
cyrus_sasl
]
++ lib.optionals stdenv.hostPlatform.isLinux [
numactl
libtirpc
systemd
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
cctools
CoreServices
developer_cmds
DarwinTools
]
++ lib.optional (stdenv.hostPlatform.isLinux && withJemalloc) jemalloc
++ lib.optional (stdenv.hostPlatform.isLinux && withTcmalloc) gperftools;

outputs = [
"out"
"static"
];

cmakeFlags =
[
# Percona-specific flags.
"-DPORTABLE=1"
"-DWITH_LDAP=system"
"-DROCKSDB_DISABLE_AVX2=1"
"-DROCKSDB_DISABLE_MARCH_NATIVE=1"

# Flags taken from mysql package.
"-DFORCE_UNSUPPORTED_COMPILER=1" # To configure on Darwin.
"-DWITH_ROUTER=OFF" # It may be packaged separately.
"-DWITH_SYSTEM_LIBS=ON"
"-DWITH_UNIT_TESTS=OFF"
"-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DINSTALL_INFODIR=share/mysql/docs"
"-DINSTALL_MANDIR=share/man"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
"-DINSTALL_INCLUDEDIR=include/mysql"
"-DINSTALL_DOCREADMEDIR=share/mysql"
"-DINSTALL_SUPPORTFILESDIR=share/mysql"
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
"-DINSTALL_MYSQLTESTDIR="
"-DINSTALL_DOCDIR=share/mysql/docs"
"-DINSTALL_SHAREDIR=share/mysql"

]
++ lib.optionals stdenv.hostPlatform.isLinux [
"-DWITH_SYSTEMD=1"
"-DWITH_SYSTEMD_DEBUG=1"
]
++ lib.optional (stdenv.hostPlatform.isLinux && withJemalloc) "-DWITH_JEMALLOC=1"
++ lib.optional (stdenv.hostPlatform.isLinux && withTcmalloc) "-DWITH_TCMALLOC=1";

postInstall =
''
moveToOutput "lib/*.a" $static
so=${stdenv.hostPlatform.extensions.sharedLibrary}
ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
wrapProgram $out/bin/mysqld_safe --prefix PATH : ${
lib.makeBinPath [
coreutils
procps
gnugrep
gnused
hostname
]
}
wrapProgram $out/bin/mysql_config --prefix PATH : ${
lib.makeBinPath [
coreutils
gnused
]
}
wrapProgram $out/bin/ps_mysqld_helper --prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
]
}
wrapProgram $out/bin/ps-admin --prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
]
}
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
wrapProgram $out/bin/mysqld_multi --prefix PATH : ${
lib.makeBinPath [
coreutils
gnugrep
]
}
'';

passthru = {
client = finalAttrs.finalPackage;
connector-c = finalAttrs.finalPackage;
server = finalAttrs.finalPackage;
mysqlVersion = lib.versions.majorMinor finalAttrs.version;
tests = nixosTests.mysql.percona-server_innovation;
};

meta = with lib; {
homepage = "https://www.percona.com/software/mysql-database/percona-server";
description = ''
A free, fully compatible, enhanced, open source drop-in replacement for
MySQL® that provides superior performance, scalability and instrumentation.
Long-term support release.
'';
license = licenses.gpl2;
maintainers = teams.flyingcircus.members;
platforms = platforms.unix;
};
})
2 changes: 1 addition & 1 deletion pkgs/servers/sql/percona-server/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgs: {
# newer versions cause linking failures against `libabsl_spinlock_wait`
protobuf = pkgs.protobuf_21;
};
percona-server_8_3 = pkgs.callPackage ./8_3.nix {
percona-server_8_4 = pkgs.callPackage ./8_4.nix {
inherit (pkgs.darwin) developer_cmds DarwinTools;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;
# newer versions cause linking failures against `libabsl_spinlock_wait`
Expand Down
7 changes: 4 additions & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11089,9 +11089,10 @@ with pkgs;

perceptualdiff = callPackage ../tools/graphics/perceptualdiff { };

inherit (import ../servers/sql/percona-server pkgs) percona-server_8_0 percona-server_8_3;
percona-server_lts = percona-server_8_0;
percona-server_innovation = percona-server_8_3;
inherit (import ../servers/sql/percona-server pkgs) percona-server_8_0 percona-server_8_4;
percona-server_lts = percona-server_8_4;
# temporarily, latest LTS and Innovation release are equal
percona-server_innovation = percona-server_8_4;
percona-server = percona-server_lts;
inherit (import ../tools/backup/percona-xtrabackup pkgs) percona-xtrabackup_8_0 percona-xtrabackup_8_3;
percona-xtrabackup_lts = percona-xtrabackup_8_0;
Expand Down

0 comments on commit 712028e

Please sign in to comment.