2017-10-25 11:51:21 -07:00
|
|
|
if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql/mysql.h")
|
2020-05-16 07:37:54 +08:00
|
|
|
message(FATAL_ERROR "FATAL ERROR: ${PORT} and libmariadb are incompatible.")
|
2017-10-25 11:51:21 -07:00
|
|
|
endif()
|
|
|
|
|
2023-03-20 07:41:57 +01:00
|
|
|
if(NOT VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
message(WARNING "'autoconf-archive' must be installed via your system package manager (brew, apt, etc.).")
|
|
|
|
endif()
|
|
|
|
|
2018-03-02 12:28:34 -08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO mysql/mysql-server
|
2023-05-01 23:23:17 +01:00
|
|
|
REF mysql-${VERSION}
|
2023-05-04 19:23:10 +02:00
|
|
|
SHA512 8b9f15b301b158e6ffc99dd916b9062968d36f6bdd7b898636fa61badfbe68f7328d4a39fa3b8b3ebef180d3aec1aee353bd2dac9ef1594e5772291390e17ac0
|
2018-03-02 12:28:34 -08:00
|
|
|
HEAD_REF master
|
2018-03-19 10:30:33 -07:00
|
|
|
PATCHES
|
2019-06-12 05:41:02 +08:00
|
|
|
ignore-boost-version.patch
|
|
|
|
system-libs.patch
|
2020-11-10 09:28:45 -08:00
|
|
|
export-cmake-targets.patch
|
2022-07-23 05:38:57 +08:00
|
|
|
Add-target-include-directories.patch
|
2023-04-10 22:26:08 -04:00
|
|
|
homebrew.patch
|
2023-06-27 05:26:55 +02:00
|
|
|
fix_dup_symbols.patch
|
2017-10-25 11:51:21 -07:00
|
|
|
)
|
|
|
|
|
2021-10-27 08:45:32 +02:00
|
|
|
file(REMOVE_RECURSE "${SOURCE_PATH}/include/boost_1_70_0")
|
2018-03-13 08:14:58 -07:00
|
|
|
|
2022-07-23 05:38:57 +08:00
|
|
|
set(STACK_DIRECTION "")
|
2018-03-07 11:10:12 -08:00
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
set(STACK_DIRECTION -DSTACK_DIRECTION=-1)
|
|
|
|
endif()
|
|
|
|
|
2020-05-16 07:37:54 +08:00
|
|
|
#Skip the version check for Visual Studio
|
2022-07-23 05:38:57 +08:00
|
|
|
set(FORCE_UNSUPPORTED_COMPILER "")
|
2020-05-16 07:37:54 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(FORCE_UNSUPPORTED_COMPILER 1)
|
|
|
|
endif()
|
|
|
|
|
2020-11-10 09:28:45 -08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT_LINKAGE)
|
|
|
|
|
2021-11-23 00:51:13 +01:00
|
|
|
vcpkg_cmake_configure(
|
2021-10-27 08:45:32 +02:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2017-10-25 11:51:21 -07:00
|
|
|
OPTIONS
|
|
|
|
-DWITHOUT_SERVER=ON
|
2023-04-14 03:25:58 +08:00
|
|
|
-DWITH_BUILD_ID=OFF
|
2017-10-25 11:51:21 -07:00
|
|
|
-DWITH_UNIT_TESTS=OFF
|
|
|
|
-DENABLED_PROFILING=OFF
|
2020-11-10 09:28:45 -08:00
|
|
|
-DENABLE_TESTING=OFF
|
2017-10-25 11:51:21 -07:00
|
|
|
-DWIX_DIR=OFF
|
2018-03-07 11:10:12 -08:00
|
|
|
${STACK_DIRECTION}
|
2018-03-13 08:14:58 -07:00
|
|
|
-DIGNORE_BOOST_VERSION=ON
|
2020-11-10 09:28:45 -08:00
|
|
|
-DWITH_SYSTEMD=OFF
|
|
|
|
-DWITH_TEST_TRACE_PLUGIN=OFF
|
|
|
|
-DMYSQL_MAINTAINER_MODE=OFF
|
|
|
|
-DBUNDLE_RUNTIME_LIBRARIES=OFF
|
|
|
|
-DDOWNLOAD_BOOST=OFF
|
2018-03-19 10:30:33 -07:00
|
|
|
-DWITH_SSL=system
|
|
|
|
-DWITH_ICU=system
|
|
|
|
-DWITH_LIBEVENT=system
|
|
|
|
-DWITH_LZ4=system
|
|
|
|
-DWITH_ZLIB=system
|
2020-05-16 07:37:54 +08:00
|
|
|
-DFORCE_UNSUPPORTED_COMPILER=${FORCE_UNSUPPORTED_COMPILER}
|
2020-11-10 09:28:45 -08:00
|
|
|
-DINSTALL_STATIC_LIBRARIES=${BUILD_STATIC_LIBS}
|
|
|
|
-DLINK_STATIC_RUNTIME_LIBRARIES=${STATIC_CRT_LINKAGE}
|
2023-03-20 07:41:57 +01:00
|
|
|
MAYBE_UNUSED_VARIABLES
|
|
|
|
BUNDLE_RUNTIME_LIBRARIES # only on windows
|
|
|
|
LINK_STATIC_RUNTIME_LIBRARIES # only on windows
|
|
|
|
WIX_DIR # only on windows
|
2023-05-01 23:23:17 +01:00
|
|
|
WITH_BUILD_ID # only on windows
|
2017-10-25 11:51:21 -07:00
|
|
|
)
|
|
|
|
|
2021-11-23 00:51:13 +01:00
|
|
|
vcpkg_cmake_install(ADD_BIN_TO_PATH)
|
2017-10-25 11:51:21 -07:00
|
|
|
|
2020-11-10 09:28:45 -08:00
|
|
|
list(APPEND MYSQL_TOOLS
|
|
|
|
comp_err
|
|
|
|
my_print_defaults
|
|
|
|
mysql
|
|
|
|
mysql_config_editor
|
2023-04-10 22:26:08 -04:00
|
|
|
mysql_migrate_keyring
|
2020-11-10 09:28:45 -08:00
|
|
|
mysql_secure_installation
|
|
|
|
mysql_ssl_rsa_setup
|
|
|
|
mysqladmin
|
|
|
|
mysqlbinlog
|
|
|
|
mysqlcheck
|
|
|
|
mysqldump
|
|
|
|
mysqlimport
|
|
|
|
mysqlpump
|
|
|
|
mysqlshow
|
|
|
|
mysqlslap
|
|
|
|
mysqltest
|
|
|
|
perror
|
|
|
|
zlib_decompress
|
|
|
|
)
|
|
|
|
|
|
|
|
if (VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND MYSQL_TOOLS
|
|
|
|
echo
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
list(APPEND MYSQL_TOOLS
|
|
|
|
mysql_config
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_copy_tools(TOOL_NAMES ${MYSQL_TOOLS} AUTO_CLEAN)
|
|
|
|
|
2021-12-23 11:53:44 +08:00
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share" "${CURRENT_PACKAGES_DIR}/${PORT}")
|
2021-10-27 08:45:32 +02:00
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share")
|
2021-12-23 11:53:44 +08:00
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/${PORT}" "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2022-10-26 19:55:31 +02:00
|
|
|
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/debug/${PORT}")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/${PORT}" "${CURRENT_PACKAGES_DIR}/debug/share/${PORT}")
|
|
|
|
endif()
|
2020-11-10 09:28:45 -08:00
|
|
|
|
2021-12-23 11:53:44 +08:00
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libmysql CONFIG_PATH share/${PORT}/unofficial-libmysql)
|
2017-10-25 11:51:21 -07:00
|
|
|
|
|
|
|
# switch mysql into /mysql
|
2021-10-27 08:45:32 +02:00
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/include" "${CURRENT_PACKAGES_DIR}/include2")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/include2" "${CURRENT_PACKAGES_DIR}/include/mysql")
|
2017-10-25 11:51:21 -07:00
|
|
|
|
|
|
|
## delete useless vcruntime/scripts/bin/msg file
|
|
|
|
file(REMOVE_RECURSE
|
2021-10-27 08:45:32 +02:00
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
2023-05-01 23:23:17 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/man"
|
2021-10-27 08:45:32 +02:00
|
|
|
"${CURRENT_PACKAGES_DIR}/docs"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/docs"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/debug"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/plugin"
|
2023-05-01 23:23:17 +01:00
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/plugin"
|
2020-11-10 09:28:45 -08:00
|
|
|
)
|
2017-10-25 11:51:21 -07:00
|
|
|
|
2023-04-10 22:26:08 -04:00
|
|
|
# delete dynamic dll on static build
|
|
|
|
if (BUILD_STATIC_LIBS)
|
|
|
|
# libmysql.dll
|
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/bin"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/bin"
|
|
|
|
)
|
|
|
|
file(REMOVE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/libmysql.lib"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.lib"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-05-16 07:37:54 +08:00
|
|
|
## remove misc files
|
2017-10-25 11:51:21 -07:00
|
|
|
file(REMOVE
|
2021-10-27 08:45:32 +02:00
|
|
|
"${CURRENT_PACKAGES_DIR}/LICENSE"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/README"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/LICENSE"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/README"
|
2020-11-10 09:28:45 -08:00
|
|
|
)
|
2017-10-25 11:51:21 -07:00
|
|
|
|
2021-11-23 00:51:13 +01:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mysql/mysql_com.h" "#include <mysql/udf_registration_types.h>" "#include \"mysql/udf_registration_types.h\"")
|
|
|
|
if (NOT VCPKG_TARGET_IS_WINDOWS)
|
2023-04-10 22:26:08 -04:00
|
|
|
set(MYSQL_CONFIG_FILE "${CURRENT_PACKAGES_DIR}/tools/libmysql/mysql_config")
|
|
|
|
vcpkg_replace_string(${MYSQL_CONFIG_FILE} "/bin/mysql_.*config" "/tools/libmysql/mysql_.*config") # try to get correct $basedir
|
|
|
|
vcpkg_replace_string(${MYSQL_CONFIG_FILE} "${CURRENT_PACKAGES_DIR}" "$basedir") # use $basedir to format paths
|
|
|
|
vcpkg_replace_string(${MYSQL_CONFIG_FILE} "-l\$\<\$\<CONFIG:DEBUG\>:${CURRENT_INSTALLED_DIR}/debug/lib/libz.a> " "") # remove debug version of libz
|
|
|
|
vcpkg_replace_string(${MYSQL_CONFIG_FILE}
|
|
|
|
"\$\<\$\<NOT:\$\<CONFIG:DEBUG\>\>:${CURRENT_INSTALLED_DIR}"
|
|
|
|
"`dirname $0`/../../../../installed/${TARGET_TRIPLET}") # correct path for release version of libz
|
|
|
|
vcpkg_replace_string(${MYSQL_CONFIG_FILE} "\> -l" " -l") # trailing > tag for previous item
|
2021-11-23 00:51:13 +01:00
|
|
|
endif()
|
2018-03-19 13:17:59 -07:00
|
|
|
|
2021-10-27 08:45:32 +02:00
|
|
|
file(INSTALL "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2020-11-10 09:28:45 -08:00
|
|
|
|
2017-10-25 11:51:21 -07:00
|
|
|
# copy license
|
2023-04-14 03:25:58 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|