[qt5-base] mysql plugin added (#15170)

* qt5-base: added mysql plugin.

* Fixed netcdf patch.

* Build only on windows.

* mysql plugin as module

The MySQL plugin for QT now is a module of qt5-base

* Update ports/qt5-base/portfile.cmake

Co-authored-by: Daniele Lupo <daniele.lupo@log-in.it>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
This commit is contained in:
Daniele Lupo 2021-01-12 05:49:05 +01:00 committed by GitHub
parent 9c63f97fa1
commit a8f5147bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 40 deletions

View File

@ -21,8 +21,8 @@ index d97ee07..f8affbb 100644
-install(TARGETS ${CDS_SHARED_LIBRARY} EXPORT LibCDSConfig LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT ${HEADERS_COMPONENT} NAMELINK_ONLY)
-install(TARGETS ${CDS_STATIC_LIBRARY} EXPORT LibCDSConfig DESTINATION lib${LIB_SUFFIX} COMPONENT ${LIBRARIES_COMPONENT})
+if (NOT DISABLE_INSTALL_SHARED)
+ install(TARGETS ${CDS_SHARED_LIBRARY} EXPORT LibCDSConfig RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT ${LIBRARIES_COMPONENT} NAMELINK_SKIP)
+ install(TARGETS ${CDS_SHARED_LIBRARY} EXPORT LibCDSConfig RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT ${HEADERS_COMPONENT} NAMELINK_ONLY)
+ install(TARGETS ${CDS_SHARED_LIBRARY} EXPORT LibCDSConfig RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT ${LIBRARIES_COMPONENT})
+ #install(TARGETS ${CDS_SHARED_LIBRARY} EXPORT LibCDSConfig RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT ${HEADERS_COMPONENT} NAMELINK_ONLY)
+endif()
+if (NOT DISABLE_INSTALL_STATIC)
+ install(TARGETS ${CDS_STATIC_LIBRARY} EXPORT LibCDSConfig DESTINATION lib${LIB_SUFFIX} COMPONENT ${LIBRARIES_COMPONENT})

View File

@ -1,9 +1,13 @@
Source: qt5-base
Version: 5.15.1
Port-Version: 3
Port-Version: 4
Homepage: https://www.qt.io/
Description: Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.
Build-Depends: zlib, zstd, libjpeg-turbo, libpng, freetype, pcre2, harfbuzz, sqlite3, libpq, double-conversion, openssl, angle (!windows), egl-registry, icu (!uwp), fontconfig (!windows)
Feature: latest
Description: Build latest qt version (5.15.1) instead of LTS (latest and LTS are currently the same)
Feature: mysqlplugin
Build-Depends: libmysql
Description: Build the sql plugin for connecting to mysql databases

View File

@ -0,0 +1,11 @@
--- a/src/plugins/sqldrivers/configure.json
+++ b/src/plugins/sqldrivers/configure.json
@@ -65,7 +65,7 @@
],
"main": "mysql_get_client_version();"
},
- "headers": "mysql.h",
+ "headers": "mysql/mysql.h",
"sources": [
{ "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": true },
{ "type": "mysqlConfig", "query": "--libs", "cleanlibs": true },

View File

@ -0,0 +1,11 @@
--- a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
@@ -57,7 +57,7 @@
#include <QtCore/qt_windows.h>
#endif
-#include <mysql.h>
+#include <mysql/mysql.h>
#ifdef QT_PLUGIN
#define Q_EXPORT_SQLDRIVER_MYSQL

View File

@ -6,6 +6,15 @@ else()
option(QT_OPENSSL_LINK "Link against OpenSSL at compile-time." OFF)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
option(QT_MYSQL_PLUGIN "Create MySQL plugin" OFF)
else()
if ("mysqlplugin" IN_LIST FEATURES)
option(QT_MYSQL_PLUGIN "Create MySQL plugin" ON)
endif()
endif()
if (VCPKG_TARGET_IS_LINUX)
message(WARNING "${PORT} currently requires the following libraries from the system package manager:\n libx11-xcb-dev\n\nThese can be installed on Ubuntu systems via apt-get install libx11-xcb-dev.")
message(WARNING "${PORT} for qt5-x11extras requires the following libraries from the system package manager:\n libxkbcommon-x11-dev\n\nThese can be installed on Ubuntu systems via apt-get install libxkbcommon-x11-dev.")
@ -17,13 +26,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
if("latest" IN_LIST FEATURES) # latest = core currently
set(QT_BUILD_LATEST ON)
set(PATCHES
set(PATCHES
patches/Qt5BasicConfig.patch
patches/Qt5PluginTarget.patch
patches/create_cmake.patch
)
else()
set(PATCHES
set(PATCHES
patches/Qt5BasicConfig.patch
patches/Qt5PluginTarget.patch
patches/create_cmake.patch
@ -52,17 +61,19 @@ endif()
qt_download_submodule( OUT_SOURCE_PATH SOURCE_PATH
PATCHES
patches/winmain_pro.patch #Moves qtmain to manual-link
patches/windows_prf.patch #fixes the qtmain dependency due to the above move
patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir.
patches/gui_configure.patch #Patches the gui configure.json to break freetype/fontconfig autodetection because it does not include its dependencies.
patches/icu.patch #Help configure find static icu builds in vcpkg on windows
patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only
patches/egl.patch #Fix egl detection logic.
patches/zstdd.patch #Fix detection of zstd in debug builds
#patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static).
#Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the
#the windows supplied gl.h header and the angle gl.h otherwise.
patches/winmain_pro.patch #Moves qtmain to manual-link
patches/windows_prf.patch #fixes the qtmain dependency due to the above move
patches/qt_app.patch #Moves the target location of qt5 host apps to always install into the host dir.
patches/gui_configure.patch #Patches the gui configure.json to break freetype/fontconfig autodetection because it does not include its dependencies.
patches/icu.patch #Help configure find static icu builds in vcpkg on windows
patches/xlib.patch #Patches Xlib check to actually use Pkgconfig instead of makeSpec only
patches/egl.patch #Fix egl detection logic.
patches/zstdd.patch #Fix detection of zstd in debug builds
patches/mysql_plugin_include.patch #Fix include path of mysql plugin
patches/mysql-configure.patch #Fix mysql project
#patches/static_opengl.patch #Use this patch if you really want to statically link angle on windows (e.g. using -opengl es2 and -static).
#Be carefull since it requires definining _GDI32_ for all dependent projects due to redefinition errors in the
#the windows supplied gl.h header and the angle gl.h otherwise.
#CMake fixes
${PATCHES}
patches/Qt5GuiConfigExtras.patch # Patches the library search behavior for EGL since angle is not build with Qt
@ -87,7 +98,7 @@ set(CORE_OPTIONS
-opensource
#-simulator_and_device
#-ltcg
#-combined-angle-lib
#-combined-angle-lib
# ENV ANGLE_DIR to external angle source dir. (Will always be compiled with Qt)
#-optimized-tools
#-force-debug-info
@ -112,6 +123,12 @@ if(QT_OPENSSL_LINK)
list(APPEND CORE_OPTIONS -openssl-linked)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
if(QT_MYSQL_PLUGIN)
list(APPEND CORE_OPTIONS -sql-mysql)
endif()
endif()
find_library(ZLIB_RELEASE NAMES z zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(ZLIB_DEBUG NAMES z zlib zd zlibd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(JPEG_RELEASE NAMES jpeg jpeg-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
@ -127,14 +144,16 @@ if(NOT (PSQL_RELEASE MATCHES ".*\.so") AND NOT (PSQL_DEBUG MATCHES ".*\.so"))
find_library(PSQL_PORT_RELEASE NAMES pgport libpgport PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on openssl and zlib(linux)
find_library(PSQL_PORT_DEBUG NAMES pgport libpgport pgportd libpgportd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
endif()
find_library(MYSQL_RELEASE NAMES libmysql mysqlclient PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on openssl and zlib(linux)
find_library(MYSQL_DEBUG NAMES libmysql libmysqld mysqlclient mysqlclientd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(PCRE2_RELEASE NAMES pcre2-16 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(PCRE2_DEBUG NAMES pcre2-16 pcre2-16d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(FREETYPE_RELEASE NAMES freetype PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) #zlib, bzip2, libpng
find_library(FREETYPE_DEBUG NAMES freetype freetyped PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(DOUBLECONVERSION_RELEASE NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(DOUBLECONVERSION_DEBUG NAMES double-conversion PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(HARFBUZZ_RELEASE NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
find_library(HARFBUZZ_DEBUG NAMES harfbuzz PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
find_library(SQLITE_RELEASE NAMES sqlite3 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) # Depends on openssl and zlib(linux)
find_library(SQLITE_DEBUG NAMES sqlite3 sqlite3d PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
@ -219,7 +238,6 @@ set(DEBUG_OPTIONS
"QMAKE_LIBS_PRIVATE+=${ZSTD_DEBUG}"
)
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_IS_UWP)
list(APPEND CORE_OPTIONS -appstore-compliant)
@ -227,7 +245,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
if(NOT ${VCPKG_LIBRARY_LINKAGE} STREQUAL "static")
list(APPEND CORE_OPTIONS -opengl dynamic) # other options are "-no-opengl", "-opengl angle", and "-opengl desktop" and "-opengel es2"
else()
list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch
list(APPEND CORE_OPTIONS -opengl dynamic) # other possible option without moving angle dlls: "-opengl desktop". "-opengel es2" only works with commented patch
endif()
list(APPEND RELEASE_OPTIONS
"PSQL_LIBS=${PSQL_RELEASE} ${PSQL_PORT_RELEASE} ${PSQL_COMMON_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
@ -235,13 +253,18 @@ if(VCPKG_TARGET_IS_WINDOWS)
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL}"
"OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
)
list(APPEND DEBUG_OPTIONS
"PSQL_LIBS=${PSQL_DEBUG} ${PSQL_PORT_DEBUG} ${PSQL_COMMON_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
"SQLITE_LIBS=${SQLITE_DEBUG}"
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL}"
"OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
)
if (QT_MYSQL_PLUGIN)
list(APPEND RELEASE_OPTIONS "MYSQL_LIBS=${MYSQL_RELEASE}")
list(APPEND DEBUG_OPTIONS "MYSQL_LIBS=${MYSQL_DEBUG}")
endif(QT_MYSQL_PLUGIN)
elseif(VCPKG_TARGET_IS_LINUX)
list(APPEND CORE_OPTIONS -fontconfig -xcb-xlib -xcb -linuxfb)
if (NOT EXISTS "/usr/include/GL/glu.h")
@ -321,7 +344,7 @@ else()
#########################
#TODO: Make this a function since it is also done by modular scripts!
# e.g. by patching mkspecs/features/qt_tools.prf somehow
file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri"
file(GLOB_RECURSE PRL_FILES "${CURRENT_PACKAGES_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/mkspecs/*.pri"
"${CURRENT_PACKAGES_DIR}/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/mkspecs/*.pri")
file(TO_CMAKE_PATH "${CURRENT_INSTALLED_DIR}/include" CMAKE_INCLUDE_PATH)
@ -338,10 +361,10 @@ else()
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/share/cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) # TODO: check if important debug information for cmake is lost
#This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!)
if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries
#This needs a new VCPKG policy or a static angle build (ANGLE needs to be fixed in VCPKG!)
if(VCPKG_TARGET_IS_WINDOWS AND ${VCPKG_LIBRARY_LINKAGE} MATCHES "static") # Move angle dll libraries
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin")
message(STATUS "Moving ANGLE dlls from /bin to /tools/qt5-angle/bin. In static builds dlls are not allowed in /bin")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/qt5-angle)
@ -358,32 +381,32 @@ else()
file(READ "${cmakefile}" _contents)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_BUILD_TYPE)
string(REPLACE "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)" "set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)" _contents "${_contents}")
string(REPLACE
[[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]]
string(REPLACE
[[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]]
[[set(imported_location_release "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib")
set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]]
set(imported_location_debug "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]]
_contents "${_contents}")
string(REPLACE
string(REPLACE
[[ set_target_properties(Qt5::WinMain PROPERTIES
IMPORTED_LOCATION_RELEASE ${imported_location}
)]]
)]]
[[ set_target_properties(Qt5::WinMain PROPERTIES
IMPORTED_LOCATION_RELEASE ${imported_location_release}
IMPORTED_LOCATION_DEBUG ${imported_location_debug}
)]]
)]]
_contents "${_contents}")
else() # Single configuration build (either debug or release)
# Release case
string(REPLACE
string(REPLACE
[[set(imported_location "${_qt5Core_install_prefix}/lib/qtmain.lib")]]
[[set(imported_location "${_qt5Core_install_prefix}/lib/manual-link/qtmain.lib")]]
_contents "${_contents}")
# Debug case (whichever will match)
string(REPLACE
string(REPLACE
[[set(imported_location "${_qt5Core_install_prefix}/lib/qtmaind.lib")]]
[[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]]
_contents "${_contents}")
string(REPLACE
string(REPLACE
[[set(imported_location "${_qt5Core_install_prefix}/debug/lib/qtmaind.lib")]]
[[set(imported_location "${_qt5Core_install_prefix}/debug/lib/manual-link/qtmaind.lib")]]
_contents "${_contents}")
@ -400,7 +423,7 @@ else()
file(COPY ${CURRENT_PACKAGES_DIR}/tools/qt5/bin DESTINATION ${CURRENT_PACKAGES_DIR}/tools/qt5/debug)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/qt5/debug/bin)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf)
file(REMOVE "${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf")
endif()
@ -408,7 +431,7 @@ else()
set(CURRENT_INSTALLED_DIR "./../../.." ) # Making the qt.conf relative and not absolute
configure_file(${CURRENT_PACKAGES_DIR}/tools/qt5/qt_release.conf ${CURRENT_PACKAGES_DIR}/tools/qt5/bin/qt.conf) # This makes the tools at least useable for release
set(CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR_BACKUP}")
qt_install_copyright(${SOURCE_PATH})
endif()
#install scripts for other qt ports
@ -442,7 +465,7 @@ if(QT_BUILD_LATEST)
)
endif()
# #Code to get generated CMake files from CI
# #Code to get generated CMake files from CI
# file(RENAME "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Core/Qt5CoreConfig.cmake" "${CURRENT_BUILDTREES_DIR}/Qt5CoreConfig.cmake.log")
# file(GLOB_RECURSE CMAKE_GUI_FILES "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Gui/*.cmake" )
# foreach(cmake_file ${CMAKE_GUI_FILES})

View File

@ -1,8 +1,9 @@
Source: qt5
Version: 5.15.1
Port-Version: 1
Homepage: https://www.qt.io/
Description: Qt5 Application Framework
Build-Depends: qt5-base[core]
Build-Depends: qt5-base[core,mysqlplugin]
Default-Features: essentials
Feature: essentials
@ -14,7 +15,7 @@ Build-Depends: qt5-base[core, latest]
Description: Build latest qt version (5.15.1) instead of LTS (Currently latest==LTS)
Feature: all
Build-Depends: qt5[3d, webchannel, websockets, extras, xmlpatterns, sensors, serialport, speech, svg, tools, virtualkeyboard, networkauth, purchasing, quickcontrols, quickcontrols2, script, scxml, activeqt, charts, datavis3d, declarative, gamepad, graphicaleffects, imageformats, location, multimedia, mqtt, webglplugin, webview, serialbus, translations, doc, remoteobjects, connectivity], qt5[core,webengine] (!static), qt5[core,wayland] (!windows)
Build-Depends: qt5[3d, webchannel, websockets, extras, xmlpatterns, sensors, serialport, speech, svg, tools, virtualkeyboard, networkauth, purchasing, quickcontrols, quickcontrols2, script, scxml, activeqt, charts, datavis3d, declarative, gamepad, graphicaleffects, imageformats, location, multimedia, mqtt, webglplugin, webview, serialbus, translations, doc, remoteobjects, connectivity], qt5[core,webengine,mysqlplugin] (!static), qt5[core,wayland] (!windows)
Description: Install all Qt5 submodules (Warning: Could take a long time and fail...)
Feature: extras