From 4ca987b79b39ecaaab4f8ab3a433f14884f2cd28 Mon Sep 17 00:00:00 2001 From: Muhammad Moinur Rahman Date: Thu, 2 Feb 2023 17:45:42 -0600 Subject: databases/mysql-connector-odbc-80: New port MySQL Connector ODBC is an ODBC driver for interfacing to MySQL databases. This is specific to mysql version 8.0.X branch. --- databases/Makefile | 1 + databases/mysql-connector-odbc-80/Makefile | 39 ++++ databases/mysql-connector-odbc-80/distinfo | 3 + .../files/patch-CMakeLists.txt | 234 +++++++++++++++++++++ .../files/patch-driver_dll.cc | 11 + .../files/patch-include_mysql-8.0_my__sys.h | 24 +++ databases/mysql-connector-odbc-80/pkg-descr | 1 + 7 files changed, 313 insertions(+) create mode 100644 databases/mysql-connector-odbc-80/Makefile create mode 100644 databases/mysql-connector-odbc-80/distinfo create mode 100644 databases/mysql-connector-odbc-80/files/patch-CMakeLists.txt create mode 100644 databases/mysql-connector-odbc-80/files/patch-driver_dll.cc create mode 100644 databases/mysql-connector-odbc-80/files/patch-include_mysql-8.0_my__sys.h create mode 100644 databases/mysql-connector-odbc-80/pkg-descr diff --git a/databases/Makefile b/databases/Makefile index d474d4765cdc..3a6cbb867cc9 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -205,6 +205,7 @@ SUBDIR += mysql-connector-java SUBDIR += mysql-connector-java51 SUBDIR += mysql-connector-odbc + SUBDIR += mysql-connector-odbc-80 SUBDIR += mysql-q4m SUBDIR += mysql-udf SUBDIR += mysql2pgsql diff --git a/databases/mysql-connector-odbc-80/Makefile b/databases/mysql-connector-odbc-80/Makefile new file mode 100644 index 000000000000..d19d0dc17b65 --- /dev/null +++ b/databases/mysql-connector-odbc-80/Makefile @@ -0,0 +1,39 @@ +PORTNAME= mysql-connector-odbc +PORTVERSION= 8.0.32 +CATEGORIES= databases +MASTER_SITES= MYSQL/Connector-ODBC/8.0 +PKGNAMESUFFIX= -${DRIVER_MANAGER}-mysql${MYSQL_VER} +DISTNAME= ${PORTNAME}-${PORTVERSION}-src + +MAINTAINER= bofh@FreeBSD.org +COMMENT= ODBC driver for MySQL${MYSQL_VER} / ${DRIVER_MANAGER} +WWW= https://www.mysql.com/ + +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/LICENSE.txt + +LIB_DEPENDS= libodbc.so:databases/unixODBC \ + libunwind.so:devel/libunwind \ + libzstd.so:archivers/zstd + +USES= cmake compiler:c++11-lang localbase:ldflags mysql:80 ssl +IGNORE_WITH_MYSQL= 56 57 101m 102m 103m 57p 57w +USE_LDCONFIG= yes + +CMAKE_ARGS= -DWITH_UNIXODBC=1 -DDISABLE_GUI=1 + +DRIVER_MANAGER= unixodbc + +PLIST_FILES= bin/myodbc-installer \ + lib/libmyodbc8a.so \ + lib/libmyodbc8w.so \ + test/dltest +PORTDOCS= * + +OPTIONS_DEFINE= DOCS + +post-install: + @${RM} ${STAGEDIR}${PREFIX}/INFO_BIN + @${RM} ${STAGEDIR}${PREFIX}/INFO_SRC + +.include diff --git a/databases/mysql-connector-odbc-80/distinfo b/databases/mysql-connector-odbc-80/distinfo new file mode 100644 index 000000000000..6348964715af --- /dev/null +++ b/databases/mysql-connector-odbc-80/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1675358550 +SHA256 (mysql-connector-odbc-8.0.32-src.tar.gz) = 068f275afccc69e2ea5ea0d59ea0ecf0380710f9a9f6158e4751f07d5eec84a2 +SIZE (mysql-connector-odbc-8.0.32-src.tar.gz) = 3845574 diff --git a/databases/mysql-connector-odbc-80/files/patch-CMakeLists.txt b/databases/mysql-connector-odbc-80/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..366b09a1ecf7 --- /dev/null +++ b/databases/mysql-connector-odbc-80/files/patch-CMakeLists.txt @@ -0,0 +1,234 @@ +--- CMakeLists.txt.orig 2022-12-10 21:58:26 UTC ++++ CMakeLists.txt +@@ -458,7 +458,7 @@ IF(WIN32) + + if (FIX_WARNINGS) + +- # TODO: Increase warning level and once all warnings are cleared, enable ++ # TODO: Increase warning level and once all warnings are cleared, enable + # higher warning level in MAINTAINER_MODE. We start with no warnings on + # level /W1 + +@@ -478,7 +478,7 @@ ELSE(WIN32) + if(FIX_WARNINGS) + + # TODO: Fix the compile warnings generated without `-w`. Once done, +- # remove this option in MAINTAINER_MODE so that we see when new ++ # remove this option in MAINTAINER_MODE so that we see when new + # warnings appear. Then proceed to `-w extra`. + + add_compile_options(-Werror) +@@ -486,7 +486,7 @@ ELSE(WIN32) + else() + + add_compile_options( -w ) +- ++ + endif() + + ENDIF(WIN32) +@@ -517,7 +517,6 @@ ADD_SUBDIRECTORY(installer) + + ADD_SUBDIRECTORY(dltest) + ADD_SUBDIRECTORY(installer) +-ADD_SUBDIRECTORY(test) + + # For dynamic linking use the built-in sys and strings + IF(NOT MYSQLCLIENT_STATIC_LINKING) +@@ -591,10 +590,10 @@ INCLUDE(cmake/info_bin.cmake) + #------------ Installation --------------------------- + INCLUDE(cmake/info_bin.cmake) + +-INSTALL(FILES LICENSE.txt DESTINATION .) ++INSTALL(FILES LICENSE.txt DESTINATION ./share/doc/mysql-connector-odbc/) + + if(EXISTS "${CMAKE_SOURCE_DIR}/README.txt") +- INSTALL(FILES README.txt DESTINATION .) ++ INSTALL(FILES README.txt DESTINATION ./share/doc/mysql-connector-odbc/) + else() + INSTALL(FILES README.md DESTINATION .) + INSTALL(FILES CONTRIBUTING.md DESTINATION .) +@@ -658,7 +657,7 @@ ELSE(WIN32) + + ELSE(WIN32) + +- INSTALL(FILES ChangeLog DESTINATION .) ++ INSTALL(FILES ChangeLog DESTINATION ./share/doc/mysql-connector-odbc/) + + ENDIF(WIN32) + +@@ -666,16 +665,16 @@ ENDIF(WIN32) + # Bundle 3rd party dependencies if needed + # ======================================= + +-# If build is configured with BUNDEL_DEPENDENCIES enabled then client-side +-# plugins, their dependencies and other dependencies of the client library that +-# are found at the client library installation location are copied to the ++# If build is configured with BUNDEL_DEPENDENCIES enabled then client-side ++# plugins, their dependencies and other dependencies of the client library that ++# are found at the client library installation location are copied to the + # location where ODBC driver is installed. + # +-# The lists of known plugins and 3rd party libraries are specified below. Only +-# the specified plugins and libraries will be bundled. Also plugins and +-# libraries that can be found with the server but which should be ignored are +-# specified below. When building in MAINTAINER_MODE cmake will report error if +-# it finds a plugin or 3rd party librariy which is not listed here. When that ++# The lists of known plugins and 3rd party libraries are specified below. Only ++# the specified plugins and libraries will be bundled. Also plugins and ++# libraries that can be found with the server but which should be ignored are ++# specified below. When building in MAINTAINER_MODE cmake will report error if ++# it finds a plugin or 3rd party librariy which is not listed here. When that + # happens the lists should be updated. + # + # TODO: Move these checks to cmake/FindMySQL.cmake ? +@@ -697,20 +696,20 @@ endif() + # Plugin dependencies. + # + # Warning: If one library name is a prefix of the other, the longer name +-# should be listed first, otherwise the logic detecting missing dependencies ++# should be listed first, otherwise the logic detecting missing dependencies + # will break... For example: `krb5support` must go before `krb5` + + set(AUTH_DEPS_fido fido2) + + if(WIN32) +- set(AUTH_DEPS_kerberos ++ set(AUTH_DEPS_kerberos + comerr gssapi k5sprt krbcc xpprof krb5 + ) + else() + set(AUTH_DEPS_kerberos gssapi_krb5 k5crypto krb5support krb5 com_err) + endif() + +-# Note: On Solaris and macOS all dependencies of ldap_sasl plugin are assumed ++# Note: On Solaris and macOS all dependencies of ldap_sasl plugin are assumed + # to be part of the OS. + + if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS") +@@ -730,7 +729,7 @@ set(BUNDLED_LIBS + libssl libcrypto ssleay libeay + ) + +-# List plugins and other libraries that can be found bundled with the server ++# List plugins and other libraries that can be found bundled with the server + # but which are not relevant on client-side and can be safely ignored. + + set(IGNORED_PLUGINS qa_auth_client) +@@ -797,11 +796,11 @@ endfunction(bundle_lib) + + + # Bundle libraries listed in a list variable ${to_bundle}. +-# Libraries that were found and bundled are removed from ${to_bundle} list. +-# Other libraries found but not listed in ${to_bundle} are returned ++# Libraries that were found and bundled are removed from ${to_bundle} list. ++# Other libraries found but not listed in ${to_bundle} are returned + # in ${ignored} variable. +-# If additional arguments are given, they are used as glob expressions to find +-# the libraries to be bundled, otherwise 3rd parties bundled in with the server ++# If additional arguments are given, they are used as glob expressions to find ++# the libraries to be bundled, otherwise 3rd parties bundled in with the server + # are searched in ${MYSQL_LIB_DIR} locations. + + macro(bundle_libs to_bundle ignored) +@@ -811,12 +810,12 @@ macro(bundle_libs to_bundle ignored) + if(ARGN) + + file(GLOB _bundled ${ARGN}) +- ++ + else() + + file(GLOB _bundled + "${MYSQL_LIB_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" +- "${MYSQL_LIB_DIR}/private/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" ++ "${MYSQL_LIB_DIR}/private/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + ) + + # On windows, libs are in bin directory +@@ -865,9 +864,9 @@ endmacro(bundle_libs) + endmacro(bundle_libs) + + +-# Bundle plugins listed in PLUGINS list. Each bundled plugin P is removed from +-# the list and its dependedencies listed in DEPS_${P} are also bundled. Client +-# side plugins found with the server and not listed in PLUGINS are returned ++# Bundle plugins listed in PLUGINS list. Each bundled plugin P is removed from ++# the list and its dependedencies listed in DEPS_${P} are also bundled. Client ++# side plugins found with the server and not listed in PLUGINS are returned + # in ${ignored} list. + + macro(bundle_plugins ignored) +@@ -888,7 +887,7 @@ macro(bundle_plugins ignored) + + #message("== looking at client-side plugin: ${lib_name}") + +- # Match plugin name against names in PLUGINS list and in case of match ++ # Match plugin name against names in PLUGINS list and in case of match + # remove that name from the list + + unset(plugin) +@@ -926,7 +925,7 @@ macro(bundle_plugins ignored) + set(sasl_bundled 1) + endif() + +- # On Windows the MIT Kerberos library uses ccapiserver.exe application ++ # On Windows the MIT Kerberos library uses ccapiserver.exe application + # in some scenarios - we need to bundle it as well. + + if(WIN32 AND "${DEPS_${plugin}}" MATCHES "krb5") +@@ -1000,7 +999,7 @@ if(BUNDLE_DEPENDENCIES) + endforeach() + + # Bundle the plugins and their dependencies. +- ++ + unset(ingored) + bundle_plugins(ignored) + +@@ -1012,7 +1011,7 @@ if(BUNDLE_DEPENDENCIES) + + foreach(plugin ${IGNORED_PLUGINS}) + +- # Note: Old cmake (seen with 3.13.4) generates this error on ++ # Note: Old cmake (seen with 3.13.4) generates this error on + # list(FILTER...) if the list is empty: + # "list sub-command FILTER requires list to be present" + +@@ -1037,8 +1036,8 @@ if(BUNDLE_DEPENDENCIES) + + message(STATUS "Looking for bundled client lib dependencies") + +- # Bundle additional libraries listed in BUNDLED_LIBS +- # For OpenSSL libs, first look in the location of the library that ++ # Bundle additional libraries listed in BUNDLED_LIBS ++ # For OpenSSL libs, first look in the location of the library that + # is actually being used in the build. + + #message("== BUNDLED_LIBS: ${BUNDLED_LIBS}") +@@ -1052,12 +1051,12 @@ if(BUNDLE_DEPENDENCIES) + unset(extra_libs) + bundle_libs(BUNDLED_LIBS extra_libs) + +- # In MAINTAINER_MODE check whether all 3rd party libs found but not bundled ++ # In MAINTAINER_MODE check whether all 3rd party libs found but not bundled + # are listed in IGNORED_LIBS + + if(MAINTAINER_MODE) + +- # Extend ignore list with libraries that are dependencies of known plugins ++ # Extend ignore list with libraries that are dependencies of known plugins + # and are not listed in BUNDLED_LIBS. Otherwise we would get false errors + # below. + +@@ -1065,8 +1064,8 @@ if(BUNDLE_DEPENDENCIES) + list(APPEND IGNORED_LIBS ${DEPS_${plugin}}) + endforeach() + +- # Remove from ${extra_libs} the libraries that we know we should ignore. +- # Also the openssl libs that might end up in ${extra_libs} bacause of two ++ # Remove from ${extra_libs} the libraries that we know we should ignore. ++ # Also the openssl libs that might end up in ${extra_libs} bacause of two + # stage search logic above. + + #message("== extra_libs: ${extra_libs}") diff --git a/databases/mysql-connector-odbc-80/files/patch-driver_dll.cc b/databases/mysql-connector-odbc-80/files/patch-driver_dll.cc new file mode 100644 index 000000000000..59db345c06bb --- /dev/null +++ b/databases/mysql-connector-odbc-80/files/patch-driver_dll.cc @@ -0,0 +1,11 @@ +--- driver/dll.cc.orig 2022-12-10 21:58:26 UTC ++++ driver/dll.cc +@@ -145,7 +145,7 @@ void myodbc_end() + This eliminates the delay when mysys_end() is called and other threads + have been initialized but not ended. + */ +- my_thread_end_wait_time= 0; ++ static uint my_thread_end_wait_time= 0; + #endif + + mysql_library_end(); diff --git a/databases/mysql-connector-odbc-80/files/patch-include_mysql-8.0_my__sys.h b/databases/mysql-connector-odbc-80/files/patch-include_mysql-8.0_my__sys.h new file mode 100644 index 000000000000..f56fd61ce3bf --- /dev/null +++ b/databases/mysql-connector-odbc-80/files/patch-include_mysql-8.0_my__sys.h @@ -0,0 +1,24 @@ +--- include/mysql-8.0/my_sys.h.orig 2022-12-10 21:58:26 UTC ++++ include/mysql-8.0/my_sys.h +@@ -34,8 +34,12 @@ + #include "my_config.h" + + #ifdef HAVE_ALLOCA_H ++#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) ++#include ++#else + #include + #endif ++#endif + #include + #ifdef _WIN32 + #include +@@ -322,6 +326,8 @@ typedef int (*IO_CACHE_CALLBACK)(IO_CACHE *); + + struct IO_CACHE; + typedef int (*IO_CACHE_CALLBACK)(IO_CACHE *); ++ ++typedef unsigned long ulong; + + struct IO_CACHE_SHARE { + mysql_mutex_t mutex; /* To sync on reads into buffer. */ diff --git a/databases/mysql-connector-odbc-80/pkg-descr b/databases/mysql-connector-odbc-80/pkg-descr new file mode 100644 index 000000000000..0441dd6a5d7f --- /dev/null +++ b/databases/mysql-connector-odbc-80/pkg-descr @@ -0,0 +1 @@ +MySQL Connector ODBC is an ODBC driver for interfacing to MySQL databases. -- cgit v1.2.3