2021-01-19 06:50:56 +00:00
|
|
|
{ lib, stdenv, fetchurl, bison, cmake, pkg-config
|
2020-07-17 17:45:39 +01:00
|
|
|
, boost, icu, libedit, libevent, lz4, ncurses, openssl, protobuf, re2, readline, zlib, zstd
|
2020-08-11 12:12:58 +01:00
|
|
|
, numactl, perl, cctools, CoreServices, developer_cmds, libtirpc, rpcsvc-proto
|
2019-08-13 20:50:52 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
self = stdenv.mkDerivation rec {
|
2019-11-28 19:21:05 +00:00
|
|
|
pname = "mysql";
|
2021-01-11 06:49:18 +00:00
|
|
|
version = "8.0.22";
|
2019-08-13 20:50:52 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-11-28 19:21:05 +00:00
|
|
|
url = "https://dev.mysql.com/get/Downloads/MySQL-${self.mysqlVersion}/${pname}-${version}.tar.gz";
|
2021-01-11 06:49:18 +00:00
|
|
|
sha256 = "9fd85bb243940ef8234d21384ef421a0962fd4d13406fc1420efa902115ce17a";
|
2019-08-13 20:50:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./abi-check.patch
|
|
|
|
];
|
|
|
|
|
2021-04-11 12:50:09 +01:00
|
|
|
nativeBuildInputs = [ bison cmake pkg-config ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ rpcsvc-proto ];
|
2019-08-13 20:50:52 +01:00
|
|
|
|
2021-01-11 07:51:29 +00:00
|
|
|
## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
|
2020-07-17 17:45:39 +01:00
|
|
|
postPatch = ''
|
2021-01-11 07:51:29 +00:00
|
|
|
substituteInPlace cmake/libutils.cmake --replace /usr/bin/libtool libtool
|
|
|
|
substituteInPlace cmake/os/Darwin.cmake --replace /usr/bin/libtool libtool
|
2020-07-17 17:45:39 +01:00
|
|
|
'';
|
|
|
|
|
2019-08-13 20:50:52 +01:00
|
|
|
buildInputs = [
|
|
|
|
boost icu libedit libevent lz4 ncurses openssl protobuf re2 readline zlib
|
2020-07-17 17:45:39 +01:00
|
|
|
zstd
|
2019-08-13 20:50:52 +01:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-08-11 12:12:58 +01:00
|
|
|
numactl libtirpc
|
2019-08-13 20:50:52 +01:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
cctools CoreServices developer_cmds
|
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [ "out" "static" ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=OFF" # To run libmysql/libmysql_api_test during build.
|
|
|
|
"-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"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
moveToOutput "lib/*.a" $static
|
|
|
|
so=${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
ln -s libmysqlclient$so $out/lib/libmysqlclient_r$so
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
client = self;
|
|
|
|
connector-c = self;
|
|
|
|
server = self;
|
|
|
|
mysqlVersion = "8.0";
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.mysql.com/";
|
|
|
|
description = "The world's most popular open source database";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ orivej ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}; in self
|