diff options
author | Shyim <s.sayakci@shopware.com> | 2024-05-12 19:51:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-12 17:51:57 +0000 |
commit | 9aed588e4f68378352d9dc949d0a03f32905e4ef (patch) | |
tree | ac96f95e5e115066ad548210e34be848733dbf5d | |
parent | 27713bdb9acec3f297726f0e179c5ef96fc4b665 (diff) |
mysql84: init at 8.4.0 (#309374)
-rw-r--r-- | pkgs/by-name/my/mysql84/no-force-outline-atomics.patch | 24 | ||||
-rw-r--r-- | pkgs/by-name/my/mysql84/package.nix | 78 |
2 files changed, 102 insertions, 0 deletions
diff --git a/pkgs/by-name/my/mysql84/no-force-outline-atomics.patch b/pkgs/by-name/my/mysql84/no-force-outline-atomics.patch new file mode 100644 index 0000000000000..a716a4f7f481d --- /dev/null +++ b/pkgs/by-name/my/mysql84/no-force-outline-atomics.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 727d66011f9..acae1aada57 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1338,19 +1338,6 @@ IF(UNIX AND MY_COMPILER_IS_GNU_OR_CLANG + ENDIF() + ENDIF() + +-# For aarch64 some sub-architectures support LSE atomics and some don't. Thus, +-# compiling for the common denominator (-march=armv8-a) means LSE is not used. +-# The -moutline-atomics switch enables run-time detection of LSE support. +-# There are compilers (gcc 9.3.1 for example) which support this switch, but +-# do not enable it by default, even though it seems to help. So, we force it. +-IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") +- MY_CHECK_CXX_COMPILER_FLAG( "-moutline-atomics" HAVE_OUTLINE_ATOMICS) +- IF(HAVE_OUTLINE_ATOMICS) +- STRING_APPEND(CMAKE_C_FLAGS " -moutline-atomics") +- STRING_APPEND(CMAKE_CXX_FLAGS " -moutline-atomics") +- ENDIF() +-ENDIF() +- + IF(LINUX) + OPTION(LINK_RANDOMIZE "Randomize the order of all symbols in the binary" OFF) + SET(LINK_RANDOMIZE_SEED "mysql" diff --git a/pkgs/by-name/my/mysql84/package.nix b/pkgs/by-name/my/mysql84/package.nix new file mode 100644 index 0000000000000..d7081f6141414 --- /dev/null +++ b/pkgs/by-name/my/mysql84/package.nix @@ -0,0 +1,78 @@ +{ lib, stdenv, fetchurl, bison, cmake, pkg-config +, icu, libedit, libevent, lz4, ncurses, openssl, protobuf_21, re2, readline, zlib, zstd, libfido2 +, darwin, numactl, libtirpc, rpcsvc-proto, curl +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "mysql"; + version = "8.4.0"; + + src = fetchurl { + url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz"; + hash = "sha256-R6VDP83WOduDa5nhtUWcK4E8va0j/ytd1K0n95K6kY4="; + }; + + nativeBuildInputs = [ bison cmake pkg-config ] + ++ lib.optionals (!stdenv.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 + ''; + + buildInputs = [ + (curl.override { inherit openssl; }) icu libedit libevent lz4 ncurses openssl protobuf_21 re2 readline zlib + zstd libfido2 + ] ++ lib.optionals stdenv.isLinux [ + numactl libtirpc + ] ++ lib.optionals stdenv.isDarwin [ + darwin.cctools darwin.apple_sdk.frameworks.CoreServices darwin.developer_cmds darwin.DarwinTools + ]; + + outputs = [ "out" "static" ]; + + cmakeFlags = [ + "-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 = finalAttrs.finalPackage; + connector-c = finalAttrs.finalPackage; + server = finalAttrs.finalPackage; + mysqlVersion = lib.versions.majorMinor finalAttrs.version; + }; + + meta = with lib; { + homepage = "https://www.mysql.com/"; + description = "The world's most popular open source database"; + license = licenses.gpl2; + maintainers = with maintainers; [ orivej shyim ]; + platforms = platforms.unix; + }; +}) |