From 7adeb35eb84dcfadcdbb191c668d417753131d7f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 12 Jan 2018 17:53:30 +0000 Subject: [PATCH] databases/percona57: Fix build with SASL If SASL is detected at build time it assumes you want SASL and also errors due to assuming we're Linux. This was already patched in our tree for MySQL. Also enable SASL support by default for the databases/percona57-client. This is expected to be the default by upstream now. Special thanks to mmokhi for figuring this out for us. PR: 220865 MFH: 2018Q1 --- databases/percona57-client/Makefile | 12 +++++- .../files/patch-cmake_plugin.cmake | 43 +++++++++++++++++++ ...bmysql_authentication__ldap_CMakeLists.txt | 18 ++++++++ databases/percona57-client/pkg-plist | 1 + databases/percona57-pam-for-mysql/pkg-plist | 1 - databases/percona57-server/Makefile | 6 +++ .../files/patch-cmake_plugin.cmake | 43 +++++++++++++++++++ ...bmysql_authentication__ldap_CMakeLists.txt | 18 ++++++++ databases/percona57-server/pkg-plist | 1 - 9 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 databases/percona57-client/files/patch-cmake_plugin.cmake create mode 100644 databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt create mode 100644 databases/percona57-server/files/patch-cmake_plugin.cmake create mode 100644 databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt diff --git a/databases/percona57-client/Makefile b/databases/percona57-client/Makefile index a2ab5f0c2b2c..d963ec3c3217 100644 --- a/databases/percona57-client/Makefile +++ b/databases/percona57-client/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= percona -PORTREVISION?= 0 +PORTREVISION?= 1 PKGNAMESUFFIX= 57-client COMMENT= Multithreaded SQL database (client) @@ -31,6 +31,16 @@ MANPAGES= comp_err.1 mysql.1 mysql_config.1 mysql_config_editor.1 \ CLIENT_ONLY= yes +OPTIONS_GROUP+= PLUGINS +PLUGINS_DESC= Default Client Plugins +OPTIONS_GROUP_PLUGINS= SASLCLIENT +SASLCLIENT_DESC= SASL client plugin module +SASLCLIENT_CMAKE_BOOL= WITH_AUTHENTICATION_LDAP +SASLCLIENT_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 +SASLCLIENT_BUILD_DEPENDS= ${LOCALBASE}/include/sasl/sasl.h:net/openldap24-sasl-client +OPTIONS_DEFAULT+= SASLCLIENT +OPTIONS_SUB= yes + # Percona renamed the libraries, until we decide how to deal with it create some symlinks # to prevent breaking installed ports. post-install: diff --git a/databases/percona57-client/files/patch-cmake_plugin.cmake b/databases/percona57-client/files/patch-cmake_plugin.cmake new file mode 100644 index 000000000000..8716c1b962b4 --- /dev/null +++ b/databases/percona57-client/files/patch-cmake_plugin.cmake @@ -0,0 +1,43 @@ +--- cmake/plugin.cmake.orig 2017-06-22 14:13:19 UTC ++++ cmake/plugin.cmake +@@ -219,9 +219,16 @@ MACRO(MYSQL_ADD_PLUGIN) + # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate + # an additional dependency. + # Use MYSQL_PLUGIN_IMPORT for static data symbols to be exported. +- IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ # ++ # P.S. "FreeBSD" is obviously not "Linux" but it behaves near similar in this case. ++ IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES}) + ENDIF() ++ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ SET_TARGET_PROPERTIES(${target} PROPERTIES ++ LINK_FLAGS "-L%%FREEBSD_LOCAL_LIB%% ${LINK_FLAGS} " ++ ) ++ ENDIF() + ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) + + IF(NOT ARG_MODULE_ONLY) +@@ -239,13 +246,17 @@ MACRO(MYSQL_ADD_PLUGIN) + MYSQL_INSTALL_TARGETS(${target} + DESTINATION ${INSTALL_PLUGINDIR} + COMPONENT ${INSTALL_COMPONENT}) +- INSTALL_DEBUG_TARGET(${target} +- DESTINATION ${INSTALL_PLUGINDIR}/debug +- COMPONENT ${INSTALL_COMPONENT}) ++ IF(CMAKE_BUILD_TYPE MATCHES "Debug") ++ INSTALL_DEBUG_TARGET(${target} ++ DESTINATION ${INSTALL_PLUGINDIR}/debug ++ COMPONENT ${INSTALL_COMPONENT}) ++ # Add installed files to list for RPMs ++ FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files ++ "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") ++ ENDIF() + # Add installed files to list for RPMs + FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files +- "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n" +- "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") ++ "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n") + # For internal testing in PB2, append collections files + IF(DEFINED ENV{PB2WORKDIR}) + PLUGIN_APPEND_COLLECTIONS(${plugin}) diff --git a/databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt b/databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt new file mode 100644 index 000000000000..05783d914af4 --- /dev/null +++ b/databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt @@ -0,0 +1,18 @@ +--- libmysql/authentication_ldap/CMakeLists.txt.orig 2017-07-20 22:54:16 UTC ++++ libmysql/authentication_ldap/CMakeLists.txt +@@ -52,8 +52,10 @@ ELSE () + SET(SASL_LIBRARY "sasl2") + ENDIF () + +-MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client +- auth_ldap_sasl_client.cc log_client.cc +- LINK_LIBRARIES ${SASL_LIBRARY} +- MODULE_ONLY +- MODULE_OUTPUT_NAME "authentication_ldap_sasl_client") ++IF (WITH_AUTHENTICATION_LDAP) ++ MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client ++ auth_ldap_sasl_client.cc log_client.cc ++ LINK_LIBRARIES ${SASL_LIBRARY} ++ MODULE_ONLY ++ MODULE_OUTPUT_NAME "authentication_ldap_sasl_client") ++ENDIF() diff --git a/databases/percona57-client/pkg-plist b/databases/percona57-client/pkg-plist index 8d1e78983d81..4971e8b943c0 100644 --- a/databases/percona57-client/pkg-plist +++ b/databases/percona57-client/pkg-plist @@ -128,6 +128,7 @@ lib/mysql/libmysqlservices.a lib/mysql/libperconaserverclient.a lib/mysql/libperconaserverclient.so lib/mysql/libperconaserverclient.so.20 +%%SASLCLIENT%%lib/mysql/plugin/authentication_ldap_sasl_client.so libdata/pkgconfig/perconaserverclient.pc man/man1/comp_err.1.gz man/man1/mysql.1.gz diff --git a/databases/percona57-pam-for-mysql/pkg-plist b/databases/percona57-pam-for-mysql/pkg-plist index 3fb96a25b7bc..45350d3e7caf 100644 --- a/databases/percona57-pam-for-mysql/pkg-plist +++ b/databases/percona57-pam-for-mysql/pkg-plist @@ -2,4 +2,3 @@ lib/mysql/plugin/auth_pam.so lib/mysql/plugin/auth_pam_compat.so lib/mysql/plugin/dialog.so -@dir lib/mysql/plugin/debug diff --git a/databases/percona57-server/Makefile b/databases/percona57-server/Makefile index aef6512055e6..f131cf5a4bc9 100644 --- a/databases/percona57-server/Makefile +++ b/databases/percona57-server/Makefile @@ -123,6 +123,9 @@ MANPAGES= my_print_defaults.1 myisam_ftdump.1 myisamchk.1 myisamlog.1 myisampack mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 resolveip.1 CMAKE_ARGS+= -DWITH_EMBEDDED_SERVER="ON" +# issue 220865: Currently there's no source to be built with server-side support. +# But this keeps the pkg-plist not overlaping +CMAKE_ARGS+= -DWITH_AUTHENTICATION_LDAP=0 post-install: ${MKDIR} ${STAGEDIR}/var/db/mysql @@ -133,6 +136,9 @@ post-install: post-patch: @${REINPLACE_CMD} 's/*.1/${MANPAGES}/' ${WRKSRC}/man/CMakeLists.txt + # issue 220865: MySQL developers forgot that FreeBSD != Linux + @${REINPLACE_CMD} -e 's|%%FREEBSD_LOCAL_LIB%%|${LOCALBASE}/lib|g' \ + ${WRKSRC}/cmake/plugin.cmake .include diff --git a/databases/percona57-server/files/patch-cmake_plugin.cmake b/databases/percona57-server/files/patch-cmake_plugin.cmake new file mode 100644 index 000000000000..8716c1b962b4 --- /dev/null +++ b/databases/percona57-server/files/patch-cmake_plugin.cmake @@ -0,0 +1,43 @@ +--- cmake/plugin.cmake.orig 2017-06-22 14:13:19 UTC ++++ cmake/plugin.cmake +@@ -219,9 +219,16 @@ MACRO(MYSQL_ADD_PLUGIN) + # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate + # an additional dependency. + # Use MYSQL_PLUGIN_IMPORT for static data symbols to be exported. +- IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ # ++ # P.S. "FreeBSD" is obviously not "Linux" but it behaves near similar in this case. ++ IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES}) + ENDIF() ++ IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") ++ SET_TARGET_PROPERTIES(${target} PROPERTIES ++ LINK_FLAGS "-L%%FREEBSD_LOCAL_LIB%% ${LINK_FLAGS} " ++ ) ++ ENDIF() + ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) + + IF(NOT ARG_MODULE_ONLY) +@@ -239,13 +246,17 @@ MACRO(MYSQL_ADD_PLUGIN) + MYSQL_INSTALL_TARGETS(${target} + DESTINATION ${INSTALL_PLUGINDIR} + COMPONENT ${INSTALL_COMPONENT}) +- INSTALL_DEBUG_TARGET(${target} +- DESTINATION ${INSTALL_PLUGINDIR}/debug +- COMPONENT ${INSTALL_COMPONENT}) ++ IF(CMAKE_BUILD_TYPE MATCHES "Debug") ++ INSTALL_DEBUG_TARGET(${target} ++ DESTINATION ${INSTALL_PLUGINDIR}/debug ++ COMPONENT ${INSTALL_COMPONENT}) ++ # Add installed files to list for RPMs ++ FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files ++ "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") ++ ENDIF() + # Add installed files to list for RPMs + FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files +- "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n" +- "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") ++ "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n") + # For internal testing in PB2, append collections files + IF(DEFINED ENV{PB2WORKDIR}) + PLUGIN_APPEND_COLLECTIONS(${plugin}) diff --git a/databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt b/databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt new file mode 100644 index 000000000000..05783d914af4 --- /dev/null +++ b/databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt @@ -0,0 +1,18 @@ +--- libmysql/authentication_ldap/CMakeLists.txt.orig 2017-07-20 22:54:16 UTC ++++ libmysql/authentication_ldap/CMakeLists.txt +@@ -52,8 +52,10 @@ ELSE () + SET(SASL_LIBRARY "sasl2") + ENDIF () + +-MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client +- auth_ldap_sasl_client.cc log_client.cc +- LINK_LIBRARIES ${SASL_LIBRARY} +- MODULE_ONLY +- MODULE_OUTPUT_NAME "authentication_ldap_sasl_client") ++IF (WITH_AUTHENTICATION_LDAP) ++ MYSQL_ADD_PLUGIN(authentication_ldap_sasl_client ++ auth_ldap_sasl_client.cc log_client.cc ++ LINK_LIBRARIES ${SASL_LIBRARY} ++ MODULE_ONLY ++ MODULE_OUTPUT_NAME "authentication_ldap_sasl_client") ++ENDIF() diff --git a/databases/percona57-server/pkg-plist b/databases/percona57-server/pkg-plist index 12fa22fd82c2..16e8cea6c749 100644 --- a/databases/percona57-server/pkg-plist +++ b/databases/percona57-server/pkg-plist @@ -90,7 +90,6 @@ bin/zlib_decompress include/mysql/mysqlx_ername.h include/mysql/mysqlx_error.h include/mysql/mysqlx_version.h -@dir lib/mysql/plugin/debug @dir(mysql,mysql,) /var/db/mysql %%INNODBMEMCACHED%%lib/mysql/plugin/innodb_engine.so %%INNODBMEMCACHED%%lib/mysql/plugin/libmemcached.so