From 28bd54e0d04fce52577a563956e853f96c060566 Mon Sep 17 00:00:00 2001 From: sdcb Date: Fri, 20 Jan 2017 15:19:23 +0800 Subject: [PATCH] [libmysql] upgrade to 5.7.17 1. upgraded upstream mysql version to 5.7.17 2. simplified the patch size from 12K to 2K 3. enabled static build 4. switched mysql.h file to mysql/mysql.h --- ports/libmysql/0001_cmake.patch | 378 --------------------------- ports/libmysql/CONTROL | 4 +- ports/libmysql/boost_and_build.patch | 44 ++++ ports/libmysql/portfile.cmake | 148 ++++++----- 4 files changed, 125 insertions(+), 449 deletions(-) delete mode 100644 ports/libmysql/0001_cmake.patch create mode 100644 ports/libmysql/boost_and_build.patch diff --git a/ports/libmysql/0001_cmake.patch b/ports/libmysql/0001_cmake.patch deleted file mode 100644 index 9defe7fc19..0000000000 --- a/ports/libmysql/0001_cmake.patch +++ /dev/null @@ -1,378 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 44842d3..e89eed9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,7 +118,7 @@ IF(DEFINED MYSQL_PROJECT_NAME) - SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - ELSE() -- SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING -+ SET(MYSQL_PROJECT_NAME "LibMySQL" CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - MARK_AS_ADVANCED(MYSQL_PROJECT_NAME) - ENDIF() -@@ -132,6 +132,9 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR WITH_DEBUG) - ENDIF() - ENDIF() - -+OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" ON) -+MARK_AS_ADVANCED(FORCE_UNSUPPORTED_COMPILER) -+ - OPTION(WITH_DEFAULT_COMPILER_OPTIONS - "Use flags from cmake/build_configurations/compiler_options.cmake" - ON) -@@ -193,46 +196,30 @@ ENDIF() - INCLUDE(character_sets) - INCLUDE(cpu_info) - INCLUDE(zlib) --INCLUDE(lz4) --INCLUDE(libevent) - INCLUDE(ssl) --INCLUDE(readline) --INCLUDE(protobuf) - INCLUDE(mysql_version) - INCLUDE(libutils) - INCLUDE(dtrace) --INCLUDE(plugin) - INCLUDE(install_macros) - INCLUDE(install_layout) - INCLUDE(mysql_add_executable) - - # Handle options --IF(EXISTS ${CMAKE_SOURCE_DIR}/rapid) -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" ON) --ELSE() -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" OFF) --ENDIF() - OPTION(DISABLE_SHARED - "Don't build shared libraries, compile code as position-dependent" OFF) -+MARK_AS_ADVANCED(DISABLE_SHARED) - IF(DISABLE_SHARED) - SET(WITHOUT_DYNAMIC_PLUGINS 1) - ENDIF() - OPTION(ENABLED_PROFILING "Enable profiling" ON) --OPTION(WITHOUT_SERVER OFF) -+SET(WITHOUT_SERVER ON) - IF(UNIX) - OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) - ENDIF() - IF(WIN32) - OPTION(WITH_MSCRT_DEBUG "MS Visual Studio Debug CRT instrumentation" OFF) - ENDIF() --IF(NOT WITHOUT_SERVER) -- OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) --ENDIF() --OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" OFF) --MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_SHARED FORCE_UNSUPPORTED_COMPILER) -- -+OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" OFF) - - include(CheckCSourceCompiles) - include(CheckCXXSourceCompiles) -@@ -452,18 +439,8 @@ ELSE() - SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") - ENDIF() - --INCLUDE(cmake/boost.cmake) -- --IF (CMAKE_SYSTEM_NAME MATCHES "Linux") -- OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) -- IF (WITH_SYSTEMD) -- INCLUDE(cmake/systemd.cmake) -- ENDIF() --ELSE() -- IF (WITH_SYSTEMD) -- MESSAGE(FATAL_ERROR "Installation of systemd support files not supported") -- ENDIF() --ENDIF() -+# Boost is not needed to build libmysql (yet) -+#INCLUDE(cmake/boost.cmake) - - # Run platform tests - INCLUDE(configure.cmake) -@@ -479,76 +456,6 @@ INCLUDE_DIRECTORIES( - MYSQL_CHECK_ZLIB_WITH_COMPRESS() - # Add bundled yassl/taocrypt or system openssl. - MYSQL_CHECK_SSL() --# Add system/bundled editline. --MYSQL_CHECK_EDITLINE() --# Add libevent --MYSQL_CHECK_LIBEVENT() --# Add lz4 library --MYSQL_CHECK_LZ4() --# Add protoc and libprotobuf --IF(NOT WITHOUT_SERVER) -- MYSQL_CHECK_PROTOBUF() --ENDIF() -- --# Check for SYS_thread_selfid system call --CHECK_C_SOURCE_COMPILES(" --#include --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_thread_selfid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_THREAD_SELFID) -- --# Check for gettid() system call --CHECK_C_SOURCE_COMPILES(" --#include --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_gettid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_GETTID) -- --IF(CMAKE_SYSTEM_NAME MATCHES "Linux") -- # Check for pthread_setname_np -- CHECK_C_SOURCE_COMPILES(" -- #include -- int main(int ac, char **av) -- { -- const char *thread_name= 0; -- int ret = pthread_setname_np(pthread_self(), thread_name); -- return ret; -- }" -- HAVE_PTHREAD_SETNAME_NP) --ENDIF() -- --# Check for pthread_getthreadid_np() --CHECK_C_SOURCE_COMPILES(" --#include --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_getthreadid_np(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_PTHREAD_GETTHREADID_NP) -- --# Check for pthread_self() returning an integer type --CHECK_C_SOURCE_COMPILES(" --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_self(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_INTEGER_PTHREAD_SELF --FAIL_REGEX "warning: incompatible pointer to integer conversion" --) - - # - # Setup maintainer mode options by the end. Platform checks are -@@ -563,18 +470,15 @@ OPTION(MYSQL_MAINTAINER_MODE - - INCLUDE(maintainer) - --IF(WITH_UNIT_TESTS) -+IF(0) #WITH_UNIT_TESTS) - ENABLE_TESTING() - ENDIF() - --IF(NOT WITHOUT_SERVER) -+IF(0) #NOT WITHOUT_SERVER) - SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") - SET (MYSQLD_STATIC_EMBEDDED_PLUGIN_LIBS "" CACHE INTERNAL "") - # Add storage engines and plugins. - CONFIGURE_PLUGINS() --ELSE() -- # We may still want Cluster client libraries, use -DWITH_NDBCLUSTER=1 -- ADD_SUBDIRECTORY(storage/ndb) - ENDIF() - - ADD_SUBDIRECTORY(include) -@@ -588,61 +492,18 @@ ADD_SUBDIRECTORY(libmysql) - ADD_SUBDIRECTORY(libbinlogevents) - ADD_SUBDIRECTORY(libbinlogstandalone) - --IF(WITH_UNIT_TESTS) -- # Visual Studio 11 needs this extra flag in order to compile gmock. -- IF(WIN32) -- ADD_DEFINITIONS( /D _VARIADIC_MAX=10 ) -- ENDIF() -- # libc++ doesn't have tuple in tr1 -- IF(HAVE_LLVM_LIBCPP) -- ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1) -- ENDIF() - -- ADD_SUBDIRECTORY(unittest) -- ADD_SUBDIRECTORY(unittest/examples) -- ADD_SUBDIRECTORY(unittest/mytap) -- ADD_SUBDIRECTORY(unittest/mytap/t) -- IF(WITH_RAPID AND EXISTS ${CMAKE_SOURCE_DIR}/rapid/unittest/gunit) -- ADD_SUBDIRECTORY(rapid/unittest/gunit) -- ENDIF() --ENDIF() - -+SET(WITH_INNOBASE_STORAGE_ENGINE 0) - ADD_SUBDIRECTORY(extra) --ADD_SUBDIRECTORY(client) - ADD_SUBDIRECTORY(sql/share) --ADD_SUBDIRECTORY(libservices) -- --IF(UNIX) -- ADD_SUBDIRECTORY(man) --ENDIF() -- --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(testclients) -- ADD_SUBDIRECTORY(sql) -- OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF) -- IF(WITH_EMBEDDED_SERVER) -- ADD_SUBDIRECTORY(libmysqld) -- ADD_SUBDIRECTORY(libmysqld/examples) -- ENDIF(WITH_EMBEDDED_SERVER) --ENDIF() -- --# scripts/mysql_config depends on client and server targets loaded above. --# It is referenced by some of the directories below, so we insert it here. - ADD_SUBDIRECTORY(scripts) -+ADD_SUBDIRECTORY(support-files) - --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(mysql-test) -- ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) -- ADD_SUBDIRECTORY(support-files) -- IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) -- ADD_SUBDIRECTORY(internal) -- ENDIF() -- ADD_SUBDIRECTORY(packaging/rpm-oel) -- ADD_SUBDIRECTORY(packaging/rpm-fedora) -- ADD_SUBDIRECTORY(packaging/rpm-sles) -- ADD_SUBDIRECTORY(packaging/rpm-docker) -- ADD_SUBDIRECTORY(packaging/deb-in) --ENDIF() -+# -+# Directory where error message database is generated (GenError target) -+# -+FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/sql/share) - - INCLUDE(cmake/abi_check.cmake) - INCLUDE(cmake/tags.cmake) -@@ -680,11 +541,7 @@ ELSE() - SET(CPACK_GENERATOR "TGZ") - ENDIF() - ADD_SUBDIRECTORY(packaging/WiX) --ADD_SUBDIRECTORY(packaging/solaris) - --IF(UNIX) -- INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) --ENDIF() - # - # RPM installs documentation directly from the source tree - # -diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt -index 3adf988..9e0ba30 100644 ---- a/extra/CMakeLists.txt -+++ b/extra/CMakeLists.txt -@@ -70,87 +70,4 @@ ADD_DEFINITIONS(-DMUTEX_EVENT) - COPY_OPENSSL_DLLS(copy_openssl_extra) - IF (WIN32 AND WITH_SSL_PATH AND HAVE_CRYPTO_DLL) - ADD_DEPENDENCIES(GenError copy_openssl_extra) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) --TARGET_LINK_LIBRARIES(my_print_defaults mysys mysys_ssl) --SET_TARGET_PROPERTIES(my_print_defaults PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(perror perror.c) --ADD_DEPENDENCIES(perror GenError) --TARGET_LINK_LIBRARIES(perror mysys mysys_ssl) --SET_TARGET_PROPERTIES(perror PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) --TARGET_LINK_LIBRARIES(resolveip mysys mysys_ssl) --SET_TARGET_PROPERTIES(resolveip PROPERTIES LINKER_LANGUAGE CXX) --IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") -- INCLUDE(CheckFunctionExists) -- INCLUDE(CheckLibraryExists) -- MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) -- TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(replace replace.c) --TARGET_LINK_LIBRARIES(replace mysys) -- --MYSQL_ADD_EXECUTABLE(lz4_decompress lz4_decompress.cc) --TARGET_LINK_LIBRARIES(lz4_decompress ${LZ4_LIBRARY}) -- --MYSQL_ADD_EXECUTABLE(zlib_decompress zlib_decompress.cc) --TARGET_LINK_LIBRARIES(zlib_decompress ${ZLIB_LIBRARY}) -- --IF(WITH_INNOBASE_STORAGE_ENGINE) -- -- IF(LZ4_INCLUDE_DIR AND LZ4_LIBRARY) -- ADD_DEFINITIONS(-DHAVE_LZ4=1) -- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) -- ENDIF() -- -- # Add path to the InnoDB headers -- INCLUDE_DIRECTORIES( -- ${CMAKE_SOURCE_DIR}/storage/innobase/include -- ${CMAKE_SOURCE_DIR}/sql -- ) -- # We use the InnoDB code directly in case the code changes. -- ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM") -- SET(INNOBASE_SOURCES -- ../storage/innobase/buf/buf0checksum.cc -- ../storage/innobase/ut/ut0crc32.cc -- ../storage/innobase/ut/ut0ut.cc -- ../storage/innobase/buf/buf0buf.cc -- ../storage/innobase/page/page0zip.cc -- ../storage/innobase/os/os0file.cc -- ) -- -- # Avoid generating Hardware Capabilities due to crc32 instructions -- IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND -- CMAKE_SYSTEM_PROCESSOR MATCHES "i386") -- INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) -- MY_CHECK_CXX_COMPILER_FLAG("-Wa,-nH" HAVE_WA_NH) -- IF(HAVE_WA_NH) -- ADD_COMPILE_FLAGS( -- ../storage/innobase/ut/ut0crc32.cc -- COMPILE_FLAGS "-Wa,-nH" -- ) -- ENDIF() -- ENDIF() -- -- MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES}) -- TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY}) -- ADD_DEPENDENCIES(innochecksum GenError) --ENDIF() -- --IF(UNIX) -- MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.cc) -- TARGET_LINK_LIBRARIES(resolve_stack_dump mysys mysys_ssl) --ENDIF() -- --# In published release builds on Solaris, we need to bundle gcc source. --# PB2 will take care of putting it in extra/ when needed --IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gcc-4.8.1.tar.bz2) -- INSTALL(FILES gcc-4.8.1.tar.bz2 -- DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Development) --ENDIF() -+ENDIF() -\ No newline at end of file -diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h -index 8b7a554..4353037 100644 ---- a/mysys/mysys_priv.h -+++ b/mysys/mysys_priv.h -@@ -18,6 +18,7 @@ - - #include "my_global.h" - #include "mysql/psi/mysql_thread.h" -+#include "my_sys.h" - - #ifdef HAVE_PSI_INTERFACE - diff --git a/ports/libmysql/CONTROL b/ports/libmysql/CONTROL index 504f14bbba..4e5564972d 100644 --- a/ports/libmysql/CONTROL +++ b/ports/libmysql/CONTROL @@ -1,3 +1,3 @@ -Source: libmysql -Version: 5.7.16 +Source: libmysql +Version: 5.7.17 Description: A MySQL client library for C development. \ No newline at end of file diff --git a/ports/libmysql/boost_and_build.patch b/ports/libmysql/boost_and_build.patch new file mode 100644 index 0000000000..7fce8ffc5f --- /dev/null +++ b/ports/libmysql/boost_and_build.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 44842d3..e34ab24 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -452,7 +452,7 @@ ELSE() + SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") + ENDIF() + +-INCLUDE(cmake/boost.cmake) ++#INCLUDE(cmake/boost.cmake) + + IF (CMAKE_SYSTEM_NAME MATCHES "Linux") + OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) +diff --git a/client/dump/CMakeLists.txt b/client/dump/CMakeLists.txt +index bae2ce7..4e11516 100644 +--- a/client/dump/CMakeLists.txt ++++ b/client/dump/CMakeLists.txt +@@ -21,12 +21,12 @@ INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/dump + ) + +-IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") ++#IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + IF (WITHOUT_SERVER) + MESSAGE(STATUS "Not building mysqlpump") + RETURN() + ENDIF() +-ENDIF() ++#ENDIF() + + # Prevent Boost from including external precompiled Boost libraries, use + # threading (not implemented for older Solaris Studio compilers) +diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h +index 8b7a554..4353037 100644 +--- a/mysys/mysys_priv.h ++++ b/mysys/mysys_priv.h +@@ -18,6 +18,7 @@ + + #include "my_global.h" + #include "mysql/psi/mysql_thread.h" ++#include "my_sys.h" + + #ifdef HAVE_PSI_INTERFACE + diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index 48412ccc74..2a7f7f33d0 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -1,70 +1,80 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.16) - -if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql.h") - message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.") -endif() - -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.16.tar.gz" - FILENAME "mysql-server-mysql-5.7.16.tar.gz" - SHA512 30a3c55ebb15f18ededf814b66c108f18b2ced9c39e08319cdc9559ccf38d494ad9322098f2b04418ddf557e46d9d727be0e514be0ae982ac4f5186aa295b9c6 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} -) - -vcpkg_install_cmake() - -# delete debug headers -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/include) - -# delete useless vcruntime/scripts/bin/msg file -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/debug/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin - ${CURRENT_PACKAGES_DIR}/lib/debug) - -file(MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) - -# remove misc files -file(REMOVE - ${CURRENT_PACKAGES_DIR}/COPYING - ${CURRENT_PACKAGES_DIR}/my-default.ini - ${CURRENT_PACKAGES_DIR}/README - ${CURRENT_PACKAGES_DIR}/debug/COPYING - ${CURRENT_PACKAGES_DIR}/debug/my-default.ini - ${CURRENT_PACKAGES_DIR}/debug/README) - -# remove mysqlclient.lib -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) - -# correct the dll directory -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) - -# copy license -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.17) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.17.tar.gz" + FILENAME "mysql-server-mysql-5.7.17.tar.gz" + SHA512 511027f28f0705f59a08ec369b1ebe5d9a77eb839d545898631f1ebbcb6b4b800f5b88511d3ae5d231c04e09a2d7b2b2d178264d36aeb2bc602cc1b0b248cfba +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/boost_and_build.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DWITHOUT_SERVER=ON + -DWITH_UNIT_TESTS=OFF + -DENABLED_PROFILING=OFF +) + +vcpkg_install_cmake() + +# delete debug headers +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include) + +# switch mysql into /mysql +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) + +## delete useless vcruntime/scripts/bin/msg file +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/share + ${CURRENT_PACKAGES_DIR}/debug/share + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/bin + ${CURRENT_PACKAGES_DIR}/docs + ${CURRENT_PACKAGES_DIR}/debug/docs + ${CURRENT_PACKAGES_DIR}/lib/debug) + +# remove misc files +file(REMOVE + ${CURRENT_PACKAGES_DIR}/COPYING + ${CURRENT_PACKAGES_DIR}/README + ${CURRENT_PACKAGES_DIR}/debug/COPYING + ${CURRENT_PACKAGES_DIR}/debug/README) + +# remove not-related libs +file (REMOVE + ${CURRENT_PACKAGES_DIR}/lib/mysqlservices.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlservices.lib) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE + ${CURRENT_PACKAGES_DIR}/lib/libmysql.lib + ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll + ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb) +else() + file(REMOVE + ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) + + # correct the dll directory + file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) + file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) + file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) + file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) +endif() + +# copy license +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmysql/COPYING ${CURRENT_PACKAGES_DIR}/share/libmysql/copyright) \ No newline at end of file