Github messages for voidlinux
 help / color / Atom feed
* [PR PATCH] New package: mysql8-8.0.21
@ 2020-07-17 15:40 rien
  2020-07-17 17:32 ` rien
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: rien @ 2020-07-17 15:40 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 4737 bytes --]

There is a new pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Currently failing with the following error:
```
/builddir/mysql-8.0.21/sql/mysqld.cc: In function 'void init_ssl()':
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:38: error: invalid conversion from 'void* (*)(size_t, const char*, int)' {aka 'void* (*)(long unsigned int, const char*, int)'} to 'void* (*)(size_t)' {aka 'void* (*)(long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                      ^~~~~~~~~~~~~~~~~
      |                                      |
      |                                      void* (*)(size_t, const char*, int) {aka void* (*)(long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:38: note:   initializing argument 1 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                              ~~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:57: error: invalid conversion from 'void* (*)(void*, size_t, const char*, int)' {aka 'void* (*)(void*, long unsigned int, const char*, int)'} to 'void* (*)(void*, size_t)' {aka 'void* (*)(void*, long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                                         ^~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         void* (*)(void*, size_t, const char*, int) {aka void* (*)(void*, long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5137:38: error: invalid conversion from 'void (*)(void*, const char*, int)' to 'void (*)(void*)' [-fpermissive]
 5137 |                                      my_openssl_free);
      |                                      ^~~~~~~~~~~~~~~
      |                                      |
      |                                      void (*)(void*, const char*, int)
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
make[2]: *** [sql/CMakeFiles/sql_main.dir/build.make:1306: sql/CMakeFiles/sql_main.dir/mysqld.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:10084: sql/CMakeFiles/sql_main.dir/all] Error 2
make: *** [Makefile:183: all] Error 2
```

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 17814 bytes --]

From 17025cc09b63fcdf881d427ab62292e07c10bff3 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 ++
 srcpkgs/mysql8/files/my.cnf                   | 145 ++++++++++++++++++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 srcpkgs/mysql8/patches/00-no-fips-mode.patch  | 109 +++++++++++++
 .../patches/01-no_bio_set_callback_ex.patch   |  11 ++
 srcpkgs/mysql8/template                       | 132 ++++++++++++++++
 srcpkgs/mysql8/update                         |   2 +
 11 files changed, 417 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/00-no-fips-mode.patch
 create mode 100644 srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..4ce513cca4a
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	usr/bin/mysql_install_db --user=mysql --keep-my-cnf --basedir=/usr --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..3870208583f
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,145 @@
+# MySQL config file for medium systems.
+#
+# This is for a system with little memory (32M - 64M) where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+[client]
+#password	= your_password
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+key_buffer_size = 16M
+max_allowed_packet = 1M
+table_open_cache = 64
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+log-bin=mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=mixed
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+#    the syntax is:
+#
+#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+#    where you replace <host>, <user>, <password> by quoted strings and
+#    <port> by the master's port number (3306 by default).
+#
+#    Example:
+#
+#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+#    MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+#    start replication for the first time (even unsuccessfully, for example
+#    if you mistyped the password in master-password and the slave fails to
+#    connect), the slave will create a master.info file, and any later
+#    change in this file to the variables' values below will be ignored and
+#    overridden by the content of the master.info file, unless you shutdown
+#    the slave server, delete master.info and restart the slaver server.
+#    For that reason, you may want to leave the lines below untouched
+#    (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id       = 2
+#
+# The replication master for this slave - required
+#master-host     =   <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user     =   <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password =   <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port     =  <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+#innodb_data_home_dir = /var/lib/mysql
+#innodb_data_file_path = ibdata1:10M:autoextend
+#innodb_log_group_home_dir = /var/lib/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 16M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+#innodb_log_file_size = 5M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 2M
+write_buffer = 2M
+
+[mysqlhotcopy]
+interactive-timeout
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/00-no-fips-mode.patch b/srcpkgs/mysql8/patches/00-no-fips-mode.patch
new file mode 100644
index 00000000000..e3328a505f0
--- /dev/null
+++ b/srcpkgs/mysql8/patches/00-no-fips-mode.patch
@@ -0,0 +1,109 @@
+diff --git a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce1..7c1a0e36 100644
+--- a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -327,26 +327,7 @@ error:
+ 
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, sizeof(err_string) - 1);
+-    err_string[sizeof(err_string) - 1] = '\0';
+-    G_ERROR("openssl fips mode set failed: %s", err_string);
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+diff --git a/plugin/x/client/xconnection_impl.cc b/plugin/x/client/xconnection_impl.cc
+index 13bc6794..164f65e8 100644
+--- a/plugin/x/client/xconnection_impl.cc
++++ b/plugin/x/client/xconnection_impl.cc
+@@ -518,24 +518,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+ */
+ int set_fips_mode(const uint32_t fips_mode,
+                   char err_string[OPENSSL_ERROR_LENGTH]) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1);
+-    err_string[OPENSSL_ERROR_LENGTH - 1] = '\0';
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ XError Connection_impl::activate_tls() {
+diff --git a/vio/viosslfactories.cc b/vio/viosslfactories.cc
+index 6c04029c..9f777af5 100644
+--- a/vio/viosslfactories.cc
++++ b/vio/viosslfactories.cc
+@@ -492,32 +492,7 @@ void ssl_start() {
+     @retval 1 Success
+ */
+ int set_fips_mode(const uint fips_mode, char err_string[OPENSSL_ERROR_LENGTH]) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    /*
+-      If OS doesn't have FIPS enabled openssl library and user sets FIPS mode
+-      ON, It fails with proper error. But in the same time it doesn't allow to
+-      perform any cryptographic operation. Now if FIPS mode set fails with
+-      error, setting old working FIPS mode value in the OpenSSL library. It will
+-      allow successful cryptographic operation and will not abort the server.
+-    */
+-    FIPS_mode_set(fips_mode_old);
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1);
+-    err_string[OPENSSL_ERROR_LENGTH - 1] = '\0';
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ /**
+@@ -525,7 +500,7 @@ EXIT:
+ 
+   @returns openssl current fips mode
+ */
+-uint get_fips_mode() { return FIPS_mode(); }
++uint get_fips_mode() { return 0; }
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
diff --git a/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
new file mode 100644
index 00000000000..eb69db28907
--- /dev/null
+++ b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
@@ -0,0 +1,11 @@
+--- vio/viossl.cc	2020-07-17 16:19:42.848476566 +0200
++++ vio/viossl.cc	2020-07-17 16:19:21.385102033 +0200
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if false // libressl doesn't have BIO_set_callback_ex
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..e33f9f44a35
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,132 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql
+ -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8
+ -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON
+ -DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man
+ -DINSTALL_PLUGINDIR=lib/mysql/plugin -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_DOCREADMEDIR=share/mysql
+ -DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql
+ -DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql
+ -DWITH_ZLIB=system -DWITH_SSL=system -DWITH_LIBWRAP=OFF
+ -DWITH_EXTRA_CHARSETS=complex -DWITH_EMBEDDED_SERVER=ON
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
+ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+ -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+ -DSTACK_DIRECTION=1 -DHAVE_LLVM_LIBCPP_EXITCODE=0"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libressl-devel readline-devel boost-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
@ 2020-07-17 17:32 ` rien
  2020-07-17 17:40 ` rien
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-17 17:32 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

New comment by rien on void-packages repository

https://github.com/void-linux/void-packages/pull/23617#issuecomment-660244088

Comment:
@Vaelatern in 48c311e12c28d7fc13e5efc7073fc312c4815e4b (4 years ago...) you noticed the change in signature of `CRYPTO_set_mem_functions`. Do you have any idea how to solve this in this case? Is there some dummy value I can pass?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
  2020-07-17 17:32 ` rien
@ 2020-07-17 17:40 ` rien
  2020-07-17 17:45 ` [PR PATCH] [Updated] " rien
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-17 17:40 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

New comment by rien on void-packages repository

https://github.com/void-linux/void-packages/pull/23617#issuecomment-660247945

Comment:
Nevermind, I've found the Gentoo patchset which looks promising.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
  2020-07-17 17:32 ` rien
  2020-07-17 17:40 ` rien
@ 2020-07-17 17:45 ` rien
  2020-07-28  9:16 ` rien
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-17 17:45 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 4742 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Currently failing with the following error:
```
/builddir/mysql-8.0.21/sql/mysqld.cc: In function 'void init_ssl()':
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:38: error: invalid conversion from 'void* (*)(size_t, const char*, int)' {aka 'void* (*)(long unsigned int, const char*, int)'} to 'void* (*)(size_t)' {aka 'void* (*)(long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                      ^~~~~~~~~~~~~~~~~
      |                                      |
      |                                      void* (*)(size_t, const char*, int) {aka void* (*)(long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:38: note:   initializing argument 1 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                              ~~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:57: error: invalid conversion from 'void* (*)(void*, size_t, const char*, int)' {aka 'void* (*)(void*, long unsigned int, const char*, int)'} to 'void* (*)(void*, size_t)' {aka 'void* (*)(void*, long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                                         ^~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         void* (*)(void*, size_t, const char*, int) {aka void* (*)(void*, long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5137:38: error: invalid conversion from 'void (*)(void*, const char*, int)' to 'void (*)(void*)' [-fpermissive]
 5137 |                                      my_openssl_free);
      |                                      ^~~~~~~~~~~~~~~
      |                                      |
      |                                      void (*)(void*, const char*, int)
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
make[2]: *** [sql/CMakeFiles/sql_main.dir/build.make:1306: sql/CMakeFiles/sql_main.dir/mysqld.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:10084: sql/CMakeFiles/sql_main.dir/all] Error 2
make: *** [Makefile:183: all] Error 2
```

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 17814 bytes --]

From 17025cc09b63fcdf881d427ab62292e07c10bff3 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 ++
 srcpkgs/mysql8/files/my.cnf                   | 145 ++++++++++++++++++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 srcpkgs/mysql8/patches/00-no-fips-mode.patch  | 109 +++++++++++++
 .../patches/01-no_bio_set_callback_ex.patch   |  11 ++
 srcpkgs/mysql8/template                       | 132 ++++++++++++++++
 srcpkgs/mysql8/update                         |   2 +
 11 files changed, 417 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/00-no-fips-mode.patch
 create mode 100644 srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..4ce513cca4a
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	usr/bin/mysql_install_db --user=mysql --keep-my-cnf --basedir=/usr --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..3870208583f
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,145 @@
+# MySQL config file for medium systems.
+#
+# This is for a system with little memory (32M - 64M) where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+[client]
+#password	= your_password
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+key_buffer_size = 16M
+max_allowed_packet = 1M
+table_open_cache = 64
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+log-bin=mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=mixed
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+#    the syntax is:
+#
+#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+#    where you replace <host>, <user>, <password> by quoted strings and
+#    <port> by the master's port number (3306 by default).
+#
+#    Example:
+#
+#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+#    MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+#    start replication for the first time (even unsuccessfully, for example
+#    if you mistyped the password in master-password and the slave fails to
+#    connect), the slave will create a master.info file, and any later
+#    change in this file to the variables' values below will be ignored and
+#    overridden by the content of the master.info file, unless you shutdown
+#    the slave server, delete master.info and restart the slaver server.
+#    For that reason, you may want to leave the lines below untouched
+#    (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id       = 2
+#
+# The replication master for this slave - required
+#master-host     =   <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user     =   <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password =   <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port     =  <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+#innodb_data_home_dir = /var/lib/mysql
+#innodb_data_file_path = ibdata1:10M:autoextend
+#innodb_log_group_home_dir = /var/lib/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 16M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+#innodb_log_file_size = 5M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 2M
+write_buffer = 2M
+
+[mysqlhotcopy]
+interactive-timeout
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/00-no-fips-mode.patch b/srcpkgs/mysql8/patches/00-no-fips-mode.patch
new file mode 100644
index 00000000000..e3328a505f0
--- /dev/null
+++ b/srcpkgs/mysql8/patches/00-no-fips-mode.patch
@@ -0,0 +1,109 @@
+diff --git a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce1..7c1a0e36 100644
+--- a/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ b/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -327,26 +327,7 @@ error:
+ 
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, sizeof(err_string) - 1);
+-    err_string[sizeof(err_string) - 1] = '\0';
+-    G_ERROR("openssl fips mode set failed: %s", err_string);
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+diff --git a/plugin/x/client/xconnection_impl.cc b/plugin/x/client/xconnection_impl.cc
+index 13bc6794..164f65e8 100644
+--- a/plugin/x/client/xconnection_impl.cc
++++ b/plugin/x/client/xconnection_impl.cc
+@@ -518,24 +518,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+ */
+ int set_fips_mode(const uint32_t fips_mode,
+                   char err_string[OPENSSL_ERROR_LENGTH]) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1);
+-    err_string[OPENSSL_ERROR_LENGTH - 1] = '\0';
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ XError Connection_impl::activate_tls() {
+diff --git a/vio/viosslfactories.cc b/vio/viosslfactories.cc
+index 6c04029c..9f777af5 100644
+--- a/vio/viosslfactories.cc
++++ b/vio/viosslfactories.cc
+@@ -492,32 +492,7 @@ void ssl_start() {
+     @retval 1 Success
+ */
+ int set_fips_mode(const uint fips_mode, char err_string[OPENSSL_ERROR_LENGTH]) {
+-  int rc = -1;
+-  unsigned int fips_mode_old = -1;
+-  unsigned long err_library = 0;
+-  if (fips_mode > 2) {
+-    goto EXIT;
+-  }
+-  fips_mode_old = FIPS_mode();
+-  if (fips_mode_old == fips_mode) {
+-    rc = 1;
+-    goto EXIT;
+-  }
+-  if (!(rc = FIPS_mode_set(fips_mode))) {
+-    /*
+-      If OS doesn't have FIPS enabled openssl library and user sets FIPS mode
+-      ON, It fails with proper error. But in the same time it doesn't allow to
+-      perform any cryptographic operation. Now if FIPS mode set fails with
+-      error, setting old working FIPS mode value in the OpenSSL library. It will
+-      allow successful cryptographic operation and will not abort the server.
+-    */
+-    FIPS_mode_set(fips_mode_old);
+-    err_library = ERR_get_error();
+-    ERR_error_string_n(err_library, err_string, OPENSSL_ERROR_LENGTH - 1);
+-    err_string[OPENSSL_ERROR_LENGTH - 1] = '\0';
+-  }
+-EXIT:
+-  return rc;
++  return 1;
+ }
+ 
+ /**
+@@ -525,7 +500,7 @@ EXIT:
+ 
+   @returns openssl current fips mode
+ */
+-uint get_fips_mode() { return FIPS_mode(); }
++uint get_fips_mode() { return 0; }
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
diff --git a/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
new file mode 100644
index 00000000000..eb69db28907
--- /dev/null
+++ b/srcpkgs/mysql8/patches/01-no_bio_set_callback_ex.patch
@@ -0,0 +1,11 @@
+--- vio/viossl.cc	2020-07-17 16:19:42.848476566 +0200
++++ vio/viossl.cc	2020-07-17 16:19:21.385102033 +0200
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if false // libressl doesn't have BIO_set_callback_ex
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..e33f9f44a35
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,132 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql
+ -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8
+ -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON
+ -DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man
+ -DINSTALL_PLUGINDIR=lib/mysql/plugin -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_DOCREADMEDIR=share/mysql
+ -DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql
+ -DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql
+ -DWITH_ZLIB=system -DWITH_SSL=system -DWITH_LIBWRAP=OFF
+ -DWITH_EXTRA_CHARSETS=complex -DWITH_EMBEDDED_SERVER=ON
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
+ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+ -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+ -DSTACK_DIRECTION=1 -DHAVE_LLVM_LIBCPP_EXITCODE=0"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libressl-devel readline-devel boost-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (2 preceding siblings ...)
  2020-07-17 17:45 ` [PR PATCH] [Updated] " rien
@ 2020-07-28  9:16 ` rien
  2020-07-28  9:16 ` rien
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28  9:16 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 4742 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Currently failing with the following error:
```
/builddir/mysql-8.0.21/sql/mysqld.cc: In function 'void init_ssl()':
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:38: error: invalid conversion from 'void* (*)(size_t, const char*, int)' {aka 'void* (*)(long unsigned int, const char*, int)'} to 'void* (*)(size_t)' {aka 'void* (*)(long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                      ^~~~~~~~~~~~~~~~~
      |                                      |
      |                                      void* (*)(size_t, const char*, int) {aka void* (*)(long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:38: note:   initializing argument 1 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                              ~~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5136:57: error: invalid conversion from 'void* (*)(void*, size_t, const char*, int)' {aka 'void* (*)(void*, long unsigned int, const char*, int)'} to 'void* (*)(void*, size_t)' {aka 'void* (*)(void*, long unsigned int)'} [-fpermissive]
 5136 |   int ret = CRYPTO_set_mem_functions(my_openssl_malloc, my_openssl_realloc,
      |                                                         ^~~~~~~~~~~~~~~~~~
      |                                                         |
      |                                                         void* (*)(void*, size_t, const char*, int) {aka void* (*)(void*, long unsigned int, const char*, int)}
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
/builddir/mysql-8.0.21/sql/mysqld.cc:5137:38: error: invalid conversion from 'void (*)(void*, const char*, int)' to 'void (*)(void*)' [-fpermissive]
 5137 |                                      my_openssl_free);
      |                                      ^~~~~~~~~~~~~~~
      |                                      |
      |                                      void (*)(void*, const char*, int)
In file included from /usr/include/openssl/bio.h:69,
                 from /usr/include/openssl/evp.h:67,
                 from /builddir/mysql-8.0.21/sql/stream_cipher.h:26,
                 from /builddir/mysql-8.0.21/include/my_sys.h:68,
                 from /builddir/mysql-8.0.21/include/my_getopt.h:39,
                 from /builddir/mysql-8.0.21/sql/mysqld.h:41,
                 from /builddir/mysql-8.0.21/sql/mysqld.cc:776:
/usr/include/openssl/crypto.h:417:85: note:   initializing argument 3 of 'int CRYPTO_set_mem_functions(void* (*)(size_t), void* (*)(void*, size_t), void (*)(void*))'
  417 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
      |                                                                              ~~~~~~~^~~~~~~~~~
make[2]: *** [sql/CMakeFiles/sql_main.dir/build.make:1306: sql/CMakeFiles/sql_main.dir/mysqld.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:10084: sql/CMakeFiles/sql_main.dir/all] Error 2
make: *** [Makefile:183: all] Error 2
```

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 32509 bytes --]

From 02154877cdb43e56fb1bfb4240ce3f8767aafde8 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   | 145 +++++++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 132 +++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 775 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..4ce513cca4a
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	usr/bin/mysql_install_db --user=mysql --keep-my-cnf --basedir=/usr --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..3870208583f
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,145 @@
+# MySQL config file for medium systems.
+#
+# This is for a system with little memory (32M - 64M) where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# MySQL programs look for option files in a set of
+# locations which depend on the deployment platform.
+# You can copy this option file to one of those
+# locations. For information about these locations, see:
+# http://dev.mysql.com/doc/mysql/en/option-files.html
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+[client]
+#password	= your_password
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+key_buffer_size = 16M
+max_allowed_packet = 1M
+table_open_cache = 64
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+log-bin=mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=mixed
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+#    the syntax is:
+#
+#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+#    where you replace <host>, <user>, <password> by quoted strings and
+#    <port> by the master's port number (3306 by default).
+#
+#    Example:
+#
+#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+#    MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+#    start replication for the first time (even unsuccessfully, for example
+#    if you mistyped the password in master-password and the slave fails to
+#    connect), the slave will create a master.info file, and any later
+#    change in this file to the variables' values below will be ignored and
+#    overridden by the content of the master.info file, unless you shutdown
+#    the slave server, delete master.info and restart the slaver server.
+#    For that reason, you may want to leave the lines below untouched
+#    (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id       = 2
+#
+# The replication master for this slave - required
+#master-host     =   <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user     =   <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password =   <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port     =  <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+#innodb_data_home_dir = /var/lib/mysql
+#innodb_data_file_path = ibdata1:10M:autoextend
+#innodb_log_group_home_dir = /var/lib/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 16M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+#innodb_log_file_size = 5M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 2M
+write_buffer = 2M
+
+[mysqlhotcopy]
+interactive-timeout
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..e33f9f44a35
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,132 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql
+ -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8
+ -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON
+ -DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man
+ -DINSTALL_PLUGINDIR=lib/mysql/plugin -DINSTALL_SCRIPTDIR=bin
+ -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_DOCREADMEDIR=share/mysql
+ -DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql
+ -DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql
+ -DWITH_ZLIB=system -DWITH_SSL=system -DWITH_LIBWRAP=OFF
+ -DWITH_EXTRA_CHARSETS=complex -DWITH_EMBEDDED_SERVER=ON
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
+ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+ -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+ -DSTACK_DIRECTION=1 -DHAVE_LLVM_LIBCPP_EXITCODE=0"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libressl-devel readline-devel boost-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (3 preceding siblings ...)
  2020-07-28  9:16 ` rien
@ 2020-07-28  9:16 ` rien
  2020-07-28  9:16 ` rien
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28  9:16 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

New comment by rien on void-packages repository

https://github.com/void-linux/void-packages/pull/23617#issuecomment-660247945

Comment:
Nevermind, I've found the Gentoo patchset which looks promising.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (4 preceding siblings ...)
  2020-07-28  9:16 ` rien
@ 2020-07-28  9:16 ` rien
  2020-07-28 15:25 ` [PR PATCH] [Updated] " rien
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28  9:16 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

New comment by rien on void-packages repository

https://github.com/void-linux/void-packages/pull/23617#issuecomment-660244088

Comment:
@Vaelatern in 48c311e12c28d7fc13e5efc7073fc312c4815e4b (4 years ago...) you noticed the change in signature of `CRYPTO_set_mem_functions`. Do you have any idea how to solve this in this case? Is there some dummy value I can pass?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (5 preceding siblings ...)
  2020-07-28  9:16 ` rien
@ 2020-07-28 15:25 ` rien
  2020-07-28 20:28 ` rien
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28 15:25 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 29354 bytes --]

From 60840590d58e5c727f240a65fc5679799ebd65d9 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 156 ++++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 698 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..4ce513cca4a
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	usr/bin/mysql_install_db --user=mysql --keep-my-cnf --basedir=/usr --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..b85ee3b5c6c
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,156 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="
+-DINSTALL_INFODIR=share/mysql/docs
+-DINSTALL_MANDIR=share/man
+-DINSTALL_PLUGINDIR=lib/mysql/plugin
+-DINSTALL_SCRIPTDIR=bin
+-DINSTALL_INCLUDEDIR=include/mysql
+-DINSTALL_DOCREADMEDIR=share/mysql
+-DINSTALL_SUPPORTFILESDIR=share/mysql
+-DINSTALL_MYSQLSHAREDIR=share/mysql
+-DINSTALL_DOCDIR=share/mysql/docs
+-DINSTALL_SHAREDIR=share/mysql
+-DSYSCONFDIR=/etc/mysql
+-DMYSQL_DATADIR=/var/lib/mysql
+-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+-DDEFAULT_CHARSET=utf8mb4               # default
+-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+-DENABLED_LOCAL_INFILE=ON
+-DWITH_ZLIB=system
+-DWITH_ZSTD=system
+-DWITH_LZ4=system
+-DWITH_LZMA=system
+-DWITH_SSL=system
+-DWITH_LIBWRAP=OFF
+-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel"
+depends="mysql8-client"
+provides="mysql-${version}_${revision}"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (6 preceding siblings ...)
  2020-07-28 15:25 ` [PR PATCH] [Updated] " rien
@ 2020-07-28 20:28 ` rien
  2020-07-28 20:29 ` rien
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28 20:28 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 29426 bytes --]

From c69edab30837c5a9e5816aeb6722bb7bdcd7bddd Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 155 ++++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 697 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..afe605e117c
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..e3bc2006621
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,155 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DINSTALL_INFODIR=share/mysql/docs
+    -DINSTALL_MANDIR=share/man
+    -DINSTALL_PLUGINDIR=lib/mysql/plugin
+    -DINSTALL_SCRIPTDIR=bin
+    -DINSTALL_INCLUDEDIR=include/mysql
+    -DINSTALL_DOCREADMEDIR=share/mysql
+    -DINSTALL_SUPPORTFILESDIR=share/mysql
+    -DINSTALL_MYSQLSHAREDIR=share/mysql
+    -DINSTALL_DOCDIR=share/mysql/docs
+    -DINSTALL_SHAREDIR=share/mysql
+    -DSYSCONFDIR=/etc/mysql
+    -DMYSQL_DATADIR=/var/lib/mysql
+    -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+    -DDEFAULT_CHARSET=utf8mb4               # default
+    -DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+    -DENABLED_LOCAL_INFILE=ON
+    -DWITH_ZLIB=system
+    -DWITH_ZSTD=system
+    -DWITH_LZ4=system
+    -DWITH_LZMA=system
+    -DWITH_SSL=system
+    -DWITH_LIBWRAP=OFF
+    -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+    -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+    -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+    -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+    -DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel"
+depends="mysql8-client"
+provides="mysql-${version}_${revision}"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (7 preceding siblings ...)
  2020-07-28 20:28 ` rien
@ 2020-07-28 20:29 ` rien
  2020-07-28 20:31 ` rien
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28 20:29 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 29348 bytes --]

From 0714ac57065c0a3aae8584faa12b4871b627261a Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 155 ++++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 697 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..afe605e117c
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..0977e58aaef
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,155 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel"
+depends="mysql8-client"
+provides="mysql-${version}_${revision}"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (8 preceding siblings ...)
  2020-07-28 20:29 ` rien
@ 2020-07-28 20:31 ` rien
  2020-07-28 21:25 ` rien
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28 20:31 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 29358 bytes --]

From dad9b0ddff11955766a916edbafca16e4e97f34a Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 155 ++++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 697 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..afe605e117c
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..0977e58aaef
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,155 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel"
+depends="mysql8-client"
+provides="mysql-${version}_${revision}"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+
+CFLAGS="-D__STDC_ISO_10646__"
+if [ "$CROSS_BUILD" ]; then
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE=1"
+	configure_args+=" -DHAVE_LLVM_LIBCPP_EXITCODE__TRYRUN_OUTPUT=0"
+fi
+
+pre_configure() {
+	# libressl major detection.
+	sed -i '/OPENSSL_MAJOR_VERSION/s/1/2/' cmake/ssl.cmake
+	#sed -i 's/sys\/poll\.h/poll.h/' include/my_net.h
+
+	# We need some host binaries before starting cross compilation.
+	if [ "$CROSS_BUILD" ]; then
+		CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+		make comp_err comp_sql gen_lex_hash gen_lex_token
+		mkdir -p bin.host/{extra,scripts,sql}
+		cp extra/comp_err bin.host/extra
+		cp scripts/comp_sql bin.host/scripts
+		cp sql/gen_lex_hash bin.host/sql
+		cp sql/gen_lex_token bin.host/sql
+		make clean
+		# Remove the rules for the host binaries to not
+		# have them overwritten with target binaries
+		rm CMakeCache.txt
+		vsed -i ${wrksrc}/scripts/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(comp_sql/d"
+		vsed -i ${wrksrc}/sql/CMakeLists.txt \
+			-e "/ADD_EXECUTABLE(gen_lex_hash/d" \
+			-e "/ADD_EXECUTABLE(gen_lex_token/d" \
+			-e "/ADD_DEPENDENCIES(gen_lex_token/d"
+	fi
+}
+
+pre_build() {
+	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ${wrksrc}/build
+		cp -a ${wrksrc}/bin.host/* ${wrksrc}/build
+		mkdir -p ${wrksrc}/build/libmysqld
+		cp ${wrksrc}/bin.host/sql/gen_lex_token ${wrksrc}/build/libmysqld
+		export PATH=${PATH}:${wrksrc}/build/extra:${wrksrc}/build/scripts:${wrksrc}/build/sql
+	fi
+}
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (9 preceding siblings ...)
  2020-07-28 20:31 ` rien
@ 2020-07-28 21:25 ` rien
  2020-07-29 10:32 ` rien
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-28 21:25 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27984 bytes --]

From f47822e568e152110c9a40cfef5c07e80547888c Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 115 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 657 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..afe605e117c
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..54c5c244d77
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,115 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+provides="mysql-${version}_${revision}"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross=yes # it is probably possible, but I haven't managed to
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (10 preceding siblings ...)
  2020-07-28 21:25 ` rien
@ 2020-07-29 10:32 ` rien
  2020-07-29 11:24 ` rien
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 10:32 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 28436 bytes --]

From 22462310a6c56ee6f3e92d301d005967bc9a6b8e Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |   9 +
 srcpkgs/mysql8/INSTALL.msg                    |   4 +
 srcpkgs/mysql8/files/my.cnf                   |  44 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 13 files changed, 663 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/INSTALL.msg
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..1479d290bcb
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,9 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	;;
+esac
diff --git a/srcpkgs/mysql8/INSTALL.msg b/srcpkgs/mysql8/INSTALL.msg
new file mode 100644
index 00000000000..e3af9fa0a9a
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL.msg
@@ -0,0 +1,4 @@
+The MySQL root password is currently empty.
+Please change it and secure your MySQL database by running
+
+    # mysql_secure_installation
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..cd879f8c0fc
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,44 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+# 
+skip-networking
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..07d0e3b67be
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible, but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (11 preceding siblings ...)
  2020-07-29 10:32 ` rien
@ 2020-07-29 11:24 ` rien
  2020-07-29 11:27 ` rien
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 11:24 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27769 bytes --]

From 2a05455aa5420e51ee28c69f92e9952799bac1d4 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |  12 +
 srcpkgs/mysql8/files/my.cnf                   |  37 ++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 655 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..55b5a7193f0
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,12 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+    echo "Your MySQL password is empty."
+    echo "Please secure your database by running"
+    echo "# mysql_secure_database"
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..5d07e58223c
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,37 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+bind		= localhost
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..07d0e3b67be
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible, but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (12 preceding siblings ...)
  2020-07-29 11:24 ` rien
@ 2020-07-29 11:27 ` rien
  2020-07-29 11:52 ` rien
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 11:27 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
Not yet finished. Currently using patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/).

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27776 bytes --]

From 46365987ba85bb03292592a7867a5811ec2f6d22 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |  12 +
 srcpkgs/mysql8/files/my.cnf                   |  37 ++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 655 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..55b5a7193f0
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,12 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+    echo "Your MySQL password is empty."
+    echo "Please secure your database by running"
+    echo "# mysql_secure_database"
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..e623c9249ab
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,37 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+bind		= 127.0.0.1
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..292ec7f207a
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+replaces="mysql>=0"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Rien Maertens <rien.maertens@posteo.be>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (13 preceding siblings ...)
  2020-07-29 11:27 ` rien
@ 2020-07-29 11:52 ` rien
  2020-07-29 12:23 ` rien
  2020-07-29 12:32 ` rien
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 11:52 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
This PR adds the MySQL database version 8.

#### Motivation

The other `mysql` package is still version 5.6, but the reason I created a new package is because the upgrade would break most databases since MySQL only has backwards compatibility for one major version. Instead of creating a lot of frustration I took the path void has already taken with postgresql (e.g. creating the `postgresql12` package next to `postgresql`).

#### LibreSSL support

MySQL does not support libressl by default, but I've used some patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/) (with permission of @Whissi). They also maintain a repository with working changes over at https://github.com/Whissi/gentoo-mysql.

#### Cross compiling

I gave up cross compiling this package because I've already spent quite some time getting this compile on x86. Sorry.

During configuration it tries to detect library versions by compiling and running small binaries, but this won't work when cross compiling. I've tried setting `build_helper=qemu` but it dies without error message, just error code 2. At that point i gave up because building this package takes ages.

#### Initialization

I've tried to replicate the behavior of the original `mysql` package as close as possible. The `INSTALL` script initializes the data directory and sets an empty root password. It also echo's a message telling the user they should run `mysql_secure_installation` in order to set a root password and to remove test databases and anonymous users.

The given configuration only allows connections from localhost, so the security risk is at a minimum here. However, if desired I can let the initialization step generate a random root password.

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27767 bytes --]

From 3915e7a47b16f602f52d189553d2704344d52d38 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |  12 +
 srcpkgs/mysql8/files/my.cnf                   |  37 ++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 655 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..b89ac5cb831
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,12 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	echo "Your MySQL password is empty."
+	echo "Please secure your database by running"
+	echo "# mysql_secure_database"
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..e623c9249ab
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,37 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+bind		= 127.0.0.1
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..8d8e4db83a7
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Rien Maertens <rien.maertens@posteo.be>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+replaces="mysql>=0"
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 640 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (14 preceding siblings ...)
  2020-07-29 11:52 ` rien
@ 2020-07-29 12:23 ` rien
  2020-07-29 12:32 ` rien
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 12:23 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
This PR adds the MySQL database version 8.

#### Motivation

The other `mysql` package is still version 5.6, but the reason I created a new package is because the upgrade would break most databases since MySQL only has backwards compatibility for one major version. Instead of creating a lot of frustration I took the path void has already taken with postgresql (e.g. creating the `postgresql12` package next to `postgresql`).

#### LibreSSL support

MySQL does not support libressl by default, but I've used some patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/) (with permission of @Whissi). They also maintain a repository with working changes over at https://github.com/Whissi/gentoo-mysql.

#### Cross compiling

I gave up cross compiling this package because I've already spent quite some time getting this compile on x86. Sorry.

During configuration it tries to detect library versions by compiling and running small binaries, but this won't work when cross compiling. I've tried setting `build_helper=qemu` but it dies without error message, just error code 2. At that point i gave up because building this package takes ages.

#### Initialization

I've tried to replicate the behavior of the original `mysql` package as close as possible. The `INSTALL` script initializes the data directory and sets an empty root password. It also echo's a message telling the user they should run `mysql_secure_installation` in order to set a root password and to remove test databases and anonymous users.

The given configuration only allows connections from localhost, so the security risk is at a minimum here. However, if desired I can let the initialization step generate a random root password.

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27767 bytes --]

From 9363d42f66c8fee649cbd740c1a90aa8a4e85f82 Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |  12 +
 srcpkgs/mysql8/files/my.cnf                   |  37 ++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 655 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..b89ac5cb831
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,12 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	echo "Your MySQL password is empty."
+	echo "Please secure your database by running"
+	echo "# mysql_secure_database"
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..e623c9249ab
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,37 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+port		= 3306
+bind		= 127.0.0.1
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..5bc304d86e7
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Rien Maertens <rien.maertens@posteo.be>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+replaces="mysql>=0"
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 644 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PR PATCH] [Updated] New package: mysql8-8.0.21
  2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
                   ` (15 preceding siblings ...)
  2020-07-29 12:23 ` rien
@ 2020-07-29 12:32 ` rien
  16 siblings, 0 replies; 18+ messages in thread
From: rien @ 2020-07-29 12:32 UTC (permalink / raw)
  To: ml


[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]

There is an updated pull request by rien against master on the void-packages repository

https://github.com/rien/void-packages new/mysql-8
https://github.com/void-linux/void-packages/pull/23617

New package: mysql8-8.0.21
This PR adds the MySQL database version 8.

#### Motivation

The other `mysql` package is still version 5.6, but the reason I created a new package is because the upgrade would break most databases since MySQL only has backwards compatibility for one major version. Instead of creating a lot of frustration I took the path void has already taken with postgresql (e.g. creating the `postgresql12` package next to `postgresql`).

#### LibreSSL support

MySQL does not support libressl by default, but I've used some patches from [gentoo](https://dev.gentoo.org/~whissi/dist/mysql/) (with permission of @Whissi). They also maintain a repository with working changes over at https://github.com/Whissi/gentoo-mysql.

#### Cross compiling

I gave up cross compiling this package because I've already spent quite some time getting this compile on x86. Sorry.

During configuration it tries to detect library versions by compiling and running small binaries, but this won't work when cross compiling. I've tried setting `build_helper=qemu` but it dies without error message, just error code 2. At that point i gave up because building this package takes ages.

#### Initialization

I've tried to replicate the behavior of the original `mysql` package as close as possible. The `INSTALL` script initializes the data directory and sets an empty root password. It also echo's a message telling the user they should run `mysql_secure_installation` in order to set a root password and to remove test databases and anonymous users.

The given configuration only allows connections from localhost, so the security risk is at a minimum here. However, if desired I can let the initialization step generate a random root password.

A patch file from https://github.com/void-linux/void-packages/pull/23617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new/mysql-8-23617.patch --]
[-- Type: text/x-diff, Size: 27862 bytes --]

From 1ec640274bc501976de29971dc36f9d6d50c3e6d Mon Sep 17 00:00:00 2001
From: Rien Maertens <rien.maertens@posteo.be>
Date: Fri, 17 Jul 2020 16:40:07 +0200
Subject: [PATCH] [ci skip] New package: mysql8-8.0.21

---
 srcpkgs/libmysqlclient8                       |   1 +
 srcpkgs/libmysqlclient8-devel                 |   1 +
 srcpkgs/mysql8-client                         |   1 +
 srcpkgs/mysql8/INSTALL                        |  12 +
 srcpkgs/mysql8/files/my.cnf                   |  42 +++
 srcpkgs/mysql8/files/mysqld/log/run           |   2 +
 srcpkgs/mysql8/files/mysqld/run               |   4 +
 .../patches/0002-cmake-Remove-Werror.patch    |  30 ++
 .../0004-tests-fix-grant_user_lock-test.patch |  92 +++++
 .../patches/0005-Add-LibreSSL-support.patch   | 356 ++++++++++++++++++
 srcpkgs/mysql8/template                       | 117 ++++++
 srcpkgs/mysql8/update                         |   2 +
 12 files changed, 660 insertions(+)
 create mode 120000 srcpkgs/libmysqlclient8
 create mode 120000 srcpkgs/libmysqlclient8-devel
 create mode 120000 srcpkgs/mysql8-client
 create mode 100644 srcpkgs/mysql8/INSTALL
 create mode 100644 srcpkgs/mysql8/files/my.cnf
 create mode 100755 srcpkgs/mysql8/files/mysqld/log/run
 create mode 100755 srcpkgs/mysql8/files/mysqld/run
 create mode 100644 srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
 create mode 100644 srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
 create mode 100644 srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
 create mode 100644 srcpkgs/mysql8/template
 create mode 100644 srcpkgs/mysql8/update

diff --git a/srcpkgs/libmysqlclient8 b/srcpkgs/libmysqlclient8
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/libmysqlclient8-devel b/srcpkgs/libmysqlclient8-devel
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/libmysqlclient8-devel
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8-client b/srcpkgs/mysql8-client
new file mode 120000
index 00000000000..9a17e91b694
--- /dev/null
+++ b/srcpkgs/mysql8-client
@@ -0,0 +1 @@
+mysql8
\ No newline at end of file
diff --git a/srcpkgs/mysql8/INSTALL b/srcpkgs/mysql8/INSTALL
new file mode 100644
index 00000000000..b89ac5cb831
--- /dev/null
+++ b/srcpkgs/mysql8/INSTALL
@@ -0,0 +1,12 @@
+# *-*-shell-*-*
+#
+case ${ACTION} in
+post)
+	install -dm0700 var/lib/mysql
+	bin/mysqld --user=mysql --initialize-insecure --datadir=/var/lib/mysql
+	chown -R mysql:mysql var/lib/mysql
+	echo "Your MySQL password is empty."
+	echo "Please secure your database by running"
+	echo "# mysql_secure_database"
+	;;
+esac
diff --git a/srcpkgs/mysql8/files/my.cnf b/srcpkgs/mysql8/files/my.cnf
new file mode 100644
index 00000000000..fdc05e6ab29
--- /dev/null
+++ b/srcpkgs/mysql8/files/my.cnf
@@ -0,0 +1,42 @@
+# MySQL configuration file for client and server based on the Gentoo
+# configurations.
+
+# The following options will be passed to all MySQL clients
+[client]
+port				= 3306
+socket				= /run/mysqld/mysqld.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+
+# Comment the next line to enable access over TCP/IP sockets.
+skip-networking
+
+port			= 3306
+bind-address	= 127.0.0.1
+
+socket		= /run/mysqld/mysqld.sock
+datadir		= /var/lib/mysql
+skip-external-locking
+
+# Since MySQL 8 the default authentication plugin switched from
+# 'mysql_native_password' to the more secure 'caching_sha2_password'.
+# Uncomment the next line if you experience issues with client libraries.
+#
+#loose-default-authentication-plugin = mysql_native_password
+
+log-bin
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+server-id	= 1
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
diff --git a/srcpkgs/mysql8/files/mysqld/log/run b/srcpkgs/mysql8/files/mysqld/log/run
new file mode 100755
index 00000000000..b36c4dafa40
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/log/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec logger -p daemon.notice
diff --git a/srcpkgs/mysql8/files/mysqld/run b/srcpkgs/mysql8/files/mysqld/run
new file mode 100755
index 00000000000..bc16a07883e
--- /dev/null
+++ b/srcpkgs/mysql8/files/mysqld/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ ! -d /run/mysqld ] && mkdir -p /run/mysqld
+chown mysql:mysql /run/mysqld
+exec chpst -u mysql:mysql mysqld --user=mysql 2>&1
diff --git a/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
new file mode 100644
index 00000000000..4a52bebef2f
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0002-cmake-Remove-Werror.patch
@@ -0,0 +1,30 @@
+From 1c066f5ea010994c790113bf6cf4a520227a9e06 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 19:59:26 +0200
+Subject: [PATCH 2/5] cmake: Remove -Werror
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/maintainer.cmake | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git cmake/maintainer.cmake cmake/maintainer.cmake
+index 6aa3ac866..b2f63bdaa 100644
+--- cmake/maintainer.cmake
++++ cmake/maintainer.cmake
+@@ -157,12 +157,6 @@ IF(MY_COMPILER_IS_CLANG)
+   # -Wzero-as-null-pointer-constant
+ ENDIF()
+ 
+-# Turn on Werror (warning => error) when using maintainer mode.
+-IF(MYSQL_MAINTAINER_MODE)
+-  STRING_APPEND(MY_C_WARNING_FLAGS   " -Werror")
+-  STRING_APPEND(MY_CXX_WARNING_FLAGS " -Werror")
+-ENDIF()
+-
+ # Set warning flags for gcc/g++/clang/clang++
+ IF(MY_COMPILER_IS_GNU_OR_CLANG)
+   STRING_APPEND(CMAKE_C_FLAGS   " ${MY_C_WARNING_FLAGS}")
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
new file mode 100644
index 00000000000..3bd1bc5a402
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0004-tests-fix-grant_user_lock-test.patch
@@ -0,0 +1,92 @@
+From 38427b53ffc34f465534bcb1cbc56fc8f2c07d8d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:20 +0200
+Subject: [PATCH 4/5] tests: fix grant_user_lock test
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ mysql-test/r/grant_user_lock.result |  4 ++--
+ mysql-test/t/grant_user_lock.test   | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git mysql-test/r/grant_user_lock.result mysql-test/r/grant_user_lock.result
+index 54aaddfb8..9c95380f1 100644
+--- mysql-test/r/grant_user_lock.result
++++ mysql-test/r/grant_user_lock.result
+@@ -98,13 +98,13 @@ CURRENT_USER()
+ DROP USER ''@localhost;
+ # Create anonymous user - LOCK
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Disabling anonymous user
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+-connect(localhost,,pass,test,MASTER_PORT,MASTER_SOCKET);
++connect(localhost, ,pass,test,MASTER_PORT,MASTER_SOCKET);
+ ERROR HY000: Access denied for user '(null)'@'localhost'. Account is locked.
+ DROP USER ''@localhost;
+ # Enabling anonymous user
+diff --git mysql-test/t/grant_user_lock.test mysql-test/t/grant_user_lock.test
+index c867bd53d..03f877def 100644
+--- mysql-test/t/grant_user_lock.test
++++ mysql-test/t/grant_user_lock.test
+@@ -112,7 +112,7 @@ DROP USER unlocked_user2@localhost;
+ --echo # Create anonymous user
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -121,7 +121,7 @@ DROP USER ''@localhost;
+ --echo # Create anonymous user - explicit UNLOCK
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -132,7 +132,7 @@ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -142,7 +142,7 @@ CREATE USER ''@localhost IDENTIFIED BY 'pass';
+ ALTER USER ''@localhost ACCOUNT LOCK;
+ --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+ --error ER_ACCOUNT_HAS_BEEN_LOCKED
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ connection default;
+ DROP USER ''@localhost;
+ 
+@@ -150,7 +150,7 @@ DROP USER ''@localhost;
+ connection default;
+ CREATE USER ''@localhost IDENTIFIED BY 'pass' ACCOUNT LOCK;
+ ALTER USER ''@localhost ACCOUNT UNLOCK;
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ SELECT CURRENT_USER();
+ disconnect anonymous_user_con;
+ connection default;
+@@ -170,7 +170,7 @@ connection default;
+ CREATE user ''@localhost IDENTIFIED BY 'pass';
+ CREATE USER 'unlocked_user'@localhost IDENTIFIED BY 'pass';
+ 
+-connect(anonymous_user_con, localhost, '', pass);
++connect(anonymous_user_con, localhost, ' ', pass);
+ --error ER_TABLEACCESS_DENIED_ERROR
+ UPDATE mysql.user SET account_locked='Y'
+   WHERE user='unlocked_user' and host = 'localhost';
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
new file mode 100644
index 00000000000..e2a9440323d
--- /dev/null
+++ b/srcpkgs/mysql8/patches/0005-Add-LibreSSL-support.patch
@@ -0,0 +1,356 @@
+From 4aadff7b08f6a69160a44c1742d5a12fb5abc059 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Thu, 30 Apr 2020 20:01:48 +0200
+Subject: [PATCH 5/5] Add LibreSSL support
+
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ cmake/ssl.cmake                               |  5 +++--
+ mysys/my_md5.cc                               |  2 ++
+ .../bindings/xcom/xcom/xcom_ssl_transport.cc  |  6 +++++-
+ plugin/x/client/xconnection_impl.cc           |  4 ++++
+ router/src/http/src/tls_client_context.cc     |  2 +-
+ router/src/http/src/tls_context.cc            |  9 ++++++--
+ router/src/http/src/tls_server_context.cc     |  3 ++-
+ sql-common/client.cc                          |  2 ++
+ sql/mysqld.cc                                 |  4 +++-
+ sql/sys_vars.cc                               | 21 +++++++++++++++++--
+ vio/viossl.cc                                 |  8 +++----
+ vio/viosslfactories.cc                        |  2 ++
+ 12 files changed, 54 insertions(+), 14 deletions(-)
+
+diff --git cmake/ssl.cmake cmake/ssl.cmake
+index 52feadeaa..3b8332695 100644
+--- cmake/ssl.cmake
++++ cmake/ssl.cmake
+@@ -222,13 +222,14 @@ MACRO (MYSQL_CHECK_SSL)
+         OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}"
+         )
+     ENDIF()
+-    IF("${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_FIX_VERSION}" VERSION_GREATER "1.1.0")
++    CHECK_SYMBOL_EXISTS(TLS1_3_VERSION "openssl/tls1.h" HAVE_TLS1_3_VERSION)
++    IF(HAVE_TLS1_3_VERSION)
+        ADD_DEFINITIONS(-DHAVE_TLSv13)
+     ENDIF()
+     IF(OPENSSL_INCLUDE_DIR AND
+        OPENSSL_LIBRARY   AND
+        CRYPTO_LIBRARY      AND
+-       OPENSSL_MAJOR_VERSION STREQUAL "1"
++       OPENSSL_MAJOR_VERSION VERSION_GREATER_EQUAL "1"
+       )
+       SET(OPENSSL_FOUND TRUE)
+       FIND_PROGRAM(OPENSSL_EXECUTABLE openssl
+diff --git mysys/my_md5.cc mysys/my_md5.cc
+index dea997b25..531696329 100644
+--- mysys/my_md5.cc
++++ mysys/my_md5.cc
+@@ -56,7 +56,9 @@ static void my_md5_hash(unsigned char *digest, unsigned const char *buf,
+ int compute_md5_hash(char *digest, const char *buf, int len) {
+   int retval = 0;
+   int fips_mode = 0;
++#ifndef LIBRESSL_VERSION_NUMBER
+   fips_mode = FIPS_mode();
++#endif
+   /* If fips mode is ON/STRICT restricted method calls will result into abort,
+    * skipping call. */
+   if (fips_mode == 0) {
+diff --git plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+index 8bf63ce14..02f91b44e 100644
+--- plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
++++ plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.cc
+@@ -325,6 +325,7 @@ error:
+   return 1;
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ #define OPENSSL_ERROR_LENGTH 512
+ static int configure_ssl_fips_mode(const uint fips_mode) {
+   int rc = -1;
+@@ -348,6 +349,7 @@ static int configure_ssl_fips_mode(const uint fips_mode) {
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ static int configure_ssl_ca(SSL_CTX *ssl_ctx, const char *ca_file,
+                             const char *ca_path) {
+@@ -544,10 +546,12 @@ int xcom_init_ssl(const char *server_key_file, const char *server_cert_file,
+   int verify_server = SSL_VERIFY_NONE;
+   int verify_client = SSL_VERIFY_NONE;
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   if (configure_ssl_fips_mode(ssl_fips_mode) != 1) {
+     G_ERROR("Error setting the ssl fips mode");
+     goto error;
+   }
++#endif
+ 
+   SSL_library_init();
+   SSL_load_error_strings();
+@@ -611,7 +615,7 @@ error:
+ void xcom_cleanup_ssl() {
+   if (!xcom_use_ssl()) return;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+   ERR_remove_thread_state(0);
+ #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+ }
+diff --git plugin/x/client/xconnection_impl.cc plugin/x/client/xconnection_impl.cc
+index 13bc6794e..5223169db 100644
+--- plugin/x/client/xconnection_impl.cc
++++ plugin/x/client/xconnection_impl.cc
+@@ -498,6 +498,7 @@ XError Connection_impl::get_ssl_error(const int error_id) {
+   return XError(CR_SSL_CONNECTION_ERROR, buffer);
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -537,6 +538,7 @@ int set_fips_mode(const uint32_t fips_mode,
+ EXIT:
+   return rc;
+ }
++#endif
+ 
+ XError Connection_impl::activate_tls() {
+   if (nullptr == m_vio) return get_socket_error(SOCKET_ECONNRESET);
+@@ -547,12 +549,14 @@ XError Connection_impl::activate_tls() {
+   if (!m_context->m_ssl_config.is_configured())
+     return XError{CR_SSL_CONNECTION_ERROR, ER_TEXT_TLS_NOT_CONFIGURATED, true};
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+   char err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(
+           static_cast<uint32_t>(m_context->m_ssl_config.m_ssl_fips_mode),
+           err_string) != 1) {
+     return XError{CR_SSL_CONNECTION_ERROR, err_string, true};
+   }
++#endif
+   auto ssl_ctx_flags = process_tls_version(
+       details::null_when_empty(m_context->m_ssl_config.m_tls_version));
+ 
+diff --git router/src/http/src/tls_client_context.cc router/src/http/src/tls_client_context.cc
+index 297ceee30..7c1157289 100644
+--- router/src/http/src/tls_client_context.cc
++++ router/src/http/src/tls_client_context.cc
+@@ -54,7 +54,7 @@ void TlsClientContext::verify(TlsVerify verify) {
+ 
+ void TlsClientContext::cipher_suites(const std::string &ciphers) {
+ // TLSv1.3 ciphers are controlled via SSL_CTX_set_ciphersuites()
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+   if (1 != SSL_CTX_set_ciphersuites(ssl_ctx_.get(), ciphers.c_str())) {
+     throw TlsError("set-cipher-suites");
+   }
+diff --git router/src/http/src/tls_context.cc router/src/http/src/tls_context.cc
+index 60ed7e6ca..388ef8f28 100644
+--- router/src/http/src/tls_context.cc
++++ router/src/http/src/tls_context.cc
+@@ -91,7 +91,7 @@ static int o11x_version(TlsVersion version) {
+       return TLS1_1_VERSION;
+     case TlsVersion::TLS_1_2:
+       return TLS1_2_VERSION;
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 1)
++#ifdef TLS1_3_VERSION
+     case TlsVersion::TLS_1_3:
+       return TLS1_3_VERSION;
+ #endif
+@@ -120,9 +120,11 @@ void TlsContext::version_range(TlsVersion min_version, TlsVersion max_version) {
+   switch (min_version) {
+     default:
+       // unknown, leave all disabled
++#ifdef TLS1_3_VERSION
+       // fallthrough
+     case TlsVersion::TLS_1_3:
+       opts |= SSL_OP_NO_TLSv1_2;
++#endif
+       // fallthrough
+     case TlsVersion::TLS_1_2:
+       opts |= SSL_OP_NO_TLSv1_1;
+@@ -170,8 +172,10 @@ TlsVersion TlsContext::min_version() const {
+       return TlsVersion::TLS_1_1;
+     case TLS1_2_VERSION:
+       return TlsVersion::TLS_1_2;
++#ifdef TLS1_3_VERSION
+     case TLS1_3_VERSION:
+       return TlsVersion::TLS_1_3;
++#endif
+     case 0:
+       return TlsVersion::AUTO;
+     default:
+@@ -230,7 +234,8 @@ TlsContext::InfoCallback TlsContext::info_callback() const {
+ }
+ 
+ int TlsContext::security_level() const {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+   return SSL_CTX_get_security_level(ssl_ctx_.get());
+ #else
+   return 0;
+diff --git router/src/http/src/tls_server_context.cc router/src/http/src/tls_server_context.cc
+index 0f4472419..707d7de86 100644
+--- router/src/http/src/tls_server_context.cc
++++ router/src/http/src/tls_server_context.cc
+@@ -167,7 +167,8 @@ void TlsServerContext::init_tmp_dh(const std::string &dh_params) {
+     }
+ 
+   } else {
+-#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0)
++#if OPENSSL_VERSION_NUMBER >= ROUTER_OPENSSL_VERSION(1, 1, 0) && \
++    !defined(LIBRESSL_VERSION_NUMBER)
+     dh2048.reset(DH_get_2048_256());
+ #else
+     /*
+diff --git sql-common/client.cc sql-common/client.cc
+index ffb136b5b..8a0c7b834 100644
+--- sql-common/client.cc
++++ sql-common/client.cc
+@@ -7766,6 +7766,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+         return 1;
+       break;
+     case MYSQL_OPT_SSL_FIPS_MODE: {
++#if !defined(LIBRESSL_VERSION_NUMBER)
+       char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+       mysql->options.extension->ssl_fips_mode = *static_cast<const uint *>(arg);
+@@ -7777,6 +7778,7 @@ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option,
+             "Set Fips mode ON/STRICT failed, detail: '%s'.", ssl_err_string);
+         return 1;
+       }
++#endif
+     } break;
+     case MYSQL_OPT_SSL_MODE:
+       ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+diff --git sql/mysqld.cc sql/mysqld.cc
+index 682e8d5ae..96a922d7a 100644
+--- sql/mysqld.cc
++++ sql/mysqld.cc
+@@ -5109,7 +5109,7 @@ static int init_thread_environment() {
+ 
+ static PSI_memory_key key_memory_openssl = PSI_NOT_INSTRUMENTED;
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define FILE_LINE_ARGS
+ #else
+ #define FILE_LINE_ARGS , const char *, int
+@@ -5143,12 +5143,14 @@ static void init_ssl() {
+ }
+ 
+ static int init_ssl_communication() {
++#ifndef LIBRESSL_VERSION_NUMBER
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   int ret_fips_mode = set_fips_mode(opt_ssl_fips_mode, ssl_err_string);
+   if (ret_fips_mode != 1) {
+     LogErr(ERROR_LEVEL, ER_SSL_FIPS_MODE_ERROR, ssl_err_string);
+     return 1;
+   }
++#endif
+   if (TLS_channel::singleton_init(&mysql_main, mysql_main_channel, opt_use_ssl,
+                                   &server_main_callback, opt_initialize))
+     return 1;
+diff --git sql/sys_vars.cc sql/sys_vars.cc
+index 5b1a82d2f..4e2dff865 100644
+--- sql/sys_vars.cc
++++ sql/sys_vars.cc
+@@ -4474,6 +4474,7 @@ static Sys_var_ulong Sys_max_execution_time(
+     HINT_UPDATEABLE SESSION_VAR(max_execution_time), CMD_LINE(REQUIRED_ARG),
+     VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+   char ssl_err_string[OPENSSL_ERROR_LENGTH] = {'\0'};
+   if (set_fips_mode(opt_ssl_fips_mode, ssl_err_string) != 1) {
+@@ -4484,15 +4485,31 @@ static bool update_fips_mode(sys_var *, THD *, enum_var_type) {
+     return false;
+   }
+ }
++#endif
++
++#if defined(LIBRESSL_VERSION_NUMBER)
++static const char *ssl_fips_mode_names[] = {"OFF", 0};
++#else
++static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", 0};
++#endif
+ 
+-static const char *ssl_fips_mode_names[] = {"OFF", "ON", "STRICT", nullptr};
+ static Sys_var_enum Sys_ssl_fips_mode(
+     "ssl_fips_mode",
+     "SSL FIPS mode (applies only for OpenSSL); "
++#ifndef LIBRESSL_VERSION_NUMBER
+     "permitted values are: OFF, ON, STRICT",
++#else
++    "permitted values are: OFF",
++#endif
+     GLOBAL_VAR(opt_ssl_fips_mode), CMD_LINE(REQUIRED_ARG, OPT_SSL_FIPS_MODE),
+     ssl_fips_mode_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+-    ON_CHECK(nullptr), ON_UPDATE(update_fips_mode), nullptr);
++    ON_CHECK(NULL),
++#ifndef LIBRESSL_VERSION_NUMBER
++    ON_UPDATE(update_fips_mode),
++#else
++    ON_UPDATE(NULL),
++#endif
++    NULL);
+ 
+ static Sys_var_bool Sys_auto_generate_certs(
+     "auto_generate_certs",
+diff --git vio/viossl.cc vio/viossl.cc
+index 0e9594741..3a589c64b 100644
+--- vio/viossl.cc
++++ vio/viossl.cc
+@@ -45,7 +45,7 @@
+   BIO_set_callback_ex was added in openSSL 1.1.1
+   For older openSSL, use the deprecated BIO_set_callback.
+ */
+-#if OPENSSL_VERSION_NUMBER >= 0x10101000L
++#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER)
+ #define HAVE_BIO_SET_CALLBACK_EX
+ #endif
+ 
+@@ -634,8 +634,8 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ 
+ #if !defined(DBUG_OFF)
+     {
+-      STACK_OF(SSL_COMP) *ssl_comp_methods = nullptr;
+-      ssl_comp_methods = SSL_COMP_get_compression_methods();
++      STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
++      ssl_comp_methods = (STACK_OF(SSL_COMP) *)SSL_COMP_get_compression_methods();
+       n = sk_SSL_COMP_num(ssl_comp_methods);
+       DBUG_PRINT("info", ("Available compression methods:\n"));
+       if (n == 0)
+@@ -643,7 +643,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+       else
+         for (j = 0; j < n; j++) {
+           SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+           DBUG_PRINT("info", ("  %d: %s\n", c->id, c->name));
+ #else  /* OPENSSL_VERSION_NUMBER < 0x10100000L */
+           DBUG_PRINT("info",
+diff --git vio/viosslfactories.cc vio/viosslfactories.cc
+index 6c04029cc..f27221463 100644
+--- vio/viosslfactories.cc
++++ vio/viosslfactories.cc
+@@ -473,6 +473,7 @@ void ssl_start() {
+   }
+ }
+ 
++#ifndef LIBRESSL_VERSION_NUMBER
+ /**
+   Set fips mode in openssl library,
+   When we set fips mode ON/STRICT, it will perform following operations:
+@@ -526,6 +527,7 @@ EXIT:
+   @returns openssl current fips mode
+ */
+ uint get_fips_mode() { return FIPS_mode(); }
++#endif
+ 
+ long process_tls_version(const char *tls_version) {
+   const char *separator = ",";
+-- 
+2.27.0
+
diff --git a/srcpkgs/mysql8/template b/srcpkgs/mysql8/template
new file mode 100644
index 00000000000..5bc304d86e7
--- /dev/null
+++ b/srcpkgs/mysql8/template
@@ -0,0 +1,117 @@
+# Template file for 'mysql8'
+pkgname=mysql8
+version=8.0.21
+revision=1
+wrksrc="mysql-${version}"
+build_style=cmake
+build_helper=qemu
+configure_args="
+	-DINSTALL_INFODIR=share/mysql/docs
+	-DINSTALL_MANDIR=share/man
+	-DINSTALL_PLUGINDIR=lib/mysql/plugin
+	-DINSTALL_SCRIPTDIR=bin
+	-DINSTALL_INCLUDEDIR=include/mysql
+	-DINSTALL_DOCREADMEDIR=share/mysql
+	-DINSTALL_SUPPORTFILESDIR=share/mysql
+	-DINSTALL_MYSQLSHAREDIR=share/mysql
+	-DINSTALL_DOCDIR=share/mysql/docs
+	-DINSTALL_SHAREDIR=share/mysql
+	-DSYSCONFDIR=/etc/mysql
+	-DMYSQL_DATADIR=/var/lib/mysql
+	-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock
+	-DDEFAULT_CHARSET=utf8mb4               # default
+	-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci  # default
+	-DENABLED_LOCAL_INFILE=ON
+	-DWITH_ZLIB=system
+	-DWITH_ZSTD=system
+	-DWITH_LZ4=system
+	-DWITH_LZMA=system
+	-DWITH_SSL=system
+	-DWITH_SSL=system
+	-DWITH_LIBWRAP=OFF
+	-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+	-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
+	-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
+	-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
+	-DWITHOUT_NDB_STORAGE_ENGINE=1
+"
+hostmakedepends="perl bison ncurses-devel"
+makedepends="zlib-devel libzstd-devel liblz4-devel liblzma-devel libressl-devel
+readline-devel boost-devel libevent-devel"
+depends="mysql8-client"
+conf_files="/etc/mysql/my.cnf"
+short_desc="World's most popular open source database"
+maintainer="Rien Maertens <rien.maertens@posteo.be>"
+license="GPL-2.0-only"
+homepage="https://www.mysql.com/products/community/"
+distfiles="http://dev.mysql.com/get/Downloads/MySQL-${version%.*}/mysql-${version}.tar.gz"
+checksum=ad56535eee03943adeef5f188e1df7a39729a7557d8b2179b1affd994b990034
+replaces="mysql>=0"
+provides="mysql-${version}_${revision}"
+system_accounts="mysql"
+mysql_homedir="/var/lib/mysql"
+lib32disabled=yes
+nocross="cross compiling should be possible but I gave up"
+
+
+post_install() {
+	# Remove unneeded stuff.
+	rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}
+	rm -f ${DESTDIR}/usr/share/man/man1/mysql-test-run.pl.1
+
+	# Configuration file.
+	vinstall ${FILESDIR}/my.cnf 644 etc/mysql
+
+	# runit service
+	vsv mysqld
+}
+
+libmysqlclient8_package() {
+	short_desc+=" - client library"
+	provides="libmysqlclient-${version}_${revision}"
+	replaces="libmysqlclient>=0"
+	pkg_install() {
+		vmove "usr/lib/libmysqlclient*.so.*"
+	}
+}
+
+libmysqlclient8-devel_package() {
+	depends="libmysqlclient8>=${version}_${revision}"
+	provides="libmysqlclient-devel-${version}_${revision}"
+	replaces="libmysqlclient-devel>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/bin/mysql_config
+		vmove usr/share/man/man1/mysql_config.1
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+	}
+}
+
+mysql8-client_package() {
+	depends="perl"
+	provides="mysql-client-${version}_${revision}"
+	replaces="mysql-client>=0"
+	short_desc+=" - database client binaries"
+	pkg_install() {
+		for f in innochecksum innotop myisam_ftdump mysql mysql_client_test \
+			mysql_client_test_embedded mysqldumpslow mysqlbinlog \
+			mysql_find_rows mysql_fix_extensions mysql_waitpid mysqlaccess \
+			mysqladmin mysqlanalyze mysqlbug mysqlcheck mysqldump \
+			mysqlimport mysqloptimize mysqlrepair mysqlreport mysqlshow \
+			mysqlslap mysqltest_embedded mysqlmanager mysqltest \
+			mysqlhotcopy mysql_upgrade mysql_zap; do
+			if [ -f ${DESTDIR}/usr/bin/${f} ]; then
+				vmove usr/bin/${f}
+			elif [ -f ${DESTDIR}/usr/sbin/${f} ]; then
+				vmove usr/sbin/${f}
+			fi
+			if [ -f ${DESTDIR}/usr/share/man/man1/${f}.1 ]; then
+				vmove usr/share/man/man1/${f}.1
+			elif [ -f ${DESTDIR}/usr/share/man/man8/${f}.8 ]; then
+				vmove usr/share/man/man8/${f}.8
+			fi
+		done
+	}
+}
diff --git a/srcpkgs/mysql8/update b/srcpkgs/mysql8/update
new file mode 100644
index 00000000000..da80797cf4a
--- /dev/null
+++ b/srcpkgs/mysql8/update
@@ -0,0 +1,2 @@
+site='http://dev.mysql.com/downloads/mysql/'
+pattern='MySQL Community Server \K[\d.]+'

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, back to index

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 15:40 [PR PATCH] New package: mysql8-8.0.21 rien
2020-07-17 17:32 ` rien
2020-07-17 17:40 ` rien
2020-07-17 17:45 ` [PR PATCH] [Updated] " rien
2020-07-28  9:16 ` rien
2020-07-28  9:16 ` rien
2020-07-28  9:16 ` rien
2020-07-28 15:25 ` [PR PATCH] [Updated] " rien
2020-07-28 20:28 ` rien
2020-07-28 20:29 ` rien
2020-07-28 20:31 ` rien
2020-07-28 21:25 ` rien
2020-07-29 10:32 ` rien
2020-07-29 11:24 ` rien
2020-07-29 11:27 ` rien
2020-07-29 11:52 ` rien
2020-07-29 12:23 ` rien
2020-07-29 12:32 ` rien

Github messages for voidlinux

Archives are clonable: git clone --mirror http://inbox.vuxu.org/voidlinux-github

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.voidlinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git